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

@@ -16,7 +16,6 @@ if str(SIM_ROOT) not in sys.path:
import numpy as np
from model.ref_model import (
generate_write_flip_mask,
match_top1,
random_hashes,
)
@@ -31,20 +30,12 @@ def apply_write_noise(
noise_bits: int = 8,
seed: int = 0,
) -> list[int]:
"""Apply write-noise flip masks to every row, returning noisy copies.
"""No-op: write-noise flip masks are now generated by Bernoulli RTL only.
*seed* is a 64-bit value (RTL NOISE_SEED). It is duplicated to form
the 128-bit xorshift initial state: {seed, seed}.
The sweep now measures top-1 stability of pure matching over queries,
since noise is applied at RTL write time, not in the Python model.
"""
noisy: list[int] = []
state = (seed << 64) | seed
mask_w = (1 << width) - 1
for row in rows:
flip, state = generate_write_flip_mask(
state, width, noise_bits, rate_num, rate_den
)
noisy.append((row ^ flip) & mask_w)
return noisy
return list(rows)
def main() -> None: