Просмотр исходного кода

fix(test): parameterize BMC epoch for wrap soak

root 3 месяцев назад
Родитель
Сommit
3c6b711f76

+ 3 - 2
src/acquisition/bmc_ascii_snapshot.v

@@ -4,7 +4,8 @@
 // target the inactive bank; only an exact, valid 48-byte line flips active.
 module bmc_ascii_snapshot #(
     parameter integer STALE_SECONDS = 3,
-    parameter integer INTER_BYTE_TIMEOUT_CLKS = 2500000
+    parameter integer INTER_BYTE_TIMEOUT_CLKS = 2500000,
+    parameter [15:0] INITIAL_EPOCH = 16'd0
 ) (
     input  wire        clk,
     input  wire        rst_n,
@@ -111,7 +112,7 @@ module bmc_ascii_snapshot #(
         if (!rst_n) begin
             snapshot_commit <= 1'b0;
             parser_error <= 1'b0;
-            epoch <= 16'd0;
+            epoch <= INITIAL_EPOCH;
             age_seconds <= 16'hffff;
             active_bank <= 1'b0;
             valid0 <= 24'd0;

+ 3 - 2
src/top/prod2u_6400_v1_top.v

@@ -5,7 +5,8 @@ module prod2u_6400_v1_top #(
     parameter integer ENABLE_STIMULUS = 0,
     parameter integer CT_SCAN_PERIOD_CLKS = 2500000,
     parameter integer HOST_INTER_BYTE_TIMEOUT_CLKS = 250000,
-    parameter integer HOST_IDLE_UNLOCK_CLKS = 1250000
+    parameter integer HOST_IDLE_UNLOCK_CLKS = 1250000,
+    parameter [15:0] BMC_INITIAL_EPOCH = 16'd0
 ) (
     input  wire        sys_clk,
     input  wire        host_rs232_rx,
@@ -209,7 +210,7 @@ module prod2u_6400_v1_top #(
         .byte_data(bmc_tx_data), .tx_o(bmc_rs232_tx), .busy(bmc_tx_busy),
         .byte_done(bmc_tx_done)
     );
-    bmc_ascii_snapshot u_bmc_snapshot (
+    bmc_ascii_snapshot #(.INITIAL_EPOCH(BMC_INITIAL_EPOCH)) u_bmc_snapshot (
         .clk(sys_clk), .rst_n(rst_n), .tick_1s(tick_1s), .rx_valid(bmc_rx_valid),
         .rx_data(bmc_rx_data), .rx_framing_error(bmc_rx_error),
         .snapshot_lock(snapshot_locked), .snapshot_lock_bank(bmc_locked_bank),

+ 3 - 1
tests/cocotb/prod2u_6400_v1_cocotb_top.v

@@ -4,7 +4,8 @@
 // only the CT7428 word-level response is modeled so 27-channel scans remain
 // deterministic and fast enough for integration testing.
 module prod2u_6400_v1_cocotb_top #(
-    parameter integer ENABLE_STIMULUS = 0
+    parameter integer ENABLE_STIMULUS = 0,
+    parameter [15:0] BMC_INITIAL_EPOCH = 16'd0
 ) (
     input  wire        host_rs232_rx,
     output wire        host_rs232_tx,
@@ -47,6 +48,7 @@ module prod2u_6400_v1_cocotb_top #(
 
     prod2u_6400_v1_top #(
         .ENABLE_STIMULUS(ENABLE_STIMULUS),
+        .BMC_INITIAL_EPOCH(BMC_INITIAL_EPOCH),
         .CT_SCAN_PERIOD_CLKS(64),
         .HOST_INTER_BYTE_TIMEOUT_CLKS(512),
         .HOST_IDLE_UNLOCK_CLKS(1024)

+ 3 - 2
tests/cocotb/test_6400_v1_soak.py

@@ -119,8 +119,9 @@ async def test_accelerated_randomized_system_soak(dut):
     previous_state = 0
     await bring_auto(dut)
 
-    # Exercise the 16-bit acquisition epoch rollover with real BMC UART frames.
-    dut.u_dut.u_bmc_snapshot.epoch.value = 0xFFFE
+    # The soak-only wrapper starts at 0xfffa, so bring_auto's four real BMC
+    # frames leave the active epoch at 0xfffe. Two more frames cross the wrap.
+    assert int(dut.bmc_epoch_mon.value) == 0xFFFE
     await send_bmc_snapshot(dut, [60] * 24)
     assert int(dut.bmc_epoch_mon.value) == 0xFFFF
     await send_bmc_snapshot(dut, [60] * 24)

+ 1 - 1
tools/run_6400_soak.py

@@ -62,7 +62,7 @@ def main() -> int:
             hdl_toplevel="prod2u_6400_v1_cocotb_top",
             build_dir=run_root / "build",
             build_args=["-g2012", "-I", str(ROOT)],
-            parameters={"ENABLE_STIMULUS": 1},
+            parameters={"ENABLE_STIMULUS": 1, "BMC_INITIAL_EPOCH": 0xFFFA},
             always=True,
         )
         result_path = Path(runner.test(