refactor(cam): remove read noise from noise architecture (Phase 2)

- Make cam_read_noise a pass-through module, removing all noise injection logic
- Switch write noise to use noise_mask_bernoulli instead of noise_mask_grouped
- Add state machine to cam_write_noise for mask generation timing
- Remove noise_mask_grouped.sv (no longer needed)
- Remove read noise parameters from cam_noisy and cam_top
- Update simulation and benchmark code to reflect read noise removal
- Sync documentation to reflect Phase 2 architecture
This commit is contained in:
2026-05-26 23:02:22 +08:00
parent e5d13917b2
commit 8b4d4c1b57
29 changed files with 277 additions and 863 deletions

View File

@@ -243,7 +243,6 @@ async def cam_perf_benchmark(dut):
hash_bits = dut_hash_bits(dut)
lanes = dut_lanes(dut)
write_noise_en = _get_param(dut, "WRITE_NOISE_EN", 1)
read_noise_en = _get_param(dut, "READ_NOISE_EN", 0)
# ── Deterministic query ─────────────────────────────────────────────
query_hash = 0xAA55_AA55_AA55_AA55_AA55_AA55_AA55_AA55
@@ -271,7 +270,7 @@ async def cam_perf_benchmark(dut):
)
# ── Correctness assertions (conditional on noise state) ─────────────
if not write_noise_en and not read_noise_en:
if not write_noise_en:
# Without noise: stored hash at row 0 == query_hash → exact match.
assert top1_index == 0, (
f"Noise disabled: expected top1_index=0 (exact match), got "
@@ -282,7 +281,7 @@ async def cam_perf_benchmark(dut):
f"{top1_score}"
)
else:
# With noise: write/read flip masks may corrupt stored values, so
# With noise: write flip masks may corrupt stored values, so
# we cannot reliably assert the exact match. Instead, confirm a
# valid non-zero score was produced (the match engine ran).
assert top1_score > 0, (
@@ -290,10 +289,10 @@ async def cam_perf_benchmark(dut):
"Match engine returned invalid result."
)
dut._log.info(
"Noise enabled (WRITE_NOISE_EN=%s, READ_NOISE_EN=%s) — "
"Noise enabled (WRITE_NOISE_EN=%s) — "
"skipping exact top1_index/top1_score assertion. "
"top1_index=%d top1_score=%d",
write_noise_en, read_noise_en, top1_index, top1_score,
write_noise_en, top1_index, top1_score,
)
# ── Machine-readable performance marker ─────────────────────────────