From 0a545700354b9b30e4b04d8b06482928e7c191f7 Mon Sep 17 00:00:00 2001 From: Maurus Item Date: Fri, 31 May 2024 17:19:53 +0200 Subject: [PATCH 1/2] Added configurable strobe with to stream fifo. --- rtl/fifo/hwpe_stream_fifo.sv | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/rtl/fifo/hwpe_stream_fifo.sv b/rtl/fifo/hwpe_stream_fifo.sv index da79d14..f50ca0f 100644 --- a/rtl/fifo/hwpe_stream_fifo.sv +++ b/rtl/fifo/hwpe_stream_fifo.sv @@ -67,6 +67,7 @@ import hwpe_stream_package::*; module hwpe_stream_fifo #( parameter int unsigned DATA_WIDTH = 32, + parameter int unsigned STRB_WIDTH = DATA_WIDTH / 8, parameter int unsigned FIFO_DEPTH = 8, parameter int unsigned LATCH_FIFO = 0, parameter int unsigned LATCH_FIFO_TEST_WRAP = 0 @@ -90,7 +91,7 @@ module hwpe_stream_fifo #( logic [ADDR_DEPTH-1:0] pop_pointer_q, pop_pointer_d; logic [ADDR_DEPTH-1:0] push_pointer_q, push_pointer_d; - logic [DATA_WIDTH+DATA_WIDTH/8-1:0] fifo_registers[FIFO_DEPTH-1:0]; + logic [DATA_WIDTH+STRB_WIDTH-1:0] fifo_registers[FIFO_DEPTH-1:0]; integer i; assign flags_o.empty = (cs == EMPTY) ? 1'b1 : 1'b0; @@ -229,8 +230,8 @@ module hwpe_stream_fifo #( endcase end - logic [DATA_WIDTH+DATA_WIDTH/8-1:0] data_out_int; - logic [DATA_WIDTH+DATA_WIDTH/8-1:0] data_in_int; + logic [DATA_WIDTH+STRB_WIDTH-1:0] data_out_int; + logic [DATA_WIDTH+STRB_WIDTH-1:0] data_in_int; generate if(LATCH_FIFO == 0) begin : fifo_ff_gen @@ -260,7 +261,7 @@ module hwpe_stream_fifo #( hwpe_stream_fifo_scm #( .ADDR_WIDTH ( ADDR_DEPTH ), - .DATA_WIDTH ( DATA_WIDTH + DATA_WIDTH/8 ) + .DATA_WIDTH ( DATA_WIDTH + STRB_WIDTH ) ) i_fifo_latch ( .clk ( clk_i ), .rst_n ( rst_ni ), @@ -279,7 +280,7 @@ module hwpe_stream_fifo #( hwpe_stream_fifo_scm_test_wrap #( .ADDR_WIDTH ( ADDR_DEPTH ), - .DATA_WIDTH ( DATA_WIDTH + DATA_WIDTH/8 ) + .DATA_WIDTH ( DATA_WIDTH + STRB_WIDTH ) ) i_fifo_latch ( .clk ( clk_i ), .rst_n ( rst_ni ), @@ -300,7 +301,7 @@ module hwpe_stream_fifo #( end endgenerate - assign pop_o.data = (pop_o.valid == 1'b1) ? data_out_int[DATA_WIDTH+DATA_WIDTH/8-1:DATA_WIDTH/8] : '0; - assign pop_o.strb = (pop_o.valid == 1'b1) ? data_out_int[DATA_WIDTH/8-1:0] : '0; + assign pop_o.data = (pop_o.valid == 1'b1) ? data_out_int[DATA_WIDTH+STRB_WIDTH-1:STRB_WIDTH] : '0; + assign pop_o.strb = (pop_o.valid == 1'b1) ? data_out_int[STRB_WIDTH-1:0] : '0; endmodule // hwpe_stream_fifo From 6d9888d1ef72234eff4e82d9420cf180b441f180 Mon Sep 17 00:00:00 2001 From: Maurus Item Date: Mon, 10 Jun 2024 18:28:21 +0200 Subject: [PATCH 2/2] Added strobe parameter to all modules and updated comments. --- rtl/basic/hwpe_stream_fence.sv | 21 ++++---- rtl/basic/hwpe_stream_merge.sv | 21 ++++---- rtl/basic/hwpe_stream_serialize.sv | 41 ++++++++------- rtl/basic/hwpe_stream_split.sv | 21 ++++---- rtl/fifo/hwpe_stream_fifo.sv | 26 +++++----- rtl/fifo/hwpe_stream_fifo_earlystall.sv | 39 +++++++------- .../hwpe_stream_fifo_earlystall_sidech.sv | 19 +++---- rtl/fifo/hwpe_stream_fifo_passthrough.sv | 26 ++++++---- rtl/fifo/hwpe_stream_fifo_sidech.sv | 17 ++++--- rtl/streamer/hwpe_stream_sink.sv | 36 +++++++------ rtl/streamer/hwpe_stream_sink_realign.sv | 51 ++++++++++--------- rtl/streamer/hwpe_stream_source.sv | 39 ++++++++------ rtl/streamer/hwpe_stream_source_realign.sv | 45 ++++++++-------- rtl/streamer/hwpe_stream_strbgen.sv | 25 +++++---- 14 files changed, 235 insertions(+), 192 deletions(-) diff --git a/rtl/basic/hwpe_stream_fence.sv b/rtl/basic/hwpe_stream_fence.sv index ba8bc29..89556b3 100644 --- a/rtl/basic/hwpe_stream_fence.sv +++ b/rtl/basic/hwpe_stream_fence.sv @@ -29,20 +29,23 @@ * .. _hwpe_stream_fence_params: * .. table:: **hwpe_stream_fence** design-time parameters. * - * +------------------+-------------+---------------------------------------------+ - * | **Name** | **Default** | **Description** | - * +------------------+-------------+---------------------------------------------+ - * | *NB_STREAMS* | 2 | Number of input/output HWPE-Stream streams. | - * +------------------+-------------+---------------------------------------------+ - * | *DATA_WIDTH* | 32 | Width of the HWPE-Stream streams. | - * +------------------+-------------+---------------------------------------------+ + * +------------------+----------------+---------------------------------------------+ + * | **Name** | **Default** | **Description** | + * +------------------+----------------+---------------------------------------------+ + * | *NB_STREAMS* | 2 | Number of input/output HWPE-Stream streams. | + * +------------------+----------------+---------------------------------------------+ + * | *DATA_WIDTH* | 32 | Width of the HWPE-Stream streams. | + * +------------------+----------------+---------------------------------------------+ + * | *STRB_WIDTH* | DATA_WIDTH / 8 | Width of the HWPE-Stream strobe signal. | + * +------------------+----------------+---------------------------------------------+ */ import hwpe_stream_package::*; module hwpe_stream_fence #( parameter int unsigned NB_STREAMS = 2, - parameter int unsigned DATA_WIDTH = 32 + parameter int unsigned DATA_WIDTH = 32, + parameter int unsigned STRB_WIDTH = DATA_WIDTH/8 ) ( input logic clk_i, @@ -59,7 +62,7 @@ module hwpe_stream_fence #( logic out_valid; logic [NB_STREAMS-1:0] fence_state_q, fence_state_d; logic [NB_STREAMS-1:0][DATA_WIDTH-1:0] data_q; - logic [NB_STREAMS-1:0][DATA_WIDTH/8-1:0] strb_q; + logic [NB_STREAMS-1:0][STRB_WIDTH-1:0] strb_q; generate for(genvar ii=0; ii0, the module produces a HWPE-MemDecoupled interface and includes a TCDM FIFO of this depth. | - * +-------------------+-------------+------------------------------------------------------------------------------------------------------------------------+ - * | *DATA_WIDTH* | 32 | Width of input/output streams. | - * +-------------------+-------------+------------------------------------------------------------------------------------------------------------------------+ - * | *LATCH_FIFO* | 0 | If 1, use latches instead of flip-flops (requires special constraints in synthesis). | - * +-------------------+-------------+------------------------------------------------------------------------------------------------------------------------+ - * | *TRANS_CNT* | 16 | Number of bits supported in the transaction counter of the address generator, which will overflow at 2^ `TRANS_CNT`. | - * +-------------------+-------------+------------------------------------------------------------------------------------------------------------------------+ - * | *REALIGNABLE* | 1 | If set to 0, the sink will not support non-word-aligned HWPE-Mem accesses. | - * +-------------------+-------------+------------------------------------------------------------------------------------------------------------------------+ + * +-------------------+----------------+------------------------------------------------------------------------------------------------------------------------+ + * | **Name** | **Default** | **Description** | + * +-------------------+----------------+------------------------------------------------------------------------------------------------------------------------+ + * | *TCDM_FIFO_DEPTH* | 2 | If >0, the module produces a HWPE-MemDecoupled interface and includes a TCDM FIFO of this depth. | + * +-------------------+----------------+------------------------------------------------------------------------------------------------------------------------+ + * | *DATA_WIDTH* | 32 | Width of input/output streams. | + * +-------------------+----------------+------------------------------------------------------------------------------------------------------------------------+ + * | *STRB_WIDTH* | DATA_WIDTH / 8 | Width of input/output stream strobe signal. | + * +-------------------+----------------+------------------------------------------------------------------------------------------------------------------------+ + * | *LATCH_FIFO* | 0 | If 1, use latches instead of flip-flops (requires special constraints in synthesis). | + * +-------------------+----------------+------------------------------------------------------------------------------------------------------------------------+ + * | *TRANS_CNT* | 16 | Number of bits supported in the transaction counter of the address generator, which will overflow at 2^ `TRANS_CNT`. | + * +-------------------+----------------+------------------------------------------------------------------------------------------------------------------------+ + * | *REALIGNABLE* | 1 | If set to 0, the sink will not support non-word-aligned HWPE-Mem accesses. | + * +-------------------+----------------+------------------------------------------------------------------------------------------------------------------------+ * * .. tabularcolumns:: |l|l|J| * .. _hwpe_stream_sink_ctrl: @@ -92,6 +94,7 @@ module hwpe_stream_sink #( // Stream interface params parameter int unsigned DATA_WIDTH = 32, + parameter int unsigned STRB_WIDTH = DATA_WIDTH/8, parameter int unsigned NB_TCDM_PORTS = DATA_WIDTH/32, parameter int unsigned REALIGNABLE = 1, parameter int unsigned LATCH_FIFO = 0, @@ -132,7 +135,8 @@ module hwpe_stream_sink ); hwpe_stream_intf_stream #( - .DATA_WIDTH ( DATA_WIDTH ) + .DATA_WIDTH ( DATA_WIDTH ), + .STRB_WIDTH ( STRB_WIDTH ) ) realigned_stream ( .clk ( clk_realign_gated ) ); @@ -142,6 +146,7 @@ module hwpe_stream_sink hwpe_stream_split #( .DATA_WIDTH_IN ( DATA_WIDTH ), + .STRB_WIDTH_IN ( STRB_WIDTH ), .NB_OUT_STREAMS( NB_TCDM_PORTS ) ) i_stream_split ( .clk_i ( clk_i ), @@ -179,7 +184,8 @@ module hwpe_stream_sink generate if (REALIGNABLE) begin : realign_gen hwpe_stream_sink_realign #( - .DATA_WIDTH ( DATA_WIDTH ) + .DATA_WIDTH ( DATA_WIDTH ), + .STRB_WIDTH ( STRB_WIDTH ) ) i_realign ( .clk_i ( clk_realign_gated ), .rst_ni ( rst_ni ), diff --git a/rtl/streamer/hwpe_stream_sink_realign.sv b/rtl/streamer/hwpe_stream_sink_realign.sv index e696b93..ffe4024 100644 --- a/rtl/streamer/hwpe_stream_sink_realign.sv +++ b/rtl/streamer/hwpe_stream_sink_realign.sv @@ -23,11 +23,13 @@ * .. _hwpe_stream_sink_realign_params: * .. table:: **hwpe_stream_sink_realign** design-time parameters. * - * +-------------------+-------------+--------------------------------------------------------------------------------------------------------------------------+ - * | **Name** | **Default** | **Description** | - * +-------------------+-------------+--------------------------------------------------------------------------------------------------------------------------+ - * | *DATA_WIDTH* | 32 | Width of input/output streams. | - * +-------------------+-------------+--------------------------------------------------------------------------------------------------------------------------+ + * +-------------------+----------------+--------------------------------------------------------------------------------------------------------------------------+ + * | **Name** | **Default** | **Description** | + * +-------------------+----------------+--------------------------------------------------------------------------------------------------------------------------+ + * | *DATA_WIDTH* | 32 | Width of input/output streams. | + * +-------------------+----------------+--------------------------------------------------------------------------------------------------------------------------+ + * | *STRB_WIDTH* | DATA_WIDTH / 8 | Width of input/output stream strobe signals. | + * +-------------------+----------------+--------------------------------------------------------------------------------------------------------------------------+ * * .. tabularcolumns:: |l|l|J| * .. _hwpe_stream_sink_realign_ctrl: @@ -56,7 +58,8 @@ import hwpe_stream_package::*; module hwpe_stream_sink_realign #( - parameter int unsigned DATA_WIDTH = 32 + parameter int unsigned DATA_WIDTH = 32, + parameter int unsigned STRB_WIDTH = DATA_WIDTH/8 ) ( input logic clk_i, @@ -66,27 +69,27 @@ module hwpe_stream_sink_realign #( input ctrl_realign_t ctrl_i, - input logic [DATA_WIDTH/8-1:0] strb_i, + input logic [STRB_WIDTH-1:0] strb_i, hwpe_stream_intf_stream.sink push_i, hwpe_stream_intf_stream.source pop_o ); - logic [DATA_WIDTH/8-1:0] strb_q; - logic unsigned [$clog2(DATA_WIDTH/8):0] strb_rotate_inv_d; - logic unsigned [$clog2(DATA_WIDTH/8):0] strb_rotate_inv_q; - logic unsigned [$clog2(DATA_WIDTH/8):0] strb_rotate_d; - logic unsigned [$clog2(DATA_WIDTH/8):0] strb_rotate_q; - logic unsigned [$clog2(DATA_WIDTH/8)+3:0] strb_rotate_d_shifted; - logic unsigned [$clog2(DATA_WIDTH/8)+3:0] strb_rotate_q_shifted; - logic unsigned [$clog2(DATA_WIDTH/8)+3:0] strb_rotate_inv_shifted; + logic [STRB_WIDTH-1:0] strb_q; + logic unsigned [$clog2(STRB_WIDTH):0] strb_rotate_inv_d; + logic unsigned [$clog2(STRB_WIDTH):0] strb_rotate_inv_q; + logic unsigned [$clog2(STRB_WIDTH):0] strb_rotate_d; + logic unsigned [$clog2(STRB_WIDTH):0] strb_rotate_q; + logic unsigned [$clog2(STRB_WIDTH)+3:0] strb_rotate_d_shifted; + logic unsigned [$clog2(STRB_WIDTH)+3:0] strb_rotate_q_shifted; + logic unsigned [$clog2(STRB_WIDTH)+3:0] strb_rotate_inv_shifted; logic [DATA_WIDTH-1:0] stream_data_q; - logic [DATA_WIDTH/8-1:0] stream_strb_q; - logic [DATA_WIDTH/8-1:0] stream_strb_latest_q; + logic [STRB_WIDTH-1:0] stream_strb_q; + logic [STRB_WIDTH-1:0] stream_strb_latest_q; logic [DATA_WIDTH-1:0] int_data; logic [DATA_WIDTH-1:0] int_data_q; - logic [DATA_WIDTH/8-1:0] int_strb; - logic [DATA_WIDTH/8-1:0] int_strb_q; + logic [STRB_WIDTH-1:0] int_strb; + logic [STRB_WIDTH-1:0] int_strb_q; logic int_valid; logic int_valid_q; logic int_ready; @@ -121,15 +124,15 @@ module hwpe_stream_sink_realign #( begin strb_rotate_inv_d = '0; if(ctrl_i.first) begin - for (int i=0; i