1616/* *
1717 * The **hci_router_reorder** module is the actual routing engine wrapped by
1818 * **hci_router** (see :ref:`hci_router`). It accepts up to `NB_IN_CHAN`
19- * 32 -bit `in` HCI-Core channels and distributes their requests across
20- * `NB_OUT_CHAN` `out` channels (typically one per memory bank) according to
21- * the external `order_i` index, with no arbitration: per cycle, each `in`
19+ * `BANK_WORD_WIDTH` -bit `in` HCI-Core channels and distributes their requests
20+ * across `NB_OUT_CHAN` `out` channels (typically one per memory bank) according
21+ * to the external `order_i` index, with no arbitration: per cycle, each `in`
2222 * channel is routed to a distinct `out` channel determined by
2323 * `(order_i + i) mod NB_OUT_CHAN`.
2424 *
2929 * are demultiplexed back to the originating `in` channel via instances of
3030 * `addr_dec_resp_mux` (one per `in` channel).
3131 *
32- * When `USE_ECC` is set, the 7 Hsiao SEC-DED check bits of the `ecc`
33- * side-channel are routed alongside the data; otherwise they are tied off.
32+ * When `USE_ECC` is set, the `$clog2(BANK_WORD_WIDTH)+2` Hsiao SEC-DED check
33+ * bits of the `ecc` side-channel are routed alongside the data; otherwise they
34+ * are tied off.
3435 *
3536 * .. tabularcolumns:: |l|l|J|
3637 * .. _hci_router_reorder_params:
3940 * +------------------------+-------------+------------------------------------------------------------------------------+
4041 * | **Name** | **Default** | **Description** |
4142 * +------------------------+-------------+------------------------------------------------------------------------------+
42- * | *NB_IN_CHAN* | 2 | Number of input HCI-Core channels (typically `DWH/32 `). |
43+ * | *NB_IN_CHAN* | 2 | Number of input HCI-Core channels (typically `DWH/BANK_WORD_WIDTH `). |
4344 * +------------------------+-------------+------------------------------------------------------------------------------+
4445 * | *NB_OUT_CHAN* | 2 | Number of output HCI-Core channels (one per memory bank). |
4546 * +------------------------+-------------+------------------------------------------------------------------------------+
47+ * | *BANK_WORD_WIDTH* | 32 | Bit-width of one bank word (data width of each `in`/`out` channel). |
48+ * +------------------------+-------------+------------------------------------------------------------------------------+
49+ * | *BANK_ELEM_WIDTH* | 8 | Bit-width of one element within a bank word (`be` strobe granularity). |
50+ * +------------------------+-------------+------------------------------------------------------------------------------+
4651 * | *FILTER_WRITE_R_VALID* | 0 | If 1, suppress the `r_valid` pulse for write transactions on the response. |
4752 * +------------------------+-------------+------------------------------------------------------------------------------+
48- * | *USE_ECC* | 0 | If 1, propagate the 7-bit ECC check bits alongside data. |
53+ * | *USE_ECC* | 0 | If 1, propagate the ECC check bits alongside data. |
4954 * +------------------------+-------------+------------------------------------------------------------------------------+
5055 *
5156 */
@@ -54,6 +59,8 @@ module hci_router_reorder
5459# (
5560 parameter int unsigned NB_IN_CHAN = 2 ,
5661 parameter int unsigned NB_OUT_CHAN = 2 ,
62+ parameter int unsigned BANK_WORD_WIDTH = 32 ,
63+ parameter int unsigned BANK_ELEM_WIDTH = 8 ,
5764 parameter int unsigned FILTER_WRITE_R_VALID = 0 ,
5865 parameter bit USE_ECC = 0
5966)
@@ -69,33 +76,34 @@ module hci_router_reorder
6976
7077);
7178
72- // Hsiao SEC-DED ECC needs $clog2(DW)+2 check bits
73- // At this level only data are ECC-protected and with DW fixed at 32 that is 5+2 = 7
74- // When USE_ECC == 1 those 7 bits are appended to the 32-bit data word
75- localparam int unsigned EW = (USE_ECC ) ? 7 : 1 ;
76- localparam int unsigned RESP_DATA_WIDTH = (USE_ECC ) ? (32 + 7 ) : 32 ;
77-
78- logic [NB_IN_CHAN - 1 : 0 ] in_req;
79- logic [NB_IN_CHAN - 1 : 0 ] in_req_q;
80- logic [NB_IN_CHAN - 1 : 0 ][31 : 0 ] in_add;
81- logic [NB_IN_CHAN - 1 : 0 ] in_wen;
82- logic [NB_IN_CHAN - 1 : 0 ][3 : 0 ] in_be;
83- logic [NB_IN_CHAN - 1 : 0 ][31 : 0 ] in_data;
84- logic [NB_IN_CHAN - 1 : 0 ][EW - 1 : 0 ] in_ecc;
85- logic [NB_IN_CHAN - 1 : 0 ] in_gnt;
86- logic [NB_IN_CHAN - 1 : 0 ][31 : 0 ] in_r_data;
87- logic [NB_IN_CHAN - 1 : 0 ] in_r_valid;
88- logic [NB_IN_CHAN - 1 : 0 ][EW - 1 : 0 ] in_r_ecc;
89- logic [NB_OUT_CHAN - 1 : 0 ] out_req;
90- logic [NB_OUT_CHAN - 1 : 0 ][31 : 0 ] out_add;
91- logic [NB_OUT_CHAN - 1 : 0 ] out_wen;
92- logic [NB_OUT_CHAN - 1 : 0 ][3 : 0 ] out_be;
93- logic [NB_OUT_CHAN - 1 : 0 ][31 : 0 ] out_data;
94- logic [NB_OUT_CHAN - 1 : 0 ][EW - 1 : 0 ] out_ecc;
95- logic [NB_OUT_CHAN - 1 : 0 ] out_gnt;
96- logic [NB_OUT_CHAN - 1 : 0 ][31 : 0 ] out_r_data;
97- logic [NB_OUT_CHAN - 1 : 0 ][EW - 1 : 0 ] out_r_ecc;
98- logic [NB_IN_CHAN - 1 : 0 ][NB_OUT_CHAN - 1 : 0 ] ma_req;
79+ // Width of the HCI byte-enable field
80+ localparam int unsigned BE_WIDTH = BANK_WORD_WIDTH / BANK_ELEM_WIDTH ;
81+ // Hsiao SEC-DED ECC needs $clog2(DW)+2 check bits.
82+ // When USE_ECC == 1 those bits are appended to the BANK_WORD_WIDTH-bit data word.
83+ localparam int unsigned EW = (USE_ECC ) ? ($clog2 (BANK_WORD_WIDTH )+ 2 ) : 1 ;
84+ localparam int unsigned RESP_DATA_WIDTH = (USE_ECC ) ? (BANK_WORD_WIDTH + EW ) : BANK_WORD_WIDTH ;
85+
86+ logic [NB_IN_CHAN - 1 : 0 ] in_req;
87+ logic [NB_IN_CHAN - 1 : 0 ] in_req_q;
88+ logic [NB_IN_CHAN - 1 : 0 ][31 : 0 ] in_add;
89+ logic [NB_IN_CHAN - 1 : 0 ] in_wen;
90+ logic [NB_IN_CHAN - 1 : 0 ][BE_WIDTH - 1 : 0 ] in_be;
91+ logic [NB_IN_CHAN - 1 : 0 ][BANK_WORD_WIDTH - 1 : 0 ] in_data;
92+ logic [NB_IN_CHAN - 1 : 0 ][EW - 1 : 0 ] in_ecc;
93+ logic [NB_IN_CHAN - 1 : 0 ] in_gnt;
94+ logic [NB_IN_CHAN - 1 : 0 ][BANK_WORD_WIDTH - 1 : 0 ] in_r_data;
95+ logic [NB_IN_CHAN - 1 : 0 ] in_r_valid;
96+ logic [NB_IN_CHAN - 1 : 0 ][EW - 1 : 0 ] in_r_ecc;
97+ logic [NB_OUT_CHAN - 1 : 0 ] out_req;
98+ logic [NB_OUT_CHAN - 1 : 0 ][31 : 0 ] out_add;
99+ logic [NB_OUT_CHAN - 1 : 0 ] out_wen;
100+ logic [NB_OUT_CHAN - 1 : 0 ][BE_WIDTH - 1 : 0 ] out_be;
101+ logic [NB_OUT_CHAN - 1 : 0 ][BANK_WORD_WIDTH - 1 : 0 ] out_data;
102+ logic [NB_OUT_CHAN - 1 : 0 ][EW - 1 : 0 ] out_ecc;
103+ logic [NB_OUT_CHAN - 1 : 0 ] out_gnt;
104+ logic [NB_OUT_CHAN - 1 : 0 ][BANK_WORD_WIDTH - 1 : 0 ] out_r_data;
105+ logic [NB_OUT_CHAN - 1 : 0 ][EW - 1 : 0 ] out_r_ecc;
106+ logic [NB_IN_CHAN - 1 : 0 ][NB_OUT_CHAN - 1 : 0 ] ma_req;
99107
100108 logic [NB_IN_CHAN - 1 : 0 ][RESP_DATA_WIDTH - 1 : 0 ] resp_data_o;
101109 logic [NB_OUT_CHAN - 1 : 0 ][RESP_DATA_WIDTH - 1 : 0 ] resp_data_i;
0 commit comments