test(fpga): F-3.2 add DDC cosim fuzz runner with seed sweep

A new SCENARIO_FUZZ branch in tb_ddc_cosim.v accepts +hex / +csv / +tag
plusargs so an external runner can pick stimulus and output paths per
iteration. The three path registers are widened to 4 kbit each so long
temp-directory paths (e.g. /private/var/folders/...) do not overflow
the MSB and emerge truncated — a real failure mode caught while writing
this runner.

test_ddc_cosim_fuzz.py is a pytest-driven fuzz harness:
 - Generates a random plausible radar scene per seed (1-4 targets with
   random range/velocity/RCS/phase, random noise level 0.5-6.0 LSB
   stddev) via radar_scene.generate_adc_samples, fully deterministic.
 - Compiles tb_ddc_cosim.v once per session (module-scope fixture),
   then runs vvp per seed.
 - Asserts sample-count bounds consistent with 4x CIC decimation,
   signed-18 range on every baseband I/Q word, and non-zero output
   (catches silent pipeline stalls).
 - Ships with two tiers: test_ddc_fuzz_fast (8 seeds, default CI) and
   test_ddc_fuzz_full (100 seeds, opt-in via -m slow) matching the
   audit ask.

Registers the "slow" marker in pyproject.toml for the 100-seed opt-in.
This commit is contained in:
Jason
2026-04-20 15:45:09 +05:45
parent b588e89f67
commit 51740fd6f5
3 changed files with 205 additions and 4 deletions
+15 -4
View File
@@ -64,9 +64,11 @@ module tb_ddc_cosim;
// Scenario selector (set via +define)
reg [255:0] scenario_name;
reg [1023:0] hex_file_path;
reg [1023:0] csv_out_path;
reg [1023:0] csv_cic_path;
// Widened to 4 kbits (512 bytes) so fuzz-runner temp paths
// (e.g. /private/var/folders/.../pytest-of-...) fit without MSB truncation.
reg [4095:0] hex_file_path;
reg [4095:0] csv_out_path;
reg [4095:0] csv_cic_path;
// Clock generation
// 400 MHz clock
@@ -152,7 +154,16 @@ module tb_ddc_cosim;
// Select scenario
// Default to DC scenario for fastest validation
// Override with: +define+SCENARIO_SINGLE, +define+SCENARIO_MULTI, etc.
`ifdef SCENARIO_SINGLE
`ifdef SCENARIO_FUZZ
// Audit F-3.2: fuzz runner provides +hex and +csv paths plus a
// scenario tag. Any missing plusarg falls back to the DC vector.
if (!$value$plusargs("hex=%s", hex_file_path))
hex_file_path = "tb/cosim/adc_dc.hex";
if (!$value$plusargs("csv=%s", csv_out_path))
csv_out_path = "tb/cosim/rtl_bb_fuzz.csv";
if (!$value$plusargs("tag=%s", scenario_name))
scenario_name = "fuzz";
`elsif SCENARIO_SINGLE
hex_file_path = "tb/cosim/adc_single_target.hex";
csv_out_path = "tb/cosim/rtl_bb_single_target.csv";
scenario_name = "single_target";