Line 4... |
Line 4... |
* This module can inject and eject packets from the NoC.
|
* This module can inject and eject packets from the NoC.
|
* It can be used in simulation for injecting real application traces to the NoC
|
* It can be used in simulation for injecting real application traces to the NoC
|
* *************************/
|
* *************************/
|
|
|
|
|
module packet_injector
|
module packet_injector #(
|
import pronoc_pkg::*;
|
parameter NOC_ID=0
|
(
|
) (
|
//general
|
//general
|
current_e_addr,
|
current_e_addr,
|
reset,
|
reset,
|
clk,
|
clk,
|
//noc port
|
//noc port
|
Line 19... |
Line 19... |
//control interafce
|
//control interafce
|
pck_injct_in,
|
pck_injct_in,
|
pck_injct_out
|
pck_injct_out
|
);
|
);
|
|
|
|
`NOC_CONF
|
|
|
//general
|
//general
|
input reset,clk;
|
input reset,clk;
|
input [EAw-1 :0 ] current_e_addr;
|
input [EAw-1 :0 ] current_e_addr;
|
|
|
// the destination endpoint address
|
// the destination endpoint address
|
Line 49... |
Line 51... |
|
|
|
|
generate if(CAST_TYPE == "UNICAST") begin : uni
|
generate if(CAST_TYPE == "UNICAST") begin : uni
|
|
|
conventional_routing #(
|
conventional_routing #(
|
|
.NOC_ID(NOC_ID),
|
.TOPOLOGY(TOPOLOGY),
|
.TOPOLOGY(TOPOLOGY),
|
.ROUTE_NAME(ROUTE_NAME),
|
.ROUTE_NAME(ROUTE_NAME),
|
.ROUTE_TYPE(ROUTE_TYPE),
|
.ROUTE_TYPE(ROUTE_TYPE),
|
.T1(T1),
|
.T1(T1),
|
.T2(T2),
|
.T2(T2),
|
Line 83... |
Line 86... |
|
|
wire [HDR_DATA_w-1 : 0] hdr_data_in = pck_injct_in.data [HDR_DATA_w-1 : 0];
|
wire [HDR_DATA_w-1 : 0] hdr_data_in = pck_injct_in.data [HDR_DATA_w-1 : 0];
|
wire [Fw-1 : 0] hdr_flit_out;
|
wire [Fw-1 : 0] hdr_flit_out;
|
|
|
header_flit_generator #(
|
header_flit_generator #(
|
|
.NOC_ID(NOC_ID),
|
.DATA_w(HDR_DATA_w)
|
.DATA_w(HDR_DATA_w)
|
)
|
) the_header_flit_generator (
|
the_header_flit_generator
|
|
(
|
|
.flit_out (hdr_flit_out),
|
.flit_out (hdr_flit_out),
|
.vc_num_in (pck_injct_in.vc),
|
.vc_num_in (pck_injct_in.vc),
|
.class_in (pck_injct_in.class_num),
|
.class_in (pck_injct_in.class_num),
|
.dest_e_addr_in (pck_injct_in.endp_addr),
|
.dest_e_addr_in (pck_injct_in.endp_addr),
|
.src_e_addr_in (current_e_addr),
|
.src_e_addr_in (current_e_addr),
|
Line 237... |
Line 239... |
.empty_vc( ),
|
.empty_vc( ),
|
.clk(clk),
|
.clk(clk),
|
.reset(reset)
|
.reset(reset)
|
);
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wire [HDR_DATA_w-1 : 0] hdr_data_o;
|
wire [HDR_DATA_w-1 : 0] hdr_data_o;
|
hdr_flit_t hdr_flit_i;
|
hdr_flit_t hdr_flit_i;
|
|
|
header_flit_info
|
header_flit_info #(
|
#(
|
.NOC_ID (NOC_ID),
|
.DATA_w (HDR_DATA_w )
|
.DATA_w (HDR_DATA_w )
|
) extractor (
|
) extractor (
|
.flit(chan_in.flit_chanel.flit),
|
.flit(chan_in.flit_chanel.flit),
|
.hdr_flit(hdr_flit_i),
|
.hdr_flit(hdr_flit_i),
|
.data_o(hdr_data_o)
|
.data_o(hdr_data_o)
|
Line 265... |
Line 261... |
reg [PCK_SIZw-1 : 0] rsv_counter [V-1 : 0];
|
reg [PCK_SIZw-1 : 0] rsv_counter [V-1 : 0];
|
reg [EAw-1 : 0] sender_endp_addr_reg [V-1 : 0];
|
reg [EAw-1 : 0] sender_endp_addr_reg [V-1 : 0];
|
logic [15:0] h2t_counter [V-1 : 0];
|
logic [15:0] h2t_counter [V-1 : 0];
|
logic [15:0] h2t_counter_next [V-1 : 0];
|
logic [15:0] h2t_counter_next [V-1 : 0];
|
|
|
|
|
|
|
//synthesis translate_off
|
//synthesis translate_off
|
wire [NEw-1 : 0] current_id;
|
wire [NEw-1 : 0] current_id;
|
wire [NEw-1 : 0] sendor_id;
|
wire [NEw-1 : 0] sendor_id;
|
endp_addr_decoder #( .TOPOLOGY(TOPOLOGY), .T1(T1), .T2(T2), .T3(T3), .EAw(EAw), .NE(NE)) encode1 ( .id(current_id), .code(current_e_addr));
|
endp_addr_decoder #( .TOPOLOGY(TOPOLOGY), .T1(T1), .T2(T2), .T3(T3), .EAw(EAw), .NE(NE)) encode1 ( .id(current_id), .code(current_e_addr));
|
endp_addr_decoder #( .TOPOLOGY(TOPOLOGY), .T1(T1), .T2(T2), .T3(T3), .EAw(EAw), .NE(NE)) encode2 ( .id(sendor_id), .code(pck_injct_out.endp_addr[EAw-1 : 0]));
|
endp_addr_decoder #( .TOPOLOGY(TOPOLOGY), .T1(T1), .T2(T2), .T3(T3), .EAw(EAw), .NE(NE)) encode2 ( .id(sendor_id), .code(pck_injct_out.endp_addr[EAw-1 : 0]));
|
Line 281... |
Line 275... |
|
|
|
|
|
|
generate
|
generate
|
if(CAST_TYPE != "UNICAST") begin
|
if(CAST_TYPE != "UNICAST") begin
|
mcast_dest_list_decode decode (
|
mcast_dest_list_decode #(
|
|
.NOC_ID(NOC_ID)
|
|
) decode (
|
.dest_e_addr(hdr_flit_i.dest_e_addr),
|
.dest_e_addr(hdr_flit_i.dest_e_addr),
|
.dest_o(dest_mcast_all_endp),
|
.dest_o(dest_mcast_all_endp),
|
.row_has_any_dest(),
|
.row_has_any_dest(),
|
.is_unicast()
|
.is_unicast()
|
);
|
);
|
Line 314... |
Line 310... |
rsv_counter[i]<= {{(PCK_SIZw-1){1'b0}}, 1'b1};
|
rsv_counter[i]<= {{(PCK_SIZw-1){1'b0}}, 1'b1};
|
sender_endp_addr_reg [i]<= hdr_flit_i.src_e_addr;
|
sender_endp_addr_reg [i]<= hdr_flit_i.src_e_addr;
|
//synthesis translate_off
|
//synthesis translate_off
|
if(CAST_TYPE == "UNICAST") begin
|
if(CAST_TYPE == "UNICAST") begin
|
if(hdr_flit_i.dest_e_addr[EAw-1:0] != current_e_addr) begin
|
if(hdr_flit_i.dest_e_addr[EAw-1:0] != current_e_addr) begin
|
$display("%t: ERROR: packet destination address %d does not match reciver endp address %d. %m",$time,hdr_flit_i.dest_e_addr , current_e_addr );
|
$display("%t: ERROR: packet destination address %d does not match receiver endp address %d. %m",$time,hdr_flit_i.dest_e_addr , current_e_addr );
|
$finish;
|
$finish;
|
end//if hdr_flit_i
|
end//if hdr_flit_i
|
end else begin
|
end else begin
|
if(dest_mcast_all_endp[current_id] !=1'b1 ) begin
|
if(dest_mcast_all_endp[current_id] !=1'b1 ) begin
|
$display("%t: ERROR: packet destination address %b does not match reciver endp address %d. %m",$time,hdr_flit_i.dest_e_addr , current_e_addr ,current_id );
|
$display("%t: ERROR: packet destination address %b does not match receiver endp address %d. %m",$time,hdr_flit_i.dest_e_addr , current_e_addr ,current_id );
|
$finish;
|
$finish;
|
end
|
end
|
end//if hdr_flit_i
|
end//if hdr_flit_i
|
//synthesis translate_on
|
//synthesis translate_on
|
end //if hdr_flag
|
end //if hdr_flag
|
Line 559... |
Line 555... |
*
|
*
|
* ***********************************/
|
* ***********************************/
|
|
|
|
|
|
|
module packet_injector_verilator
|
module packet_injector_verilator #(
|
import pronoc_pkg::*;
|
parameter NOC_ID=0
|
(
|
) (
|
//general
|
//general
|
current_e_addr,
|
current_e_addr,
|
reset,
|
reset,
|
clk,
|
clk,
|
//noc port
|
//noc port
|
Line 591... |
Line 587... |
pck_injct_out_ready,
|
pck_injct_out_ready,
|
pck_injct_out_distance,
|
pck_injct_out_distance,
|
pck_injct_out_h2t_delay,
|
pck_injct_out_h2t_delay,
|
min_pck_size
|
min_pck_size
|
|
|
|
|
);
|
);
|
|
|
|
`NOC_CONF
|
|
|
//general
|
//general
|
input reset,clk;
|
input reset,clk;
|
input [EAw-1 :0 ] current_e_addr;
|
input [EAw-1 :0 ] current_e_addr;
|
|
|
Line 650... |
Line 646... |
assign pck_injct_out_pck_wr = pck_injct_out.pck_wr;
|
assign pck_injct_out_pck_wr = pck_injct_out.pck_wr;
|
assign pck_injct_out_ready = pck_injct_out.ready;
|
assign pck_injct_out_ready = pck_injct_out.ready;
|
assign pck_injct_out_distance = pck_injct_out.distance;
|
assign pck_injct_out_distance = pck_injct_out.distance;
|
assign pck_injct_out_h2t_delay = pck_injct_out.h2t_delay;
|
assign pck_injct_out_h2t_delay = pck_injct_out.h2t_delay;
|
|
|
packet_injector injector (
|
packet_injector #(
|
|
.NOC_ID(NOC_ID)
|
|
) injector (
|
.current_e_addr (current_e_addr ),
|
.current_e_addr (current_e_addr ),
|
.reset (reset ),
|
.reset (reset ),
|
.clk (clk ),
|
.clk (clk ),
|
.chan_in (chan_in ),
|
.chan_in (chan_in ),
|
.chan_out (chan_out ),
|
.chan_out (chan_out ),
|
.pck_injct_in (pck_injct_in ),
|
.pck_injct_in (pck_injct_in ),
|
.pck_injct_out (pck_injct_out ));
|
.pck_injct_out (pck_injct_out )
|
|
);
|
|
|
|
|
localparam
|
localparam
|
HDR_BYTE_NUM = HDR_MAX_DATw / 8, // = HDR_MAX_DATw / (8 - HDR_MAX_DATw %8)
|
HDR_BYTE_NUM = HDR_MAX_DATw / 8, // = HDR_MAX_DATw / (8 - HDR_MAX_DATw %8)
|
HDR_DATA_w_tmp = HDR_BYTE_NUM * 8,
|
HDR_DATA_w_tmp = HDR_BYTE_NUM * 8,
|