Skip to content

Commit

Permalink
id_queue: Parametrize number of compare ports (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricted98 authored Sep 16, 2024
1 parent 10dac0f commit aa85c7a
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions src/id_queue.sv
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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,
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit aa85c7a

Please sign in to comment.