OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk/mpsoc/src_verilator
    from Rev 16 to Rev 28
    Reverse comparison

Rev 16 → Rev 28

/noc_connection.sv
59,6 → 59,7
`define INCLUDE_PARAM
`include"parameter.v"
localparam CONGw= (CONGESTION_INDEX==3)? 3:
(CONGESTION_INDEX==5)? 3:
72,7 → 73,7
P_1 = P-1 ,
Fw = 2+V+Fpay, //flit width;
PFw = P * Fw,
NC = NX * NY, //number of cores
NC = (TOPOLOGY=="RING")? NX : NX*NY, //number of cores
NCFw = NC * Fw,
NCV = NC * V;
110,7 → 111,45
 
genvar x,y;
generate
if( TOPOLOGY == "RING") begin : ring
for (x=0; x<NX; x=x+1) begin :ring_loop
if(x < NX-1) begin: not_last_node
assign router_flit_out_all [`SELECT_WIRE(x,0,1,Fw)] = router_flit_in_all [`SELECT_WIRE((x+1),0,2,Fw)];
assign router_credit_out_all [`SELECT_WIRE(x,0,1,V)] = router_credit_in_all [`SELECT_WIRE((x+1),0,2,V)];
assign router_flit_out_we_all [x][1] = router_flit_in_we_all [`CORE_NUM((x+1),0)][2];
assign router_congestion_out_all[`SELECT_WIRE(x,0,1,CONGw)] = router_congestion_in_all [`SELECT_WIRE((x+1),0,2,CONGw)];
end else begin :last_node
assign router_flit_out_all [`SELECT_WIRE(x,0,1,Fw)] = router_flit_in_all [`SELECT_WIRE(0,0,2,Fw)];
assign router_credit_out_all [`SELECT_WIRE(x,0,1,V)] = router_credit_in_all [`SELECT_WIRE(0,0,2,V)];
assign router_flit_out_we_all [x][1] = router_flit_in_we_all [`CORE_NUM(0,0)][2];
assign router_congestion_out_all [`SELECT_WIRE(x,0,1,CONGw)] = router_congestion_in_all [`SELECT_WIRE(0,0,2,CONGw)];
end
 
// local port connection
assign router_flit_out_all [`SELECT_WIRE(x,0,0,Fw)] = ni_flit_in [x];
assign router_credit_out_all [`SELECT_WIRE(x,0,0,V)] = ni_credit_in [x];
assign router_flit_out_we_all [x][0] = ni_flit_in_wr [x];
assign router_congestion_out_all[`SELECT_WIRE(x,0,0,CONGw)] = {CONGw{1'b0}};
assign ni_flit_out [x] = router_flit_in_all [`SELECT_WIRE(x,0,0,Fw)];
assign ni_flit_out_wr [x] = router_flit_in_we_all[x][0];
assign ni_credit_out [x] = router_credit_in_all [`SELECT_WIRE(x,0,0,V)];
 
end//x
end else begin :mesh_torus
 
 
 
 
 
 
 
 
 
 
for (x=0; x<NX; x=x+1) begin :x_loop
for (y=0; y<NY; y=y+1) begin: y_loop
localparam IP_NUM = (y * NX) + x;
275,7 → 314,7
 
end //y
end //x
end
endgenerate
 
309,10 → 348,12
);
 
input reset,clk,start_i;
output reg [NC-1 : 0] start_o;
reg shift_en,start_i_reg;
output [NC-1 : 0] start_o;
reg start_i_reg;
wire start;
wire cnt_increase;
reg [NC-1 : 0] start_o_next;
reg [NC-1 : 0] start_o_reg;
assign start= start_i_reg|start_i;
 
324,20 → 365,25
end
end
 
reg [2:0] counter;
assign cnt_increase=(counter==3'd0);
always @(posedge clk or posedge reset) begin
if(reset) begin
shift_en <=1'b0;
start_o <= {NC{1'b0}};
start_o_reg <= {NC{1'b0}};
start_i_reg <=1'b0;
counter <=2'd0;
end else begin
shift_en <=~shift_en;
start_i_reg <=start_i;
if(shift_en) start_o <=start_o_next;
counter <= counter+3'd1;
start_i_reg <=start_i;
if(cnt_increase | start) start_o_reg <=start_o_next;
 
end//reset
end //always
 
assign start_o=(cnt_increase | start)? start_o_reg : {NC{1'b0}};
 
endmodule
 
/parameter.h
2,10 → 2,10
#define INCLUDE_PARAM
 
#define V 4
#define B 4
#define B 5
#define NX 8
#define NY 8
#define C 1
#define C 4
#define Fpay 32
#define MUX_TYPE "ONE_HOT"
#define VC_REALLOCATION_TYPE "NONATOMIC"
13,23 → 13,23
#define FIRST_ARBITER_EXT_P_EN 0
#define TOPOLOGY "MESH"
#define ROUTE_NAME "XY"
#define C0_p 100
#define C1_p 0
#define C2_p 0
#define C3_p 0
#define C0_p 25
#define C1_p 25
#define C2_p 25
#define C3_p 25
#define TRAFFIC "RANDOM"
#define HOTSPOT_PERCENTAGE 3
#define HOTSOPT_NUM 4
#define HOTSPOT_CORE_1 9
#define HOTSPOT_CORE_2 25
#define HOTSPOT_CORE_3 11
#define HOTSPOT_CORE_4 27
#define HOTSPOT_CORE_1 18
#define HOTSPOT_CORE_2 50
#define HOTSPOT_CORE_3 22
#define HOTSPOT_CORE_4 54
#define HOTSPOT_CORE_5 18
#define MAX_PCK_NUM 128000
#define MAX_PCK_NUM 256000
#define MAX_SIM_CLKs 100000
#define MAX_PCK_SIZ 10
#define TIMSTMP_FIFO_NUM 64
#define PACKET_SIZE 2
#define TIMSTMP_FIFO_NUM 8
#define PACKET_SIZE 4
#define DEBUG_EN 1
#define ROUTE_SUBFUNC "NORTH_LAST"
#define AVC_ATOMIC_EN 0
37,10 → 37,10
#define STND_DEV_EN 0
#define AVG_LATENCY_METRIC "HEAD_2_TAIL"
#define ADD_PIPREG_AFTER_CROSSBAR 0
#define ADD_PIPREG_BEFORE_CROSSBAR 0
#define CVw (C==0)? V : C * V
#define CLASS_SETTING 8'b11111111
#define ESCAP_VC_MASK 1
#define CLASS_SETTING "16'b111111111111111"
#define ESCAP_VC_MASK 4'b0001
#define SSA_EN "NO"
 
#endif
/parameter.v
1,35 → 1,35
`ifdef INCLUDE_PARAM
 
parameter V=4;
parameter P=5;
parameter B=4;
parameter TOPOLOGY="MESH";
parameter P=(TOPOLOGY=="RING")? 3 : 5;
parameter B=5;
parameter NX=8;
parameter NY=8;
parameter C=1;
parameter C=4;
parameter Fpay=32;
parameter MUX_TYPE="ONE_HOT";
parameter VC_REALLOCATION_TYPE="NONATOMIC";
parameter COMBINATION_TYPE="COMB_NONSPEC";
parameter FIRST_ARBITER_EXT_P_EN=0;
parameter TOPOLOGY="MESH";
parameter ROUTE_NAME="XY";
parameter CONGESTION_INDEX=3;
parameter C0_p=100;
parameter C1_p=0;
parameter C2_p=0;
parameter C3_p=0;
parameter C0_p=25;
parameter C1_p=25;
parameter C2_p=25;
parameter C3_p=25;
parameter TRAFFIC="RANDOM";
parameter HOTSPOT_PERCENTAGE=3;
parameter HOTSOPT_NUM=4;
parameter HOTSPOT_CORE_1=9;
parameter HOTSPOT_CORE_2=25;
parameter HOTSPOT_CORE_3=11;
parameter HOTSPOT_CORE_4=27;
parameter HOTSPOT_CORE_1=18;
parameter HOTSPOT_CORE_2=50;
parameter HOTSPOT_CORE_3=22;
parameter HOTSPOT_CORE_4=54;
parameter HOTSPOT_CORE_5=18;
parameter MAX_PCK_NUM=128000;
parameter MAX_PCK_NUM=256000;
parameter MAX_SIM_CLKs=100000;
parameter MAX_PCK_SIZ=10;
parameter TIMSTMP_FIFO_NUM=64;
parameter TIMSTMP_FIFO_NUM=8;
parameter ROUTE_TYPE = (ROUTE_NAME == "XY" || ROUTE_NAME == "TRANC_XY" )? "DETERMINISTIC" :
(ROUTE_NAME == "DUATO" || ROUTE_NAME == "TRANC_DUATO" )? "FULL_ADAPTIVE": "PAR_ADAPTIVE";
parameter DEBUG_EN=1;
37,10 → 37,10
parameter AVC_ATOMIC_EN= 0;
parameter AVG_LATENCY_METRIC= "HEAD_2_TAIL";
parameter ADD_PIPREG_AFTER_CROSSBAR= 0;
parameter ADD_PIPREG_BEFORE_CROSSBAR= 0;
parameter CVw=(C==0)? V : C * V;
parameter [CVw-1: 0] CLASS_SETTING = 8'b11111111;
parameter [V-1 : 0] ESCAP_VC_MASK=1;
parameter [CVw-1: 0] CLASS_SETTING = 16'b111111111111111;
parameter [V-1 : 0] ESCAP_VC_MASK=4'b0001;
parameter SSA_EN= "NO";
 
`endif
/router_verilator.v
1,4 → 1,4
module router_verilator
module router_verilator
(
current_x,
current_y,
73,7 → 73,7
 
router # (
.V(V),
.V(V),
.P(P),
.B(B),
.NX(NX),
93,10 → 93,10
.CONGw(CONGw),
.DEBUG_EN(DEBUG_EN),
.ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR),
.ADD_PIPREG_BEFORE_CROSSBAR(ADD_PIPREG_BEFORE_CROSSBAR),
.CVw(CVw),
.CLASS_SETTING(CLASS_SETTING),
.ESCAP_VC_MASK(ESCAP_VC_MASK)
.ESCAP_VC_MASK(ESCAP_VC_MASK),
.SSA_EN(SSA_EN)
)
/testbench.cpp
7,12 → 7,16
#include "Vrouter.h" // From Verilating "router.v"
#include "Vnoc.h"
#include "Vtraffic.h"
 
 
 
 
#include "parameter.h"
//#include "traffic_tabel.h"
 
 
#define NC (NX*NY)
#define RATIO_INIT 5
#define RATIO_INIT 2
 
unsigned char FIXED_SRC_DST_PAIR;
 
353,7 → 357,8
sum_clk_pow2+=(double)clk_num_h2h * (double) clk_num_h2h;
sum_clk_pow2_per_class[class_num]+=(double)clk_num_h2h * (double) clk_num_h2h;
#endif
sum_clk_per_hop+= ((double)clk_num_h2h/(double)distance);
sum_clk_per_hop+= ((double)clk_num_h2h/(double)distance);
total_pck_num_per_class[class_num]+=1;
sum_clk_h2h_per_class[class_num]+=clk_num_h2h ;
sum_clk_h2t_per_class[class_num]+=clk_num_h2t ;
412,11 → 417,13
sprintf(file_name,"%s_all.txt",out_file_name);
//update_file(file_name ,ratio,avg_latency );
if(strcmp (AVG_LATENCY_METRIC,"HEAD_2_TAIL")==0){
printf(" Total number of packet = %d \n average latency per hop = %f \n average latency = %f\n",total_pck_num,avg_latency_per_hop,avg_latency_flit);
printf(" Total number of packet = %d \n average latency per hop = %f \n average latency = %f\n",total_pck_num,avg_latency_per_hop,avg_latency_pck);
update_file(file_name ,avg_throughput,avg_latency_pck);
}else{
printf(" Total number of packet = %d \n average latency per hop = %f \n average latency = %f\n",total_pck_num,avg_latency_per_hop,avg_latency_flit);
update_file(file_name ,avg_throughput,avg_latency_flit);
}else{
printf(" Total number of packet = %d \n average latency per hop = %f \n average latency = %f\n",total_pck_num,avg_latency_per_hop,avg_latency_pck);
update_file(file_name ,avg_throughput,avg_latency_pck);
}
//fwrite(fp,"%d,%f,%f,%f,",total_pck_num,avg_latency_per_hop,avg_latency,max_latency_per_hop);
min_avg_latency_per_class=1000000;
426,16 → 433,20
avg_latency_pck = (total_pck_num_per_class[i]>0)? (double)sum_clk_h2t_per_class[i]/total_pck_num_per_class[i]:0;
avg_latency_per_hop = (total_pck_num_per_class[i]>0)? (double)sum_clk_per_hop_per_class[i]/total_pck_num_per_class[i]:0;
if(strcmp (AVG_LATENCY_METRIC,"HEAD_2_TAIL")==0){
printf ("\nclass : %d \n",i);
printf (" Total number of packet = %d \n avg_throughput = %f \n average latency per hop = %f \n average latency = %f\n",total_pck_num_per_class[i],avg_throughput,avg_latency_per_hop,avg_latency_flit);
sprintf(file_name,"%s_c%u.txt",out_file_name,i);
update_file( file_name,avg_throughput,avg_latency_flit );
}else{
printf ("\nclass : %d \n",i);
printf ("\nclass : %d \n",i);
printf (" Total number of packet = %d \n avg_throughput = %f \n average latency per hop = %f \n average latency = %f\n",total_pck_num_per_class[i],avg_throughput,avg_latency_per_hop,avg_latency_pck);
sprintf(file_name,"%s_c%u.txt",out_file_name,i);
update_file( file_name,avg_throughput,avg_latency_pck );
}else{
 
printf ("\nclass : %d \n",i);
printf (" Total number of packet = %d \n avg_throughput = %f \n average latency per hop = %f \n average latency = %f\n",total_pck_num_per_class[i],avg_throughput,avg_latency_per_hop,avg_latency_flit);
sprintf(file_name,"%s_c%u.txt",out_file_name,i);
update_file( file_name,avg_throughput,avg_latency_flit );
 
 
 
}
if(min_avg_latency_per_class > avg_latency_flit) min_avg_latency_per_class=avg_latency_flit;
 
472,7 → 483,7
printf ("\tAVC_ATOMIC_EN:%d \n", AVC_ATOMIC_EN);
printf ("\tCongestion Index:%d \n",CONGESTION_INDEX);
printf ("\tADD_PIPREG_AFTER_CROSSBAR:%d\n",ADD_PIPREG_AFTER_CROSSBAR);
printf ("\tADD_PIPREG_BEFORE_CROSSBAR:%d\n",ADD_PIPREG_BEFORE_CROSSBAR);
 
 
#if(DEBUG_EN)
498,6 → 509,7
printf ("\t Simulation timeout =%d\n", MAX_SIM_CLKs);
printf ("\t Simulation ends on total packet num of =%d\n", MAX_PCK_NUM);
printf ("\tPacket size: %u flits\n",PACKET_SIZE);
printf ("\t SSA_EN enabled:%s \n",SSA_EN);
}
 
 
550,7 → 562,7
int update_ratio(){
//printf("current_avg_latency=%f\n",current_avg_latency_flit);
if(current_avg_latency_flit <= (2*first_avg_latency_flit)) ratio+=2;
else if(current_avg_latency_flit <= (6*first_avg_latency_flit)) ratio+=1;
else if(current_avg_latency_flit <= (4*first_avg_latency_flit)) ratio+=1;
else return 1;
return 0;
}
692,8 → 704,19
(*dest_y) = ((current_y + ((NY/2)-1))%NY);
 
 
}
} else if( strcmp(TRAFFIC ,"CUSTOM") == 0){
//[(x+(k/2-1)) mod k, (y+(k/2-1)) mod k],
if(current_x ==0 && current_y == 0 ){
(*dest_x) = NX-1;
(*dest_y) = NY-1;
}else{// make it unvalid
(*dest_x) = current_x;
(*dest_y) = current_y;
 
}
 
}
 
else printf ("traffic %s is an unsupported traffic pattern\n",TRAFFIC);
 
}
/traffic_gen_verilator.v
8,7 → 8,7
module traffic_gen_verilator (
//input
ratio,
pck_size,
pck_size_in,
current_x,
current_y,
dest_x,
82,7 → 82,7
input [Xw-1 :0] dest_x;
input [Yw-1 :0] dest_y;
output [PCK_CNTw-1 :0] pck_number;
input [PCK_SIZw-1 :0] pck_size;
input [PCK_SIZw-1 :0] pck_size_in;
output sent_done;
output hdr_flit_sent;
input [Cw-1 :0] pck_class_in;
100,28 → 100,14
 
traffic_gen #(
.V(V),
.P(P),
.B(B),
.NX(NX),
.NY(NY),
.Fpay(Fpay),
.C(C),
.VC_REALLOCATION_TYPE(VC_REALLOCATION_TYPE),
.TOPOLOGY(TOPOLOGY),
.ROUTE_NAME(ROUTE_NAME),
.ROUTE_TYPE(ROUTE_TYPE),
.TRAFFIC(TRAFFIC),
.HOTSPOT_PERCENTAGE(HOTSPOT_PERCENTAGE),
.HOTSOPT_NUM(HOTSOPT_NUM),
.HOTSPOT_CORE_1(HOTSPOT_CORE_1),
.HOTSPOT_CORE_2(HOTSPOT_CORE_2),
.HOTSPOT_CORE_3(HOTSPOT_CORE_3),
.HOTSPOT_CORE_4(HOTSPOT_CORE_4),
.HOTSPOT_CORE_5(HOTSPOT_CORE_5),
.C(C),
.C0_p(C0_p),
.C1_p(C1_p),
.C2_p(C2_p),
.C3_p(C3_p),
.MAX_PCK_NUM(MAX_PCK_NUM),
.MAX_SIM_CLKs(MAX_SIM_CLKs),
.MAX_PCK_SIZ(MAX_PCK_SIZ),
131,7 → 117,7
(
//input
.ratio (ratio),
.pck_size(pck_size),
.pck_size_in(pck_size_in),
.current_x(current_x),
.current_y(current_y),
.dest_x(dest_x),
161,7 → 147,9
);
// always @(posedge start ) begin
// $display(" (%d,%d) start at %t",current_x, current_y,$time);
//end
 
endmodule
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.