From aa85c7ae1179668994146b901f164bc0e0ce9d38 Mon Sep 17 00:00:00 2001 From: Riccardo Tedeschi <58978462+ricted98@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:53:15 +0200 Subject: [PATCH] id_queue: Parametrize number of compare ports (#230) --- src/id_queue.sv | 54 ++++++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/src/id_queue.sv b/src/id_queue.sv index 9bf0c204..1737381d 100644 --- a/src/id_queue.sv +++ b/src/id_queue.sv @@ -50,6 +50,7 @@ module id_queue #( parameter int CAPACITY = 0, parameter bit FULL_BW = 0, parameter bit CUT_OUP_POP_INP_GNT = 0, + parameter int NUM_CMP_PORTS = 1, parameter type data_t = logic[31:0], // Dependent parameters, DO NOT OVERRIDE! localparam type id_t = logic[ID_WIDTH-1:0] @@ -62,11 +63,11 @@ module id_queue #( input logic inp_req_i, output logic inp_gnt_o, - input data_t exists_data_i, - input data_t exists_mask_i, - input logic exists_req_i, - output logic exists_o, - output logic exists_gnt_o, + input data_t [NUM_CMP_PORTS-1:0] exists_data_i, + input data_t [NUM_CMP_PORTS-1:0] exists_mask_i, + input logic [NUM_CMP_PORTS-1:0] exists_req_i, + output logic [NUM_CMP_PORTS-1:0] exists_o, + output logic [NUM_CMP_PORTS-1:0] exists_gnt_o, input id_t oup_id_i, input logic oup_pop_i, @@ -118,8 +119,8 @@ module id_queue #( idx_matches_in_id, idx_matches_out_id; - logic [CAPACITY-1:0] exists_match, - linked_data_free; + logic [NUM_CMP_PORTS-1:0][CAPACITY-1:0] exists_match; + logic [CAPACITY-1:0] linked_data_free; id_t match_in_id, match_out_id; @@ -357,29 +358,32 @@ module id_queue #( end // Exists Lookup - for (genvar i = 0; i < CAPACITY; i++) begin: gen_lookup - data_t exists_match_bits; - for (genvar j = 0; j < $bits(data_t); j++) begin: gen_mask - always_comb begin - if (linked_data_q[i].free) begin - exists_match_bits[j] = 1'b0; - end else begin - if (!exists_mask_i[j]) begin - exists_match_bits[j] = 1'b1; + for (genvar k = 0; k < NUM_CMP_PORTS; k++) begin: gen_lookup_port + for (genvar i = 0; i < CAPACITY; i++) begin: gen_lookup + data_t exists_match_bits; + for (genvar j = 0; j < $bits(data_t); j++) begin: gen_mask + always_comb begin + if (linked_data_q[i].free) begin + exists_match_bits[j] = 1'b0; end else begin - exists_match_bits[j] = (linked_data_q[i].data[j] == exists_data_i[j]); + if (!exists_mask_i[k][j]) begin + exists_match_bits[j] = 1'b1; + end else begin + exists_match_bits[j] = + (linked_data_q[i].data[j] == exists_data_i[k][j]); + end end end end + assign exists_match[k][i] = (&exists_match_bits); end - assign exists_match[i] = (&exists_match_bits); - end - always_comb begin - exists_gnt_o = 1'b0; - exists_o = '0; - if (exists_req_i) begin - exists_gnt_o = 1'b1; - exists_o = (|exists_match); + always_comb begin + exists_gnt_o[k] = 1'b0; + exists_o[k] = '0; + if (exists_req_i[k]) begin + exists_gnt_o[k] = 1'b1; + exists_o[k] = (|exists_match[k]); + end end end