congestion_y_plus)? YDIR : XDIR;
assign conjestion_cmp[X_MINUS_Y_PLUS] = (congestion_x_min > congestion_y_plus)? YDIR : XDIR;
assign conjestion_cmp[X_PLUS_Y_MINUS] = (congestion_x_plus > congestion_y_min)? YDIR : XDIR;
@@ -263,14 +238,12 @@ endmodule
* CONGESTION_INDEX==8,10
********************************/
module port_presel_based_dst_routers_ovc #(
- parameter PPSw=4,
- parameter P=5,
- parameter V=4,
- parameter CONGw=2 //congestion width per port
+ parameter P=5
)(
port_pre_sel,
congestion_in_all
);
+ import pronoc_pkg::*;
localparam
P_1 = P-1,
CONG_ALw = CONGw* P; // congestion width per router;
@@ -289,16 +262,18 @@ module port_presel_based_dst_routers_ovc #(
Q1 = 1,
Q2 = 2,
Q0 = 0;
- localparam
- EAST = 0,
- NORTH = 1,
- WEST = 2,
- SOUTH = 3;
+
localparam
XDIR =1'b0,
YDIR =1'b1;
- wire [CONGw-1 : 0] congestion_in [P_1-1 : 0];
- assign {congestion_in[SOUTH],congestion_in[WEST],congestion_in[NORTH],congestion_in[EAST]} = congestion_in_all[CONG_ALw-1 : CONGw];
+ wire [CONGw-1 : 0] congestion_in [P-1 : 0];
+ genvar i;
+ generate
+ for(i=0;i (2**INw)-1) ? {INw{1'b1}} : INw'(MAX_IN);
+ // One-hot output
+ logic [OUT_ON_HOT_NUM-1:0] one_hot_out;
+ // Saturate input
+ logic [INw-1:0] D_clamped;
+ assign D_clamped = (D_in > MAX) ? MAX : D_in;
+ // Generate one-hot bins
genvar i;
- generate
- for(i=0;i< OUT_ON_HOT_NUM;i=i+1)begin :lp
- /* verilator lint_off WIDTH */
- if(i==0) begin : i0 assign one_hot_out[i]= (D_in <= (MAX_IN /OUT_ON_HOT_NUM)); end
- else begin :ib0 assign one_hot_out[i]= ((D_in> ((MAX_IN *i)/OUT_ON_HOT_NUM)) && (D_in<= ((MAX_IN *(i+1))/OUT_ON_HOT_NUM))); end
- /* verilator lint_on WIDTH */
- end//for
+ generate
+ for (i = 0; i < OUT_ON_HOT_NUM; i++) begin : BIN_GEN
+ localparam LOW = (MAX_IN * i) / OUT_ON_HOT_NUM;
+ localparam HIGH = (MAX_IN * (i+1)) / OUT_ON_HOT_NUM;
+ assign one_hot_out[i] =
+ (i == 0) ? (D_clamped < INw'(HIGH)) : // first bin: include MIN_IN
+ (i == OUT_ON_HOT_NUM-1) ? (D_clamped >= INw'(LOW)) : // last bin: include MAX_IN
+ (D_clamped >= INw'(LOW)) && (D_clamped < INw'(HIGH));
+ end
endgenerate
-
- one_hot_to_bin#(
+ // Convert one-hot to binary
+ one_hot_to_bin #(
.ONE_HOT_WIDTH(OUT_ON_HOT_NUM)
- )cnv (
+ ) cnv (
.one_hot_code(one_hot_out),
.bin_code(Q_out)
);
endmodule
+
/**************************
- congestion_out_gen
+* congestion_out_gen
*************************/
module congestion_out_gen #(
- parameter P=5,
- parameter V=4,
- parameter ROUTE_TYPE ="ADAPTIVE",
- parameter CONGESTION_INDEX=2,
- parameter CONGw=2
+ parameter P=5
)(
ivc_request_all,
ivc_num_getting_sw_grant,
@@ -950,10 +861,10 @@ module congestion_out_gen #(
clk,
reset
);
-
-localparam
- PV = P*V,
- CONG_ALw = CONGw* P; // congestion width per router;;
+ import pronoc_pkg::*;
+ localparam
+ PV = P*V,
+ CONG_ALw = CONGw* P; // congestion width per router;;
input [PV-1 : 0] ovc_avalable_all;
input [PV-1 : 0] ivc_request_all;
@@ -962,22 +873,23 @@ localparam
input clk,reset;
wire [CONG_ALw-1 : 0] congestion_out_all_next;
+ wire [V-1 : 0] ovc_avalable [P-1 : 0];
+ genvar i;
generate
+ for (i=0;i
2) begin :mwb2
wire [MUX_SEL_WIDTH-1 : 0] mux_sel;
- wire [DEPTH_DATA_WIDTH-1 : 0] depth_2;
- wire empty;
+ wire [DEPTHw-1 : 0] depth_2;
wire out_sel ;
if(DATA_WIDTH>1) begin :wb1
wire [MAX_DEPTH-2 : 0] mux_in [DATA_WIDTH-1 :0];
wire [DATA_WIDTH-1 : 0] mux_out;
reg [MAX_DEPTH-2 : 0] shiftreg [DATA_WIDTH-1 :0];
-
for(i=0;i= MAX_DEPTH [DEPTH_DATA_WIDTH-1 : 0] -1'b1;
- assign empty = depth == {DEPTH_DATA_WIDTH{1'b0}};
- assign recieve_more_than_0 = ~ empty;
- assign recieve_more_than_1 = ~( depth == {DEPTH_DATA_WIDTH{1'b0}} || depth== DEPTH_DATA_WIDTH'(1) );
- assign out_sel = (recieve_more_than_1) ? 1'b1 : 1'b0;
- assign out_ld = (depth !=DEPTH_DATA_WIDTH'(0) )? rd_en : wr_en;
- assign depth_2 = depth - DEPTH_DATA_WIDTH'(2);
+ assign out_sel = (status_o.has_multiple) ? 1'b1 : 1'b0;
+ assign out_ld = (depth !=DEPTHw'(0) )? rd_en : wr_en;
+ assign depth_2 = depth - DEPTHw'(2);
assign mux_sel = depth_2[MUX_SEL_WIDTH-1 : 0];
-
end else if ( MAX_DEPTH == 2) begin :mw2
-
reg [DATA_WIDTH-1 : 0] din_f;
-
always @(posedge clk ) begin
if(wr_en) din_f <= din;
end //always
-
- assign full = depth == MAX_DEPTH [DEPTH_DATA_WIDTH-1 : 0];
- assign nearly_full = depth >= MAX_DEPTH [DEPTH_DATA_WIDTH-1 : 0] -1'b1;
assign out_ld = (depth !=0 )? rd_en : wr_en;
- assign recieve_more_than_0 = (depth != {DEPTH_DATA_WIDTH{1'b0}});
- assign recieve_more_than_1 = ~( depth == 0 || depth== 1 );
- assign dout_next = (recieve_more_than_1) ? din_f : din;
-
+ assign dout_next = (status_o.has_multiple) ? din_f : din;
end else begin :mw1 // MAX_DEPTH == 1
assign out_ld = wr_en;
assign dout_next = din;
- assign full = depth == MAX_DEPTH [DEPTH_DATA_WIDTH-1 : 0];
- assign nearly_full= 1'b1;
- assign recieve_more_than_0 = full;
- assign recieve_more_than_1 = 1'b0;
end
endgenerate
- always_ff @ (`pronoc_clk_reset_edge )begin
- if(`pronoc_reset) begin
- depth <= {DEPTH_DATA_WIDTH{1'b0}};
- dout <= {DATA_WIDTH{1'b0}};
- end else begin
- depth <= depth_next;
- dout <= dout_next_ld;
- end
+
+ always_ff @ (`pronoc_clk_reset_edge ) begin
+ if(`pronoc_reset) begin
+ depth <= {DEPTHw{1'b0}};
+ dout <= {DATA_WIDTH{1'b0}};
+ end else begin
+ depth <= depth_next;
+ dout <= dout_next_ld;
end
+ end
always_comb begin
depth_next = depth;
@@ -614,22 +572,31 @@ module fwft_fifo #(
if (wr_en & ~rd_en) depth_next = depth + 1'h1;
else if (~wr_en & rd_en) depth_next = depth - 1'h1;
if (out_ld) dout_next_ld = dout_next;
+ status_o.full = (depth == MAX_DEPTH [DEPTHw-1 : 0]);
+ status_o.nearly_full =
+ (MAX_DEPTH == 1)? 1'b1 :
+ (depth >= MAX_DEPTH [DEPTHw-1 : 0] -1'b1);
+ status_o.empty = (depth == {DEPTHw{1'b0}});
+ status_o.has_data = ~ status_o.empty;
+ status_o.has_multiple =
+ (MAX_DEPTH == 1)? 1'b0 :
+ ~( depth == DEPTHw'(0) || depth== DEPTHw'(1) );
end//always
-/*********************************************
-* Validating Parameters/Simulation
-*********************************************/
+ /*********************************************
+ * Validating Parameters/Simulation
+ *********************************************/
`ifdef SIMULATION
always @(posedge clk) begin
- if (wr_en & ~rd_en & full) begin
+ if (wr_en & ~rd_en & status_o.full) begin
$display("%t: ERROR: Attempt to write to full FIFO:FIFO size is %d. %m",$time,MAX_DEPTH);
$finish;
end
- if (rd_en & !recieve_more_than_0 & IGNORE_SAME_LOC_RD_WR_WARNING == 0) begin
+ if (rd_en & status_o.empty & IGNORE_SAME_LOC_RD_WR_WARNING == 0) begin
$display("%t ERROR: Attempt to read an empty FIFO: %m", $time);
$finish;
end
- if (rd_en & ~wr_en & !recieve_more_than_0 & (IGNORE_SAME_LOC_RD_WR_WARNING == 1)) begin
+ if (rd_en & ~wr_en & status_o.empty & (IGNORE_SAME_LOC_RD_WR_WARNING == 1)) begin
$display("%t ERROR: Attempt to read an empty FIFO: %m", $time);
$finish;
end
@@ -637,14 +604,13 @@ module fwft_fifo #(
`endif//SIMULATION
endmodule
-/*********************
-
- fwft_fifo_with_output_clear
- each individual output bit has
- its own clear signal
-
- **********************/
-
+/***************************
+ *
+ * fwft_fifo_with_output_clear
+ * each individual output bit has
+ * its own clear signal
+ *
+ ***************************/
module fwft_fifo_with_output_clear #(
parameter DATA_WIDTH = 2,
parameter MAX_DEPTH = 2,
@@ -652,59 +618,42 @@ module fwft_fifo_with_output_clear #(
) (
din, // Data in
wr_en, // Write enable
- rd_en, // Read the next word
dout, // Data out
- full,
- nearly_full,
- recieve_more_than_0,
- recieve_more_than_1,
+ rd_en, // Read the next word
+ status_o,// fifo status
reset,
clk,
clear
);
- input [DATA_WIDTH-1:0] din;
- input wr_en;
- input rd_en;
- output logic [DATA_WIDTH-1:0] dout;
- output full;
- output nearly_full;
- output recieve_more_than_0;
- output recieve_more_than_1;
- input reset;
- input clk;
+ import pronoc_pkg::*;
+ input [DATA_WIDTH-1:0] din; // Data in
+ input wr_en; // Write enable
+ input rd_en; // Read the next word
+ output logic [DATA_WIDTH-1:0] dout; // Data out
+ input reset, clk;
+ output fifo_stat_t status_o;
input [DATA_WIDTH-1:0] clear;
- function integer log2;
- input integer number; begin
- log2=(number <=1) ? 1: 0;
- while(2**log22) begin :mwb2
wire [MUX_SEL_WIDTH-1 : 0] mux_sel;
- wire [DEPTH_DATA_WIDTH-1 : 0] depth_2;
- wire empty;
+ wire [DEPTHw-1 : 0] depth_2;
wire out_sel ;
if(DATA_WIDTH>1) begin :wb1
wire [MAX_DEPTH-2 : 0] mux_in [DATA_WIDTH-1 :0];
wire [DATA_WIDTH-1 : 0] mux_out;
reg [MAX_DEPTH-2 : 0] shiftreg [DATA_WIDTH-1 :0];
-
for(i=0;i= MAX_DEPTH [DEPTH_DATA_WIDTH-1 : 0] -1'b1;
- assign empty = depth == {DEPTH_DATA_WIDTH{1'b0}};
- assign recieve_more_than_0 = ~ empty;
- assign recieve_more_than_1 = ~( depth == {DEPTH_DATA_WIDTH{1'b0}} || depth== 1 );
- assign out_sel = (recieve_more_than_1) ? 1'b1 : 1'b0;
+ assign out_sel = (status_o.has_multiple) ? 1'b1 : 1'b0;
assign out_ld = (depth !=0 )? rd_en : wr_en;
assign depth_2 = depth-'d2;
assign mux_sel = depth_2[MUX_SEL_WIDTH-1 : 0];
-
end else if ( MAX_DEPTH == 2) begin :mw2
-
reg [DATA_WIDTH-1 : 0] din_f;
-
always @(posedge clk ) begin
if(wr_en) din_f <= din;
end //always
-
- assign full = depth == MAX_DEPTH [DEPTH_DATA_WIDTH-1 : 0];
- assign nearly_full = depth >= MAX_DEPTH [DEPTH_DATA_WIDTH-1 : 0] -1'b1;
assign out_ld = (depth !=0 )? rd_en : wr_en;
- assign recieve_more_than_0 = (depth != {DEPTH_DATA_WIDTH{1'b0}});
- assign recieve_more_than_1 = ~( depth == 0 || depth== 1 );
- assign dout_next = (recieve_more_than_1) ? din_f : din;
-
+ assign dout_next = (status_o.has_multiple) ? din_f : din;
end else begin :mw1 // MAX_DEPTH == 1
assign out_ld = wr_en;
assign dout_next = din;
- assign full = depth == MAX_DEPTH [DEPTH_DATA_WIDTH-1 : 0];
- assign nearly_full= 1'b1;
- assign recieve_more_than_0 = full;
- assign recieve_more_than_1 = 1'b0;
end
endgenerate
always_ff @ (`pronoc_clk_reset_edge) begin
@@ -781,6 +707,15 @@ module fwft_fifo_with_output_clear #(
depth_next = depth;
if (wr_en & ~rd_en) depth_next = depth + 1'h1;
else if (~wr_en & rd_en) depth_next = depth - 1'h1;
+ status_o.full = (depth == MAX_DEPTH [DEPTHw-1 : 0]);
+ status_o.nearly_full =
+ (MAX_DEPTH == 1)? 1'b1 :
+ (depth >= MAX_DEPTH [DEPTHw-1 : 0] -1'b1);
+ status_o.empty = (depth == {DEPTHw{1'b0}});
+ status_o.has_data = ~ status_o.empty;
+ status_o.has_multiple =
+ (MAX_DEPTH == 1)? 1'b0 :
+ ~( depth == DEPTHw'(0) || depth== DEPTHw'(1) );
end//always
always_comb begin
@@ -791,22 +726,21 @@ module fwft_fifo_with_output_clear #(
end
end
-
-/*********************************************
-* Validating Parameters/Simulation
-*********************************************/
+ /*********************************************
+ * Validating Parameters/Simulation
+ *********************************************/
`ifdef SIMULATION
always @(posedge clk) begin
if(`pronoc_reset==0)begin
- if (wr_en && ~rd_en && full) begin
+ if (wr_en && ~rd_en && status_o.full) begin
$display("%t: ERROR: Attempt to write to full FIFO:FIFO size is %d. %m",$time,MAX_DEPTH);
$finish;
end
- if (rd_en && !recieve_more_than_0 && (IGNORE_SAME_LOC_RD_WR_WARNING == 0)) begin
+ if (rd_en && status_o.empty && (IGNORE_SAME_LOC_RD_WR_WARNING == 0)) begin
$display("%t ERROR: Attempt to read an empty FIFO: %m", $time);
$finish;
end
- if (rd_en && ~wr_en && !recieve_more_than_0 && (IGNORE_SAME_LOC_RD_WR_WARNING == 1)) begin
+ if (rd_en && ~wr_en && status_o.empty && (IGNORE_SAME_LOC_RD_WR_WARNING == 1)) begin
$display("%t ERROR: Attempt to read an empty FIFO: %m", $time);
$finish;
end
@@ -815,64 +749,63 @@ module fwft_fifo_with_output_clear #(
`endif // SIMULATION
endmodule
-/***************
-fwft_fifo_bram
-****************/
+/***************************
+*fwft_fifo_bram
+* An FWFT FIFO implementation based on BRAMs
+* optimized for low LUTs utilization.
+***************************/
module fwft_fifo_bram #(
parameter DATA_WIDTH = 2,
parameter MAX_DEPTH = 2,
parameter IGNORE_SAME_LOC_RD_WR_WARNING=1 // 1 : "YES" , 0: "NO"
- ) (
- input [DATA_WIDTH-1:0] din, // Data in
- input wr_en, // Write enable
- input rd_en, // Read the next word
- output [DATA_WIDTH-1:0] dout, // Data out
- output full,
- output nearly_full,
- output recieve_more_than_0,
- output recieve_more_than_1,
- input reset,
- input clk
+ )(
+ din, // Data in
+ wr_en, // Write enable
+ rd_en, // Read the next word
+ dout, // Data out
+ stat_o,
+ reset,
+ clk
);
+ import pronoc_pkg::*;
+ input [DATA_WIDTH-1:0] din; // Data in
+ input wr_en; // Write enable
+ input rd_en; // Read the next word
+ output [DATA_WIDTH-1:0] dout; // Data out
+ output fifo_stat_t stat_o;
+ input reset;
+ input clk;
- function integer log2;
- input integer number; begin
- log2=(number <=1) ? 1: 0;
- while(2**log2= MAX_DEPTH [DEPTH_DATA_WIDTH-1 : 0] -1'b1;
- assign empty = depth == {DEPTH_DATA_WIDTH{1'b0}};
- assign recieve_more_than_0 = ~ empty;
- assign recieve_more_than_1 = ~( depth == {DEPTH_DATA_WIDTH{1'b0}} || depth== 1 );
+ assign stat_o.full = (depth == MAX_DEPTH [DEPTHw-1 : 0]);
+ assign stat_o.nearly_full = (depth >= MAX_DEPTH [DEPTHw-1 : 0] -1'b1);
+ assign stat_o.empty = (depth == {DEPTHw{1'b0}});
+ assign stat_o.has_data = ~(depth == {DEPTHw{1'b0}});
+ assign stat_o.has_multiple = ~((depth == DEPTHw'(0)) || (depth == DEPTHw'(1)));
`ifdef SIMULATION
always @(posedge clk) begin
- if (wr_en & ~rd_en & full) begin
+ if (wr_en & ~rd_en & stat_o.full) begin
$display("%t: ERROR: Attempt to write to full FIFO:FIFO size is %d. %m",$time,MAX_DEPTH);
$finish;
end
- if (rd_en & !recieve_more_than_0 & (IGNORE_SAME_LOC_RD_WR_WARNING == 0)) begin
+ if (rd_en & stat_o.empty & (IGNORE_SAME_LOC_RD_WR_WARNING == 0)) begin
$display("%t ERROR: Attempt to read an empty FIFO: %m", $time);
$finish;
end
- if (rd_en & ~wr_en & !recieve_more_than_0 & (IGNORE_SAME_LOC_RD_WR_WARNING == 1)) begin
+ if (rd_en & ~wr_en & stat_o.empty & (IGNORE_SAME_LOC_RD_WR_WARNING == 1)) begin
$display("%t ERROR: Attempt to read an empty FIFO: %m", $time);
$finish;
end
end // always
`endif // SIMULATION
-
endmodule
/**********************************
- bram_based_fifo
- *********************************/
+* bram_based_fifo
+*********************************/
module bram_based_fifo #(
parameter Dw = 72,//data_width
parameter B = 10// buffer num
@@ -949,22 +878,11 @@ module bram_based_fifo #(
wr_en,
rd_en,
dout,
- full,
- nearly_full,
- empty,
+ stat_o,
reset,
clk
);
-
- function integer log2;
- input integer number; begin
- log2=(number <=1) ? 1: 0;
- while(2**log2=Bint2; // B-1
- assign empty = depth == {DEPTHw{1'b0}};
-
+ always_comb begin
+ stat_o.full = depth == B [DEPTHw-1 : 0];
+ stat_o.nearly_full = depth >=Bint2; // B-1
+ stat_o.empty = depth == {DEPTHw{1'b0}};
+ stat_o.has_data = ~(depth == {DEPTHw{1'b0}});
+ stat_o.has_multiple = ~((depth == DEPTHw'(0)) || (depth == DEPTHw'(1)));
+ end
`ifdef SIMULATION
always @(posedge clk) begin
if(`pronoc_reset==1'b0)begin
@@ -1041,5 +956,4 @@ module bram_based_fifo #(
end//~reset
end
`endif
-
endmodule
diff --git a/mpsoc/rtl/src_noc/fmesh.sv b/mpsoc/rtl/src_noc/fmesh.sv
index 88e5bc8..bb8642f 100644
--- a/mpsoc/rtl/src_noc/fmesh.sv
+++ b/mpsoc/rtl/src_noc/fmesh.sv
@@ -79,15 +79,9 @@ endmodule
module fmesh_destp_generator #(
- parameter ROUTE_NAME = "XY",
- parameter ROUTE_TYPE = "DETERMINISTIC",
parameter P=5,
- parameter DSTPw=4,
- parameter NL=1,
parameter PLw=1,
- parameter PPSw=4,
- parameter SW_LOC=0,
- parameter SELF_LOOP_EN=0
+ parameter SW_LOC=0
)(
dest_port_out,
dest_port_coded,
@@ -96,7 +90,7 @@ module fmesh_destp_generator #(
port_pre_sel,
odd_column
);
-
+ import pronoc_pkg::*;
localparam P_1 = (SELF_LOOP_EN )? P : P-1;
input [DSTPw-1 : 0] dest_port_coded;
@@ -109,14 +103,9 @@ module fmesh_destp_generator #(
wire [P_1-1 : 0] dest_port_in;
fmesh_destp_decoder #(
- .ROUTE_TYPE(ROUTE_TYPE),
.P(P),
- .DSTPw(DSTPw),
- .NL(NL),
.PLw(PLw),
- .PPSw(PPSw),
- .SW_LOC(SW_LOC),
- .SELF_LOOP_EN(SELF_LOOP_EN)
+ .SW_LOC(SW_LOC)
) decoder (
.dest_port_coded(dest_port_coded),
.dest_port_out(dest_port_in),
@@ -130,14 +119,9 @@ endmodule
module fmesh_destp_decoder #(
- parameter ROUTE_TYPE="DETERMINISTIC",
parameter P=6,
- parameter DSTPw=4,
- parameter NL=2,
parameter PLw=1,
- parameter PPSw=4,
- parameter SW_LOC=0,
- parameter SELF_LOOP_EN=0
+ parameter SW_LOC=0
)(
dest_port_coded,
endp_localp_num,
@@ -145,6 +129,7 @@ module fmesh_destp_decoder #(
swap_port_presel,
port_pre_sel
);
+ import pronoc_pkg::*;
localparam P_1 = (SELF_LOOP_EN )? P : P-1;
input [DSTPw-1 : 0] dest_port_coded;
@@ -159,7 +144,7 @@ module fmesh_destp_decoder #(
assign {x,y,a,b} = dest_port_coded;
wire [PPSw-1:0] port_pre_sel_final;
assign port_pre_sel_final =
- ( ROUTE_TYPE == "DETERMINISTIC") ? {PPSw{1'b1}}:
+ ( IS_DETERMINISTIC ) ? {PPSw{1'b1}}:
(swap_port_presel) ? ~port_pre_sel : port_pre_sel;
always_comb begin
case({a,b})
@@ -176,7 +161,7 @@ module fmesh_destp_decoder #(
endp_localp_onehot = {P{1'b0}};
endp_localp_onehot[endp_localp_num] = 1'b1;
end
-
+
generate
if(NL>1) begin :multi
assign destport_onehot =(portout[0])? endp_localp_onehot : /*select local destination*/
@@ -184,19 +169,17 @@ module fmesh_destp_decoder #(
end else begin
assign destport_onehot =(portout[0])? endp_localp_onehot : /*select local destination*/
portout;
- end
- if(SELF_LOOP_EN == 0) begin :nslp
- remove_sw_loc_one_hot #(
- .P(P),
- .SW_LOC(SW_LOC)
- ) remove_sw_loc (
- .destport_in(destport_onehot),
- .destport_out(dest_port_out)
- );
- end else begin: slp
- assign dest_port_out = destport_onehot;
- end
- endgenerate
+ end
+ endgenerate
+
+ destport_non_selfloop_fix #(
+ .SELF_LOOP_EN(SELF_LOOP_EN),
+ .P(P),
+ .SW_LOC(SW_LOC)
+ ) fix (
+ .destport_in(destport_onehot),
+ .destport_out(dest_port_out)
+ );
endmodule
diff --git a/mpsoc/rtl/src_noc/header_flit.sv b/mpsoc/rtl/src_noc/header_flit.sv
index b7cfb27..0119721 100644
--- a/mpsoc/rtl/src_noc/header_flit.sv
+++ b/mpsoc/rtl/src_noc/header_flit.sv
@@ -180,6 +180,46 @@ module extract_header_flit_info # (
assign hdr_flit_wr_o= (flit_in_wr & hdr_flg_o )? vc_num_o : {V{1'b0}};
endmodule
+module header_flit_info #(
+ parameter DATA_w = 0
+)(
+ flit,
+ hdr_flit,
+ data_o
+);
+
+ import pronoc_pkg::*;
+
+ localparam
+ Dw = (DATA_w==0)? 1 : DATA_w;
+
+ input flit_t flit;
+ output hdr_flit_t hdr_flit;
+ output [Dw-1 : 0] data_o;
+
+ localparam
+ DATA_LSB= MSB_BE+1,
+ DATA_MSB= (DATA_LSB + DATA_w)1)? flit.payload [CLASS_MSB : CLASS_LSB] : {Cw{1'b0}};
+ hdr_flit.weight = (IS_WRRA)? flit.payload [WEIGHT_MSB : WEIGHT_LSB] : {WEIGHTw{1'b0}};
+ hdr_flit.be = (BYTE_EN)? flit.payload [BE_MSB : BE_LSB]: {BEw{1'b0}};
+ end
+
+ wire [OFFSETw-1 : 0 ] offset = flit.payload [DATA_MSB : DATA_LSB];
+ generate
+ if(Dw > OFFSETw) begin : if1
+ assign data_o={{(Dw-OFFSETw){1'b0}},offset};
+ end else begin : if2
+ assign data_o=offset[Dw-1 : 0];
+ end
+ endgenerate
+endmodule
/***********************************
* flit_update
diff --git a/mpsoc/rtl/src_noc/inout_ports.sv b/mpsoc/rtl/src_noc/inout_ports.sv
index ac65f6e..f04e998 100755
--- a/mpsoc/rtl/src_noc/inout_ports.sv
+++ b/mpsoc/rtl/src_noc/inout_ports.sv
@@ -251,11 +251,7 @@ module inout_ports #(
);
congestion_out_gen #(
- .P(P),
- .V(V),
- .ROUTE_TYPE(ROUTE_TYPE),
- .CONGESTION_INDEX(CONGESTION_INDEX),
- .CONGw(CONGw)
+ .P(P)
) congestion_out (
.ovc_avalable_all(ovc_avalable_all),
.ivc_request_all(ivc_request_all),
@@ -267,7 +263,7 @@ module inout_ports #(
genvar i;
generate
-
+
if( SSA_EN == 1 ) begin : ssa
ss_allocator #(
.P(P)
@@ -313,14 +309,12 @@ module inout_ports #(
endmodule
/******************
- output_vc_status
+* output_vc_status
******************/
module output_vc_status #(
- parameter V = 4,
- parameter B = 16,
+ parameter PORT_B = 16,
parameter CAND_VC_SEL_MODE = 0, // 0: use arbiteration between not full vcs, 1: select the vc with most availble free space
- parameter CRDTw = 4,
- parameter HETERO_VC=0
+ parameter CRDTw = 4
)(
credit_init_val_in,
ovc_presence,
@@ -334,7 +328,7 @@ module output_vc_status #(
clk,
reset
);
-
+ import pronoc_pkg::*;
input [V-1 : 0] [CRDTw-1 : 0 ] credit_init_val_in ;
input [V-1 : 0] ovc_presence;
input [V-1 : 0] wr_in;
@@ -347,16 +341,7 @@ module output_vc_status #(
input clk;
input reset;
- function integer log2;
- input integer number; begin
- log2=(number <=1) ? 1: 0;
- while(2**log20 && vc_num_in[j] && t1[j]==0)begin
- $display("%t : Parser:current_r=%h, class_in=%h, destport_in=%h, dest_e_addr_in=%h, src_e_addr_in=%h, vc_num_in=%h,hdr_flit_wr=%h, hdr_flg_in=%h,tail_flg_in=%h ",$time,current_r_addr, class_in, destport_in, dest_e_addr_in, src_e_addr_in, vc_num_in,hdr_flit_wr, hdr_flg_in,tail_flg_in);
+ if(flit_in_wr > 0 && flit_in.vc[j] && t1[j]==0)begin
+ $display("%t : Parser:current_r=%h, hdr_info:%p, vc_num_in=%h,hdr_flit_wr=%h",$time,current_r_addr, hdr_flit_i, flit_in.vc,hdr_flit_wr);
t1[j]<=1;
end
end
@@ -993,7 +894,7 @@ module destp_generator #(
Pw = log2(P),
PLw = (IS_FMESH) ? Pw : ELw,
P_1 = (SELF_LOOP_EN )? P : P-1;
-
+
input [DSTPw-1 : 0] dest_port_encoded;
input [PLw-1 : 0] endp_localp_num;
output [P_1-1: 0] dest_port_out;
@@ -1004,18 +905,14 @@ module destp_generator #(
generate
if( ~IS_UNICAST ) begin : muticast
- // destination port is not coded for multicast/broadcast
- if( SELF_LOOP_EN==0) begin : nslp
- remove_sw_loc_one_hot #(
- .P(P),
- .SW_LOC(SW_LOC)
- ) remove_sw_loc (
- .destport_in(dest_port_encoded),
- .destport_out(dest_port_out)
- );
- end else begin : slp
- assign dest_port_out = dest_port_encoded;
- end
+ destport_non_selfloop_fix #(
+ .SELF_LOOP_EN(SELF_LOOP_EN),
+ .P(P),
+ .SW_LOC(SW_LOC)
+ ) fix_sw_loc (
+ .destport_in(dest_port_encoded),
+ .destport_out(dest_port_out)
+ );
end else if( IS_FATTREE ) begin : fat
fattree_destp_generator #(
.K(T1),
@@ -1042,16 +939,9 @@ module destp_generator #(
);
end else if( IS_REGULAR_TOPO ) begin : regular
regular_topo_destp_generator #(
- .TOPOLOGY(TOPOLOGY),
- .ROUTE_NAME(ROUTE_NAME),
- .ROUTE_TYPE(ROUTE_TYPE),
.P(P),
- .DSTPw(DSTPw),
- .NL(NL),
.PLw(PLw),
- .PPSw(PPSw),
- .SW_LOC(SW_LOC),
- .SELF_LOOP_EN(SELF_LOOP_EN)
+ .SW_LOC(SW_LOC)
) destp_generator (
.dest_port_coded(dest_port_encoded),
.endp_localp_num(endp_localp_num),
@@ -1062,15 +952,9 @@ module destp_generator #(
);
end else if ( IS_FMESH ) begin :fmesh
fmesh_destp_generator #(
- .ROUTE_NAME(ROUTE_NAME),
- .ROUTE_TYPE(ROUTE_TYPE),
.P(P),
- .DSTPw(DSTPw),
- .NL(NL),
.PLw(PLw),
- .PPSw(PPSw),
- .SW_LOC(SW_LOC),
- .SELF_LOOP_EN(SELF_LOOP_EN)
+ .SW_LOC(SW_LOC)
) destp_generator (
.dest_port_coded(dest_port_encoded),
.endp_localp_num(endp_localp_num),
@@ -1132,19 +1016,14 @@ module custom_topology_destp_decoder #(
dest_port_one_hot[dest_port_in_encoded] = 1'b1;
end
- generate
- if( SELF_LOOP_EN==0) begin : nslp
- remove_sw_loc_one_hot #(
- .P(P),
- .SW_LOC(SW_LOC)
- ) remove_sw_loc (
- .destport_in(dest_port_one_hot[P-1 : 0]),
- .destport_out(dest_port_out)
- );
- end else begin : slp
- assign dest_port_out = dest_port_one_hot;
- end
- endgenerate
+ destport_non_selfloop_fix #(
+ .SELF_LOOP_EN(SELF_LOOP_EN),
+ .P(P),
+ .SW_LOC(SW_LOC)
+ ) remove_sw_loc (
+ .destport_in(dest_port_one_hot[P-1 : 0]),
+ .destport_out(dest_port_out)
+ );
`ifdef SIMULATION
initial begin
diff --git a/mpsoc/rtl/src_noc/mesh_3d_top.sv b/mpsoc/rtl/src_noc/mesh_3d_top.sv
new file mode 100644
index 0000000..67ff523
--- /dev/null
+++ b/mpsoc/rtl/src_noc/mesh_3d_top.sv
@@ -0,0 +1,151 @@
+`include "pronoc_def.v"
+/**********************************************************************
+** File: mesh_cluster.sv
+**
+** Copyright (C) 2014-2017 Alireza Monemi
+**
+** This file is part of ProNoC
+**
+** ProNoC ( stands for Prototype Network-on-chip) is free software:
+** you can redistribute it and/or modify it under the terms of the GNU
+** Lesser General Public License as published by the Free Software Foundation,
+** either version 2 of the License, or (at your option) any later version.
+**
+** ProNoC is distributed in the hope that it will be useful, but WITHOUT
+** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+** Public License for more details.
+**
+** You should have received a copy of the GNU Lesser General Public
+** License along with ProNoC. If not, see .
+**
+**
+**
+** Description:
+** A `mesh_cluster` refers to a group of interconnected routers arranged in a **3D Mesh topology**
+** within a larger **Multi-Mesh NoC** for chiplets. In this architecture, each chiplet functions
+** as an independent cluster of nodes, featuring its own local mesh-based communication network.
+**
+** Each router in the `mesh_cluster` drives two I/O channels:
+** 1. **Endpoint Channel** – Connects to processing elements (PEs) or memory endpoints.
+** 2. **Vertical Link Channel** – Facilitates inter-cluster communication.
+**
+** If an endpoint or vertical link is not present in the target Multi-Mesh topology,
+** the corresponding input is tied to **ground**, enabling synthesis optimizations
+** that effectively remove unused logic.
+**
+***************************************/
+
+module mesh_3d_noc_top (
+ reset,
+ clk,
+ chan_in_all,
+ chan_out_all,
+ router_event
+);
+ import pronoc_pkg::*;
+ input clk,reset;
+ //Endpoints ports
+ input smartflit_chanel_t chan_in_all [NE-1 : 0];
+ output smartflit_chanel_t chan_out_all [NE-1 : 0];
+ //Events
+ output router_event_t router_event [NR-1 : 0][MAX_P-1 : 0];
+
+ //indididual routers interconnect ports
+ smartflit_chanel_t router_chan_in [NZ-1:0][NY-1:0][NX-1:0][MAX_P-1:0];
+ smartflit_chanel_t router_chan_out [NZ-1:0][NY-1:0][NX-1:0][MAX_P-1:0];
+ //Unused Input channels are connected to ground
+ smartflit_chanel_t is_grounded;
+ assign is_grounded= {SMARTFLIT_CHANEL_w{1'b0}};
+
+ regular_topo_router_addr_t current_r_addr [NR-1:0];
+ regular_topo_endp_addr_t endp_addr [NE-1:0];
+ router_config_t router_config_in [NR-1 : 0];
+
+ genvar x,y,z,l;
+ generate
+ if(IS_MESH_3D) begin
+ for (z=0; z 0 ) ?
+ router_chan_out[z][y-1][x][SOUTH] : is_grounded;
+ assign router_chan_in[z][y][x][WEST] = (x > 0 ) ?
+ router_chan_out[z][y][x-1][EAST] : is_grounded;
+ assign router_chan_in[z][y][x][SOUTH] = (y < NY-1) ?
+ router_chan_out[z][y+1][x][NORTH] : is_grounded;
+ assign router_chan_in[z][y][x][UP] = (z < NZ-1) ?
+ router_chan_out[z+1][y][x][DOWN] : is_grounded;
+ assign router_chan_in[z][y][x][DOWN] = (z > 0 ) ?
+ router_chan_out[z-1][y][x][UP] : is_grounded;
+ //endpoint connections
+ for (l=0;l current_router_addr_i.x)? MASS:(dest_router_addr_i.x == current_router_addr_i.x)?EQUAL : LESS;
+ assign Dy = (dest_router_addr_i.y > current_router_addr_i.y)? MASS:(dest_router_addr_i.y == current_router_addr_i.y)?EQUAL : LESS;
+ assign Dz = (dest_router_addr_i.z > current_router_addr_i.z)? MASS:(dest_router_addr_i.z == current_router_addr_i.z)?EQUAL : LESS;
+
+ always_comb begin
+ destport=0;
+ if(Dx==MASS) destport =DSTPw'(EAST);
+ else if(Dx==LESS) destport =DSTPw'(WEST);
+ else if(Dy==MASS) destport =DSTPw'(SOUTH);
+ else if(Dy==LESS) destport =DSTPw'(NORTH);
+ else if(Dz==MASS) destport =DSTPw'(UP);
+ else if(Dz==LESS) destport =DSTPw'(DOWN);
+ else destport = DSTPw'(LOCAL);
+ end
+endmodule
+
diff --git a/mpsoc/rtl/src_noc/mesh_torus.sv b/mpsoc/rtl/src_noc/mesh_torus.sv
index 73d6cae..5b40cd1 100755
--- a/mpsoc/rtl/src_noc/mesh_torus.sv
+++ b/mpsoc/rtl/src_noc/mesh_torus.sv
@@ -33,14 +33,7 @@
* ---------x
* 0 | 2
***************************/
-module regular_topo_vc_alloc_request_gen_adaptive #(
- parameter ROUTE_TYPE = "FULL_ADAPTIVE", // "FULL_ADAPTIVE", "PAR_ADAPTIVE"
- parameter V = 4,
- parameter DSTPw=4,
- parameter SSA_EN = 0,
- parameter PPSw=4,
- parameter [V-1 : 0] ESCAP_VC_MASK = 4'b1000 // mask scape vc, valid only for full adaptive
-)(
+module regular_topo_vc_alloc_request_gen_adaptive (
ovc_avalable_all,
dest_port_coded_all,
candidate_ovc_all,
@@ -56,6 +49,7 @@ module regular_topo_vc_alloc_request_gen_adaptive #(
reset,
clk
);
+ import pronoc_pkg::*;
localparam
P = 5,
P_1 = P-1,
@@ -64,13 +58,6 @@ module regular_topo_vc_alloc_request_gen_adaptive #(
VP_1 = V * P_1,
PVDSTPw = PV * DSTPw;
- localparam
- LOCAL = 3'd0,
- EAST = 3'd1,
- NORTH = 3'd2,
- WEST = 3'd3,
- SOUTH = 3'd4;
-
input [PV-1 : 0] ovc_avalable_all;
input [PVDSTPw-1 : 0] dest_port_coded_all;
input [PV-1 : 0] ivc_request_all;
@@ -85,7 +72,6 @@ module regular_topo_vc_alloc_request_gen_adaptive #(
input [PV-1 : 0] ssa_ivc_num_getting_ovc_grant_all;
input reset,clk;
-
wire [PV-1 : 0] non_assigned_ovc_request_all;
wire [PV-1 : 0] y_evc_forbiden,x_evc_forbiden;
wire [V-1 : 0] ovc_avb_x_plus,ovc_avb_x_minus,ovc_avb_y_plus,ovc_avb_y_minus,ovc_avb_local;
@@ -93,7 +79,6 @@ module regular_topo_vc_alloc_request_gen_adaptive #(
wire [PPSw-1 : 0] port_pre_sel_perport [P-1 : 0];
wire [PVV-1 : 0] candidate_ovc_x_all, candidate_ovc_y_all;
-
assign non_assigned_ovc_request_all = ivc_request_all & ~ovc_is_assigned_all;
assign {ovc_avb_y_minus,ovc_avb_x_minus,ovc_avb_y_plus,ovc_avb_x_plus,ovc_avb_local} = ovc_avalable_all;
assign ovc_avalable_perport[LOCAL] = {ovc_avb_x_plus,ovc_avb_x_minus,ovc_avb_y_plus,ovc_avb_y_minus};
@@ -124,8 +109,7 @@ module regular_topo_vc_alloc_request_gen_adaptive #(
);
regular_topo_port_selector #(
- .SW_LOC (i/V),
- .PPSw(PPSw)
+ .SW_LOC (i/V)
) the_portsel (
.port_pre_sel (port_pre_sel_perport[i/V]),
.swap_port_presel (swap_port_presel[i]),
@@ -136,8 +120,6 @@ module regular_topo_vc_alloc_request_gen_adaptive #(
);
regular_topo_dspt_clear_gen #(
- .SSA_EN(SSA_EN),
- .DSTPw(DSTPw),
.SW_LOC(i/V)
) dspt_clear_gen (
.destport_clear(destport_clear_all[((i+1)*DSTPw)-1 : i*DSTPw]),
@@ -154,8 +136,6 @@ module regular_topo_vc_alloc_request_gen_adaptive #(
assign avc_unavailable[i] = (masked_ovc_request_all [((i+1)*V)-1 : i*V] & ~ESCAP_VC_MASK) == {V{1'b0}};
regular_topo_swap_port_presel_gen #(
- .V(V),
- .ESCAP_VC_MASK(ESCAP_VC_MASK),
.VC_NUM(i)
) swap_presel (
.avc_unavailable(avc_unavailable[i]),
@@ -179,8 +159,6 @@ endmodule
module regular_topo_dspt_clear_gen #(
- parameter SSA_EN = 1,
- parameter DSTPw =4,
parameter SW_LOC=0
)(
destport_clear,
@@ -188,16 +166,12 @@ module regular_topo_dspt_clear_gen #(
sel,
ssa_ivc_num_getting_ovc_grant
);
-
+ import pronoc_pkg::*;
output [DSTPw-1 : 0] destport_clear;
input ivc_num_getting_ovc_grant;
input sel;
input ssa_ivc_num_getting_ovc_grant;
- localparam
- LOCAL = 3'd0,
- EAST = 3'd1,
- WEST = 3'd3;
generate
if ( SSA_EN==1 ) begin :predict_if
if (SW_LOC == LOCAL ) begin :local_if
@@ -220,18 +194,15 @@ module regular_topo_dspt_clear_gen #(
endmodule
-module regular_topo_mask_non_assignable_destport #(
- parameter TOPOLOGY="MESH",
- parameter ROUTE_NAME="XY",
+module regular_topo_mask_non_assignable_destport #(
parameter SW_LOC=0,
- parameter P=5,
- parameter SELF_LOOP_EN=0
+ parameter P=5
) (
odd_column,// use only for odd even routing
dest_port_in,
dest_port_out
);
-
+ import pronoc_pkg::*;
localparam P_1 = (SELF_LOOP_EN )? P : P-1;
input [P_1-1 : 0 ] dest_port_in;
output [P_1-1 : 0 ] dest_port_out;
@@ -266,8 +237,6 @@ module regular_topo_mask_non_assignable_destport #(
endgenerate
regular_topo_mask_non_assignable_destport_no_self_loop # (
- .TOPOLOGY(TOPOLOGY),
- .ROUTE_NAME(ROUTE_NAME),
.SW_LOC(SW_LOC),
.P(P)
) mask_no_self_loop (
@@ -278,8 +247,6 @@ module regular_topo_mask_non_assignable_destport #(
endmodule
module regular_topo_mask_non_assignable_destport_no_self_loop #(
- parameter TOPOLOGY="MESH",
- parameter ROUTE_NAME="XY",
parameter SW_LOC=0,
parameter P=5
)(
@@ -287,12 +254,7 @@ module regular_topo_mask_non_assignable_destport_no_self_loop #(
dest_port_in,
dest_port_out
);
-
- localparam
- EAST = 1,
- NORTH = 2,
- WEST = 3,
- SOUTH = 4;
+ import pronoc_pkg::*;
//port number in north port
localparam
N_LOCAL = 0,
@@ -333,7 +295,7 @@ module regular_topo_mask_non_assignable_destport_no_self_loop #(
assign dest_port_out[P_1-1:4] = dest_port_in[P_1-1:4]; //other local ports
end
/* verilator lint_off WIDTH */
- if ( ROUTE_NAME == "XY" || ROUTE_NAME == "TRANC_XY") begin :xy
+ if ( ROUTE_NAME == "DOR" || ROUTE_NAME == "TRANC_DOR") begin :xy
/* verilator lint_on WIDTH */
if (SW_LOC == NORTH ) begin : nort_p // The port located in y axsis does not send packets to x dimension
assign dest_port_out[N_LOCAL]= dest_port_in[N_LOCAL];
@@ -427,8 +389,6 @@ endmodule
module regular_topo_swap_port_presel_gen #(
- parameter V = 4,
- parameter [V-1 : 0] ESCAP_VC_MASK = 4'b1000, // mask scape vc, valid only for full adaptive
parameter VC_NUM=0
)(
avc_unavailable,
@@ -440,7 +400,7 @@ module regular_topo_swap_port_presel_gen #(
clk,
reset
);
-
+ import pronoc_pkg::*;
localparam LOCAL_VC_NUM= VC_NUM % V;
input avc_unavailable;
input y_evc_forbiden,x_evc_forbiden;
@@ -528,8 +488,7 @@ endmodule
module regular_topo_port_selector #(
- parameter SW_LOC = 0,
- parameter PPSw=4
+ parameter SW_LOC = 0
)(
port_pre_sel,
dest_port_in,
@@ -538,7 +497,7 @@ module regular_topo_port_selector #(
y_evc_forbiden,
x_evc_forbiden
);
-
+ import pronoc_pkg::*;
/************************
*
* destination-port_in
@@ -666,15 +625,15 @@ module mesh_line_distance_gen (
input [EAw-1 : 0] src_e_addr;
input [EAw-1 : 0] dest_e_addr;
output[DISTw-1: 0]distance;
- wire [NXw-1 : 0]src_x,dest_x;
- wire [NYw-1 : 0]src_y,dest_y;
- regular_topo_endp_addr_decode src_addr_decode (.e_addr(src_e_addr), .ex(src_x), .ey(src_y), .el(), .valid());
- regular_topo_endp_addr_decode dst_addr_decode (.e_addr(dest_e_addr), .ex(dest_x), .ey(dest_y), .el(), .valid());
+ regular_topo_router_addr_t src_router_addr, dest_router_addr;
+ assign src_router_addr = regular_topo_router_addr_t'(src_e_addr);
+ assign dest_router_addr = regular_topo_router_addr_t'(dest_e_addr);
+
logic [NXw-1 : 0] x_offset;
logic [NYw-1 : 0] y_offset;
always_comb begin
- x_offset = (src_x > dest_x) ? src_x - dest_x : dest_x - src_x;
- y_offset = (src_y > dest_y) ? src_y - dest_y : dest_y - src_y;
+ x_offset = (src_router_addr.x > dest_router_addr.x) ? src_router_addr.x - dest_router_addr.x : dest_router_addr.x - src_router_addr.x;
+ y_offset = (src_router_addr.y > dest_router_addr.y) ? src_router_addr.y - dest_router_addr.y : dest_router_addr.y - src_router_addr.y;
end
/* verilator lint_off WIDTH */
assign distance = x_offset+y_offset+1'b1;
@@ -692,8 +651,13 @@ module ring_torus_distance_gen (
output[DISTw-1: 0]distance;
wire [NXw-1 : 0]src_x,dest_x;
wire [NYw-1 : 0]src_y,dest_y;
- regular_topo_endp_addr_decode src_addr_decode (.e_addr(src_e_addr), .ex(src_x), .ey(src_y), .el(), .valid());
- regular_topo_endp_addr_decode dest_addr_decode (.e_addr(dest_e_addr), .ex(dest_x), .ey(dest_y), .el(), .valid());
+ regular_topo_router_addr_t src_router_addr, dest_router_addr;
+ assign src_router_addr = regular_topo_router_addr_t'(src_e_addr);
+ assign dest_router_addr = regular_topo_router_addr_t'(dest_e_addr);
+ assign src_x = src_router_addr.x;
+ assign src_y = src_router_addr.y;
+ assign dest_x = dest_router_addr.x;
+ assign dest_y = dest_router_addr.y;
logic [NXw-1 : 0] x_offset;
logic [NYw-1 : 0] y_offset;
wire tranc_x_plus,tranc_x_min,tranc_y_plus,tranc_y_min,same_x,same_y;
@@ -744,36 +708,26 @@ module ring_torus_distance_gen (
endmodule
-module regular_topo_ssa_check_destport #(
- parameter ROUTE_TYPE="DETERMINISTIC",
+module two_dim_ssa_check_destport #(
parameter SW_LOC = 0,
- parameter P=5,
- parameter DEBUG_EN = 0,
- parameter DSTPw = P-1,
parameter SS_PORT=0
)(
destport_encoded, //exsited packet dest port
destport_in_encoded, // incomming packet dest port
ss_port_hdr_flit,
- ss_port_nonhdr_flit
+ ss_port_nonhdr_flit
`ifdef SIMULATION
,clk,
ivc_num_getting_sw_grant,
hdr_flg
`endif
);
-
+ import pronoc_pkg::*;
input [DSTPw-1 : 0] destport_encoded, destport_in_encoded;
output ss_port_hdr_flit, ss_port_nonhdr_flit;
`ifdef SIMULATION
input clk, ivc_num_getting_sw_grant,hdr_flg;
`endif
- //MESH, TORUS Topology p=5
- localparam
- LOCAL = 0,
- EAST = 1,
- WEST = 3;
-
/*************************
* destination port is coded
* destination-port_in
@@ -818,12 +772,8 @@ endgenerate
endmodule
-module line_ring_ssa_check_destport #(
- parameter ROUTE_TYPE="DETERMINISTIC",
+module one_dim_ssa_check_destport #(
parameter SW_LOC = 0,
- parameter P=3,
- parameter DEBUG_EN = 0,
- parameter DSTPw = P-1,
parameter SS_PORT=0
)(
destport_encoded, //exsited packet dest port
@@ -831,9 +781,10 @@ module line_ring_ssa_check_destport #(
ss_port_hdr_flit,
ss_port_nonhdr_flit
);
+ import pronoc_pkg::*;
input [DSTPw-1 : 0] destport_encoded, destport_in_encoded;
output ss_port_hdr_flit, ss_port_nonhdr_flit;
- wire [P-1 : 0] dest_port_num,assigned_dest_port_num;
+ wire [MAX_P-1 : 0] dest_port_num,assigned_dest_port_num;
line_ring_decode_dstport cnv1(
.dstport_one_hot(dest_port_num),
@@ -859,7 +810,7 @@ module regular_topo_router_addr_decode (
localparam
RXw = log2(NX), // number of node in x axis
- RYw = (IS_RING | IS_LINE) ? 1 : log2(NY); // number of node in y axis
+ RYw = (IS_1D_TOPO) ? 1 : log2(NY); // number of node in y axis
/* verilator lint_off WIDTH */
localparam [RXw-1 : 0] MAXX = (NX-1);
localparam [RYw-1 : 0] MAXY = (NY-1);
@@ -871,7 +822,7 @@ module regular_topo_router_addr_decode (
output valid;
generate
- if (IS_RING | IS_LINE) begin :oneD
+ if (IS_1D_TOPO) begin :D1_
assign rx = r_addr;
assign ry = 1'b0;
end else begin : twoD
@@ -883,63 +834,32 @@ module regular_topo_router_addr_decode (
/* verilator lint_on CMPCONST */
endmodule
-
-module regular_topo_endp_addr_decode
-(
- e_addr,
- ex,
- ey,
- el,
+module regular_topo_address_validator (
+ addr,
valid
);
import pronoc_pkg::*;
- localparam
- EXw = log2(NX), // number of node in x axis
- EYw = (IS_RING | IS_LINE) ? 1 : log2(NY),
- ELw = log2(NL); // number of node in y axis
- /* verilator lint_off WIDTH */
- localparam [EXw-1 : 0] MAXX = (NX-1);
- localparam [EYw-1 : 0] MAXY = (NY-1);
- localparam [ELw-1 : 0] MAXL = (NL-1);
- /* verilator lint_on WIDTH */
-
- input [EAw-1 : 0] e_addr;
- output [EXw-1 : 0] ex;
- output [EYw-1 : 0] ey;
- output [ELw-1 : 0] el;
- output valid;
-
- generate
- if (IS_RING | IS_LINE) begin :oneD
- if(NL==1) begin:one_local
- assign ex = e_addr;
- assign ey = 1'b0;
- assign el = 1'b0;
- /* verilator lint_off CMPCONST */
- assign valid = ex<= MAXX;
- /* verilator lint_on CMPCONST */
- end else begin: multi_local
- assign {el,ex} = e_addr;
- assign ey = 1'b0;
- /* verilator lint_off CMPCONST */
- assign valid = ((ex<= MAXX) & (el<=MAXL));
- /* verilator lint_on CMPCONST */
+ input [EAw-1 : 0] addr;
+ output logic valid;
+ regular_topo_endp_addr_t endp_addr;
+ always_comb begin
+ endp_addr = regular_topo_endp_addr_t'(addr);
+ //for 2/1d we need to re-extact the l
+ endp_addr.l=addr[EAw-1: EAw-NLw];
+ end
+ always_comb begin
+ valid = 1'b1;
+ if(32'(endp_addr.x) >= NX) valid = 1'b0;
+ if((IS_2D_TOPO | IS_3D_TOPO) && ((NY & (NY - 1)) != 0) ) begin
+ if(32'(endp_addr.y) >= NY) valid = 1'b0;
end
- end else begin : twoD
- if(NL==1)begin:one_local
- assign {ey,ex} = e_addr;
- assign el = 1'b0;
- /* verilator lint_off CMPCONST */
- assign valid = (ex<= MAXX) & (ey <= MAXY);
- /* verilator lint_on CMPCONST */
- end else begin :multi_l
- assign {el,ey,ex} = e_addr;
- /* verilator lint_off CMPCONST */
- assign valid = ( (ex<= MAXX) & (ey <= MAXY) & (el<=MAXL) );
- /* verilator lint_on CMPCONST */
+ if(IS_3D_TOPO) begin
+ if(32'(endp_addr.z) >= NZ) valid = 1'b0;
+ end
+ if(NL>1) begin
+ if(32'(endp_addr.l) >= NL) valid = 1'b0;
end
end
- endgenerate
endmodule
@@ -947,7 +867,6 @@ endmodule
* Regular_topo_endp_addr_encoder
* most probably it is only needed for simulation purposes
***************/
-
module regular_topo_endp_addr_encoder
(
id,
@@ -989,16 +908,9 @@ module regular_topo_addr_coder (
endmodule
module regular_topo_destp_generator #(
- parameter TOPOLOGY = "MESH",
- parameter ROUTE_NAME = "XY",
- parameter ROUTE_TYPE = "DETERMINISTIC",
parameter P=5,
- parameter DSTPw=4,
- parameter NL=1,
parameter PLw=1,
- parameter PPSw=4,
- parameter SW_LOC=0,
- parameter SELF_LOOP_EN=0
+ parameter SW_LOC=0
)(
dest_port_out,
dest_port_coded,
@@ -1007,46 +919,53 @@ module regular_topo_destp_generator #(
port_pre_sel,
odd_column
);
- localparam P_1 = (SELF_LOOP_EN )? P : P-1;
+ import pronoc_pkg::*;
+ localparam
+ P_1 = (SELF_LOOP_EN )? P : P-1,
+ Pw = log2(P);
input [DSTPw-1 : 0] dest_port_coded;
input [PLw-1 : 0] endp_localp_num;
output [P_1-1 : 0] dest_port_out;
- input swap_port_presel;
+ input swap_port_presel;
input [PPSw-1 : 0] port_pre_sel;
input odd_column;
wire [P_1-1 : 0] dest_port_in;
generate
- /* verilator lint_off WIDTH */
- if (TOPOLOGY == "RING" || TOPOLOGY == "LINE" ) begin : one_D
- /* verilator lint_on WIDTH */
+ if (IS_1D_TOPO) begin : D1_
line_ring_destp_decoder #(
- .ROUTE_TYPE(ROUTE_TYPE),
.P(P),
- .DSTPw(DSTPw),
- .NL(NL),
.ELw(PLw),
- .PPSw(PPSw),
- .SW_LOC(SW_LOC),
- .SELF_LOOP_EN(SELF_LOOP_EN)
+ .SW_LOC(SW_LOC)
) decoder (
- .dest_port_coded(dest_port_coded),
+ .dest_port_coded(dest_port_coded),
.dest_port_out(dest_port_in),
- .endp_localp_num(endp_localp_num)
+ .endp_localp_num(endp_localp_num)
+ );
+ end else if (IS_MESH_3D) begin : three_D
+ logic [P-1 : 0] mesh_3d_one_hot_dest_port;
+ logic [Pw-1 : 0] local_dest_port;
+ always @(*) begin
+ local_dest_port =Pw'(endp_localp_num) + Pw'(DOWN);
+ mesh_3d_one_hot_dest_port = {P{1'b0}};
+ if(dest_port_coded == 0 && endp_localp_num!=0 && NL >1) mesh_3d_one_hot_dest_port[local_dest_port] = 1'b1;
+ else mesh_3d_one_hot_dest_port[dest_port_coded] = 1'b1;
+ end
+ destport_non_selfloop_fix #(
+ .SELF_LOOP_EN(SELF_LOOP_EN),
+ .P(P),
+ .SW_LOC(SW_LOC)
+ ) remove_sw_loc (
+ .destport_in(mesh_3d_one_hot_dest_port[P-1 : 0]),
+ .destport_out(dest_port_out)
);
-
end else begin :two_D
regular_topo_destp_decoder #(
- .ROUTE_TYPE(ROUTE_TYPE),
.P(P),
- .DSTPw(DSTPw),
- .NL(NL),
.ELw(PLw),
- .PPSw(PPSw),
- .SW_LOC(SW_LOC),
- .SELF_LOOP_EN(SELF_LOOP_EN)
+ .SW_LOC(SW_LOC)
) decoder (
.dest_port_coded(dest_port_coded),
.dest_port_out(dest_port_in),
@@ -1058,11 +977,8 @@ module regular_topo_destp_generator #(
endgenerate
regular_topo_mask_non_assignable_destport #(
- .TOPOLOGY(TOPOLOGY),
- .ROUTE_NAME(ROUTE_NAME),
.SW_LOC(SW_LOC),
- .P(P),
- .SELF_LOOP_EN(SELF_LOOP_EN)
+ .P(P)
) mask_destport (
.dest_port_in(dest_port_in),
.dest_port_out(dest_port_out),
@@ -1071,14 +987,9 @@ module regular_topo_destp_generator #(
endmodule
module regular_topo_destp_decoder #(
- parameter ROUTE_TYPE="DETERMINISTIC",
parameter P=6,
- parameter DSTPw=4,
- parameter NL=2,
parameter ELw=1,
- parameter PPSw=4,
- parameter SW_LOC=0,
- parameter SELF_LOOP_EN=0
+ parameter SW_LOC=0
)(
dest_port_coded,
endp_localp_num,
@@ -1086,11 +997,12 @@ module regular_topo_destp_decoder #(
swap_port_presel,
port_pre_sel
);
+ import pronoc_pkg::*;
localparam P_1 = (SELF_LOOP_EN )? P : P-1;
input [DSTPw-1 : 0] dest_port_coded;
input [ELw-1 : 0] endp_localp_num;
output [P_1-1 : 0] dest_port_out;
- input swap_port_presel;
+ input swap_port_presel;
input [PPSw-1 : 0] port_pre_sel;
logic [NL-1 : 0] endp_localp_onehot;
@@ -1117,34 +1029,27 @@ module regular_topo_destp_decoder #(
end
generate
if(NL==1) begin :slp
- if(SELF_LOOP_EN == 0) begin :nslp
- remove_sw_loc_one_hot #(
- .P(5),
- .SW_LOC(SW_LOC)
- ) conv (
- .destport_in(portout),
- .destport_out(dest_port_out)
- );
- end else begin : slp
- assign dest_port_out = portout;
- end
+ destport_non_selfloop_fix #(
+ .SELF_LOOP_EN(SELF_LOOP_EN),
+ .P(5),
+ .SW_LOC(SW_LOC)
+ ) conv (
+ .destport_in(portout),
+ .destport_out(dest_port_out)
+ );
end else begin :mlp
wire [P-1 : 0] destport_onehot;
-
assign destport_onehot =(portout[0])?
{ endp_localp_onehot[NL-1 : 1] ,{(P-NL){1'b0}},endp_localp_onehot[0]}: /*select local destination*/
{ {(NL-1){1'b0}} ,portout};
- if(SELF_LOOP_EN == 0) begin :nslp
- remove_sw_loc_one_hot #(
- .P(P),
- .SW_LOC(SW_LOC)
- ) remove_sw_loc (
- .destport_in(destport_onehot),
- .destport_out(dest_port_out)
- );
- end else begin: slp
- assign dest_port_out = destport_onehot;
- end
+ destport_non_selfloop_fix #(
+ .SELF_LOOP_EN(SELF_LOOP_EN),
+ .P(P),
+ .SW_LOC(SW_LOC)
+ ) remove_sw_loc (
+ .destport_in(destport_onehot),
+ .destport_out(dest_port_out)
+ );
end
endgenerate
endmodule
@@ -1154,19 +1059,15 @@ endmodule
* line_ring_destp_decoder
**************************/
module line_ring_destp_decoder #(
- parameter ROUTE_TYPE="DETERMINISTIC",
parameter P=4,
- parameter DSTPw=2,
- parameter NL=2,
parameter ELw=1,
- parameter PPSw=4,
- parameter SW_LOC=0,
- parameter SELF_LOOP_EN= 0
+ parameter SW_LOC=0
)(
dest_port_coded,
endp_localp_num,
dest_port_out
);
+ import pronoc_pkg::*;
localparam P_1 = (SELF_LOOP_EN )? P : P-1;
input [DSTPw-1 : 0] dest_port_coded;
input [ELw-1 : 0] endp_localp_num;
@@ -1186,34 +1087,27 @@ module line_ring_destp_decoder #(
end
generate
if(NL==1) begin :_se
- if(SELF_LOOP_EN == 0) begin :nslp
- remove_sw_loc_one_hot #(
- .P(3),
- .SW_LOC(SW_LOC)
- ) conv (
- .destport_in(portout),
- .destport_out(dest_port_out)
- );
- end else begin : slp
- assign dest_port_out = portout;
- end
+ destport_non_selfloop_fix #(
+ .SELF_LOOP_EN(SELF_LOOP_EN),
+ .P(3),
+ .SW_LOC(SW_LOC)
+ ) conv (
+ .destport_in(portout),
+ .destport_out(dest_port_out)
+ );
end else begin :_me
wire [P-1 : 0] destport_onehot;
-
assign destport_onehot =(portout[0])?
{ endp_localp_onehot[NL-1 : 1] ,{(P-NL){1'b0}},endp_localp_onehot[0]}: /*select local destination*/
{ {(NL-1){1'b0}} ,portout};
- if(SELF_LOOP_EN == 0) begin :nslp
- remove_sw_loc_one_hot #(
- .P(P),
- .SW_LOC(SW_LOC)
- ) remove_sw_loc (
- .destport_in(destport_onehot),
- .destport_out(dest_port_out)
- );
- end else begin :slp
- assign dest_port_out = destport_onehot;
- end
+ destport_non_selfloop_fix #(
+ .SELF_LOOP_EN(SELF_LOOP_EN),
+ .P(P),
+ .SW_LOC(SW_LOC)
+ ) remove_sw_loc (
+ .destport_in(destport_onehot),
+ .destport_out(dest_port_out)
+ );
end
endgenerate
endmodule
@@ -1222,13 +1116,7 @@ endmodule
* regular_topo_dynamic_portsel_control
*****************/
module regular_topo_dynamic_portsel_control #(
- parameter P = 5,
- parameter ROUTE_TYPE = "FULL_ADAPTIVE", // "FULL_ADAPTIVE", "PAR_ADAPTIVE"
- parameter V = 4,
- parameter DSTPw=4,
- parameter SSA_EN = 0, // 1: SSA enabled, 0: SSA disabled
- parameter PPSw=4,
- parameter [V-1 : 0] ESCAP_VC_MASK = 4'b1000 // mask scape vc, valid only for full adaptive
+ parameter P = 5
)(
dest_port_coded_all,
ivc_request_all,
@@ -1243,15 +1131,12 @@ module regular_topo_dynamic_portsel_control #(
reset,
clk
);
+ import pronoc_pkg::*;
localparam
PV = V * P,
PVV= PV * V,
PVDSTPw = PV * DSTPw;
- localparam LOCAL = 0,
- EAST = 1,
- NORTH = 2,
- WEST = 3,
- SOUTH = 4;
+
input [PVDSTPw-1 : 0] dest_port_coded_all;
input [PV-1 : 0] ivc_request_all;
input [PV-1 : 0] ovc_is_assigned_all;
@@ -1262,11 +1147,11 @@ module regular_topo_dynamic_portsel_control #(
output [PVDSTPw-1 : 0] destport_clear_all;
input [PV-1 : 0] ivc_num_getting_ovc_grant;
input [PV-1 : 0] ssa_ivc_num_getting_ovc_grant_all;
- input reset,clk;
+ input reset,clk;
- wire [PV-1 : 0] non_assigned_ovc_request_all;
- wire [PV-1 : 0] y_evc_forbiden,x_evc_forbiden;
- wire [PPSw-1 : 0] port_pre_sel_perport [P-1 : 0];
+ wire [PV-1 : 0] non_assigned_ovc_request_all;
+ wire [PV-1 : 0] y_evc_forbiden,x_evc_forbiden;
+ wire [PPSw-1 : 0] port_pre_sel_perport [P-1 : 0];
assign non_assigned_ovc_request_all = ivc_request_all & ~ovc_is_assigned_all;
assign port_pre_sel_perport[LOCAL] = port_pre_sel;
assign port_pre_sel_perport[EAST] = {2'b00,port_pre_sel[1:0]};
@@ -1279,8 +1164,7 @@ module regular_topo_dynamic_portsel_control #(
for(i=0;i< PV;i=i+1) begin : PV_
localparam SW_LOC = ((i/V)<5)? i/V : LOCAL;
regular_topo_port_selector #(
- .SW_LOC (SW_LOC),
- .PPSw(PPSw)
+ .SW_LOC (SW_LOC)
) the_portsel (
.port_pre_sel (port_pre_sel_perport[SW_LOC]),
.swap_port_presel (swap_port_presel[i]),
@@ -1290,8 +1174,6 @@ module regular_topo_dynamic_portsel_control #(
.x_evc_forbiden (x_evc_forbiden[i])
);
regular_topo_dspt_clear_gen #(
- .SSA_EN(SSA_EN),
- .DSTPw(DSTPw),
.SW_LOC(SW_LOC)
) dspt_clear_gen(
.destport_clear(destport_clear_all[((i+1)*DSTPw)-1 : i*DSTPw]),
@@ -1304,8 +1186,6 @@ module regular_topo_dynamic_portsel_control #(
/* verilator lint_on WIDTH */
assign avc_unavailable[i] = (masked_ovc_request_all [((i+1)*V)-1 : i*V] & ~ESCAP_VC_MASK) == {V{1'b0}};
regular_topo_swap_port_presel_gen #(
- .V(V),
- .ESCAP_VC_MASK(ESCAP_VC_MASK),
.VC_NUM(i)
) the_swap_port_presel (
.avc_unavailable(avc_unavailable[i]),
diff --git a/mpsoc/rtl/src_noc/mesh_torus_noc_top.sv b/mpsoc/rtl/src_noc/mesh_torus_noc_top.sv
index 067b0db..60473e0 100644
--- a/mpsoc/rtl/src_noc/mesh_torus_noc_top.sv
+++ b/mpsoc/rtl/src_noc/mesh_torus_noc_top.sv
@@ -56,7 +56,7 @@ module regular_topo_noc_top (
genvar x,y,l;
generate
- if( IS_RING | IS_LINE) begin : D1_
+ if( IS_1D_TOPO ) begin : D1_
for (x=0; x YY);
/* verilator lint_on CMPCONST */
@@ -218,13 +212,10 @@ module multicast_routing_fmesh #(
wire [NE-1 : 0] y_plus,y_min;
//Only one-bit is asserted for each local_p[i]
wire [NE-1 : 0] local_p [MAX_P_FMESH-1 : 0];
- regular_topo_router_addr_decode router_addr_decode
- (
- .r_addr(current_r_addr),
- .rx(current_rx),
- .ry(current_ry),
- .valid( )
- );
+ regular_topo_router_addr_t current_router_addr_struct;
+ assign current_router_addr_struct = regular_topo_router_addr_t'(current_r_addr);
+ assign current_rx = current_router_addr_struct.x;
+ assign current_ry = current_router_addr_struct.y;
wire [NX-1 : 0] row_has_any_dest;
wire [NE-1 : 0] dest_mcast_all_endp;
@@ -540,29 +531,45 @@ module multicast_dst_sel (
input [DSTPw-1 : 0] destport_in;
output [DSTPw-1 : 0] destport_out;
wire [DSTPw-1 : 0] arb_in, arb_out;
+
+ function integer three_dim_topo_priority_order;
+ input integer x;
+ begin
+ case(x)
+ 0 : three_dim_topo_priority_order = DOWN;
+ 1 : three_dim_topo_priority_order = UP;
+ 2 : three_dim_topo_priority_order = EAST;
+ 3 : three_dim_topo_priority_order = WEST;
+ 4 : three_dim_topo_priority_order = NORTH;
+ 5 : three_dim_topo_priority_order = SOUTH;
+ 6 : three_dim_topo_priority_order = LOCAL;
+ default : three_dim_topo_priority_order =x;
+ endcase
+ end
+ endfunction // pririty_order
- function integer regular_topo_pririty_order;
+ function integer two_dim_topo_priority_order;
input integer x;
begin
case(x)
- 0 : regular_topo_pririty_order = EAST;
- 1 : regular_topo_pririty_order = WEST;
- 2 : regular_topo_pririty_order = NORTH;
- 3 : regular_topo_pririty_order = SOUTH;
- 4 : regular_topo_pririty_order = LOCAL;
- default : regular_topo_pririty_order =x;
+ 0 : two_dim_topo_priority_order = EAST;
+ 1 : two_dim_topo_priority_order = WEST;
+ 2 : two_dim_topo_priority_order = NORTH;
+ 3 : two_dim_topo_priority_order = SOUTH;
+ 4 : two_dim_topo_priority_order = LOCAL;
+ default : two_dim_topo_priority_order =x;
endcase
end
endfunction // pririty_order
- function integer ring_lin_pririty_order;
+ function integer one_dim_topo_priority_order;
input integer x;
begin
case(x)
- 0 : ring_lin_pririty_order = FORWARD;
- 1 : ring_lin_pririty_order = BACKWARD;
- 2 : ring_lin_pririty_order = LOCAL;
- default : ring_lin_pririty_order =x;
+ 0 : one_dim_topo_priority_order = FORWARD;
+ 1 : one_dim_topo_priority_order = BACKWARD;
+ 2 : one_dim_topo_priority_order = LOCAL;
+ default : one_dim_topo_priority_order =x;
endcase
end
endfunction // pririty_order
@@ -571,8 +578,9 @@ module multicast_dst_sel (
generate
for (i=0; i1)? flit.payload [CLASS_MSB : CLASS_LSB] : {Cw{1'b0}};
- hdr_flit.weight = (IS_WRRA)? flit.payload [WEIGHT_MSB : WEIGHT_LSB] : {WEIGHTw{1'b0}};
- hdr_flit.be = (BYTE_EN)? flit.payload [BE_MSB : BE_LSB]: {BEw{1'b0}};
- end
-
- wire [OFFSETw-1 : 0 ] offset = flit.payload [DATA_MSB : DATA_LSB];
- generate
- if(Dw > OFFSETw) begin : if1
- assign data_o={{(Dw-OFFSETw){1'b0}},offset};
- end else begin : if2
- assign data_o=offset[Dw-1 : 0];
- end
- endgenerate
-endmodule
-
`ifdef SIMULATION
module smart_chanel_check (
flit_chanel,
@@ -367,10 +325,25 @@ module check_straight_oport #(
import pronoc_pkg::*;
input [DSTPw-1 : 0] destport_coded_i;
output goes_straight_o;
-
+
generate
- if(IS_MESH | IS_TORUS | IS_FMESH) begin :twoD
- if (SS_PORT_LOC == 0 || SS_PORT_LOC > 4) begin : local_ports
+ if(IS_3D_TOPO) begin : D3_
+ if (SS_PORT_LOC == 0 || SS_PORT_LOC > DOWN) begin : local_ports
+ assign goes_straight_o = 1'b0; // There is not a next router in this case at all
+ end else begin :non_local
+ logic [MAX_P-1 : 0 ] destport_one_hot;
+ always @(*) begin
+ destport_one_hot = '0;
+ //for deterministic routing destination port is decimal encoded
+ if(IS_DETERMINISTIC) destport_one_hot[destport_coded_i] = 1'b1;
+ //for non-deterministic routing destination port is one-hot encoded
+ else destport_one_hot [DSTPw-1 : 0] = destport_coded_i;
+ end
+ assign goes_straight_o = destport_one_hot [SS_PORT_LOC];
+ end//else
+ end//regular_topo
+ if(IS_2D_TOPO) begin : D2_
+ if (SS_PORT_LOC == 0 || SS_PORT_LOC > SOUTH) begin : local_ports
assign goes_straight_o = 1'b0; // There is not a next router in this case at all
end else begin :non_local
wire [4 : 0 ] destport_one_hot;
@@ -378,12 +351,11 @@ module check_straight_oport #(
.dstport_encoded(destport_coded_i),
.dstport_one_hot(destport_one_hot)
);
-
assign goes_straight_o = destport_one_hot [SS_PORT_LOC];
end//else
end//regular_topo
- else if(IS_RING | IS_LINE) begin :oneD
- if (SS_PORT_LOC == 0 || SS_PORT_LOC > 2) begin : local_ports
+ else if(IS_1D_TOPO) begin : D1_
+ if (SS_PORT_LOC == 0 || SS_PORT_LOC > BACKWARD) begin : local_ports
assign goes_straight_o = 1'b0; // There is not a next router in this case at all
end else begin :non_local
wire [2: 0 ] destport_one_hot;
@@ -394,7 +366,6 @@ module check_straight_oport #(
assign goes_straight_o = destport_one_hot [SS_PORT_LOC];
end //non_local
end// oneD
-
//TODO Add fattree & custom
endgenerate
endmodule
@@ -595,8 +566,8 @@ module smart_allocator_per_iport # (
wire goes_straight;
localparam LOCATED_IN_NI =
- (IS_RING | IS_LINE) ? (SW_LOC == 0 || SW_LOC > 2) :
- (IS_MESH | IS_TORUS | IS_FMESH) ? (SW_LOC == 0 || SW_LOC > 4 ) : 0;
+ (IS_1D_TOPO) ? (SW_LOC == 0 || SW_LOC > 2) :
+ (IS_2D_TOPO) ? (SW_LOC == 0 || SW_LOC > 4 ) : 0;
// does the route computation for the current router
conventional_routing #(
diff --git a/mpsoc/rtl/src_noc/router_top.sv b/mpsoc/rtl/src_noc/router_top.sv
index 548e891..673c286 100644
--- a/mpsoc/rtl/src_noc/router_top.sv
+++ b/mpsoc/rtl/src_noc/router_top.sv
@@ -424,4 +424,11 @@ module router_top_v
.reset(reset)
);
+ `ifdef SIMULATION
+ initial begin
+ if (current_r_addr==0) begin
+ display_noc_parameters();
+ end
+ end
+ `endif
endmodule
diff --git a/mpsoc/rtl/src_noc/router_two_stage.sv b/mpsoc/rtl/src_noc/router_two_stage.sv
index a56c270..6d71110 100644
--- a/mpsoc/rtl/src_noc/router_two_stage.sv
+++ b/mpsoc/rtl/src_noc/router_two_stage.sv
@@ -161,8 +161,12 @@ module router_two_stage #(
wire [EAw-1 : 0] endp_addrs [NE_PER_R-1 : 0];
function automatic int get_enp_num(input int i);
- if(IS_LINE | IS_RING | IS_MESH | IS_FMESH | IS_TORUS) begin
- return (i > SOUTH) ? i - SOUTH : LOCAL;
+ if(IS_1D_TOPO) begin
+ return (i > BACKWARD) ? i - BACKWARD : LOCAL;
+ end else if(IS_2D_TOPO) begin
+ return (i > SOUTH) ? i - SOUTH : LOCAL;
+ end else if(IS_3D_TOPO) begin
+ return (i > DOWN) ? i - DOWN : LOCAL;
end else if (IS_MULTI_MESH) begin
return LOCAL;
end else return 0; //TODO complete it for fattree and bin tree
@@ -458,9 +462,6 @@ module router_two_stage #(
generate
if(DEBUG_EN & IS_MESH)begin :dbg
debug_mesh_edges #(
- .T1(T1),
- .T2(T2),
- .RAw(RAw),
.P(P)
) debug_edges (
.clk(clk),
diff --git a/mpsoc/rtl/src_noc/routing.sv b/mpsoc/rtl/src_noc/routing.sv
index 0ea5f5d..e8332d1 100755
--- a/mpsoc/rtl/src_noc/routing.sv
+++ b/mpsoc/rtl/src_noc/routing.sv
@@ -47,47 +47,17 @@ module conventional_routing #(
output [DSTPw-1 :0] destport;
generate
- if( IS_MESH | IS_FMESH | IS_TORUS | IS_RING | IS_LINE ) begin : regular_topo
- localparam
- RXw = log2(NX),
- RYw = (IS_RING | IS_LINE) ? 1 :log2(NY),
- EXw = RXw,
- EYw =(IS_RING | IS_LINE) ? 1 : RYw;
- wire [RXw-1 : 0] current_rx;
- wire [RYw-1 : 0] current_ry;
- wire [EXw-1 : 0] dest_ex;
- wire [EYw-1 : 0] dest_ey;
-
- regular_topo_router_addr_decode router_addr_decode (
- .r_addr(current_r_addr),
- .rx(current_rx),
- .ry(current_ry),
- .valid( )
- );
- if( IS_FMESH) begin :fmesh
- fmesh_endp_addr_decode end_addr_decode (
- .e_addr(dest_e_addr),
- .ex(dest_ex),
- .ey(dest_ey),
- .ep( ),
- .valid()
- );
- end else begin : mesh
- regular_topo_endp_addr_decode end_addr_decode (
- .e_addr(dest_e_addr),
- .ex(dest_ex),
- .ey(dest_ey),
- .el( ),
- .valid()
- );
- end//mesh
+ if( IS_REGULAR_TOPO | IS_FMESH ) begin : regular_topo
+ regular_topo_router_addr_t dest_router_addr, current_router_addr;
+ always @(*) begin
+ dest_router_addr = regular_topo_router_addr_t'(dest_e_addr);
+ current_router_addr = regular_topo_router_addr_t'(current_r_addr);
+ end
regular_topo_conventional_routing #(
.LOCATED_IN_NI(LOCATED_IN_NI)
) the_conventional_routing (
- .current_x(current_rx),
- .current_y(current_ry),
- .dest_x(dest_ex),
- .dest_y(dest_ey),
+ .current_router_addr_i(current_router_addr),
+ .dest_router_addr_i(dest_router_addr),
.destport(destport)
);
end else if(IS_FATTREE | IS_TREE ) begin : ftree
@@ -184,48 +154,23 @@ module look_ahead_routing #(
input [DSTPw-1 : 0] destport_encoded;
output [DSTPw-1 : 0] lkdestport_encoded;
input reset,clk;
+ localparam PP = ( IS_MESH | IS_FMESH | IS_TORUS ) ? 5 : (IS_MESH_3D) ? 7 : 3;
+ logic [RAw-1 : 0] neighbors_r_addr_array [PP-1 : 0];
genvar i;
generate
+ for (i=0;i SOUTH) ) :
- (IS_RING | IS_LINE) ? ((SW_LOC==LOCAL) || (SW_LOC > BACKWARD) ) : 0;
+ (IS_3D_TOPO)? ((SW_LOC==LOCAL) || (SW_LOC > DOWN) ) :
+ (IS_2D_TOPO)? ((SW_LOC==LOCAL) || (SW_LOC > SOUTH) ) :
+ (IS_1D_TOPO) ? ((SW_LOC==LOCAL) || (SW_LOC > BACKWARD) ) : 0;
hdr_flit_t hdr_flit_i;
wire [DSTPw-1 :0] destport;
header_flit_info #(
diff --git a/mpsoc/rtl/src_noc/ss_allocator.sv b/mpsoc/rtl/src_noc/ss_allocator.sv
index 8b090e5..924d2fd 100755
--- a/mpsoc/rtl/src_noc/ss_allocator.sv
+++ b/mpsoc/rtl/src_noc/ss_allocator.sv
@@ -282,7 +282,6 @@ module ssa_per_vc #(
ssa_check_destport #(
.SW_LOC(SW_LOC),
- .P(P),
.SS_PORT(SS_PORT)
) check_destport (
.destport_encoded(destport_encoded),
@@ -335,7 +334,6 @@ endmodule
module ssa_check_destport #(
parameter SW_LOC = 0,
- parameter P=5,
parameter SS_PORT=0
) (
destport_encoded, //non header flit dest port
@@ -370,13 +368,9 @@ module ssa_check_destport #(
.ss_port_hdr_flit(ss_port_hdr_flit),
.ss_port_nonhdr_flit(ss_port_nonhdr_flit)
);
- end else if (IS_MESH | IS_TORUS ) begin : mesh
- regular_topo_ssa_check_destport #(
- .ROUTE_TYPE(ROUTE_TYPE),
+ end else if (IS_MESH | IS_TORUS ) begin : D2_
+ two_dim_ssa_check_destport #(
.SW_LOC(SW_LOC),
- .P(P),
- .DEBUG_EN(DEBUG_EN),
- .DSTPw(DSTPw),
.SS_PORT(SS_PORT)
) destport_check (
.destport_encoded(destport_encoded),
@@ -392,21 +386,13 @@ module ssa_check_destport #(
end else if (IS_FMESH) begin :fmesh
localparam
ELw = log2(T3),
- Pw = log2(P);
+ Pw = log2(MAX_P);
wire [Pw-1 : 0] endp_p_in;
wire [MAX_P-1 : 0] destport_one_hot_in;
-
- fmesh_endp_addr_decode endp_addr_decode (
- .e_addr(dest_e_addr_in),
- .ex(),
- .ey(),
- .ep(endp_p_in),
- .valid()
- );
-
+ assign endp_p_in = dest_e_addr_in[DAw-1 : DAw-Pw];
destp_generator #(
- .P(P),
+ .P(MAX_P),
.SW_LOC(SW_LOC)
) decoder (
.destport_one_hot (destport_one_hot_in),
@@ -419,13 +405,9 @@ module ssa_check_destport #(
);
assign ss_port_nonhdr_flit = destport_one_hot [SS_PORT];
assign ss_port_hdr_flit = destport_one_hot_in [SS_PORT];
- end else begin : line
- line_ring_ssa_check_destport #(
- .ROUTE_TYPE(ROUTE_TYPE),
+ end else if(IS_LINE | IS_RING) begin : D1_
+ one_dim_ssa_check_destport #(
.SW_LOC(SW_LOC),
- .P(P),
- .DEBUG_EN(DEBUG_EN),
- .DSTPw(DSTPw),
.SS_PORT(SS_PORT)
) destport_check (
.destport_encoded(destport_encoded),
@@ -433,6 +415,17 @@ module ssa_check_destport #(
.ss_port_hdr_flit(ss_port_hdr_flit),
.ss_port_nonhdr_flit(ss_port_nonhdr_flit)
);
+ end else begin : other
+ logic [MAX_P-1 : 0] destport_one_hot_in;
+ always @(*) begin
+ destport_one_hot_in = '0;
+ //for deterministic routing destination port is decimal encoded
+ if(IS_DETERMINISTIC) destport_one_hot_in[destport_in_encoded] = 1'b1;
+ //for non-deterministic routing destination port is one-hot encoded
+ else destport_one_hot_in [DSTPw-1 : 0] = destport_in_encoded;
+ end
+ assign ss_port_nonhdr_flit = destport_one_hot [SS_PORT];
+ assign ss_port_hdr_flit = destport_one_hot_in [SS_PORT];
end
endgenerate
endmodule
diff --git a/mpsoc/rtl/src_noc/topology_localparam.v b/mpsoc/rtl/src_noc/topology_localparam.v
index c16f8f5..6b03106 100644
--- a/mpsoc/rtl/src_noc/topology_localparam.v
+++ b/mpsoc/rtl/src_noc/topology_localparam.v
@@ -19,7 +19,11 @@
IS_TREE= (TOPOLOGY == "TREE"),
IS_STAR= (TOPOLOGY == "STAR"),
IS_MULTI_MESH=(TOPOLOGY == "MULTI_MESH"),
- IS_REGULAR_TOPO = (IS_RING | IS_LINE | IS_MESH | IS_TORUS),
+ IS_MESH_3D= (TOPOLOGY == "MESH_3D"),
+ IS_REGULAR_TOPO = (IS_RING | IS_LINE | IS_MESH | IS_TORUS | IS_MESH_3D),
+ IS_1D_TOPO = (IS_LINE | IS_RING),
+ IS_2D_TOPO = (IS_MESH | IS_TORUS | IS_FMESH),
+ IS_3D_TOPO = (IS_MESH_3D | IS_MULTI_MESH),
IS_MULTI_ENDP_ROUTER = (T3 > 1) ;
/* verilator lint_on WIDTH */
@@ -96,16 +100,16 @@
input integer router_port_num; //router port num
input integer current_port;
begin
- if(IS_MESH | IS_FMESH | IS_TORUS | IS_MULTI_MESH) begin
+ if(IS_2D_TOPO | IS_3D_TOPO) begin
strieght_port =
(current_port == EAST)? WEST:
(current_port == WEST)? EAST:
(current_port == SOUTH)? NORTH:
(current_port == NORTH)? SOUTH:
- (IS_MULTI_MESH && current_port== UP)? DOWN:
- (IS_MULTI_MESH && current_port== DOWN)? UP:
+ (IS_3D_TOPO && current_port== UP)? DOWN:
+ (IS_3D_TOPO && current_port== DOWN)? UP:
router_port_num; //DISABLED;
- end else if (IS_RING | IS_LINE) begin
+ end else if (IS_1D_TOPO) begin
strieght_port =
(current_port== FORWARD )? BACKWARD:
(current_port== BACKWARD)? FORWARD:
@@ -131,38 +135,42 @@
input integer router_port_num; //router port num
begin
port_buffer_size = B;
- if(IS_MESH || IS_FMESH || IS_TORUS || IS_RING || IS_LINE)begin
- if (router_port_num == 0 || router_port_num > 4 ) port_buffer_size = LB;
- end else if (IS_MULTI_MESH) begin
- if (router_port_num == 0) port_buffer_size = LB;
+ if(IS_1D_TOPO) begin
+ if (router_port_num == 0 || router_port_num > BACKWARD ) port_buffer_size = LB;
+ end else if (IS_2D_TOPO) begin
+ if (router_port_num == 0 || router_port_num > SOUTH ) port_buffer_size = LB;
+ end else if (IS_3D_TOPO) begin
+ if (router_port_num == 0 || router_port_num > DOWN) port_buffer_size = LB;
end
end
endfunction
/*******************
- * REGULAR_TOPO: "RING" "LINE" "MESH" TORUS" "FMESH"
+ * REGULAR_TOPO: "RING" "LINE" "MESH" TORUS" "FMESH" "MESH_3D"
******************/
localparam
NX = T1,
- NY = (IS_RING | IS_LINE) ? 1 : T2,
- NL = T3,
+ NY = (IS_1D_TOPO) ? 1 : T2,
+ NL = (IS_3D_TOPO)? T4 : T3,
+ NZ = (IS_3D_TOPO)? T3 : 1,
NXw = log2(NX),
NYw = log2(NY),
NLw = log2(NL),
+ NZw= log2(NZ),
PPSw_REGULAR = 4, //port presel width for adaptive routing
/* verilator lint_off WIDTH */
ROUTE_TYPE_REGULAR =
- (ROUTE_NAME == "XY" || ROUTE_NAME == "TRANC_XY" )? "DETERMINISTIC" :
+ (ROUTE_NAME == "DOR" || ROUTE_NAME == "TRANC_DOR" )? "DETERMINISTIC" :
(ROUTE_NAME == "FULL_ADPT" || ROUTE_NAME == "TRANC_FULL_ADPT" )? "FULL_ADAPTIVE": "PAR_ADAPTIVE",
/* verilator lint_on WIDTH */
- R2R_CHANELS_REGULAR= (IS_RING || IS_LINE)? 2 : 4,
+ R2R_CHANELS_REGULAR= (IS_1D_TOPO)? 2 : (IS_3D_TOPO)? 6 : 4,
R2E_CHANELS_REGULAR= NL,
- RAw_REGULAR = ( IS_RING | IS_LINE)? NXw : NXw + NYw,
- EAw_REGULAR = (NL==1) ? RAw_REGULAR : RAw_REGULAR + NLw,
- NR_REGULAR = (IS_RING || IS_LINE)? NX : NX*NY,
+ RAw_REGULAR = ( IS_1D_TOPO )? NXw : (IS_3D_TOPO)? NXw + NYw + NZw : NXw + NYw,
+ EAw_REGULAR = (NL==1 ) ? RAw_REGULAR : RAw_REGULAR + NLw,
+ NR_REGULAR = (IS_1D_TOPO)? NX :(IS_3D_TOPO)? NX*NY*NZ : NX*NY,
NE_REGULAR = NR_REGULAR * NL,
MAX_P_REGULAR = R2R_CHANELS_REGULAR + R2E_CHANELS_REGULAR,
- DSTPw_REGULAR = R2R_CHANELS_REGULAR, // P-1
+ DSTPw_REGULAR = (IS_3D_TOPO)? log2(MAX_P_REGULAR) : R2R_CHANELS_REGULAR, // P-1
NE_PER_R_REGULAR = NL;
/****************
@@ -213,7 +221,7 @@
localparam
ROUTE_TYPE_STAR = "DETERMINISTIC",
NE_STAR = T1, //total number of endpoints
- NR_STAR = 1, // total number of routers
+ NR_STAR = 1, // total number of routers
RAw_STAR = 1,
EAw_STAR = log2(NE_STAR),
DSTPw_STAR = (~IS_UNICAST) ? NE_STAR :EAw_STAR,
@@ -244,6 +252,20 @@
EAw_MULTI_MESH = T2,
MAX_P_MULTI_MESH = 7,
DSTPw_MULTI_MESH = log2(MAX_P_MULTI_MESH);
+ /*************************
+ * regular_topo address struct
+ **************************/
+ typedef struct packed {
+ logic [NZw-1 : 0] z;
+ logic [NYw-1 : 0] y;
+ logic [NXw-1 : 0] x;
+ } regular_topo_router_addr_t;
+ typedef struct packed {
+ logic [NLw-1 : 0] l;
+ logic [NZw-1 : 0] z;
+ logic [NYw-1 : 0] y;
+ logic [NXw-1 : 0] x;
+ } regular_topo_endp_addr_t;
localparam
PPSw = PPSw_REGULAR,
@@ -390,12 +412,17 @@
function automatic integer regular_topo_endp_addr;
input integer endp_id;
- integer y, x, l,p, diff,mul;
+ integer y, x, z, l,rid;
begin
- y = ((endp_id/NL) / NX );
- x = ((endp_id/NL) % NX );
- l = (endp_id % NL);
- regular_topo_endp_addr = ( l << ( NXw+NYw) | (y<> parameter.v
printf " parameter MAX_PCK_SIZ=$MAX_PCK_SIZ;\n" >> parameter.v
printf " parameter TIMSTMP_FIFO_NUM=$TIMSTMP_FIFO_NUM;\n" >> parameter.v
- printf " parameter ROUTE_TYPE = (ROUTE_NAME == \"XY\" || ROUTE_NAME == \"TRANC_XY\" )? \"DETERMINISTIC\" : \n" >> parameter.v
+ printf " parameter ROUTE_TYPE = (ROUTE_NAME == \"DOR\" || ROUTE_NAME == \"TRANC_DOR\" )? \"DETERMINISTIC\" : \n" >> parameter.v
printf " (ROUTE_NAME == \"FULL_ADPT\" || ROUTE_NAME == \"TRANC_FULL_ADPT\" )? \"FULL_ADAPTIVE\": \"PAR_ADAPTIVE\"; \n" >> parameter.v
printf " parameter DEBUG_EN=$DEBUG_EN;\n" >> parameter.v
printf " parameter ROUTE_SUBFUNC= \"$ROUTE_SUBFUNC\";\n">> parameter.v
diff --git a/mpsoc/script/synfull/noc_localparam.v b/mpsoc/script/synfull/noc_localparam.v
index 09a939c..feff061 100644
--- a/mpsoc/script/synfull/noc_localparam.v
+++ b/mpsoc/script/synfull/noc_localparam.v
@@ -38,7 +38,7 @@
localparam B=4;
localparam LB=4;
localparam Fpay=64;
- localparam ROUTE_NAME="XY";
+ localparam ROUTE_NAME="DOR";
localparam PCK_TYPE="MULTI_FLIT";
localparam MIN_PCK_SIZE=1;
localparam BYTE_EN=0;
diff --git a/mpsoc/script/verilator_2D_mesh.sh b/mpsoc/script/verilator_2D_mesh.sh
index 4a1d247..a4cf231 100755
--- a/mpsoc/script/verilator_2D_mesh.sh
+++ b/mpsoc/script/verilator_2D_mesh.sh
@@ -42,8 +42,8 @@ CORE_NUM(){
FIRST_ARBITER_EXT_P_EN=1
TOPOLOGY="MESH" #"MESH" or "TORUS"
ROUTE_NAME="FULL_ADPT" # Routing algorithm
- # mesh : "XY" , "WEST_FIRST" , "NORTH_LAST" , "NEGETIVE_FIRST" , "FULL_ADPT"
- # torus: "TRANC_XY" , "TRANC_WEST_FIRST", "TRANC_NORTH_LAST", "TRANC_NEGETIVE_FIRST", "TRANC_FULL_ADPT"
+ # mesh : "DOR" , "WEST_FIRST" , "NORTH_LAST" , "NEGETIVE_FIRST" , "FULL_ADPT"
+ # torus: "TRANC_DOR" , "TRANC_WEST_FIRST", "TRANC_NORTH_LAST", "TRANC_NEGETIVE_FIRST", "TRANC_FULL_ADPT"
CONGESTION_INDEX="VC" #"CREDIT","VC"
CLASS_SETTING="4'b1111"
#0: no class. packets can be sent to any available OVC
@@ -81,7 +81,7 @@ CORE_NUM(){
# for minimal fully adaptive on 2D mesh paper
- ROUTING_SUBFUNCTION= "XY" # "XY" "NORTH_LAST"
+ ROUTING_SUBFUNCTION= "DOR" # "DOR" "NORTH_LAST"
AVC_REALLOCATION= ""
generate_parameter_v (){
@@ -112,7 +112,7 @@ generate_parameter_v (){
printf " parameter TOTAL_PKT_PER_ROUTER=$TOTAL_PKT_PER_ROUTER;\n" >> parameter.v
printf " parameter MAX_DELAY_BTWN_PCKTS=$MAX_DELAY_BTWN_PCKTS;\n" >> parameter.v
printf " parameter DEBUG_EN=$DEBUG_EN;\n" >> parameter.v
- printf " parameter ROUTE_TYPE = (ROUTE_NAME == \"XY\" || ROUTE_NAME == \"TRANC_XY\" )? \"DETERMINISTIC\" : \n" >> parameter.v
+ printf " parameter ROUTE_TYPE = (ROUTE_NAME == \"DOR\" || ROUTE_NAME == \"TRANC_DOR\" )? \"DETERMINISTIC\" : \n" >> parameter.v
printf " (ROUTE_NAME == \"FULL_ADPT\" || ROUTE_NAME == \"TRANC_FULL_ADPT\" )? \"FULL_ADAPTIVE\": \"PAR_ADAPTIVE\"; \n" >> parameter.v
printf " parameter ADD_PIPREG_AFTER_CROSSBAR= $ADD_PIPREG_AFTER_CROSSBAR;\n" >> parameter.v
printf " parameter CVw=(C==0)? V : C * V;\n" >> parameter.v
@@ -168,7 +168,7 @@ for PACKET_SIZE in 3 2 4 6
for TRAFFIC in "RANDOM" "TRANSPOSE1" "TRANSPOSE2" "HOTSPOT"
do
- for ROUTE_NAME in "XY" "WEST_FIRST" "NORTH_LAST" "NEGETIVE_FIRST" "FULL_ADPT"
+ for ROUTE_NAME in "DOR" "WEST_FIRST" "NORTH_LAST" "NEGETIVE_FIRST" "FULL_ADPT"
do
# regenerate NoC
generate_parameter_v
@@ -190,7 +190,7 @@ for PACKET_SIZE in 3 2 4 6
#run multiple testbench files in the same time
cd $multiple_path
- for ROUTE_NAME in "XY" "WEST_FIRST" "NORTH_LAST" "NEGETIVE_FIRST" "FULL_ADPT"
+ for ROUTE_NAME in "DOR" "WEST_FIRST" "NORTH_LAST" "NEGETIVE_FIRST" "FULL_ADPT"
do
./$ROUTE_NAME$TRAFFIC"_"$PACKET_SIZE $ROUTE_NAME$TRAFFIC"_"$PACKET_SIZE &
@@ -200,7 +200,7 @@ for PACKET_SIZE in 3 2 4 6
wait
# merge the result in one file
- for ROUTE_NAME in "XY" "WEST_FIRST" "NORTH_LAST" "NEGETIVE_FIRST" "FULL_ADPT"
+ for ROUTE_NAME in "DOR" "WEST_FIRST" "NORTH_LAST" "NEGETIVE_FIRST" "FULL_ADPT"
do
data_file=$data_path/$TRAFFIC"_"$PACKET_SIZE"_all.txt"
plot_file=$plot_path/$TRAFFIC"_"$PACKET_SIZE".eps"
diff --git a/mpsoc/smart-netrace/models/B4_V1_S0 b/mpsoc/smart-netrace/models/B4_V1_S0
index 3b9e23c..6f9937f 100644
--- a/mpsoc/smart-netrace/models/B4_V1_S0
+++ b/mpsoc/smart-netrace/models/B4_V1_S0
@@ -1,6 +1,6 @@
$model = bless( {
'noc_param'=> {
- "ROUTE_NAME" => "\"XY\"",
+ "ROUTE_NAME" => "\"DOR\"",
"ADD_PIPREG_AFTER_CROSSBAR" => "1'b1",
"V" => "1",
"B" => "4",
diff --git a/mpsoc/smart-netrace/models/B4_V1_S2 b/mpsoc/smart-netrace/models/B4_V1_S2
index 893796d..94c23d7 100644
--- a/mpsoc/smart-netrace/models/B4_V1_S2
+++ b/mpsoc/smart-netrace/models/B4_V1_S2
@@ -1,6 +1,6 @@
$model = bless( {
'noc_param'=> {
- "ROUTE_NAME" => "\"XY\"",
+ "ROUTE_NAME" => "\"DOR\"",
"ADD_PIPREG_AFTER_CROSSBAR" => "1'b1",
"V" => "1",
"B" => "4",
diff --git a/mpsoc/smart-netrace/models/B4_V1_S4 b/mpsoc/smart-netrace/models/B4_V1_S4
index 87959c4..8bcb6e2 100644
--- a/mpsoc/smart-netrace/models/B4_V1_S4
+++ b/mpsoc/smart-netrace/models/B4_V1_S4
@@ -1,6 +1,6 @@
$model = bless( {
'noc_param'=> {
- "ROUTE_NAME" => "\"XY\"",
+ "ROUTE_NAME" => "\"DOR\"",
"ADD_PIPREG_AFTER_CROSSBAR" => "1'b1",
"V" => "1",
"B" => "4",
diff --git a/mpsoc/smart-netrace/models/B4_V1_S7 b/mpsoc/smart-netrace/models/B4_V1_S7
index c624e39..936f5e9 100644
--- a/mpsoc/smart-netrace/models/B4_V1_S7
+++ b/mpsoc/smart-netrace/models/B4_V1_S7
@@ -1,6 +1,6 @@
$model = bless( {
'noc_param'=> {
- "ROUTE_NAME" => "\"XY\"",
+ "ROUTE_NAME" => "\"DOR\"",
"ADD_PIPREG_AFTER_CROSSBAR" => "1'b1",
"V" => "1",
"B" => "4",
diff --git a/mpsoc/smart-netrace/src/deafult_noc_param b/mpsoc/smart-netrace/src/deafult_noc_param
index 1affbb5..4c3b565 100644
--- a/mpsoc/smart-netrace/src/deafult_noc_param
+++ b/mpsoc/smart-netrace/src/deafult_noc_param
@@ -8,7 +8,7 @@ $model = bless( {
"B" => "4",
"LB" => "B",
"Fpay" => "32",
-"ROUTE_NAME" => "\"XY\"",
+"ROUTE_NAME" => "\"DOR\"",
"PCK_TYPE" => " \"MULTI_FLIT\"",
"MIN_PCK_SIZE" => "2",
"BYTE_EN" => "0",
diff --git a/mpsoc/src_c/plot/parameter.v b/mpsoc/src_c/plot/parameter.v
index aa4c112..66b4001 100755
--- a/mpsoc/src_c/plot/parameter.v
+++ b/mpsoc/src_c/plot/parameter.v
@@ -12,7 +12,7 @@
parameter COMBINATION_TYPE="BASELINE";
parameter FIRST_ARBITER_EXT_P_EN=0;
parameter TOPOLOGY="MESH";
- parameter ROUTE_NAME="XY";
+ parameter ROUTE_NAME="DOR";
parameter CONGESTION_INDEX=3;
parameter CLASS_CONFIG_NUM=0;
parameter C0_p=100;
@@ -32,7 +32,7 @@
parameter MAX_PCK_SIZ=10;
parameter TIMSTMP_FIFO_NUM=64;
parameter [V-1 : 0] ESCAP_VC_MASK=1;
- parameter ROUTE_TYPE = (ROUTE_NAME == "XY" || ROUTE_NAME == "TRANC_XY" || ROUTE_NAME == "TRANC")? "DETERMINISTIC" :
+ parameter ROUTE_TYPE = (ROUTE_NAME == "DOR" || ROUTE_NAME == "TRANC_DOR" || ROUTE_NAME == "TRANC")? "DETERMINISTIC" :
(ROUTE_NAME == "FULL_ADPT" || ROUTE_NAME == "TRANC_FULL_ADPT" )? "FULL_ADAPTIVE": "PAR_ADAPTIVE";
parameter DEBUG_EN=0;
parameter ROUTE_SUBFUNC= "NORTH_LAST";
diff --git a/mpsoc/src_verilator/simulator.cpp b/mpsoc/src_verilator/simulator.cpp
index 1be9cb2..f773427 100755
--- a/mpsoc/src_verilator/simulator.cpp
+++ b/mpsoc/src_verilator/simulator.cpp
@@ -52,7 +52,7 @@ int main(int argc, char** argv) {
mcast_init();
topology_init();
-
+
if( TRAFFIC_TYPE == NETRACE){
netrace_init(netrace_file); // should be called first to initiate header
pck_inj_init((int)header->num_nodes);
@@ -64,10 +64,9 @@ int main(int argc, char** argv) {
else traffic_gen_init();
main_time=0;
- print_parameter();
if( thread_num>1) initial_threads();
-
while (!Verilated::gotFinish()) {
+ if(main_time == 1) print_parameter();
if(main_time - saved_time < 50) {//set reset and start
#ifdef FLAT_MODE
reset_active_high = ((noc_top->router_event[0][0] & ACTIVE_HIGH_RST)!=0) ? 1 : 0;
@@ -371,8 +370,7 @@ int parse_string ( char * str, int * array)
unsigned int pck_dst_gen_unicast ( unsigned int core_num, unsigned char * inject_en) {
if(TRAFFIC_TYPE==TASK) return pck_dst_gen_task_graph ( core_num, inject_en);
- if((strcmp (TOPOLOGY,"MESH")==0)||(strcmp (TOPOLOGY,"TORUS")==0)) return pck_dst_gen_2D (core_num, inject_en);
- return pck_dst_gen_1D (core_num, inject_en);
+ return pck_dst_gen_synthetic (core_num, inject_en);
}
void mcast_full_rnd (unsigned int core_num){
@@ -645,7 +643,7 @@ void traffic_gen_init( void ){
unsigned int dest_e_addr;
for (i=0;icurrent_e_addr = endp_addr_encoder(i);
traffic[i]->start=0;
traffic[i]->pck_class_in= pck_class_in_gen( i);
@@ -1232,45 +1230,6 @@ void print_statistic_new (unsigned long int total_clk){
}
void print_parameter (){
- printf ("NoC parameters:---------------- \n");
- printf ("\tTopology: %s\n",TOPOLOGY);
- printf ("\tRouting algorithm: %s\n",ROUTE_NAME);
- printf ("\tVC_per port: %d\n", V);
- printf ("\tNon-local port buffer_width per VC: %d\n", B);
- printf ("\tLocal port buffer_width per VC: %d\n", LB);
- #if defined (IS_MESH) || defined (IS_FMESH) || defined (IS_TORUS)
- printf ("\tRouter num in row: %d \n",T1);
- printf ("\tRouter num in column: %d \n",T2);
- printf ("\tEndpoint num per router: %d\n",T3);
- #elif defined (IS_LINE) || defined (IS_RING )
- printf ("\tTotal Router num: %d \n",T1);
- printf ("\tEndpoint num per router: %d\n",T3);
- #elif defined (IS_FATTREE) || defined (IS_TREE)
- printf ("\tK: %d \n",T1);
- printf ("\tL: %d \n",T2);
- #elif defined (IS_STAR)
- printf ("\tTotal Endpoints number: %d \n",T1);
- #else//CUSTOM
- printf ("\tTotal Endpoints number: %d \n",T1);
- printf ("\tTotal Routers number: %d \n",T2);
- #endif
- printf ("\tNumber of Class: %d\n", C);
- printf ("\tFlit data width: %d \n", Fpay);
- printf ("\tVC reallocation mechanism: %s \n", VC_REALLOCATION_TYPE);
- printf ("\tVC/sw combination mechanism: %s \n", COMBINATION_TYPE);
- 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 ("\tSSA_EN enabled: %d \n",SSA_EN);
- printf ("\tSwitch allocator arbitration type:%s \n",SWA_ARBITER_TYPE);
- printf ("\tMinimum supported packet size:%d flit(s) \n",MIN_PCK_SIZE);
- printf ("\tLoop back is enabled:%d \n",SELF_LOOP_EN);
- printf ("\tNumber of multihop bypass (SMART max):%d \n",SMART_MAX);
- printf ("\tCastying type:%s.\n",CAST_TYPE);
- if (IS_MCAST_PARTIAL){
- printf ("\tCAST LIST:%s\n",MCAST_ENDP_LIST);
- }
- printf ("NoC parameters:---------------- \n");
printf ("\nSimulation parameters-------------\n");
#if(DEBUG_EN)
printf ("\tDebuging is enabled\n");
diff --git a/mpsoc/src_verilator/topology/mesh.h b/mpsoc/src_verilator/topology/mesh.h
index f64b633..5f9ba85 100644
--- a/mpsoc/src_verilator/topology/mesh.h
+++ b/mpsoc/src_verilator/topology/mesh.h
@@ -1,491 +1,294 @@
#ifndef MESH_H
- #define MESH_H
-
- #define LOCAL 0
- #define EAST 1
- #define NORTH 2
- #define WEST 3
- #define SOUTH 4
- //ring line
- #define FORWARD 1
- #define BACKWARD 2
- #define router_id(x,y) ((y * T1) + x)
- #define endp_id(x,y,l) ((y * T1) + x) * T3 + l
+#define MESH_H
- unsigned int nxw=0;
- unsigned int nyw=0;
- unsigned int maskx=0;
- unsigned int masky=0;
+#define LOCAL 0
+#define EAST 1
+#define NORTH 2
+#define SOUTH 4
+//ring line
+#define FORWARD 1
+#define BACKWARD 2
- void mesh_tori_addrencod_sep(unsigned int id, unsigned int *x, unsigned int *y, unsigned int *l){
- (*l)=id%T3; // id%NL
- (*x)=(id/T3)%T1;// (id/NL)%NX
- (*y)=(id/T3)/T1;// (id/NL)/NX
- }
+#define UP 5
+#define DOWN 6
- void mesh_tori_addr_sep(unsigned int code, unsigned int *x, unsigned int *y, unsigned int *l){
- (*x) = code & maskx;
- code>>=nxw;
- (*y) = code & masky;
- code>>=nyw;
- (*l) = code;
- }
+#if defined (IS_LINE) || defined (IS_RING )
+ #define X_MAX T1
+ #define Y_MAX 1
+ #define Z_MAX 1
+ #define L_MAX T3
+ #define DIM 1
+#elif defined (IS_MESH_3D)
+ #define X_MAX T1
+ #define Y_MAX T2
+ #define Z_MAX T3
+ #define L_MAX T4
+ #define DIM 3
+#elif defined (IS_TORUS) || defined (IS_MESH) || defined (IS_FMESH)
+ #define X_MAX T1
+ #define Y_MAX T2
+ #define Z_MAX 1
+ #define L_MAX T3
+ #define DIM 2
+#endif
- void ring_line_addr_sep(unsigned int code, unsigned int *x, unsigned int *l){
- (*x) = code & maskx;
- code>>=nxw;
- (*l) = code;
- }
+#if defined (IS_LINE) || defined (IS_RING )
+ #define WEST BACKWARD
+ #define R2R_CHANELS_MESH_TORI 2
+#else
+ #define WEST 3
+ #if defined (IS_MESH_3D)
+ #define R2R_CHANELS_MESH_TORI 6
+ #else
+ #define R2R_CHANELS_MESH_TORI 4
+ #endif //IS_MESH_3D
+#endif
- unsigned int mesh_tori_addr_join(unsigned int x, unsigned int y, unsigned int l){
- unsigned int addrencode=0;
- addrencode =(T3==1)? (y< SOUTH) return l;
+ if(x==0 && l == WEST) return l;
+ if(x== (T1-1) && l == EAST) return l;
+ if(y==0 && l == NORTH) return l;
+ if(y== (T2-1) && l == SOUTH) return l;
+ if(x==0) return WEST;
+ if(x== (T1-1)) return EAST;
+ if(y==0) return NORTH;
+ if(y== (T2-1)) return SOUTH;
+ return LOCAL;
+}
- void fmesh_addrencod_sep(unsigned int id, unsigned int *x, unsigned int *y, unsigned int *p){
- unsigned int l, diff,mul,addrencode;
- mul = T1*T2*T3;
- if(id < mul) {
- *y = ((id/T3) / T1 );
- *x = ((id/T3) % T1 );
- l = (id % T3);
- *p = (l==0)? LOCAL : 4+l;
- }else{
- diff = id - mul ;
- if( diff < T1) { //top mesh edge
- *y = 0;
- *x = diff;
- *p = NORTH;
- } else if ( diff < 2* T1) { //bottom mesh edge
- *y = T2-1;
- *x = diff-T1;
- *p = SOUTH;
- } else if ( diff < (2* T1) + T2 ) { //left mesh edge
- *y = diff - (2* T1);
- *x = 0;
- *p = WEST;
- } else { //right mesh edge
- *y = diff - (2* T1) -T2;
- *x = T1-1;
- *p = EAST;
- }
+void fmesh_Eid_to_coords(unsigned int id, unsigned int *x, unsigned int *y, unsigned int *p){
+ unsigned int l, diff,mul,addrencode;
+ mul = T1*T2*T3;
+ if(id < mul) {
+ *y = ((id/T3) / T1 );
+ *x = ((id/T3) % T1 );
+ l = (id % T3);
+ *p = (l==0)? LOCAL : 4+l;
+ }else{
+ diff = id - mul ;
+ if( diff < T1) { //top mesh edge
+ *y = 0;
+ *x = diff;
+ *p = NORTH;
+ } else if ( diff < 2* T1) { //bottom mesh edge
+ *y = T2-1;
+ *x = diff-T1;
+ *p = SOUTH;
+ } else if ( diff < (2* T1) + T2 ) { //left mesh edge
+ *y = diff - (2* T1);
+ *x = 0;
+ *p = WEST;
+ } else { //right mesh edge
+ *y = diff - (2* T1) -T2;
+ *x = T1-1;
+ *p = EAST;
}
}
+}
- unsigned int fmesh_addrencode(unsigned int id){
- //input integer in,nx,nxw,nl,nyw,ny;
- unsigned int y, x, p, addrencode;
- fmesh_addrencod_sep(id, &x, &y, &p);
- addrencode = ( p<<(nxw+nyw) | (y< SOUTH) return ((y*T1)+x)*T3+(p-SOUTH);
- if(p== NORTH) return ((T1*T2*T3) + x);
- if(p== SOUTH) return ((T1*T2*T3) + T1 + x);
- if(p== WEST ) return ((T1*T2*T3) + 2*T1 + y);
- if(p== EAST ) return ((T1*T2*T3) + 2*T1 + T2 + y);
- return 0;//should not reach here
+unsigned int regular_topo_coords_to_Eaddr(unsigned int x, unsigned int y, unsigned int z, unsigned int l){
+ unsigned int code=x;
+ unsigned int shift =nxw;
+ if(DIM > 1) {
+ code|=y< 2) {
+ code|=z<>=nxw;
+ if(DIM > 1) {
+ (*y) = code & masky;
+ code>>=nyw;
+ } else (*y)=0;
+ if(DIM > 2) {
+ (*z) = code & maskz;
+ code>>=nzw;
+ } else (*z)=0;
+ (*l) = code;
+}
+
+unsigned int reqular_topo_addr_encode (unsigned int id){
+ unsigned int y, x, z, l;
+ regular_topo_Eid_to_coords(id,&x,&y,&z,&l);
+ return regular_topo_coords_to_Eaddr(x,y,z,l);
+}
+
+unsigned int regular_topo_addr_decoder (unsigned int code){
+ unsigned int y, x, z, l;
+ regular_topo_Eaddr_to_coords(code,&x,&y,&z,&l);
+ return endp_id(x,y,z,l);
+}
+
+unsigned int fmesh_endp_addr_decoder (unsigned int code){
+ unsigned int x, y, z, p;
+ regular_topo_Eaddr_to_coords(code,&x,&y,&z,&p);
+ if(p== LOCAL) return ((y*T1)+x)*T3;
+ if(p > SOUTH) return ((y*T1)+x)*T3+(p-SOUTH);
+ if(p== NORTH) return ((T1*T2*T3) + x);
+ if(p== SOUTH) return ((T1*T2*T3) + T1 + x);
+ if(p== WEST ) return ((T1*T2*T3) + 2*T1 + y);
+ if(p== EAST ) return ((T1*T2*T3) + 2*T1 + T2 + y);
+ return 0;//should not reach here
+}
+
+unsigned int fmesh_addrencode(unsigned int id){
+ unsigned int y, x, p, addrencode;
+ fmesh_Eid_to_coords(id, &x, &y, &p);
+ addrencode = ( p<<(nxw+nyw) | (y< %d,%d\n",r2r_cnt_all[n].r1, r2r_cnt_all[n].p1,r2r_cnt_all[n].r2,r2r_cnt_all[n].p2);
+ conect_r2r(1,r2r_cnt_all[n].r1,r2r_cnt_all[n].p1,1,r2r_cnt_all[n].r2,r2r_cnt_all[n].p2);
+}
+
+static inline void topology_connect_r2e (int n){
+ //printf ("%d,%d -> %d\n",r2e_cnt_all[n].r1,r2e_cnt_all[n].p1,n);
+ connect_r2e(1,r2e_cnt_all[n].r1,r2e_cnt_all[n].p1,n);
+}
+
+#define fill_r2r_cnt(T1,R1,P1,T2,R2,P2) (r2r_cnt_table_t){.id1=R1,.t1=T1,.r1=R1,.p1=P1,.id2=R2,.t2=T2,.r2=R2,.p2=P2}
-/*
-void topology_connect_all_nodes_old (void){
+
+static inline void topology_edge_connect(unsigned id1, unsigned id2, unsigned int p1, unsigned int p2, unsigned int fmesh_id,unsigned int R_ADDR, unsigned *num) {
+ #if defined (IS_MESH) || defined (IS_MESH_3D) || defined (IS_LINE)
+ connect_r2gnd(1,id1,p1);
+ #elif defined (IS_TORUS) || defined (IS_RING)
+ r2r_cnt_all[*num]=fill_r2r_cnt(1,id1,p1,1,id2,p2);
+ (*num)++;
+ #elif defined (IS_FMESH)
+ r2e_cnt_all[fmesh_id].r1=id1;
+ r2e_cnt_all[fmesh_id].p1=p1;
+ er_addr [fmesh_id] = R_ADDR;
+ #endif//topology
+}
+
+void topology_init(void){
+ nxw=Log2(X_MAX);
+ nyw=Log2(Y_MAX);
+ nzw=Log2(Z_MAX);
- unsigned int x,y,l;
- #if defined (IS_LINE) || defined (IS_RING )
- #define R2R_CHANELS_MESH_TORI 2
- for (x=0; xcurrent_r_addr = x;
- router1[x]->current_r_id = x;
- if(x < T1-1){// not_last_node
- //assign router_chan_in[x][FORWARD] = router_chan_out [(x+1)][BACKWARD];
- conect_r2r(1,x,FORWARD,1,(x+1),BACKWARD);
- } else { //last_node
-
- #if defined (IS_LINE) // : line_last_x
- //assign router_chan_in[x][FORWARD]= {SMARTFLIT_CHANEL_w{1'b0}};
- connect_r2gnd(1,x,FORWARD);
- #else // : ring_last_x
- //assign router_chan_in[x][FORWARD]= router_chan_out [0][BACKWARD];
- conect_r2r(1,x,FORWARD,1,0,BACKWARD);
- #endif
- }
- if(x>0){// :not_first_x
- //assign router_chan_in[x][BACKWARD]= router_chan_out [(x-1)][FORWARD];
- conect_r2r(1,x,BACKWARD,1,(x-1),FORWARD);
-
- }else {// :first_x
- #if defined (IS_LINE) // : line_first_x
- //assign router_chan_in[x][BACKWARD]={SMARTFLIT_CHANEL_w{1'b0}};
- connect_r2gnd(1,x,BACKWARD);
- #else // : ring_first_x
- //assign router_chan_in[x][BACKWARD]= router_chan_out [(NX-1)][FORWARD];
- conect_r2r(1,x,BACKWARD,1,(T1-1),FORWARD);
- #endif
- }
- // connect other local ports
- for (l=0; lcurrent_r_addr = R_ADDR;
router1[ROUTER_NUM]->current_r_id = ROUTER_NUM;
- if(x < T1-1) {//: not_last_x
- //assign router_chan_in[`router_id(x,y)][EAST]= router_chan_out [`router_id(x+1,y)][WEST];
- conect_r2r(1,router_id(x,y),EAST,1,router_id(x+1,y),WEST);
-
- }else {// :last_x
- #if defined (IS_MESH) // :last_x_mesh
- // assign router_chan_in[`router_id(x,y)][EAST] = {SMARTFLIT_CHANEL_w{1'b0}};
- connect_r2gnd(1,router_id(x,y),EAST);
- #elif defined (IS_TORUS) // : last_x_torus
- //assign router_chan_in[`router_id(x,y)][EAST] = router_chan_out [`router_id(0,y)][WEST];
- conect_r2r(1,router_id(x,y),EAST,1,router_id(0,y),WEST);
- #elif defined (IS_FMESH) //:last_x_fmesh
- //connect to endp
- unsigned int EAST_ID = T1*T2*T3 + 2*T1 + T2 + y;
- connect_r2e(1,router_id(x,y),EAST,EAST_ID);
- er_addr [EAST_ID] = R_ADDR;
- #endif//topology
- }
- if(y>0) {// : not_first_y
- //assign router_chan_in[`router_id(x,y)][NORTH] = router_chan_out [`router_id(x,(y-1))][SOUTH];
- conect_r2r(1,router_id(x,y),NORTH,1,router_id(x,(y-1)),SOUTH);
- }else {// :first_y
- #if defined (IS_MESH) // : first_y_mesh
- //assign router_chan_in[`router_id(x,y)][NORTH] = {SMARTFLIT_CHANEL_w{1'b0}};
- connect_r2gnd(1,router_id(x,y),NORTH);
- #elif defined (IS_TORUS)// :first_y_torus
- //assign router_chan_in[`router_id(x,y)][NORTH] = router_chan_out [`router_id(x,(T2-1))][SOUTH];
- conect_r2r(1,router_id(x,y),NORTH,1,router_id(x,(T2-1)),SOUTH);
- #elif defined (IS_FMESH) // :first_y_fmesh
- unsigned int NORTH_ID = T1*T2*T3 + x;
- connect_r2e(1,router_id(x,y),NORTH,NORTH_ID);
- er_addr [NORTH_ID] = R_ADDR;
- #endif//topology
- }//y>0
- if(x>0){// :not_first_x
- //assign router_chan_in[`router_id(x,y)][WEST] = router_chan_out [`router_id((x-1),y)][EAST];
- conect_r2r(1,router_id(x,y),WEST,1,router_id((x-1),y),EAST);
- }else {// :first_x
-
- #if defined (IS_MESH) // :first_x_mesh
- //assign router_chan_in[`router_id(x,y)][WEST] = {SMARTFLIT_CHANEL_w{1'b0}};
- connect_r2gnd(1,router_id(x,y),WEST);
-
- #elif defined (IS_TORUS) // :first_x_torus
- //assign router_chan_in[`router_id(x,y)][WEST] = router_chan_out [`router_id((NX-1),y)][EAST] ;
- conect_r2r(1,router_id(x,y),WEST,1,router_id((T1-1),y),EAST);
- #elif defined (IS_FMESH) // :first_x_fmesh
- unsigned int WEST_ID = T1*T2*T3 + 2*T1 + y;
- connect_r2e(1,router_id(x,y),WEST,WEST_ID);
- er_addr [WEST_ID] = R_ADDR;
- #endif//topology
- }
- if(y < T2-1) {// : firsty
- //assign router_chan_in[`router_id(x,y)][SOUTH] = router_chan_out [`router_id(x,(y+1))][NORTH];
- conect_r2r(1,router_id(x,y),SOUTH,1,router_id(x,(y+1)),NORTH);
- }else {// : lasty
-
- #if defined (IS_MESH) // :ly_mesh
-
- //assign router_chan_in[`router_id(x,y)][SOUTH]= {SMARTFLIT_CHANEL_w{1'b0}};
- connect_r2gnd(1,router_id(x,y),SOUTH);
-
- #elif defined (IS_TORUS) // :ly_torus
- //assign router_chan_in[`router_id(x,y)][SOUTH]= router_chan_out [`router_id(x,0)][NORTH];
- conect_r2r(1,router_id(x,y),SOUTH,1,router_id(x,0),NORTH);
- #elif defined (IS_FMESH) // :ly_Fmesh
- unsigned int SOUTH_ID = T1*T2*T3 + T1 + x;
- connect_r2e(1,router_id(x,y),SOUTH,SOUTH_ID);
- er_addr [SOUTH_ID] = R_ADDR;
- #endif//topology
- }
+ unsigned int FMESH_EAST_ID = T1*T2*T3 + 2*T1 + T2 + y;
+ unsigned int FMESH_WEST_ID = T1*T2*T3 + 2*T1 + y;
+ unsigned int FMESH_SOUTH_ID = T1*T2*T3 + T1 + x;
+ unsigned int FMESH_NORTH_ID = T1*T2*T3 + x;
// endpoint(s) connection
- // connect other local ports
- for (l=0; l0) r2r_cnt_all[num++]=fill_r2r_cnt(1,ROUTER_NUM,WEST,1,router_id((x-1),y,z),EAST);
+ else topology_edge_connect(ROUTER_NUM, router_id((X_MAX-1),y,z), WEST, EAST, FMESH_WEST_ID, R_ADDR, &num);
+ if(DIM==1) continue;
+ if (y < Y_MAX-1) r2r_cnt_all[num++] = fill_r2r_cnt(1, ROUTER_NUM, SOUTH, 1, router_id(x, y + 1, z), NORTH);
+ else topology_edge_connect(ROUTER_NUM, router_id(x, 0, z), SOUTH, NORTH, FMESH_SOUTH_ID, R_ADDR, &num);
+
+ if (y>0) r2r_cnt_all[num++] = fill_r2r_cnt(1, ROUTER_NUM, NORTH, 1, router_id(x, y - 1, z), SOUTH);
+ else topology_edge_connect(ROUTER_NUM, router_id(x, (Y_MAX-1), z), NORTH, SOUTH, FMESH_NORTH_ID, R_ADDR, &num);
+ if(DIM==2) continue;
+ if (z < Z_MAX-1) r2r_cnt_all[num++] = fill_r2r_cnt(1, router_id(x, y, z), UP, 1, router_id(x, y, z + 1), DOWN);
+ else connect_r2gnd(1,ROUTER_NUM,UP);
+ if (z > 0) r2r_cnt_all[num++] = fill_r2r_cnt(1, ROUTER_NUM, DOWN, 1, router_id(x, y, z - 1), UP);
+ else connect_r2gnd(1,ROUTER_NUM,DOWN);
}//y
}//x
- #endif
-}
-*/
-#define fill_r2r_cnt(T1,R1,P1,T2,R2,P2) (r2r_cnt_table_t){.id1=R1,.t1=T1,.r1=R1,.p1=P1,.id2=R2,.t2=T2,.r2=R2,.p2=P2}
-
-void topology_init(void){
- nxw=Log2(T1);
- nyw=Log2(T2);
- maskx = (0x1<current_r_addr = x;
- router1[x]->current_r_id = x;
- if(x < T1-1){// not_last_node
- //assign router_chan_in[x][FORWARD] = router_chan_out [(x+1)][BACKWARD];
- //conect_r2r(1,x,FORWARD,1,(x+1),BACKWARD);
- r2r_cnt_all[num]=fill_r2r_cnt(1,x,FORWARD,1,(x+1),BACKWARD);
- num++;
- } else { //last_node
- #if defined (IS_LINE) // : line_last_x
- //assign router_chan_in[x][FORWARD]= {SMARTFLIT_CHANEL_w{1'b0}};
- connect_r2gnd(1,x,FORWARD);
- #else // : ring_last_x
- //assign router_chan_in[x][FORWARD]= router_chan_out [0][BACKWARD];
- //conect_r2r(1,x,FORWARD,1,0,BACKWARD);
- r2r_cnt_all[num]=fill_r2r_cnt(1,x,FORWARD,1,0,BACKWARD);
- num++;
- #endif
- }
- if(x>0){// :not_first_x
- //assign router_chan_in[x][BACKWARD]= router_chan_out [(x-1)][FORWARD];
- //conect_r2r(1,x,BACKWARD,1,(x-1),FORWARD);
- r2r_cnt_all[num]=fill_r2r_cnt(1,x,BACKWARD,1,(x-1),FORWARD);
- num++;
- }else {// :first_x
- #if defined (IS_LINE) // : line_first_x
- //assign router_chan_in[x][BACKWARD]={SMARTFLIT_CHANEL_w{1'b0}};
- connect_r2gnd(1,x,BACKWARD);
- #else // : ring_first_x
- //assign router_chan_in[x][BACKWARD]= router_chan_out [(NX-1)][FORWARD];
- //conect_r2r(1,x,BACKWARD,1,(T1-1),FORWARD);
- r2r_cnt_all[num]=fill_r2r_cnt(1,x,BACKWARD,1,(T1-1),FORWARD);
- num++;
- #endif
- }
- // connect other local ports
- for (l=0; lcurrent_r_addr = R_ADDR;
- router1[ROUTER_NUM]->current_r_id = ROUTER_NUM;
- if(x < T1-1) {//: not_last_x
- //assign router_chan_in[`router_id(x,y)][EAST]= router_chan_out [`router_id(x+1,y)][WEST];
- //conect_r2r(1,router_id(x,y),EAST,1,router_id(x+1,y),WEST);
- r2r_cnt_all[num]=fill_r2r_cnt(1,router_id(x,y),EAST,1,router_id(x+1,y),WEST);
- num++;
- }else {// :last_x
- #if defined (IS_MESH) // :last_x_mesh
- // assign router_chan_in[`router_id(x,y)][EAST] = {SMARTFLIT_CHANEL_w{1'b0}};
- connect_r2gnd(1,router_id(x,y),EAST);
- #elif defined (IS_TORUS) // : last_x_torus
- //assign router_chan_in[`router_id(x,y)][EAST] = router_chan_out [`router_id(0,y)][WEST];
- //conect_r2r(1,router_id(x,y),EAST,1,router_id(0,y),WEST);
- r2r_cnt_all[num]=fill_r2r_cnt(1,router_id(x,y),EAST,1,router_id(0,y),WEST);
- num++;
- #elif defined (IS_FMESH) //:last_x_fmesh
- //connect to endp
- unsigned int EAST_ID = T1*T2*T3 + 2*T1 + T2 + y;
- //connect_r2e(1,router_id(x,y),EAST,EAST_ID);
- r2e_cnt_all[EAST_ID].r1=router_id(x,y);
- r2e_cnt_all[EAST_ID].p1=EAST;
- er_addr [EAST_ID] = R_ADDR;
- #endif//topology
- }
- if(y>0) {// : not_first_y
- //assign router_chan_in[`router_id(x,y)][NORTH] = router_chan_out [`router_id(x,(y-1))][SOUTH];
- //conect_r2r(1,router_id(x,y),NORTH,1,router_id(x,(y-1)),SOUTH);
- r2r_cnt_all[num]=fill_r2r_cnt(1,router_id(x,y),NORTH,1,router_id(x,(y-1)),SOUTH);
- num++;
- }else {// :first_y
- #if defined (IS_MESH) // : first_y_mesh
- //assign router_chan_in[`router_id(x,y)][NORTH] = {SMARTFLIT_CHANEL_w{1'b0}};
- connect_r2gnd(1,router_id(x,y),NORTH);
- #elif defined (IS_TORUS)// :first_y_torus
- //assign router_chan_in[`router_id(x,y)][NORTH] = router_chan_out [`router_id(x,(T2-1))][SOUTH];
- //conect_r2r(1,router_id(x,y),NORTH,1,router_id(x,(T2-1)),SOUTH);
- r2r_cnt_all[num]=fill_r2r_cnt(1,router_id(x,y),NORTH,1,router_id(x,(T2-1)),SOUTH);
- num++;
- #elif defined (IS_FMESH) // :first_y_fmesh
- unsigned int NORTH_ID = T1*T2*T3 + x;
- //connect_r2e(1,router_id(x,y),NORTH,NORTH_ID);
- r2e_cnt_all[NORTH_ID].r1=router_id(x,y);
- r2e_cnt_all[NORTH_ID].p1=NORTH;
- er_addr [NORTH_ID] = R_ADDR;
- #endif//topology
- }//y>0
- if(x>0){// :not_first_x
- //assign router_chan_in[`router_id(x,y)][WEST] = router_chan_out [`router_id((x-1),y)][EAST];
- //conect_r2r(1,router_id(x,y),WEST,1,router_id((x-1),y),EAST);
- r2r_cnt_all[num]=fill_r2r_cnt(1,router_id(x,y),WEST,1,router_id((x-1),y),EAST);
- num++;
- }else {// :first_x
- #if defined (IS_MESH) // :first_x_mesh
- //assign router_chan_in[`router_id(x,y)][WEST] = {SMARTFLIT_CHANEL_w{1'b0}};
- connect_r2gnd(1,router_id(x,y),WEST);
- #elif defined (IS_TORUS) // :first_x_torus
- //assign router_chan_in[`router_id(x,y)][WEST] = router_chan_out [`router_id((NX-1),y)][EAST] ;
- //conect_r2r(1,router_id(x,y),WEST,1,router_id((T1-1),y),EAST);
- r2r_cnt_all[num]=fill_r2r_cnt(1,router_id(x,y),WEST,1,router_id((T1-1),y),EAST);
- num++;
- #elif defined (IS_FMESH) // :first_x_fmesh
- unsigned int WEST_ID = T1*T2*T3 + 2*T1 + y;
- //connect_r2e(1,router_id(x,y),WEST,WEST_ID);
- r2e_cnt_all[WEST_ID].r1=router_id(x,y);
- r2e_cnt_all[WEST_ID].p1=WEST;
- er_addr [WEST_ID] = R_ADDR;
- #endif//topology
- }
- if(y < T2-1) {// : firsty
- //assign router_chan_in[`router_id(x,y)][SOUTH] = router_chan_out [`router_id(x,(y+1))][NORTH];
- // conect_r2r(1,router_id(x,y),SOUTH,1,router_id(x,(y+1)),NORTH);
- r2r_cnt_all[num]=fill_r2r_cnt(1,router_id(x,y),SOUTH,1,router_id(x,(y+1)),NORTH);
- num++;
- }else {// : lasty
- #if defined (IS_MESH) // :ly_mesh
- //assign router_chan_in[`router_id(x,y)][SOUTH]= {SMARTFLIT_CHANEL_w{1'b0}};
- connect_r2gnd(1,router_id(x,y),SOUTH);
- #elif defined (IS_TORUS) // :ly_torus
- //assign router_chan_in[`router_id(x,y)][SOUTH]= router_chan_out [`router_id(x,0)][NORTH];
- // conect_r2r(1,router_id(x,y),SOUTH,1,router_id(x,0),NORTH);
- r2r_cnt_all[num]=fill_r2r_cnt(1,router_id(x,y),SOUTH,1,router_id(x,0),NORTH);
- num++;
- #elif defined (IS_FMESH) // :ly_Fmesh
- unsigned int SOUTH_ID = T1*T2*T3 + T1 + x;
- //connect_r2e(1,router_id(x,y),SOUTH,SOUTH_ID);
- r2e_cnt_all[SOUTH_ID].r1=router_id(x,y);
- r2e_cnt_all[SOUTH_ID].p1=SOUTH;
- er_addr [SOUTH_ID] = R_ADDR;
- #endif//topology
- }
- // endpoint(s) connection
- // connect other local ports
- for (l=0; l x2) ? (x1 - x2) : (x2 - x1);
unsigned int y_diff = (y1 > y2) ? (y1 - y2) : (y2 - y1);
- return x_diff + y_diff;
+ unsigned int z_diff = (z1 > z2) ? (z1 - z2) : (z2 - z1);
+ return x_diff + y_diff + z_diff;
}
-#endif
+#endif
\ No newline at end of file
diff --git a/mpsoc/src_verilator/topology/topology_top.h b/mpsoc/src_verilator/topology/topology_top.h
index 361292c..5143e4d 100644
--- a/mpsoc/src_verilator/topology/topology_top.h
+++ b/mpsoc/src_verilator/topology/topology_top.h
@@ -37,7 +37,7 @@
NR_num-=1;
offset += router_NRs[NR_num];
}
- return offset + NR_id;
+ return offset + NR_id;
}
#endif
@@ -52,12 +52,12 @@
}
unsigned int powi (unsigned int x, unsigned int y){ // x^y
- unsigned int i;
+ unsigned int i;
unsigned int pow=1;
for (int i = 0; i >1;
mcast_list_array[i*4+2] = (ch & 0x4)>>2;
mcast_list_array[i*4+3] = (ch & 0x8)>>3;
@@ -350,28 +158,152 @@ void mcast_init(){
ch&=0xf;
mcast_list_array[i ] = ch;
}
-
}
-
for (i=0;i