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

test(6400): expose soak transaction diagnostics

root 3 месяцев назад
Родитель
Сommit
0c2720c878
1 измененных файлов с 26 добавлено и 4 удалено
  1. 26 4
      tests/cocotb/test_6400_v1_soak.py

+ 26 - 4
tests/cocotb/test_6400_v1_soak.py

@@ -60,6 +60,30 @@ async def wait_host_idle(dut) -> None:
     )
 
 
+async def set_target(dut, port: str, target: int) -> None:
+    try:
+        kind, payload = await host_transaction(dut, port, SET_TARGET, bytes([target]))
+    except BaseException:
+        cocotb.log.error(
+            "SET_TARGET_TIMEOUT port=%s target=%d locked=%d selected=%d "
+            "rx_valid=%d rx_error=%d frame_valid=%d frame_ready=%d command_busy=%d "
+            "target_commits=%d responses=%d",
+            port,
+            target,
+            int(dut.u_dut.host_locked.value),
+            int(dut.u_dut.host_port_sel.value),
+            int(dut.u_dut.host_rx_valid.value),
+            int(dut.u_dut.host_rx_error.value),
+            int(dut.u_dut.frame_valid.value),
+            int(dut.u_dut.frame_ready.value),
+            int(dut.u_dut.host_command_busy.value),
+            int(dut.target_commit_count_mon.value),
+            int(dut.host_response_count_mon.value),
+        )
+        raise
+    assert (kind, payload) == (SET_TARGET_ACK, b"")
+
+
 async def send_noise(dut, rng: random.Random) -> None:
     await wait_host_idle(dut)
     before_commit = int(dut.target_commit_count_mon.value)
@@ -163,11 +187,9 @@ async def test_accelerated_randomized_system_soak(dut):
             port = "rs232" if iteration & 1 else "ttl"
             target = rng.choice((58, 63, 70, 75))
             await wait_host_idle(dut)
-            kind, payload = await host_transaction(dut, port, SET_TARGET, bytes([target]))
-            assert (kind, payload) == (SET_TARGET_ACK, b"")
+            await set_target(dut, port, target)
             await wait_host_idle(dut)
-            kind, payload = await host_transaction(dut, port, SET_TARGET, bytes([target]))
-            assert (kind, payload) == (SET_TARGET_ACK, b"")
+            await set_target(dut, port, target)
             counters["set_target"] += 2
             counters["repeated_set"] += 1
             await recover_safe(dut)