|
@@ -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:
|
|
async def send_noise(dut, rng: random.Random) -> None:
|
|
|
await wait_host_idle(dut)
|
|
await wait_host_idle(dut)
|
|
|
before_commit = int(dut.target_commit_count_mon.value)
|
|
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"
|
|
port = "rs232" if iteration & 1 else "ttl"
|
|
|
target = rng.choice((58, 63, 70, 75))
|
|
target = rng.choice((58, 63, 70, 75))
|
|
|
await wait_host_idle(dut)
|
|
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)
|
|
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["set_target"] += 2
|
|
|
counters["repeated_set"] += 1
|
|
counters["repeated_set"] += 1
|
|
|
await recover_safe(dut)
|
|
await recover_safe(dut)
|