Line 1... |
Line 1... |
`timescale 1ns / 1ps
|
`include "pronoc_def.v"
|
|
|
/**************************************
|
/**************************************
|
* Module: router_bypass
|
* Module: router_bypass
|
* Date:2020-11-24
|
* Date:2020-11-24
|
* Author: alireza
|
* Author: alireza
|
*
|
*
|
* Description:
|
* Description:
|
* This file contains HDL modules that can be added
|
* This file contains HDL modules that can be added
|
* to a 3-stage NoC router and provide router bypassing
|
* to a 2-stage NoC router and provides router bypassing
|
***************************************/
|
***************************************/
|
|
|
/**************************
|
/**************************
|
* SMART_flags_gen:
|
* SMART_flags_gen:
|
* generate SMART flags based on NoC parameter, current router's port and address,
|
* generate SMART flags based on NoC parameter, current router's port and address,
|
Line 18... |
Line 18... |
* smart_flag_o indicates how many more router in direct line can be bypassed
|
* smart_flag_o indicates how many more router in direct line can be bypassed
|
* if SPB_OPORT_NUM is also one of the possible output port in
|
* if SPB_OPORT_NUM is also one of the possible output port in
|
* lk-ahead routing, The packet can by-pass the next router once the bypassing condition are met
|
* lk-ahead routing, The packet can by-pass the next router once the bypassing condition are met
|
***************************/
|
***************************/
|
|
|
module register #(parameter W=1)(
|
`include "pronoc_def.v"
|
input [W-1:0] in,
|
|
input reset,
|
|
input clk,
|
|
output reg [W-1:0] out
|
|
);
|
|
|
|
`ifdef SYNC_RESET_MODE
|
|
always @ (posedge clk )begin
|
|
`else
|
|
always @ (posedge clk or posedge reset)begin
|
|
`endif
|
|
if(reset) begin
|
|
out<={W{1'b0}};
|
|
end else begin
|
|
out<=in;
|
|
end
|
|
end
|
|
endmodule
|
|
|
|
|
|
module reduction_or #(
|
module reduction_or #(
|
parameter W = 5,//out width
|
parameter W = 5,//out width
|
parameter N = 4 //array lenght
|
parameter N = 4 //array lenght
|
Line 113... |
Line 95... |
|
|
|
|
endmodule
|
endmodule
|
|
|
|
|
|
module onehot_mux_1D_reverse #(
|
|
parameter W = 5,//out width p
|
|
parameter N = 4 //sel width v
|
|
)(
|
|
input [W*N-1 : 0] in,
|
|
input [N-1 : 0] sel,
|
|
output [W-1 : 0] out
|
|
);
|
|
|
|
wire [N-1 : 0] in_array [W-1 : 0];
|
|
wire [W-1 : 0] in_array2[N-1 : 0];
|
|
|
|
genvar i,j;
|
|
generate
|
|
for (i=0;i
|
|
assign in_array[i] = in[(i+1)*N-1 : i*N];
|
|
for (j=0;j
|
|
assign in_array2[j][i] = in_array[i][j];
|
|
end
|
|
end
|
|
endgenerate
|
|
|
|
|
|
onehot_mux_2D #(
|
|
.W (N ),
|
|
.N (W )
|
|
) onehot_mux_2D (
|
|
.in (in_array2 ),
|
|
.sel (sel ),
|
|
.out (out ));
|
|
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
|
|
|
|
|
module header_flit_info
|
module header_flit_info
|
import pronoc_pkg::*;
|
import pronoc_pkg::*;
|
#(
|
#(
|
Line 293... |
Line 312... |
assign mask_gen[z][j][i] = non_assigned_vc_req[i][j] & ivc_info[i][j].destport_one_hot[z];
|
assign mask_gen[z][j][i] = non_assigned_vc_req[i][j] & ivc_info[i][j].destport_one_hot[z];
|
end
|
end
|
assign ovc_locally_requested_next[i][j]=|mask_gen[i][j];
|
assign ovc_locally_requested_next[i][j]=|mask_gen[i][j];
|
end//V
|
end//V
|
|
|
register #(.W(V)) reg1 (.in(ovc_locally_requested_next[i] ), .reset(reset), .clk(clk), .out(ovc_locally_requested[i]));
|
pronoc_register #(.W(V)) reg1 (.in(ovc_locally_requested_next[i] ), .reset(reset), .clk(clk), .out(ovc_locally_requested[i]));
|
|
|
|
|
|
|
|
|
onehot_mux_2D #(.W(SMART_IVC_w),.N(V)) mux1 ( .in(smart_ivc_info[i]), .sel(iport_info[i].swa_first_level_grant), .out(smart_ivc_mux[i]));
|
onehot_mux_2D #(.W(SMART_IVC_w),.N(V)) mux1 ( .in(smart_ivc_info[i]), .sel(iport_info[i].swa_first_level_grant), .out(smart_ivc_mux[i]));
|
Line 336... |
Line 355... |
|
|
assign smart_chanel_next[i].dest_e_addr= smart_vc_info_o[i].dest_e_addr;
|
assign smart_chanel_next[i].dest_e_addr= smart_vc_info_o[i].dest_e_addr;
|
assign smart_chanel_next[i].ovc= (smart_vc_info_o[i].ovc_is_assigned)? assigned_ovc[i] : oport_info[i].non_smart_ovc_is_allocated;
|
assign smart_chanel_next[i].ovc= (smart_vc_info_o[i].ovc_is_assigned)? assigned_ovc[i] : oport_info[i].non_smart_ovc_is_allocated;
|
assign smart_chanel_next[i].hdr_flit=~smart_vc_info_o[i].ovc_is_assigned;
|
assign smart_chanel_next[i].hdr_flit=~smart_vc_info_o[i].ovc_is_assigned;
|
assign smart_chanel_next[i].requests = (oport_info[i].any_ovc_granted)? {SMART_NUM{1'b1}}:{SMART_NUM{1'b0}} ;
|
assign smart_chanel_next[i].requests = (oport_info[i].any_ovc_granted)? {SMART_NUM{1'b1}}:{SMART_NUM{1'b0}} ;
|
|
assign smart_chanel_next[i].bypassed_num = {BYPASSw{1'b0}} ;
|
|
|
|
|
if( ADD_PIPREG_AFTER_CROSSBAR == 1 ) begin :link_reg
|
if( ADD_PIPREG_AFTER_CROSSBAR == 1 ) begin :link_reg
|
register #(
|
pronoc_register #(
|
.W ( SMART_CHANEL_w )
|
.W ( SMART_CHANEL_w )
|
) register (
|
) register (
|
.in (smart_chanel_next[i] ),
|
.in (smart_chanel_next[i] ),
|
.reset (reset ),
|
.reset (reset ),
|
.clk (clk ),
|
.clk (clk ),
|
Line 351... |
Line 372... |
end else begin :no_link_reg
|
end else begin :no_link_reg
|
assign smart_chanel[i] = smart_chanel_next[i];
|
assign smart_chanel[i] = smart_chanel_next[i];
|
end
|
end
|
/*
|
/*
|
|
|
`ifdef SYNC_RESET_MODE
|
always @ (`pronoc_clk_reset_edge )begin
|
always @ (posedge clk )begin
|
if(`pronoc_reset) begin
|
`else
|
|
always @ (posedge clk or posedge reset)begin
|
|
`endif
|
|
if(reset) begin
|
|
smart_chanel[i].dest_e_addr<= {EAw{1'b0}};
|
smart_chanel[i].dest_e_addr<= {EAw{1'b0}};
|
smart_chanel[i].ovc<= {V{1'b0}};
|
smart_chanel[i].ovc<= {V{1'b0}};
|
smart_chanel[i].hdr_flit<=1'b0;
|
smart_chanel[i].hdr_flit<=1'b0;
|
end else begin
|
end else begin
|
smart_chanel[i].dest_e_addr<= smart_vc_info_o[i].dest_e_addr;
|
smart_chanel[i].dest_e_addr<= smart_vc_info_o[i].dest_e_addr;
|
Line 446... |
Line 463... |
//smart_chanel_shifter
|
//smart_chanel_shifter
|
assign smart_forwardable[i] = | (ivc_forwardable[i] & smart_chanel_in[i].ovc);
|
assign smart_forwardable[i] = | (ivc_forwardable[i] & smart_chanel_in[i].ovc);
|
always @(*) begin
|
always @(*) begin
|
smart_chanel_shifted[i] = smart_chanel_in [i];
|
smart_chanel_shifted[i] = smart_chanel_in [i];
|
{smart_chanel_shifted[i].requests,rq[i]} =(smart_forwardable[i])? {1'b0,smart_chanel_in[i].requests}:{{SMART_NUM{1'b0}},smart_chanel_in[i].requests[0]};
|
{smart_chanel_shifted[i].requests,rq[i]} =(smart_forwardable[i])? {1'b0,smart_chanel_in[i].requests}:{{SMART_NUM{1'b0}},smart_chanel_in[i].requests[0]};
|
|
smart_chanel_shifted[i].bypassed_num = smart_chanel_in [i].bypassed_num +1'b1;
|
end
|
end
|
assign smart_req[i]=rq[i];
|
assign smart_req[i]=rq[i];
|
// mux out smart chanel
|
// mux out smart chanel
|
assign smart_chanel_out[i] = (outport_is_granted[i])? smart_chanel_new[i] : smart_chanel_shifted[SS_PORT];
|
assign smart_chanel_out[i] = (outport_is_granted[i])? smart_chanel_new[i] : smart_chanel_shifted[SS_PORT];
|
|
|
Line 486... |
Line 504... |
input [DSTPw-1 : 0] destport_coded_i;
|
input [DSTPw-1 : 0] destport_coded_i;
|
output goes_straight_o;
|
output goes_straight_o;
|
|
|
generate
|
generate
|
/* verilator lint_off WIDTH */
|
/* verilator lint_off WIDTH */
|
if(TOPOLOGY == "MESH" || TOPOLOGY == "TORUS" ) begin :twoD
|
if(TOPOLOGY == "MESH" || TOPOLOGY == "TORUS" || TOPOLOGY =="FMESH" ) begin :twoD
|
/* verilator lint_on WIDTH */
|
/* verilator lint_on WIDTH */
|
if (SS_PORT_LOC == 0 || SS_PORT_LOC > 4) begin : local_ports
|
if (SS_PORT_LOC == 0 || SS_PORT_LOC > 4) begin : local_ports
|
assign goes_straight_o = 1'b0; // There is not a next router in this case at all
|
assign goes_straight_o = 1'b0; // There is not a next router in this case at all
|
end
|
end
|
else begin :non_local
|
else begin :non_local
|
Line 616... |
Line 634... |
wire smart_req_valid_next = smart_requests_i & smart_ivc_i & goes_straight;
|
wire smart_req_valid_next = smart_requests_i & smart_ivc_i & goes_straight;
|
logic smart_req_valid;
|
logic smart_req_valid;
|
wire smart_hdr_flit_req_next = smart_req_valid_next & smart_hdr_flit;
|
wire smart_hdr_flit_req_next = smart_req_valid_next & smart_hdr_flit;
|
logic smart_hdr_flit_req;
|
logic smart_hdr_flit_req;
|
|
|
register #(.W(1)) req1 (.in(smart_req_valid_next), .reset(reset), .clk(clk), .out(smart_req_valid));
|
pronoc_register #(.W(1)) req1 (.in(smart_req_valid_next), .reset(reset), .clk(clk), .out(smart_req_valid));
|
register #(.W(1)) req2 (.in(smart_hdr_flit_req_next), .reset(reset), .clk(clk), .out(smart_hdr_flit_req));
|
pronoc_register #(.W(1)) req2 (.in(smart_hdr_flit_req_next), .reset(reset), .clk(clk), .out(smart_hdr_flit_req));
|
|
|
|
|
|
|
|
|
// condition1: new smart vc allocation condition
|
// condition1: new smart vc allocation condition
|
Line 669... |
Line 687... |
|
|
//mask the available SS OVC for local requests allocation if the following conditions met
|
//mask the available SS OVC for local requests allocation if the following conditions met
|
assign smart_mask_available_ss_ovc_o = smart_hdr_flit_req & ~ovc_locally_requested & condition2;
|
assign smart_mask_available_ss_ovc_o = smart_hdr_flit_req & ~ovc_locally_requested & condition2;
|
|
|
|
|
register #(.W(1)) credit(.in(smart_buff_space_decreased_o), .reset(reset), .clk(clk), .out(smart_credit_o));
|
pronoc_register #(.W(1)) credit(.in(smart_buff_space_decreased_o), .reset(reset), .clk(clk), .out(smart_credit_o));
|
|
|
endmodule
|
endmodule
|
|
|
|
|
|
|
Line 751... |
Line 769... |
|
|
|
|
/* verilator lint_off WIDTH */
|
/* verilator lint_off WIDTH */
|
localparam LOCATED_IN_NI=
|
localparam LOCATED_IN_NI=
|
(TOPOLOGY=="RING" || TOPOLOGY=="LINE") ? (SW_LOC == 0 || SW_LOC>2) :
|
(TOPOLOGY=="RING" || TOPOLOGY=="LINE") ? (SW_LOC == 0 || SW_LOC>2) :
|
(TOPOLOGY =="MESH" || TOPOLOGY=="TORUS")? (SW_LOC == 0 || SW_LOC>4) : 0;
|
(TOPOLOGY =="MESH" || TOPOLOGY=="TORUS" || TOPOLOGY == "FMESH")? (SW_LOC == 0 || SW_LOC>4) : 0;
|
/* verilator lint_on WIDTH */
|
/* verilator lint_on WIDTH */
|
|
|
// does the route computation for the current router
|
// does the route computation for the current router
|
conventional_routing #(
|
conventional_routing #(
|
.TOPOLOGY (TOPOLOGY ),
|
.TOPOLOGY (TOPOLOGY ),
|
Line 775... |
Line 793... |
.src_e_addr ( ),// needed only for custom routing
|
.src_e_addr ( ),// needed only for custom routing
|
.dest_e_addr (smart_chanel_i.dest_e_addr ),
|
.dest_e_addr (smart_chanel_i.dest_e_addr ),
|
.destport (destport)
|
.destport (destport)
|
);
|
);
|
|
|
register #(.W(DSTPw)) reg1 (.in(destport), .reset(reset), .clk(clk), .out(smart_destport_o));
|
pronoc_register #(.W(DSTPw)) reg1 (.in(destport), .reset(reset), .clk(clk), .out(smart_destport_o));
|
|
|
check_straight_oport #(
|
check_straight_oport #(
|
.TOPOLOGY ( TOPOLOGY ),
|
.TOPOLOGY ( TOPOLOGY ),
|
.ROUTE_NAME ( ROUTE_NAME ),
|
.ROUTE_NAME ( ROUTE_NAME ),
|
.ROUTE_TYPE ( ROUTE_TYPE ),
|
.ROUTE_TYPE ( ROUTE_TYPE ),
|
Line 809... |
Line 827... |
.src_e_addr ( ),// needed only for custom routing
|
.src_e_addr ( ),// needed only for custom routing
|
.dest_e_addr (smart_chanel_i.dest_e_addr ),
|
.dest_e_addr (smart_chanel_i.dest_e_addr ),
|
.destport (lkdestport)
|
.destport (lkdestport)
|
);
|
);
|
|
|
register #(.W(DSTPw)) reg2 (.in(lkdestport), .reset(reset), .clk(clk), .out(smart_lk_destport_o));
|
pronoc_register #(.W(DSTPw)) reg2 (.in(lkdestport), .reset(reset), .clk(clk), .out(smart_lk_destport_o));
|
|
|
wire [V-1 : 0] ss_ovc_crossbar_wr;//If asserted, a flit will be injected to ovc at next clk cycle
|
wire [V-1 : 0] ss_ovc_crossbar_wr;//If asserted, a flit will be injected to ovc at next clk cycle
|
assign ss_ovc_crossbar_wr = (ss_smart_chanel_new.requests[0] ) ? ss_smart_chanel_new.ovc : {V{1'b0}};
|
assign ss_ovc_crossbar_wr = (ss_smart_chanel_new.requests[0] ) ? ss_smart_chanel_new.ovc : {V{1'b0}};
|
|
|
|
|
Line 867... |
Line 885... |
|
|
end//for
|
end//for
|
endgenerate
|
endgenerate
|
|
|
|
|
register #(.W(1)) reg3 (.in(smart_chanel_i.hdr_flit), .reset(reset), .clk(clk), .out(smart_hdr_flit_req_o));
|
pronoc_register #(.W(1)) reg3 (.in(smart_chanel_i.hdr_flit), .reset(reset), .clk(clk), .out(smart_hdr_flit_req_o));
|
|
|
endmodule
|
endmodule
|
|
|
//
|
//
|
module smart_credit_manage #(
|
module smart_credit_manage #(
|
Line 927... |
Line 945... |
else if(counter > 0) counter_next = counter -1'b1;
|
else if(counter > 0) counter_next = counter -1'b1;
|
end
|
end
|
|
|
assign credit_out = credit_in | smart_credit_in | (counter > 0);
|
assign credit_out = credit_in | smart_credit_in | (counter > 0);
|
|
|
register #(.W(Bw+1)) reg1 (.in(counter_next), .reset(reset), .clk(clk), .out(counter));
|
pronoc_register #(.W(Bw+1)) reg1 (.in(counter_next), .reset(reset), .clk(clk), .out(counter));
|
|
|
|
|
endmodule
|
endmodule
|
|
|
|
|