mirror of
https://github.com/retroSoC/retroSoC.git
synced 2026-11-04 22:32:36 +00:00
- Introduced new task in for handling high-performance APU writes with access fault checks. - Updated to support an expanded resource count, including ownership and IRQ routing for the new APU resource. - Enhanced to validate IRQ expectations for the newly added APU resource. - Created for directed verification of APU-P1 APB4 register shell and integrated IRQ ownership topology. - Added to ensure synchronization between RTL and SDK register ABI. - Modified to parameterize tests for product modes, improving flexibility in testing. - Updated to reflect changes in APU memory mapping and ensure correct assertions. - Enhanced to validate the complete IRQ and resource allocations for the APU.
337 lines
12 KiB
Python
337 lines
12 KiB
Python
"""Directed tests for the active AXI4 fabric adapters."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def test_axi4_address_gate_blocks_new_and_drains_accepted_requests(tmp_path: Path) -> None:
|
|
verilator = shutil.which("verilator")
|
|
if verilator is None:
|
|
return
|
|
|
|
output = tmp_path / "axi4_address_gate_tb"
|
|
ccache_tmp = tmp_path / "ccache"
|
|
ccache_tmp.mkdir()
|
|
subprocess.run(
|
|
[
|
|
verilator,
|
|
"--binary",
|
|
"--timing",
|
|
"-Wno-fatal",
|
|
"--top-module",
|
|
"axi4_address_gate_tb",
|
|
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl"),
|
|
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl/interface"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/interface/axi4_if.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/utils/register.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/utils/xchecker.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/utils/spill_register.sv"),
|
|
str(ROOT / "rtl/mini/top/axi4_address_gate.sv"),
|
|
str(ROOT / "tests/rtl/axi4_address_gate_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 "AXI4 address gate quiesce test passed" in result.stdout
|
|
|
|
|
|
def test_axi4_async_bridge_transfers_and_warm_flushes(tmp_path: Path) -> None:
|
|
verilator = shutil.which("verilator")
|
|
if verilator is None:
|
|
return
|
|
output = tmp_path / "axi4_async_bridge_tb"
|
|
ccache_tmp = tmp_path / "ccache"
|
|
ccache_tmp.mkdir()
|
|
subprocess.run(
|
|
[
|
|
verilator, "--binary", "--timing", "-Wno-fatal", "--top-module",
|
|
"axi4_async_bridge_tb",
|
|
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl"),
|
|
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl/cdc"),
|
|
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl/interface"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/interface/axi4_if.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/utils/register.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/utils/xchecker.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/utils/spill_register.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/utils/bin2gray.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/utils/gray2bin.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/cdc/cdc_sync.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/cdc/cdc_rst_ctrlr.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/cdc/cdc_2phase.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/clkrst/rst_sync.sv"),
|
|
str(ROOT / "rtl/mini/top/soc_common_cdc.sv"),
|
|
str(ROOT / "rtl/mini/top/axi4_async_bridge.sv"),
|
|
str(ROOT / "tests/rtl/axi4_async_bridge_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 "AXI4 async bridge transfer and warm flush test passed" in result.stdout
|
|
|
|
|
|
def test_axi4_downsizer_preserves_bursts_lanes_and_backpressure(
|
|
tmp_path: Path,
|
|
) -> None:
|
|
verilator = shutil.which("verilator")
|
|
if verilator is None:
|
|
return
|
|
|
|
output = tmp_path / "axi4_downsizer_64to32_tb"
|
|
ccache_tmp = tmp_path / "ccache"
|
|
ccache_tmp.mkdir()
|
|
subprocess.run(
|
|
[
|
|
verilator,
|
|
"--binary",
|
|
"--timing",
|
|
"-Wno-fatal",
|
|
"--top-module",
|
|
"axi4_downsizer_64to32_tb",
|
|
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl"),
|
|
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl/interface"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/interface/axi4_if.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/utils/register.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/interface/axi4_addr_gen.sv"),
|
|
str(ROOT / "rtl/mini/top/axi4_downsizer_64to32.sv"),
|
|
str(ROOT / "tests/rtl/axi4_downsizer_64to32_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 "AXI4 64-to-32 downsizer test passed" in result.stdout
|
|
|
|
|
|
def test_axi4_word_bridge_supports_bursts_backpressure_and_errors(tmp_path: Path) -> None:
|
|
verilator = shutil.which("verilator")
|
|
if verilator is None:
|
|
return
|
|
|
|
output = tmp_path / "axi4_word_bridge_tb"
|
|
ccache_tmp = tmp_path / "ccache"
|
|
ccache_tmp.mkdir()
|
|
subprocess.run(
|
|
[
|
|
verilator,
|
|
"--binary",
|
|
"--timing",
|
|
"-Wno-fatal",
|
|
"--top-module",
|
|
"axi4_word_bridge_tb",
|
|
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl"),
|
|
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl/interface"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/interface/axi4_if.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/interface/apb4_if.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/utils/register.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/interface/axi4_addr_gen.sv"),
|
|
str(ROOT / "rtl/mini/top/axi4_word_bridge.sv"),
|
|
str(ROOT / "tests/rtl/axi4_word_bridge_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 "AXI4 word bridge test passed" in result.stdout
|
|
|
|
|
|
@pytest.mark.parametrize("product_mode", [False, True])
|
|
def test_axi4_interconnect_classifies_decode_protocol_and_access_errors(
|
|
tmp_path: Path, product_mode: bool
|
|
) -> None:
|
|
verilator = shutil.which("verilator")
|
|
if verilator is None:
|
|
return
|
|
|
|
memory_map = tmp_path / "memory_map"
|
|
subprocess.run(
|
|
[
|
|
sys.executable,
|
|
str(ROOT / "rtl/mini/address_map/generate_memory_map.py"),
|
|
"--map",
|
|
str(ROOT / "rtl/mini/address_map/memory_map.json"),
|
|
"--output-dir",
|
|
str(memory_map),
|
|
"--have-sram-if",
|
|
"NO",
|
|
],
|
|
check=True,
|
|
)
|
|
output = tmp_path / "axi4_interconnect_tb"
|
|
ccache_tmp = tmp_path / "ccache"
|
|
ccache_tmp.mkdir()
|
|
subprocess.run(
|
|
[
|
|
verilator,
|
|
"--binary",
|
|
"--timing",
|
|
"-Wno-fatal",
|
|
"--top-module",
|
|
"axi4_interconnect_tb",
|
|
*(["-DMINI_PRODUCT"] if product_mode else []),
|
|
"-I" + str(memory_map / "rtl"),
|
|
"-I" + str(ROOT / "rtl/mini/top"),
|
|
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl"),
|
|
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl/interface"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/interface/axi4_if.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/utils/register.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/stream/round_robin_arbiter.sv"),
|
|
str(ROOT / "rtl/mini/top/axi4_interconnect.sv"),
|
|
str(ROOT / "rtl/mini/top/axi4_error_slave.sv"),
|
|
str(ROOT / "tests/rtl/axi4_interconnect_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 "AXI4 interconnect fault classification test passed" in result.stdout
|
|
|
|
|
|
def test_axi4_data_crossbar_supports_cross_target_outstanding_and_acl(tmp_path: Path) -> None:
|
|
verilator = shutil.which("verilator")
|
|
if verilator is None:
|
|
return
|
|
|
|
memory_map = tmp_path / "memory_map"
|
|
subprocess.run(
|
|
[
|
|
sys.executable,
|
|
str(ROOT / "rtl/mini/address_map/generate_memory_map.py"),
|
|
"--map",
|
|
str(ROOT / "rtl/mini/address_map/memory_map.json"),
|
|
"--output-dir",
|
|
str(memory_map),
|
|
"--have-sram-if",
|
|
"YES",
|
|
"--sram-size-kib",
|
|
"32",
|
|
],
|
|
check=True,
|
|
)
|
|
output = tmp_path / "axi4_data_crossbar_tb"
|
|
ccache_tmp = tmp_path / "ccache"
|
|
ccache_tmp.mkdir()
|
|
subprocess.run(
|
|
[
|
|
verilator,
|
|
"--binary",
|
|
"--timing",
|
|
"-Wno-fatal",
|
|
"--top-module",
|
|
"axi4_data_crossbar_tb",
|
|
"-I" + str(memory_map / "rtl"),
|
|
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl"),
|
|
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl/interface"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/interface/axi4_if.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/stream/round_robin_arbiter.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/utils/register.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/utils/fifo.sv"),
|
|
str(ROOT / "rtl/mini/top/axi4_data_crossbar.sv"),
|
|
str(ROOT / "tests/rtl/axi4_data_crossbar_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 "AXI4 data crossbar concurrency, ACL, and QoS test passed" in result.stdout
|
|
|
|
|
|
def test_axi4_target_guard_terminates_and_isolates_timeouts(tmp_path: Path) -> None:
|
|
verilator = shutil.which("verilator")
|
|
if verilator is None:
|
|
return
|
|
|
|
output = tmp_path / "axi4_target_guard_tb"
|
|
ccache_tmp = tmp_path / "ccache"
|
|
ccache_tmp.mkdir()
|
|
subprocess.run(
|
|
[
|
|
verilator,
|
|
"--binary",
|
|
"--timing",
|
|
"-Wno-fatal",
|
|
"--top-module",
|
|
"axi4_target_guard_tb",
|
|
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl"),
|
|
"-I" + str(ROOT / "rtl/managed/clusterip/common/rtl/interface"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/interface/axi4_if.sv"),
|
|
str(ROOT / "rtl/managed/clusterip/common/rtl/utils/fifo.sv"),
|
|
str(ROOT / "rtl/mini/top/axi4_target_guard.sv"),
|
|
str(ROOT / "tests/rtl/axi4_target_guard_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 "AXI4 target guard timeout and isolation test passed" in result.stdout
|