| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #!/usr/bin/env python3
- """Run the independent RX fast-JOG contract directly with Icarus."""
- from __future__ import annotations
- import subprocess
- import tempfile
- from pathlib import Path
- from tools import prod2u_p4_harness as harness
- ROOT = Path(__file__).resolve().parents[2]
- TESTBENCH = ROOT / "tests/sim/prod2u_p4_normal_v3_rx_fast_jog_tb.v"
- SOURCES = (
- ROOT / "src/rtl/binary921_crc16.v",
- ROOT / "src/rtl/prod2u_p4_normal_v3_rx.v",
- TESTBENCH,
- )
- def test_rx_fast_jog_bypasses_held_normal_request_slot() -> None:
- iverilog = harness.resolve_tool("iverilog")
- vvp = harness.resolve_tool("vvp")
- assert iverilog is not None, "Icarus Verilog is required"
- assert vvp is not None, "vvp is required"
- with tempfile.TemporaryDirectory(prefix="p4-rx-fast-jog-") as temporary:
- executable = Path(temporary) / "rx_fast_jog.vvp"
- compile_result = subprocess.run(
- [
- str(iverilog),
- "-g2005-sv",
- "-s",
- "prod2u_p4_normal_v3_rx_fast_jog_tb",
- "-o",
- str(executable),
- *(str(path) for path in SOURCES),
- ],
- cwd=ROOT,
- env=harness.tool_env(),
- capture_output=True,
- text=True,
- timeout=60,
- check=False,
- )
- compile_output = compile_result.stdout + compile_result.stderr
- assert compile_result.returncode == 0, compile_output
- run_result = subprocess.run(
- [str(vvp), str(executable)],
- cwd=ROOT,
- env=harness.tool_env(),
- capture_output=True,
- text=True,
- timeout=60,
- check=False,
- )
- output = run_result.stdout + run_result.stderr
- assert run_result.returncode == 0, output
- assert "PASS: prod2u_p4_normal_v3_rx_fast_jog_tb" in output
|