mirror of
https://github.com/retroSoC/retroSoC.git
synced 2026-11-06 14:55:14 +00:00
- Implemented module to handle debug reset requests, ensuring proper synchronization with the AHB-Lite bridge. - Created to integrate JTAG-DTM and Debug Module, facilitating abstract command exposure. - Updated and modules to include JTAG interface signals. - Enhanced the development environment with scripts for running debug sessions using OpenOCD and GDB. - Added tests for management debug reset functionality and JTAG integration, ensuring correct behavior under various scenarios. - Updated SDC generation to include JTAG clock domain and port requirements. - Modified various scripts to support new debug features and ensure compatibility with the Hazard3 architecture.
66 lines
2.3 KiB
Python
66 lines
2.3 KiB
Python
"""Tests for the root clock/reset and CDC inventory checker."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
DOMAIN_MAP = ROOT / "rtl/mini/integration/clock_reset_domains.json"
|
|
CHECKER = ROOT / "scripts/check_clock_reset_domains.py"
|
|
|
|
|
|
def check(domain_map: Path) -> subprocess.CompletedProcess[str]:
|
|
return subprocess.run(
|
|
[sys.executable, str(CHECKER), "--map", str(domain_map), "--root", str(ROOT)],
|
|
text=True,
|
|
capture_output=True,
|
|
)
|
|
|
|
|
|
def write_invalid_map(tmp_path: Path, document: dict[str, object]) -> Path:
|
|
path = tmp_path / "clock_reset_domains.json"
|
|
path.write_text(json.dumps(document), encoding="utf-8")
|
|
return path
|
|
|
|
|
|
def test_clock_reset_domain_inventory_matches_the_rcu() -> None:
|
|
result = check(DOMAIN_MAP)
|
|
assert result.returncode == 0, result.stderr
|
|
document = json.loads(DOMAIN_MAP.read_text(encoding="utf-8"))
|
|
assert document["schema_version"] == 2
|
|
assert {domain["name"] for domain in document["domains"]} == {
|
|
"external",
|
|
"system",
|
|
"audio",
|
|
"jtag",
|
|
"dvp",
|
|
}
|
|
assert {
|
|
(crossing["name"], crossing["source"], crossing["destination"])
|
|
for crossing in document["crossings"]
|
|
} >= {("jtag_dmi", "jtag", "system")}
|
|
|
|
|
|
def test_clock_reset_domain_inventory_rejects_unknown_domain_and_instance(tmp_path: Path) -> None:
|
|
document = json.loads(DOMAIN_MAP.read_text(encoding="utf-8"))
|
|
document["crossings"][0]["destination"] = "unknown"
|
|
result = check(write_invalid_map(tmp_path, document))
|
|
assert result.returncode != 0
|
|
assert "references an unknown domain" in result.stderr
|
|
|
|
document = json.loads(DOMAIN_MAP.read_text(encoding="utf-8"))
|
|
document["domains"][0]["instance"] = "u_missing_rst_sync"
|
|
result = check(write_invalid_map(tmp_path, document))
|
|
assert result.returncode != 0
|
|
assert "does not declare rst_sync instance" in result.stderr
|
|
|
|
document = json.loads(DOMAIN_MAP.read_text(encoding="utf-8"))
|
|
document["domains"][1]["sta"]["source_domain"] = "unknown"
|
|
result = check(write_invalid_map(tmp_path, document))
|
|
assert result.returncode != 0
|
|
assert "STA source references unknown domain" in result.stderr
|