Files
retroSoC/tests/test_fabric_monitor.py
T
maksyuki d164a562ad feate: add fabric monitor and enhance AXI4 data crossbar tests
- Introduced  and its corresponding testbench  to monitor fabric interactions.
- Updated  to include additional checks for ACL and QoS, enhancing the test coverage.
- Modified  to include the new fabric monitor file.
- Created a new test file  to validate the functionality of the fabric monitor.
- Updated  to integrate the fabric monitor interface.
- Adjusted  to reflect changes in the AXI4 data crossbar test output.
- Enhanced  to ensure proper generation of connections for the fabric monitor.
- Updated user extension tests to account for new local SRAM and stream definitions.
2026-08-31 10:02:19 +08:00

58 lines
1.7 KiB
Python

"""Directed verification for the Mini Data Plane Fabric Monitor."""
from __future__ import annotations
import os
import shutil
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_fabric_monitor_counts_snapshots_and_clears(tmp_path: Path) -> None:
verilator = shutil.which("verilator")
if verilator is None:
return
output = tmp_path / "fabric_monitor_tb"
ccache_tmp = tmp_path / "ccache"
ccache_tmp.mkdir()
subprocess.run(
[
verilator,
"--binary",
"--timing",
"-Wno-fatal",
"--top-module",
"fabric_monitor_tb",
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl/interface"),
str(ROOT / "rtl/managed/clusterip/common/rtl/interface/apb4_if.sv"),
str(ROOT / "rtl/mini/top/fabric_monitor.sv"),
str(ROOT / "tests/rtl/fabric_monitor_tb.sv"),
"-Mdir",
str(tmp_path / "obj"),
"-o",
str(output),
],
check=True,
text=True,
capture_output=True,
env={
**os.environ,
"CCACHE_DIR": str(ccache_tmp),
"CCACHE_TEMPDIR": str(ccache_tmp),
},
)
result = subprocess.run([output], check=True, text=True, capture_output=True)
assert "Fabric Monitor counter, snapshot, and clear test passed" in result.stdout
def test_fabric_monitor_registers_match_hal() -> None:
rtl = (ROOT / "rtl/mini/top/fabric_monitor.sv").read_text(encoding="utf-8")
hal = (ROOT / "crt/src/hal/fabric_monitor.c").read_text(encoding="utf-8")
for value in ("00C", "010", "014", "018", "01C", "020", "100", "300"):
assert value in rtl
assert value in hal