`timescale 1ns / 1ps
|
`include "pronoc_def.v"
|
|
|
|
|
/****************************************************************************
|
/****************************************************************************
|
* router_top.v
|
* router_top.v
|
****************************************************************************/
|
****************************************************************************/
|
|
|
/**
|
/**
|
* Module: router_top
|
* Module: router_top
|
*
|
*
|
* add optional bypass links to two stage router.
|
* add optional bypass links to two stage router.
|
*/
|
*/
|
module router_top
|
module router_top
|
import pronoc_pkg::*;
|
import pronoc_pkg::*;
|
|
|
# (
|
# (
|
parameter P = 5 // router port num
|
parameter P = 5 // router port num
|
)(
|
)(
|
current_r_addr,// connected to constant parameter
|
current_r_id,
|
|
current_r_addr,
|
|
|
chan_in,
|
chan_in,
|
chan_out,
|
chan_out,
|
|
|
|
router_event,
|
|
|
clk,
|
clk,
|
reset
|
reset
|
|
|
);
|
);
|
|
|
|
|
localparam DISABLED =P;
|
localparam DISABLED =P;
|
|
|
input [RAw-1 : 0] current_r_addr;
|
input [RAw-1 : 0] current_r_addr;
|
|
input [31 : 0] current_r_id;
|
|
|
|
|
input smartflit_chanel_t chan_in [P-1 : 0];
|
input smartflit_chanel_t chan_in [P-1 : 0];
|
output smartflit_chanel_t chan_out [P-1 : 0];
|
output smartflit_chanel_t chan_out [P-1 : 0];
|
|
|
|
output router_event_t router_event [P-1 : 0];
|
|
|
|
|
|
|
input clk,reset;
|
input clk,reset;
|
|
|
genvar i,j;
|
genvar i,j;
|
|
|
|
|
//synthesis translate_off
|
//synthesis translate_off
|
//synopsys translate_off
|
//synopsys translate_off
|
/* verilator lint_off WIDTH */
|
/* verilator lint_off WIDTH */
|
initial begin
|
initial begin
|
if((SSA_EN=="YES") && (SMART_EN==1'b1) )begin
|
if((SSA_EN=="YES") && (SMART_EN==1'b1) )begin
|
$display("ERROR: Only one of the SMART or SAA can be enabled at the same time");
|
$display("ERROR: Only one of the SMART or SAA can be enabled at the same time");
|
$finish;
|
$finish;
|
end
|
end
|
if((SMART_EN==1'b1) && COMBINATION_TYPE!="COMB_NONSPEC" )begin
|
if((SMART_EN==1'b1) && COMBINATION_TYPE!="COMB_NONSPEC" )begin
|
$display("ERROR: SMART only works with non-speculative VSA");
|
$display("ERROR: SMART only works with non-speculative VSA");
|
$finish;
|
$finish;
|
end
|
end
|
if((MIN_PCK_SIZE > 1) && (PCK_TYPE == "SINGLE_FLIT")) begin
|
if((MIN_PCK_SIZE > 1) && (PCK_TYPE == "SINGLE_FLIT")) begin
|
$display("ERROR: The minimum packet size must be set as one for single-flit packet type NoC");
|
$display("ERROR: The minimum packet size must be set as one for single-flit packet type NoC");
|
$finish;
|
$finish;
|
end
|
end
|
|
if(((SSA_EN=="YES") || (SMART_EN==1'b1) ) && CAST_TYPE!="UNICAST") begin
|
|
$display("ERROR: SMART or SAA do not support muticast/braodcast packets");
|
|
$finish;
|
end
|
end
|
|
|
|
end
|
|
/* verilator lint_on WIDTH */
|
|
|
|
|
|
|
|
|
|
|
logic report_active_ivcs = 0;
|
logic report_active_ivcs = 0;
|
|
|
generate
|
generate
|
for (i=0; i
|
for (i=0; i
|
for (j=0; j
|
for (j=0; j
|
always @ (posedge report_active_ivcs) begin
|
always @ (posedge report_active_ivcs) begin
|
if(ivc_info[i][j].ivc_req) $display("%t : The IVC in router[%h] port[%d] VC [%d] is not empty",$time,current_r_addr,i,j);
|
if(ivc_info[i][j].ivc_req) $display("%t : The IVC in router[%h] port[%d] VC [%d] is not empty",$time,current_r_addr,i,j);
|
end
|
end
|
end
|
end
|
end
|
end
|
endgenerate
|
endgenerate
|
|
|
/* verilator lint_on WIDTH */
|
|
//synopsys translate_on
|
//synopsys translate_on
|
//synthesis translate_on
|
//synthesis translate_on
|
|
|
|
|
|
|
|
generate
|
|
for (i=0; i
|
|
assign router_event[i].flit_wr_i = chan_in[i].flit_chanel.flit_wr;
|
|
assign router_event[i].bypassed_num = chan_in[i].smart_chanel.bypassed_num;
|
|
assign router_event[i].pck_wr_i = chan_in[i].flit_chanel.flit_wr & chan_in[i].flit_chanel.flit.hdr_flag;
|
|
assign router_event[i].flit_wr_o = chan_out[i].flit_chanel.flit_wr;
|
|
assign router_event[i].pck_wr_o = chan_out[i].flit_chanel.flit_wr & chan_out[i].flit_chanel.flit.hdr_flag;
|
|
assign router_event[i].flit_in_bypassed = chan_out[i].smart_chanel.flit_in_bypassed;
|
|
|
|
end
|
|
endgenerate
|
|
|
|
|
|
|
|
|
|
|
|
|
flit_chanel_t r2_chan_in [P-1 : 0];
|
flit_chanel_t r2_chan_in [P-1 : 0];
|
flit_chanel_t r2_chan_out [P-1 : 0];
|
flit_chanel_t r2_chan_out [P-1 : 0];
|
|
|
ivc_info_t ivc_info [P-1 : 0][V-1 : 0];
|
ivc_info_t ivc_info [P-1 : 0][V-1 : 0];
|
ovc_info_t ovc_info [P-1 : 0][V-1 : 0];
|
ovc_info_t ovc_info [P-1 : 0][V-1 : 0];
|
iport_info_t iport_info [P-1 : 0];
|
iport_info_t iport_info [P-1 : 0];
|
oport_info_t oport_info [P-1 : 0];
|
oport_info_t oport_info [P-1 : 0];
|
smart_chanel_t smart_chanel_new [P-1 : 0];
|
smart_chanel_t smart_chanel_new [P-1 : 0];
|
smart_chanel_t smart_chanel_in [P-1 : 0];
|
smart_chanel_t smart_chanel_in [P-1 : 0];
|
smart_chanel_t smart_chanel_out [P-1 : 0];
|
smart_chanel_t smart_chanel_out [P-1 : 0];
|
smart_ctrl_t smart_ctrl [P-1 : 0];
|
smart_ctrl_t smart_ctrl [P-1 : 0];
|
|
|
|
|
ctrl_chanel_t ctrl_in [P-1 : 0];
|
ctrl_chanel_t ctrl_in [P-1 : 0];
|
ctrl_chanel_t ctrl_out [P-1 : 0];
|
ctrl_chanel_t ctrl_out [P-1 : 0];
|
|
|
generate
|
generate
|
for (i=0; i
|
for (i=0; i
|
assign ctrl_in [i] = chan_in[i].ctrl_chanel;
|
assign ctrl_in [i] = chan_in[i].ctrl_chanel;
|
assign chan_out[i].ctrl_chanel= ctrl_out [i];
|
assign chan_out[i].ctrl_chanel= ctrl_out [i];
|
|
|
end
|
end
|
endgenerate
|
endgenerate
|
|
|
// synthesis translate_off
|
// synthesis translate_off
|
|
|
//header flit info, it is useful for debugin
|
//header flit info, it is useful for debugin
|
hdr_flit_t hdr_flit_i [P-1 : 0]; // the received packet header flit info
|
hdr_flit_t hdr_flit_i [P-1 : 0]; // the received packet header flit info
|
hdr_flit_t hdr_flit_o [P-1 : 0]; // the sent packet header flit info
|
hdr_flit_t hdr_flit_o [P-1 : 0]; // the sent packet header flit info
|
|
|
generate
|
generate
|
for (i=0; i
|
for (i=0; i
|
|
|
|
|
|
|
header_flit_info in_extract(
|
header_flit_info in_extract(
|
.flit(chan_in[i].flit_chanel.flit),
|
.flit(chan_in[i].flit_chanel.flit),
|
.hdr_flit( hdr_flit_i[i]),
|
.hdr_flit( hdr_flit_i[i]),
|
.data_o()
|
.data_o()
|
);
|
);
|
|
|
header_flit_info out_extract(
|
header_flit_info out_extract(
|
.flit(chan_out[i].flit_chanel.flit),
|
.flit(chan_out[i].flit_chanel.flit),
|
.hdr_flit( hdr_flit_o[i]),
|
.hdr_flit( hdr_flit_o[i]),
|
.data_o()
|
.data_o()
|
);
|
);
|
|
|
if(DEBUG_EN) begin :dbg
|
if(DEBUG_EN) begin :dbg
|
check_flit_chanel_type_is_in_order #(
|
check_flit_chanel_type_is_in_order #(
|
.V(V),
|
.V(V),
|
.PCK_TYPE(PCK_TYPE),
|
.PCK_TYPE(PCK_TYPE),
|
.MIN_PCK_SIZE(MIN_PCK_SIZE)
|
.MIN_PCK_SIZE(MIN_PCK_SIZE)
|
)
|
)
|
IVC_flit_type_check
|
IVC_flit_type_check
|
(
|
(
|
.clk(clk),
|
.clk(clk),
|
.reset(reset),
|
.reset(reset),
|
.hdr_flg_in(chan_in[i].flit_chanel.flit.hdr_flag),
|
.hdr_flg_in(chan_in[i].flit_chanel.flit.hdr_flag),
|
.tail_flg_in(chan_in[i].flit_chanel.flit.tail_flag),
|
.tail_flg_in(chan_in[i].flit_chanel.flit.tail_flag),
|
.flit_in_wr(chan_in[i].flit_chanel.flit_wr),
|
.flit_in_wr(chan_in[i].flit_chanel.flit_wr),
|
.vc_num_in(chan_in[i].flit_chanel.flit.vc)
|
.vc_num_in(chan_in[i].flit_chanel.flit.vc)
|
);
|
);
|
|
|
|
check_pck_size #(
|
|
.V(V),
|
|
.MIN_PCK_SIZE(MIN_PCK_SIZE),
|
|
.Fw(Fw),
|
|
.DAw(DAw),
|
|
.CAST_TYPE(CAST_TYPE),
|
|
.NE(NE),
|
|
.B(B),
|
|
.LB(LB)
|
|
)
|
|
check_pck_siz
|
|
(
|
|
.clk(clk),
|
|
.reset(reset),
|
|
.hdr_flg_in(chan_in[i].flit_chanel.flit.hdr_flag),
|
|
.tail_flg_in(chan_in[i].flit_chanel.flit.tail_flag),
|
|
.flit_in_wr(chan_in[i].flit_chanel.flit_wr),
|
|
.vc_num_in(chan_in[i].flit_chanel.flit.vc),
|
|
.dest_e_addr_in(chan_in[i].flit_chanel.flit.payload[E_DST_MSB : E_DST_LSB])
|
|
);
|
|
|
|
|
end
|
end
|
|
|
|
|
end
|
end
|
endgenerate
|
endgenerate
|
// synthesis translate_on
|
// synthesis translate_on
|
|
|
|
|
|
|
|
|
|
|
wire [V-1 : 0] ovc_locally_requested [P-1 : 0];
|
wire [V-1 : 0] ovc_locally_requested [P-1 : 0];
|
flit_chanel_t ss_flit_chanel [P-1 : 0]; //flit bypass link goes to straight port
|
flit_chanel_t ss_flit_chanel [P-1 : 0]; //flit bypass link goes to straight port
|
|
|
router_two_stage #(//r2
|
router_two_stage #(//r2
|
.P (P)
|
.P (P)
|
)router_ref (
|
)router_ref (
|
.ivc_info (ivc_info),
|
.ivc_info (ivc_info),
|
.ovc_info (ovc_info),
|
.ovc_info (ovc_info),
|
.iport_info (iport_info),
|
.iport_info (iport_info),
|
.oport_info (oport_info),
|
.oport_info (oport_info),
|
.smart_ctrl_in (smart_ctrl),
|
.smart_ctrl_in (smart_ctrl),
|
.current_r_addr(current_r_addr),
|
.current_r_addr(current_r_addr),
|
|
.current_r_id(current_r_id),
|
.chan_in (r2_chan_in),
|
.chan_in (r2_chan_in),
|
.chan_out (r2_chan_out),
|
.chan_out (r2_chan_out),
|
.ctrl_in (ctrl_in),
|
.ctrl_in (ctrl_in),
|
.ctrl_out (ctrl_out),
|
.ctrl_out (ctrl_out),
|
.clk (clk),
|
.clk (clk),
|
.reset (reset)
|
.reset (reset)
|
);
|
);
|
|
|
generate
|
generate
|
|
|
if(SMART_EN) begin :smart
|
if(SMART_EN) begin :smart
|
|
|
|
|
smart_forward_ivc_info
|
smart_forward_ivc_info
|
#(
|
#(
|
.P(P)
|
.P(P)
|
)forward_ivc(
|
)forward_ivc(
|
.ivc_info(ivc_info),
|
.ivc_info(ivc_info),
|
.iport_info(iport_info),
|
.iport_info(iport_info),
|
.oport_info(oport_info),
|
.oport_info(oport_info),
|
.smart_chanel(smart_chanel_new),
|
.smart_chanel(smart_chanel_new),
|
.ovc_locally_requested(ovc_locally_requested),
|
.ovc_locally_requested(ovc_locally_requested),
|
.reset(reset),
|
.reset(reset),
|
.clk(clk)
|
.clk(clk)
|
);
|
);
|
|
|
smart_bypass_chanels
|
smart_bypass_chanels
|
#(
|
#(
|
.P(P)
|
.P(P)
|
)smart_bypass(
|
)smart_bypass(
|
.ivc_info(ivc_info),
|
.ivc_info(ivc_info),
|
.iport_info(iport_info),
|
.iport_info(iport_info),
|
.oport_info(oport_info),
|
.oport_info(oport_info),
|
.smart_chanel_new(smart_chanel_new),
|
.smart_chanel_new(smart_chanel_new),
|
.smart_chanel_in(smart_chanel_in),
|
.smart_chanel_in(smart_chanel_in),
|
.smart_chanel_out(smart_chanel_out),
|
.smart_chanel_out(smart_chanel_out),
|
.smart_req( ),
|
.smart_req( ),
|
.reset(reset),
|
.reset(reset),
|
.clk(clk)
|
.clk(clk)
|
);
|
);
|
|
|
wire [RAw-1: 0] neighbors_r_addr [P-1: 0];
|
wire [RAw-1: 0] neighbors_r_addr [P-1: 0];
|
wire [V-1 : 0] credit_out [P-1 : 0];
|
wire [V-1 : 0] credit_out [P-1 : 0];
|
wire [V-1 : 0] ivc_smart_en [P-1 : 0];
|
wire [V-1 : 0] ivc_smart_en [P-1 : 0];
|
for (i=0;i
|
for (i=0;i
|
localparam SS_PORT = strieght_port (P,i);
|
localparam SS_PORT = strieght_port (P,i);
|
if(SS_PORT == DISABLED) begin: smart_dis
|
if(SS_PORT == DISABLED) begin: smart_dis
|
assign r2_chan_in[i] = chan_in[i].flit_chanel;
|
assign r2_chan_in[i] = chan_in[i].flit_chanel;
|
assign chan_out[i].flit_chanel = r2_chan_out[i];
|
assign chan_out[i].flit_chanel = r2_chan_out[i];
|
assign smart_ctrl[i]={SMART_CTRL_w{1'b0}};
|
assign smart_ctrl[i]={SMART_CTRL_w{1'b0}};
|
end
|
end
|
else begin :smart_en
|
else begin :smart_en
|
assign neighbors_r_addr [i] = chan_in[i].ctrl_chanel.neighbors_r_addr;
|
assign neighbors_r_addr [i] = chan_in[i].ctrl_chanel.neighbors_r_addr;
|
//smart allocator
|
//smart allocator
|
smart_allocator_per_iport #(
|
smart_allocator_per_iport #(
|
.P (P ),
|
.P (P ),
|
.SW_LOC (i ),
|
.SW_LOC (i ),
|
.SS_PORT_LOC (SS_PORT )
|
.SS_PORT_LOC (SS_PORT )
|
) smart_allocator(
|
) smart_allocator(
|
.clk (clk ),
|
.clk (clk ),
|
.reset (reset ),
|
.reset (reset ),
|
.current_r_addr_i (current_r_addr ),
|
.current_r_addr_i (current_r_addr ),
|
.neighbors_r_addr_i (neighbors_r_addr ),
|
.neighbors_r_addr_i (neighbors_r_addr ),
|
.smart_chanel_i (chan_in[i].smart_chanel ),
|
.smart_chanel_i (chan_in[i].smart_chanel ),
|
.flit_chanel_i (chan_in[i].flit_chanel ),
|
.flit_chanel_i (chan_in[i].flit_chanel ),
|
.ivc_info (ivc_info[i] ),
|
.ivc_info (ivc_info[i] ),
|
.ss_ovc_info (ovc_info[SS_PORT] ),
|
.ss_ovc_info (ovc_info[SS_PORT] ),
|
.ovc_locally_requested (ovc_locally_requested[SS_PORT] ),
|
.ovc_locally_requested (ovc_locally_requested[SS_PORT] ),
|
.ss_smart_chanel_new (smart_chanel_new[SS_PORT]),
|
.ss_smart_chanel_new (smart_chanel_new[SS_PORT]),
|
.ss_port_link_reg_flit_wr (r2_chan_out[SS_PORT].flit_wr),
|
.ss_port_link_reg_flit_wr (r2_chan_out[SS_PORT].flit_wr),
|
|
|
.smart_ivc_single_flit_pck_o (smart_ctrl[i].ivc_single_flit_pck),
|
.smart_ivc_single_flit_pck_o (smart_ctrl[i].ivc_single_flit_pck),
|
.smart_destport_o (smart_ctrl[i].destport ),
|
.smart_destport_o (smart_ctrl[i].destport ),
|
.smart_lk_destport_o (smart_ctrl[i].lk_destport ),
|
.smart_lk_destport_o (smart_ctrl[i].lk_destport ),
|
.smart_hdr_flit_req_o (smart_ctrl[i].hdr_flit_req ),
|
.smart_hdr_flit_req_o (smart_ctrl[i].hdr_flit_req ),
|
.smart_ivc_smart_en_o (ivc_smart_en[i] ),
|
.smart_ivc_smart_en_o (ivc_smart_en[i] ),
|
.smart_credit_o (smart_ctrl[i].credit_out ),
|
.smart_credit_o (smart_ctrl[i].credit_out ),
|
.smart_buff_space_decreased_o (smart_ctrl[SS_PORT].buff_space_decreased),
|
.smart_buff_space_decreased_o (smart_ctrl[SS_PORT].buff_space_decreased),
|
.smart_ivc_num_getting_ovc_grant_o(smart_ctrl[i].ivc_num_getting_ovc_grant),
|
.smart_ivc_num_getting_ovc_grant_o(smart_ctrl[i].ivc_num_getting_ovc_grant),
|
.smart_ivc_reset_o (smart_ctrl[i].ivc_reset),
|
.smart_ivc_reset_o (smart_ctrl[i].ivc_reset),
|
.smart_ivc_granted_ovc_num_o (smart_ctrl[i].ivc_granted_ovc_num),
|
.smart_ivc_granted_ovc_num_o (smart_ctrl[i].ivc_granted_ovc_num),
|
.smart_ovc_single_flit_pck_o (smart_ctrl[SS_PORT].ovc_single_flit_pck),
|
.smart_ovc_single_flit_pck_o (smart_ctrl[SS_PORT].ovc_single_flit_pck),
|
.smart_ss_ovc_is_allocated_o (smart_ctrl[SS_PORT].ovc_is_allocated),
|
.smart_ss_ovc_is_allocated_o (smart_ctrl[SS_PORT].ovc_is_allocated),
|
.smart_ss_ovc_is_released_o (smart_ctrl[SS_PORT].ovc_is_released),
|
.smart_ss_ovc_is_released_o (smart_ctrl[SS_PORT].ovc_is_released),
|
.smart_mask_available_ss_ovc_o (smart_ctrl[SS_PORT].mask_available_ovc)
|
.smart_mask_available_ss_ovc_o (smart_ctrl[SS_PORT].mask_available_ovc)
|
|
|
);
|
);
|
|
|
assign smart_ctrl[i].ivc_smart_en = ivc_smart_en[i];
|
assign smart_ctrl[i].ivc_smart_en = ivc_smart_en[i];
|
assign smart_ctrl[i].smart_en = |ivc_smart_en[i];
|
assign smart_ctrl[i].smart_en = |ivc_smart_en[i];
|
|
|
|
|
|
|
|
|
// synthesis translate_off
|
// synthesis translate_off
|
//assign chan_out[i].smart_chanel = (smart_chanel[i].requests[0]) ? smart_chanel_new[i] : take ss shifted smart;
|
//assign chan_out[i].smart_chanel = (smart_chanel[i].requests[0]) ? smart_chanel_new[i] : take ss shifted smart;
|
smart_chanel_check check (
|
smart_chanel_check check (
|
.flit_chanel(chan_out[i].flit_chanel),
|
.flit_chanel(chan_out[i].flit_chanel),
|
.smart_chanel(chan_out[i].smart_chanel),
|
.smart_chanel(chan_out[i].smart_chanel),
|
.reset(reset),
|
.reset(reset),
|
.clk(clk)
|
.clk(clk)
|
);
|
);
|
// synthesis translate_on
|
// synthesis translate_on
|
|
|
assign smart_chanel_in[i] = chan_in[i].smart_chanel;
|
assign smart_chanel_in[i] = chan_in[i].smart_chanel;
|
assign chan_out[i].smart_chanel = smart_chanel_out[i];
|
|
|
|
//r2 demux
|
//r2 demux
|
// flit_in_wr demux
|
// flit_in_wr demux
|
always @(*) begin
|
always @(*) begin
|
|
chan_out[i].smart_chanel = smart_chanel_out[i];
|
|
chan_out[i].smart_chanel.flit_in_bypassed =smart_ctrl[i].smart_en & chan_in[i].flit_chanel.flit_wr ;
|
|
|
|
|
//mask only flit_wr if smart_en is asserted
|
//mask only flit_wr if smart_en is asserted
|
r2_chan_in[i] = chan_in[i].flit_chanel;
|
r2_chan_in[i] = chan_in[i].flit_chanel;
|
//can replace destport here and remove lk rout from internal router
|
//can replace destport here and remove lk rout from internal router
|
if (smart_ctrl[i].smart_en) r2_chan_in[i].flit_wr = 1'b0;
|
if (smart_ctrl[i].smart_en) r2_chan_in[i].flit_wr = 1'b0;
|
|
|
|
|
//send flit_in to straight out port. Replace lk destport in header flit
|
//send flit_in to straight out port. Replace lk destport in header flit
|
ss_flit_chanel[SS_PORT] = chan_in[i].flit_chanel;
|
ss_flit_chanel[SS_PORT] = chan_in[i].flit_chanel;
|
if(smart_ctrl[i].hdr_flit_req) ss_flit_chanel[SS_PORT].flit[DST_P_MSB : DST_P_LSB] = smart_ctrl[i].lk_destport;
|
if(smart_ctrl[i].hdr_flit_req) ss_flit_chanel[SS_PORT].flit[DST_P_MSB : DST_P_LSB] = smart_ctrl[i].lk_destport;
|
end
|
end
|
|
|
always @(*) begin
|
always @(*) begin
|
// mux out flit channel
|
// mux out flit channel
|
chan_out[i].flit_chanel = r2_chan_out[i];
|
chan_out[i].flit_chanel = r2_chan_out[i];
|
chan_out[i].flit_chanel.credit = credit_out[i] ;
|
chan_out[i].flit_chanel.credit = credit_out[i] ;
|
if(smart_ctrl[SS_PORT].smart_en) begin
|
if(smart_ctrl[SS_PORT].smart_en) begin
|
chan_out[i].flit_chanel.flit = ss_flit_chanel[i].flit;
|
chan_out[i].flit_chanel.flit = ss_flit_chanel[i].flit;
|
chan_out[i].flit_chanel.flit_wr = ss_flit_chanel[i].flit_wr;
|
chan_out[i].flit_chanel.flit_wr = ss_flit_chanel[i].flit_wr;
|
|
|
end
|
end
|
end
|
end
|
|
|
smart_credit_manage #(
|
smart_credit_manage #(
|
.V (V ),
|
.V (V ),
|
.B (B )
|
.B (B )
|
) smart_credit_manage (
|
) smart_credit_manage (
|
.credit_in (r2_chan_out[i].credit ),
|
.credit_in (r2_chan_out[i].credit ),
|
.smart_credit_in (smart_ctrl[i].credit_out ),
|
.smart_credit_in (smart_ctrl[i].credit_out ),
|
.credit_out ( credit_out[i] ),
|
.credit_out ( credit_out[i] ),
|
.reset (reset ),
|
.reset (reset ),
|
.clk (clk ));
|
.clk (clk ));
|
|
|
|
|
|
|
end //for
|
end //for
|
end//smart_en
|
end//smart_en
|
|
|
|
|
|
|
end else begin :no_smart
|
end else begin :no_smart
|
for (i=0;i
|
for (i=0;i
|
assign r2_chan_in[i] = chan_in[i].flit_chanel;
|
assign r2_chan_in[i] = chan_in[i].flit_chanel;
|
assign chan_out[i].flit_chanel = r2_chan_out[i];
|
assign chan_out[i].flit_chanel = r2_chan_out[i];
|
assign smart_ctrl[i]={SMART_CTRL_w{1'b0}};
|
assign smart_ctrl[i]={SMART_CTRL_w{1'b0}};
|
end//for
|
end//for
|
end
|
end
|
endgenerate
|
endgenerate
|
|
|
|
|
//`ifdef VERILATOR
|
//`ifdef VERILATOR
|
// logic nb_router_active [P-1 : 0] /*verilator public_flat_rd*/ ;
|
// logic nb_router_active [P-1 : 0] /*verilator public_flat_rd*/ ;
|
// logic router_is_ideal /*verilator public_flat_rd*/ ;
|
// logic router_is_ideal /*verilator public_flat_rd*/ ;
|
// logic not_ideal_next,not_ideal;
|
// logic not_ideal_next,not_ideal;
|
// integer ii,jj;
|
// integer ii,jj;
|
// always @ (*) begin
|
// always @ (*) begin
|
// router_is_ideal = 1'b1;
|
// router_is_ideal = 1'b1;
|
// not_ideal_next = 1'b0;
|
// not_ideal_next = 1'b0;
|
// for (ii=0; ii
|
// for (ii=0; ii
|
// nb_router_active[ii]= 1'b0;
|
// nb_router_active[ii]= 1'b0;
|
// if (chan_out[ii].flit_chanel.flit_wr) nb_router_active[ii]=1'b1;
|
// if (chan_out[ii].flit_chanel.flit_wr) nb_router_active[ii]=1'b1;
|
// if (chan_out[ii].flit_chanel.credit > {V{1'b0}} ) nb_router_active[ii]=1'b1;
|
// if (chan_out[ii].flit_chanel.credit > {V{1'b0}} ) nb_router_active[ii]=1'b1;
|
// if (chan_out[ii].smart_chanel.requests > {SMART_NUM{1'b0}} ) nb_router_active[ii]=1'b1;
|
// if (chan_out[ii].smart_chanel.requests > {SMART_NUM{1'b0}} ) nb_router_active[ii]=1'b1;
|
//
|
//
|
// for (jj=0; jj
|
// for (jj=0; jj
|
// //no active request is in any input queues
|
// //no active request is in any input queues
|
// if(ivc_info[ii][jj].ivc_req)begin
|
// if(ivc_info[ii][jj].ivc_req)begin
|
// router_is_ideal=1'b0;
|
// router_is_ideal=1'b0;
|
// not_ideal_next=1'b1;
|
// not_ideal_next=1'b1;
|
// end
|
// end
|
// end
|
// end
|
// //no output flit wr
|
// //no output flit wr
|
// if (r2_chan_out[ii].flit_wr) router_is_ideal=1'b0;
|
// if (r2_chan_out[ii].flit_wr) router_is_ideal=1'b0;
|
// end
|
// end
|
// if (not_ideal) router_is_ideal =1'b0; // delay one clock cycle if the input req exist in last clock cycle bot not on the current one
|
// if (not_ideal) router_is_ideal =1'b0; // delay one clock cycle if the input req exist in last clock cycle bot not on the current one
|
// end
|
// end
|
// register #( .W(1)) no_ideal_register (.in(not_ideal_next), .reset (reset), .clk(clk), .out (not_ideal));
|
// pronoc_register #( .W(1)) no_ideal_register (.in(not_ideal_next), .reset (reset), .clk(clk), .out (not_ideal));
|
//`endif
|
//`endif
|
|
|
|
|
|
|
endmodule
|
endmodule
|
|
|
|
|
|
|
module router_top_v //to be used as top module in veralator
|
module router_top_v //to be used as top module in veralator
|
import pronoc_pkg::*;
|
import pronoc_pkg::*;
|
|
|
# (
|
# (
|
parameter P = 5 // router port num
|
parameter P = 5 // router port num
|
)(
|
)(
|
current_r_addr,
|
current_r_addr,
|
|
current_r_id,
|
|
|
chan_in,
|
chan_in,
|
chan_out,
|
chan_out,
|
|
|
|
router_event,
|
|
|
clk,
|
clk,
|
reset
|
reset
|
|
|
);
|
);
|
|
|
|
|
|
|
input [RAw-1 : 0] current_r_addr;
|
input [RAw-1 : 0] current_r_addr;
|
|
input [31:0] current_r_id;
|
|
|
input smartflit_chanel_t chan_in [P-1 : 0];
|
input smartflit_chanel_t chan_in [P-1 : 0];
|
output smartflit_chanel_t chan_out [P-1 : 0];
|
output smartflit_chanel_t chan_out [P-1 : 0];
|
input reset,clk;
|
input reset,clk;
|
|
|
|
output router_event_t router_event [P-1 : 0];
|
|
|
|
|
router_top # (
|
router_top # (
|
.P(P)
|
.P(P)
|
)
|
)
|
router
|
router
|
(
|
(
|
|
.current_r_id(current_r_id),
|
.current_r_addr(current_r_addr),
|
.current_r_addr(current_r_addr),
|
.chan_in (chan_in),
|
.chan_in (chan_in),
|
.chan_out(chan_out),
|
.chan_out(chan_out),
|
|
.router_event(router_event),
|
.clk(clk),
|
.clk(clk),
|
.reset(reset)
|
.reset(reset)
|
);
|
);
|
|
|
|
|
endmodule
|
endmodule
|
|
|
|
|
|
|