diff --git a/rtl/common/tnoc_config_pkg.sv b/rtl/common/tnoc_config_pkg.sv index 1292f78..2684051 100644 --- a/rtl/common/tnoc_config_pkg.sv +++ b/rtl/common/tnoc_config_pkg.sv @@ -17,7 +17,7 @@ package tnoc_config_pkg; bit [`TNOC_MAX_DATA_WIDTH-1:0] error_data; } tnoc_config; - parameter tnoc_config TNOC_DEFAULT_CONFIG = '{ + localparam tnoc_config TNOC_DEFAULT_CONFIG = '{ address_width: `TNOC_DEFAULT_ADDRESS_WIDTH, data_width: `TNOC_DEFAULT_DATA_WIDTH, id_x_width: `TNOC_DEFAULT_ID_X_WIDTH, diff --git a/rtl/common/tnoc_enums_pkg.sv b/rtl/common/tnoc_enums_pkg.sv index 0955854..95e46f9 100644 --- a/rtl/common/tnoc_enums_pkg.sv +++ b/rtl/common/tnoc_enums_pkg.sv @@ -75,16 +75,16 @@ package tnoc_enums_pkg; } tnoc_flit_type; typedef enum bit { - TNOC_LOCAL_PORT = 0, - TNOC_INTERNAL_PORT = 1 + TNOC_LOCAL_PORT = 'b0, + TNOC_INTERNAL_PORT = 'b1 } tnoc_port_type; function automatic bit is_local_port(input tnoc_port_type port_type); - return (port_type == TNOC_LOCAL_PORT) ? 1 : 0; + return (port_type == TNOC_LOCAL_PORT) ? 'b1 : 'b0; endfunction function automatic bit is_internal_port(input tnoc_port_type port_type); - return (port_type == TNOC_INTERNAL_PORT) ? 1 : 0; + return (port_type == TNOC_INTERNAL_PORT) ? 'b1 : 'b0; endfunction endpackage `endif diff --git a/rtl/common/tnoc_flit_if_fifo.sv b/rtl/common/tnoc_flit_if_fifo.sv index e4a371b..3843cd7 100644 --- a/rtl/common/tnoc_flit_if_fifo.sv +++ b/rtl/common/tnoc_flit_if_fifo.sv @@ -22,8 +22,8 @@ module tnoc_flit_if_fifo `include "tnoc_flit.svh" typedef struct packed { - logic [CHANNELS-1:0] valid; - logic [FLIT_WIDTH-1:0] flit; + logic [CHANNELS-1:0] valid; + logic [TNOC_FLIT_WIDTH-1:0] flit; } s_fifo_data; logic [FLITS-1:0] empty; @@ -41,10 +41,10 @@ module tnoc_flit_if_fifo assign flit_out_if.valid[i] = ~empty[i]; tnoc_fifo #( - .WIDTH (FLIT_WIDTH ), - .DEPTH (DEPTH ), - .THRESHOLD (THRESHOLD ), - .DATA_FF_OUT (DATA_FF_OUT ) + .WIDTH (TNOC_FLIT_WIDTH ), + .DEPTH (DEPTH ), + .THRESHOLD (THRESHOLD ), + .DATA_FF_OUT (DATA_FF_OUT ) ) u_fifo ( .clk (clk ), .rst_n (rst_n ), @@ -65,10 +65,10 @@ module tnoc_flit_if_fifo assign flit_out_if.valid = ~empty; tnoc_fifo #( - .WIDTH (FLIT_WIDTH ), - .DEPTH (DEPTH ), - .THRESHOLD (THRESHOLD ), - .DATA_FF_OUT (DATA_FF_OUT ) + .WIDTH (TNOC_FLIT_WIDTH ), + .DEPTH (DEPTH ), + .THRESHOLD (THRESHOLD ), + .DATA_FF_OUT (DATA_FF_OUT ) ) u_fifo ( .clk (clk ), .rst_n (rst_n ), diff --git a/rtl/common/tnoc_flit_if_mux.sv b/rtl/common/tnoc_flit_if_mux.sv index 6a26766..7876b4d 100644 --- a/rtl/common/tnoc_flit_if_mux.sv +++ b/rtl/common/tnoc_flit_if_mux.sv @@ -59,19 +59,19 @@ module tnoc_flit_if_mux //-------------------------------------------------------------- localparam int FLITS = (is_local_port(PORT_TYPE)) ? CHANNELS : 1; - logic [FLITS*FLIT_WIDTH-1:0] flit_in[ENTRIES]; - logic [FLITS*FLIT_WIDTH-1:0] flit_out; + logic [FLITS*TNOC_FLIT_WIDTH-1:0] flit_in[ENTRIES]; + logic [FLITS*TNOC_FLIT_WIDTH-1:0] flit_out; for (genvar i = 0;i < FLITS;++i) begin for (genvar j = 0;j < ENTRIES;++j) begin - assign flit_in[j][i*FLIT_WIDTH+:FLIT_WIDTH] = flit_in_if[j].flit[i]; + assign flit_in[j][i*TNOC_FLIT_WIDTH+:TNOC_FLIT_WIDTH] = flit_in_if[j].flit[i]; end - assign flit_out_if.flit[i] = flit_out[i*FLIT_WIDTH+:FLIT_WIDTH]; + assign flit_out_if.flit[i] = flit_out[i*TNOC_FLIT_WIDTH+:TNOC_FLIT_WIDTH]; end tnoc_mux #( - .WIDTH (FLITS*FLIT_WIDTH ), - .ENTRIES (ENTRIES ) + .WIDTH (FLITS*TNOC_FLIT_WIDTH ), + .ENTRIES (ENTRIES ) ) u_flit_mux ( .i_select (i_select ), .i_value (flit_in ), diff --git a/rtl/common/tnoc_packet_packer.sv b/rtl/common/tnoc_packet_packer.sv index 7f896c0..fdac160 100644 --- a/rtl/common/tnoc_packet_packer.sv +++ b/rtl/common/tnoc_packet_packer.sv @@ -95,7 +95,7 @@ module tnoc_packet_packer localparam int REQUEST_HEADER_FLITS = calc_request_header_flits(); localparam int RESPONSE_HEADER_FLITS = calc_response_header_flits(); localparam int HEADER_FLITS = calc_header_flits(); - localparam int HEADER_DATA_WIDTH = HEADER_FLITS * FLIT_DATA_WIDTH; + localparam int HEADER_DATA_WIDTH = HEADER_FLITS * TNOC_FLIT_DATA_WIDTH; // renaming tnoc_common_header_fields common_header_fields; @@ -126,12 +126,12 @@ module tnoc_packet_packer input tnoc_response_header_fields response_header_fields ); logic [HEADER_DATA_WIDTH-1:0] header = '0; - header[COMMON_HEADER_WIDTH-1:0] = common_header_fields; + header[TNOC_COMMON_HEADER_WIDTH-1:0] = common_header_fields; if (is_request_packet_type(common_header_fields.packet_type)) begin - header[REQUEST_HEADER_WIDTH-1:COMMON_HEADER_WIDTH] = request_header_fields; + header[TNOC_REQUEST_HEADER_WIDTH-1:TNOC_COMMON_HEADER_WIDTH] = request_header_fields; end else begin - header[RESPONSE_HEADER_WIDTH-1:COMMON_HEADER_WIDTH] = response_header_fields; + header[TNOC_RESPONSE_HEADER_WIDTH-1:TNOC_COMMON_HEADER_WIDTH] = response_header_fields; end return header; endfunction @@ -154,7 +154,7 @@ module tnoc_packet_packer assign packet_in_if.header_ready = header_flit_ready & header_flit_last; assign header_flit.head = (flit_count == 0) ? '1 : '0; assign header_flit.tail = no_payload & header_flit_last; - assign header_flit.data = header_data[flit_count*FLIT_DATA_WIDTH+:FLIT_DATA_WIDTH]; + assign header_flit.data = header_data[flit_count*TNOC_FLIT_DATA_WIDTH+:TNOC_FLIT_DATA_WIDTH]; assign header_flit_last = (flit_count == get_last_count(packet_in_if.packet_type)) ? '1 : '0; always_ff @(posedge clk, negedge rst_n) begin @@ -210,10 +210,10 @@ module tnoc_packet_packer flit_data = '0; if (is_write_payload(payload_type)) begin - flit_data[WRITE_PAYLOAD_WIDTH-1:0] = write_payload; + flit_data[TNOC_WRITE_PAYLOAD_WIDTH-1:0] = write_payload; end else begin - flit_data[READ_PAYLOAD_WIDTH-1:0] = read_payload; + flit_data[TNOC_READ_PAYLOAD_WIDTH-1:0] = read_payload; end return flit_data; diff --git a/rtl/common/tnoc_packet_unpacker.sv b/rtl/common/tnoc_packet_unpacker.sv index 32e810d..45e3f35 100644 --- a/rtl/common/tnoc_packet_unpacker.sv +++ b/rtl/common/tnoc_packet_unpacker.sv @@ -60,14 +60,14 @@ module tnoc_packet_unpacker localparam int REQUEST_HEADER_FLITS = calc_request_header_flits(); localparam int RESPONSE_HEADER_FLITS = calc_response_header_flits(); localparam int HEADER_FLITS = calc_header_flits(); - localparam int HEADER_DATA_WIDTH = HEADER_FLITS * FLIT_DATA_WIDTH; + localparam int HEADER_DATA_WIDTH = HEADER_FLITS * TNOC_FLIT_DATA_WIDTH; logic [HEADER_DATA_WIDTH-1:0] header_data; tnoc_common_header_fields common_header_fields; tnoc_request_header_fields request_header_fields; tnoc_response_header_fields response_header_fields; - assign common_header_fields = tnoc_common_header_fields'(header_data[COMMON_HEADER_WIDTH-1:0]); + assign common_header_fields = tnoc_common_header_fields'(header_data[TNOC_COMMON_HEADER_WIDTH-1:0]); assign packet_out_if.packet_type = common_header_fields.packet_type; assign packet_out_if.destination_id = common_header_fields.destination_id; assign packet_out_if.source_id = common_header_fields.source_id; @@ -75,12 +75,12 @@ module tnoc_packet_unpacker assign packet_out_if.tag = common_header_fields.tag; assign packet_out_if.routing_mode = common_header_fields.routing_mode; assign packet_out_if.invalid_destination = common_header_fields.invalid_destination; - assign request_header_fields = tnoc_request_header_fields'(header_data[REQUEST_HEADER_WIDTH-1:COMMON_HEADER_WIDTH]); + assign request_header_fields = tnoc_request_header_fields'(header_data[TNOC_REQUEST_HEADER_WIDTH-1:TNOC_COMMON_HEADER_WIDTH]); assign packet_out_if.burst_type = request_header_fields.burst_type; assign packet_out_if.burst_length = unpack_burst_length(request_header_fields.burst_length); assign packet_out_if.burst_size = request_header_fields.burst_size; assign packet_out_if.address = request_header_fields.address; - assign response_header_fields = tnoc_response_header_fields'(header_data[RESPONSE_HEADER_WIDTH-1:COMMON_HEADER_WIDTH]); + assign response_header_fields = tnoc_response_header_fields'(header_data[TNOC_RESPONSE_HEADER_WIDTH-1:TNOC_COMMON_HEADER_WIDTH]); assign packet_out_if.packet_status = response_header_fields.status; if (HEADER_FLITS == 1) begin : g_single_header_flit @@ -101,11 +101,11 @@ module tnoc_packet_unpacker for (genvar i = 0;i < HEADER_FLITS;++i) begin if (i < (HEADER_FLITS - 1)) begin - assign header_data[i*FLIT_DATA_WIDTH+:FLIT_DATA_WIDTH] = + assign header_data[i*TNOC_FLIT_DATA_WIDTH+:TNOC_FLIT_DATA_WIDTH] = (flit_count == i) ? flit.data : flit_buffer[i]; end else begin - assign header_data[i*FLIT_DATA_WIDTH+:FLIT_DATA_WIDTH] = flit.data; + assign header_data[i*TNOC_FLIT_DATA_WIDTH+:TNOC_FLIT_DATA_WIDTH] = flit.data; end end @@ -145,8 +145,8 @@ module tnoc_packet_unpacker tnoc_write_payload write_payload; tnoc_read_payload read_payload; - assign write_payload = tnoc_write_payload'(flit.data[WRITE_PAYLOAD_WIDTH-1:0]); - assign read_payload = tnoc_read_payload'(flit.data[READ_PAYLOAD_WIDTH-1:0]); + assign write_payload = tnoc_write_payload'(flit.data[TNOC_WRITE_PAYLOAD_WIDTH-1:0]); + assign read_payload = tnoc_read_payload'(flit.data[TNOC_READ_PAYLOAD_WIDTH-1:0]); assign packet_out_if.payload_valid = payload_flit_valid; assign payload_flit_ready = packet_out_if.payload_ready; assign packet_out_if.payload_type = payload_type; diff --git a/rtl/common/tnoc_vc_mux.sv b/rtl/common/tnoc_vc_mux.sv index c52c994..20b71ec 100644 --- a/rtl/common/tnoc_vc_mux.sv +++ b/rtl/common/tnoc_vc_mux.sv @@ -21,7 +21,7 @@ module tnoc_vc_mux end end else begin : g_vc_mux_internal_port - logic [FLIT_WIDTH-1:0] flit_in[CHANNELS]; + logic [TNOC_FLIT_WIDTH-1:0] flit_in[CHANNELS]; for (genvar i = 0;i < CHANNELS;++i) begin assign flit_out_if.valid[i] = i_vc_grant[i] & flit_in_if[i].valid; @@ -31,8 +31,8 @@ module tnoc_vc_mux end tnoc_mux #( - .WIDTH (FLIT_WIDTH ), - .ENTRIES (CHANNELS ) + .WIDTH (TNOC_FLIT_WIDTH ), + .ENTRIES (CHANNELS ) ) ttnoc_mux ( .i_select (i_vc_grant ), .i_value (flit_in ), diff --git a/rtl/include/tnoc_flit.svh b/rtl/include/tnoc_flit.svh index 60eae29..b6296e4 100644 --- a/rtl/include/tnoc_flit.svh +++ b/rtl/include/tnoc_flit.svh @@ -2,11 +2,11 @@ import tnoc_enums_pkg::tnoc_flit_type; import tnoc_enums_pkg::TNOC_HEADER_FLIT; import tnoc_enums_pkg::TNOC_PAYLOAD_FLIT; -localparam int FLIT_DATA_WIDTH = ( - COMMON_HEADER_WIDTH > PAYLOD_WIDTH -) ? COMMON_HEADER_WIDTH : PAYLOD_WIDTH; +localparam int TNOC_FLIT_DATA_WIDTH = ( + TNOC_COMMON_HEADER_WIDTH > TNOC_PAYLOD_WIDTH +) ? TNOC_COMMON_HEADER_WIDTH : TNOC_PAYLOD_WIDTH; -typedef logic [FLIT_DATA_WIDTH-1:0] tnoc_flit_data; +typedef logic [TNOC_FLIT_DATA_WIDTH-1:0] tnoc_flit_data; typedef struct packed { tnoc_flit_data data; @@ -15,4 +15,4 @@ typedef struct packed { tnoc_flit_type flit_type; } tnoc_flit; -localparam int FLIT_WIDTH = $bits(tnoc_flit); +localparam int TNOC_FLIT_WIDTH = $bits(tnoc_flit); diff --git a/rtl/include/tnoc_flit_utils.svh b/rtl/include/tnoc_flit_utils.svh index 8da9ab6..8b2b6c8 100644 --- a/rtl/include/tnoc_flit_utils.svh +++ b/rtl/include/tnoc_flit_utils.svh @@ -1,13 +1,13 @@ function automatic int calc_request_header_flits(); - return (REQUEST_HEADER_WIDTH + FLIT_DATA_WIDTH - 1) / FLIT_DATA_WIDTH; + return (TNOC_REQUEST_HEADER_WIDTH + TNOC_FLIT_DATA_WIDTH - 1) / TNOC_FLIT_DATA_WIDTH; endfunction function automatic int calc_response_header_flits(); - return (RESPONSE_HEADER_WIDTH + FLIT_DATA_WIDTH - 1) / FLIT_DATA_WIDTH; + return (TNOC_RESPONSE_HEADER_WIDTH + TNOC_FLIT_DATA_WIDTH - 1) / TNOC_FLIT_DATA_WIDTH; endfunction function automatic int calc_header_flits(); - return (HEADER_WIDTH + FLIT_DATA_WIDTH - 1) / FLIT_DATA_WIDTH; + return (TNOC_HEADER_WIDTH + TNOC_FLIT_DATA_WIDTH - 1) / TNOC_FLIT_DATA_WIDTH; endfunction function automatic logic is_header_flit(input tnoc_flit flit); @@ -27,13 +27,13 @@ function automatic logic is_tail_flit(input tnoc_flit flit); endfunction function automatic tnoc_common_header get_common_header(input tnoc_flit flit); - return tnoc_common_header'(flit.data[COMMON_HEADER_WIDTH-1:0]); + return tnoc_common_header'(flit.data[TNOC_COMMON_HEADER_WIDTH-1:0]); endfunction function automatic tnoc_write_payload get_write_payload(input tnoc_flit flit); - return tnoc_write_payload'(flit.data[WRITE_PAYLOAD_WIDTH-1:0]); + return tnoc_write_payload'(flit.data[TNOC_WRITE_PAYLOAD_WIDTH-1:0]); endfunction function automatic tnoc_read_payload get_read_payload(input tnoc_flit flit); - return tnoc_read_payload'(flit.data[READ_PAYLOAD_WIDTH-1:0]); + return tnoc_read_payload'(flit.data[TNOC_READ_PAYLOAD_WIDTH-1:0]); endfunction diff --git a/rtl/include/tnoc_macros.svh b/rtl/include/tnoc_macros.svh index 7bcdc6a..348acbc 100644 --- a/rtl/include/tnoc_macros.svh +++ b/rtl/include/tnoc_macros.svh @@ -3,8 +3,8 @@ `define tnoc_array_slicer(ARRAY, INDEX, ELEMENTS) ARRAY[INDEX*ELEMENTS:(INDEX+1)*ELEMENTS-1] -`define tnoc_internal_flit_if(channel, if_config = CONFIG) \ -tnoc_flit_if #(if_config, channel, TNOC_INTERNAL_PORT) +`define tnoc_internal_flit_if(channel) \ +tnoc_flit_if #(CONFIG, channel, TNOC_INTERNAL_PORT) `define tnoc_flit_if_renamer(flit_in_if, flit_out_if) \ if (1) begin \ diff --git a/rtl/include/tnoc_packet.svh b/rtl/include/tnoc_packet.svh index ebe7d2f..0c89cee 100644 --- a/rtl/include/tnoc_packet.svh +++ b/rtl/include/tnoc_packet.svh @@ -42,21 +42,21 @@ typedef struct packed { tnoc_id_y y; } tnoc_location_id; -localparam int VC_WIDTH = (CONFIG.virtual_channels == 1) ? 1 : $clog2(CONFIG.virtual_channels); -typedef logic [VC_WIDTH-1:0] tnoc_vc; +localparam int TNOC_VC_WIDTH = (CONFIG.virtual_channels == 1) ? 1 : $clog2(CONFIG.virtual_channels); +typedef logic [TNOC_VC_WIDTH-1:0] tnoc_vc; -localparam int TAG_WIDTH = (CONFIG.tags == 1) ? 1 : $clog2(CONFIG.tags); -typedef logic [TAG_WIDTH-1:0] tnoc_tag; +localparam int TNOC_TAG_WIDTH = (CONFIG.tags == 1) ? 1 : $clog2(CONFIG.tags); +typedef logic [TNOC_TAG_WIDTH-1:0] tnoc_tag; -localparam int PACKED_BURST_LENGTH_WIDTH = (CONFIG.max_burst_length == 0) ? 1 : $clog2(CONFIG.max_burst_length); -localparam int UNPACKED_BURST_LENGTH_WIDTH = $clog2(CONFIG.max_burst_length + 1); -typedef logic [PACKED_BURST_LENGTH_WIDTH-1:0] tnoc_packed_burst_length; -typedef logic [UNPACKED_BURST_LENGTH_WIDTH-1:0] tnoc_unpacked_burst_length; +localparam int TNOC_PACKED_BURST_LENGTH_WIDTH = (CONFIG.max_burst_length == 0) ? 1 : $clog2(CONFIG.max_burst_length); +localparam int TNOC_UNPACKED_BURST_LENGTH_WIDTH = $clog2(CONFIG.max_burst_length + 1); +typedef logic [TNOC_PACKED_BURST_LENGTH_WIDTH-1:0] tnoc_packed_burst_length; +typedef logic [TNOC_UNPACKED_BURST_LENGTH_WIDTH-1:0] tnoc_unpacked_burst_length; -localparam int BURST_SIZE_WIDTH = ( +localparam int TNOC_BURST_SIZE_WIDTH = ( CONFIG.data_width <= 16 ) ? 1 : $clog2($clog2(CONFIG.data_width)); -typedef logic [BURST_SIZE_WIDTH-1:0] tnoc_burst_size; +typedef logic [TNOC_BURST_SIZE_WIDTH-1:0] tnoc_burst_size; typedef logic [CONFIG.address_width-1:0] tnoc_address; @@ -120,14 +120,14 @@ typedef struct packed { tnoc_data data; } tnoc_read_payload; -localparam int COMMON_HEADER_WIDTH = $bits(tnoc_common_header); -localparam int REQUEST_HEADER_WIDTH = $bits(tnoc_request_header); -localparam int RESPONSE_HEADER_WIDTH = $bits(tnoc_response_header); -localparam int HEADER_WIDTH = ( - REQUEST_HEADER_WIDTH > RESPONSE_HEADER_WIDTH -) ? REQUEST_HEADER_WIDTH : RESPONSE_HEADER_WIDTH; -localparam int WRITE_PAYLOAD_WIDTH = $bits(tnoc_write_payload); -localparam int READ_PAYLOAD_WIDTH = $bits(tnoc_read_payload); -localparam int PAYLOD_WIDTH = ( - WRITE_PAYLOAD_WIDTH > READ_PAYLOAD_WIDTH -) ? WRITE_PAYLOAD_WIDTH : READ_PAYLOAD_WIDTH; +localparam int TNOC_COMMON_HEADER_WIDTH = $bits(tnoc_common_header); +localparam int TNOC_REQUEST_HEADER_WIDTH = $bits(tnoc_request_header); +localparam int TNOC_RESPONSE_HEADER_WIDTH = $bits(tnoc_response_header); +localparam int TNOC_HEADER_WIDTH = ( + TNOC_REQUEST_HEADER_WIDTH > TNOC_RESPONSE_HEADER_WIDTH +) ? TNOC_REQUEST_HEADER_WIDTH : TNOC_RESPONSE_HEADER_WIDTH; +localparam int TNOC_WRITE_PAYLOAD_WIDTH = $bits(tnoc_write_payload); +localparam int TNOC_READ_PAYLOAD_WIDTH = $bits(tnoc_read_payload); +localparam int TNOC_PAYLOD_WIDTH = ( + TNOC_WRITE_PAYLOAD_WIDTH > TNOC_READ_PAYLOAD_WIDTH +) ? TNOC_WRITE_PAYLOAD_WIDTH : TNOC_READ_PAYLOAD_WIDTH; diff --git a/rtl/include/tnoc_packet_utils.svh b/rtl/include/tnoc_packet_utils.svh index d353f2b..452899a 100644 --- a/rtl/include/tnoc_packet_utils.svh +++ b/rtl/include/tnoc_packet_utils.svh @@ -25,14 +25,14 @@ endfunction function automatic tnoc_packed_burst_length pack_burst_length( input tnoc_unpacked_burst_length unpacked_burst_length ); - return unpacked_burst_length[PACKED_BURST_LENGTH_WIDTH-1:0]; + return unpacked_burst_length[TNOC_PACKED_BURST_LENGTH_WIDTH-1:0]; endfunction function automatic tnoc_unpacked_burst_length unpack_burst_length( input tnoc_packed_burst_length packed_burst_length ); if (packed_burst_length == 0) begin - return 2**PACKED_BURST_LENGTH_WIDTH; + return 2**TNOC_PACKED_BURST_LENGTH_WIDTH; end else begin return packed_burst_length; diff --git a/rtl/router/tnoc_output_block.sv b/rtl/router/tnoc_output_block.sv index b1fa7fd..a5d6d36 100644 --- a/rtl/router/tnoc_output_block.sv +++ b/rtl/router/tnoc_output_block.sv @@ -39,10 +39,10 @@ module tnoc_output_block if (is_local_port(PORT_TYPE)) begin : g_input_local_port_renamer for (genvar i = 0;i < CHANNELS;++i) begin : g `define input_port_renamer(suffix, index) \ - assign flit_in_if[5*i+index].valid = flit_in_if_``suffix``.valid[i]; \ - assign flit_in_if_``suffix``.ready[i] = flit_in_if[5*i+index].ready; \ - assign flit_in_if[5*i+index].flit[0] = flit_in_if_``suffix``.flit[0]; \ - assign flit_in_if_``suffix``.vc_available[i] = flit_in_if[5*i+index].vc_available; + assign flit_in_if[5*i+index].valid = flit_in_if_``suffix.valid[i]; \ + assign flit_in_if_``suffix.ready[i] = flit_in_if[5*i+index].ready; \ + assign flit_in_if[5*i+index].flit[0] = flit_in_if_``suffix.flit[0]; \ + assign flit_in_if_``suffix.vc_available[i] = flit_in_if[5*i+index].vc_available; `input_port_renamer(xp, 0) `input_port_renamer(xm, 1) diff --git a/rtl/router/tnoc_router.sv b/rtl/router/tnoc_router.sv index 5498f28..4ef228e 100644 --- a/rtl/router/tnoc_router.sv +++ b/rtl/router/tnoc_router.sv @@ -29,20 +29,22 @@ module tnoc_router `tnoc_internal_flit_if(CHANNELS) flit_if[25](); tnoc_port_control_if #(CONFIG) port_control_if[25](); + function automatic tnoc_port_type get_port_type(int index); + return (index == 4) ? TNOC_LOCAL_PORT : TNOC_INTERNAL_PORT; + endfunction + `define tnoc_instance_input_block(index, port_suffix) \ - if (AVAILABLE_PORTS[index]) begin : g_input_block``port_suffix`` \ - localparam tnoc_port_type PORT_TYPE = \ - (index == 4) ? TNOC_LOCAL_PORT : TNOC_INTERNAL_PORT; \ + if (AVAILABLE_PORTS[index]) begin : g_input_block``port_suffix \ tnoc_input_block #( \ - .CONFIG (CONFIG ), \ - .PORT_TYPE (PORT_TYPE ), \ - .AVAILABLE_PORTS (AVAILABLE_PORTS ) \ + .CONFIG (CONFIG ), \ + .PORT_TYPE (get_port_type(index) ), \ + .AVAILABLE_PORTS (AVAILABLE_PORTS ) \ ) u_input_block ( \ .clk (clk ), \ .rst_n (rst_n ), \ .i_id_x (i_id_x ), \ .i_id_y (i_id_y ), \ - .flit_in_if (flit_in_if``port_suffix`` ), \ + .flit_in_if (flit_in_if``port_suffix ), \ .flit_out_if_xp (flit_if[5*0+index] ), \ .flit_out_if_xm (flit_if[5*1+index] ), \ .flit_out_if_yp (flit_if[5*2+index] ), \ @@ -55,11 +57,11 @@ module tnoc_router .port_control_if_l (port_control_if[5*4+index] ) \ ); \ end \ - else begin : g_dummy_input_block``port_suffix`` \ + else begin : g_dummy_input_block``port_suffix \ tnoc_input_block_dummy #( \ .CONFIG (CONFIG ) \ ) u_dummy ( \ - .flit_in_if (flit_in_if``port_suffix`` ), \ + .flit_in_if (flit_in_if``port_suffix ), \ .flit_out_if_xp (flit_if[5*0+index] ), \ .flit_out_if_xm (flit_if[5*1+index] ), \ .flit_out_if_yp (flit_if[5*2+index] ), \ @@ -82,12 +84,10 @@ module tnoc_router `undef tnoc_instance_input_block `define tnoc_instance_output_block(index, port_suffix) \ - if (AVAILABLE_PORTS[index]) begin : g_output_block``port_suffix`` \ - localparam tnoc_port_type PORT_TYPE = \ - (index == 4) ? TNOC_LOCAL_PORT : TNOC_INTERNAL_PORT; \ + if (AVAILABLE_PORTS[index]) begin : g_output_block``port_suffix \ tnoc_output_block #( \ - .CONFIG (CONFIG ), \ - .PORT_TYPE (PORT_TYPE ) \ + .CONFIG (CONFIG ), \ + .PORT_TYPE (get_port_type(index) ) \ ) u_output_block ( \ .clk (clk ), \ .rst_n (rst_n ), \ @@ -96,7 +96,7 @@ module tnoc_router .flit_in_if_yp (flit_if[5*index+2] ), \ .flit_in_if_ym (flit_if[5*index+3] ), \ .flit_in_if_l (flit_if[5*index+4] ), \ - .flit_out_if (flit_out_if``port_suffix`` ), \ + .flit_out_if (flit_out_if``port_suffix ), \ .port_control_if_xp (port_control_if[5*index+0] ), \ .port_control_if_xm (port_control_if[5*index+1] ), \ .port_control_if_yp (port_control_if[5*index+2] ), \ @@ -104,7 +104,7 @@ module tnoc_router .port_control_if_l (port_control_if[5*index+4] ) \ ); \ end \ - else begin : g_dummy_output_block``port_suffix`` \ + else begin : g_dummy_output_block``port_suffix \ tnoc_output_block_dummy #( \ .CONFIG (CONFIG ) \ ) u_dummy ( \ @@ -113,7 +113,7 @@ module tnoc_router .flit_in_if_yp (flit_if[5*index+2] ), \ .flit_in_if_ym (flit_if[5*index+3] ), \ .flit_in_if_l (flit_if[5*index+4] ), \ - .flit_out_if (flit_out_if``port_suffix`` ), \ + .flit_out_if (flit_out_if``port_suffix ), \ .port_control_if_xp (port_control_if[5*index+0] ), \ .port_control_if_xm (port_control_if[5*index+1] ), \ .port_control_if_yp (port_control_if[5*index+2] ), \