Skip to content

Commit d3090d1

Browse files
authored
id_queue: Simplify exists_match computation (#258)
* id_queue: Simplify existence lookup for Verilator speed-up * id_queue: Use bit-wise instead of logical operators * id_queue: Fix formatting
1 parent 47b020a commit d3090d1

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

src/id_queue.sv

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -362,22 +362,11 @@ module id_queue #(
362362
// Exists Lookup
363363
for (genvar k = 0; k < NUM_CMP_PORTS; k++) begin: gen_lookup_port
364364
for (genvar i = 0; i < CAPACITY; i++) begin: gen_lookup
365-
data_t exists_match_bits;
366-
for (genvar j = 0; j < $bits(data_t); j++) begin: gen_mask
367-
always_comb begin
368-
if (linked_data_q[i].free) begin
369-
exists_match_bits[j] = 1'b0;
370-
end else begin
371-
if (!exists_mask_i[k][j]) begin
372-
exists_match_bits[j] = 1'b1;
373-
end else begin
374-
exists_match_bits[j] =
375-
(linked_data_q[i].data[j] == exists_data_i[k][j]);
376-
end
377-
end
378-
end
379-
end
380-
assign exists_match[k][i] = (&exists_match_bits);
365+
// For a match, the entry needs to be occupied AND
366+
// the masked slot data needs to match the masked query data.
367+
assign exists_match[k][i] = ~linked_data_q[i].free &
368+
((linked_data_q[i].data & exists_mask_i[k]) ==
369+
(exists_data_i[k] & exists_mask_i[k]));
381370
end
382371
always_comb begin
383372
exists_gnt_o[k] = 1'b0;

0 commit comments

Comments
 (0)