fix(pipeline): add S_WAIT_READ_RESP state to fix read-noise PRNG timing

- Emit rd_valid_o for exactly one combinational cycle before waiting for
  read response, ensuring the read-noise PRNG advances once per batch issue
- Fix query handshake: wait for query_ready before asserting query_valid
  to avoid valid&&ready handshake drops on clock edges
- Add dynamic timeout estimation in test utilities based on DUT parameters
- Update test-top Makefile to run all noise configurations by default
- Remove uv run prefix from cocotb-config Makefile invocation
This commit is contained in:
2026-05-22 15:06:26 +08:00
parent 424cf6e1d3
commit 29f4cc91f6
7 changed files with 60 additions and 26 deletions

View File

@@ -31,9 +31,10 @@ module match_engine_pipeline (
//==========================================================================
// State encoding
//==========================================================================
typedef enum logic [2:0] {
typedef enum logic [3:0] {
S_IDLE,
S_ISSUE_READ,
S_WAIT_READ_RESP,
S_WAIT_SCORE,
S_STAGE_CANDIDATES,
S_PUSH_CANDIDATES,
@@ -373,6 +374,13 @@ module match_engine_pipeline (
end
S_ISSUE_READ: begin
// Emit rd_valid_o for exactly one cycle (combinational), then
// transition to S_WAIT_READ_RESP. This ensures the read-noise
// PRNG in cam_read_noise only advances once per batch issue.
state_q <= S_WAIT_READ_RESP;
end
S_WAIT_READ_RESP: begin
if (rd_valid_i) begin
// Capture staging data for popcount pipeline
rd_stage_valid_q <= 1'b1;
@@ -380,8 +388,7 @@ module match_engine_pipeline (
rd_stage_hashes_q <= rd_hashes_i;
rd_stage_lane_valid_q <= rd_lane_valid_i;
// Remember the lane mask for this batch (used in S_WAIT_SCORE
// to determine batch_scores_done — survives until overwritten
// by the next S_ISSUE_READ).
// to determine batch_scores_done).
batch_lane_mask_q <= rd_lane_valid_i;
issue_base_q <= issue_base_q + `LANES;
issued_batches_q <= issued_batches_q + 1;