From 57e130634eede6627d054d51a2f07c0a21988fa0 Mon Sep 17 00:00:00 2001 From: Max Wipfli Date: Fri, 20 Jun 2025 15:50:20 +0200 Subject: [PATCH 1/3] id_queue: Simplify existence lookup for Verilator speed-up --- src/id_queue.sv | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/id_queue.sv b/src/id_queue.sv index 6d9c1763..bdc40cf4 100644 --- a/src/id_queue.sv +++ b/src/id_queue.sv @@ -362,22 +362,10 @@ module id_queue #( // Exists Lookup 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 - 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); + // For a match, the entry needs to be occupied AND + // the masked slot data needs to match the masked query data. + assign exists_match[k][i] = !linked_data_q[i].free && + ((linked_data_q[i].data & exists_mask_i[k]) == (exists_data_i[k] & exists_mask_i[k])); end always_comb begin exists_gnt_o[k] = 1'b0; From 483f05942eb73c046d66b13968e5d402521412a7 Mon Sep 17 00:00:00 2001 From: Max Wipfli Date: Fri, 20 Jun 2025 16:22:04 +0200 Subject: [PATCH 2/3] id_queue: Use bit-wise instead of logical operators --- src/id_queue.sv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/id_queue.sv b/src/id_queue.sv index bdc40cf4..67ded13d 100644 --- a/src/id_queue.sv +++ b/src/id_queue.sv @@ -364,7 +364,7 @@ module id_queue #( for (genvar i = 0; i < CAPACITY; i++) begin: gen_lookup // For a match, the entry needs to be occupied AND // the masked slot data needs to match the masked query data. - assign exists_match[k][i] = !linked_data_q[i].free && + assign exists_match[k][i] = ~linked_data_q[i].free & ((linked_data_q[i].data & exists_mask_i[k]) == (exists_data_i[k] & exists_mask_i[k])); end always_comb begin From 18ed5d3417d1a08e47318de026018489f6ffc048 Mon Sep 17 00:00:00 2001 From: Max Wipfli Date: Fri, 20 Jun 2025 16:26:41 +0200 Subject: [PATCH 3/3] id_queue: Fix formatting --- src/id_queue.sv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/id_queue.sv b/src/id_queue.sv index 67ded13d..1d7e1058 100644 --- a/src/id_queue.sv +++ b/src/id_queue.sv @@ -365,7 +365,8 @@ module id_queue #( // For a match, the entry needs to be occupied AND // the masked slot data needs to match the masked query data. assign exists_match[k][i] = ~linked_data_q[i].free & - ((linked_data_q[i].data & exists_mask_i[k]) == (exists_data_i[k] & exists_mask_i[k])); + ((linked_data_q[i].data & exists_mask_i[k]) == + (exists_data_i[k] & exists_mask_i[k])); end always_comb begin exists_gnt_o[k] = 1'b0;