Files
retroSoC/tests/test_clock_reset_domains.py
T
maksyuki 87fdfe49d8 feat: enhance core-STA integration and timing analysis
- Updated soc_topology.json to include new fabric links for core, DMA, native, and APB interfaces.
- Refactored retrosoc.sv to utilize generated fabric links and included necessary SVH files for better modularity.
- Improved check_clock_reset_domains.py to validate hierarchical pins and added support for positive number checks.
- Modified regress.py to include OpenSTA in the regression commands.
- Enhanced README.md in the STA directory to clarify the timing analysis flow and supported PDK profiles.
- Removed outdated gen2.sdc file and replaced it with a dynamic SDC generation approach.
- Updated opensta.mk to generate SDC files dynamically based on the current domain map and pin map.
- Created generate_sdc.py to automate SDC generation from clock/reset domain inventory.
- Added tests for generated core-STA constraints to ensure coverage of current clock domains and validate pin map integrity.
- Introduced new timing metrics and warnings for the sky130 PDK in the quality checks.
2026-07-24 17:59:35 +08:00

61 lines
2.1 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",
"dvp",
}
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