mirror of
https://github.com/retroSoC/retroSoC.git
synced 2026-11-06 14:55:14 +00:00
feat: enhance PDK support and add test coverage
- Updated gen_iverilog_filelist.py to exclude sequential models from the file list for GF180 PDK. - Introduced black box definitions for GF180 and SKY130 IO cells in their respective .sv files. - Added simulation models for GF180 IO cells and sequential cells in gf180_seq_sim_cells.v. - Modified tc_clk.sv to utilize specific clock cells for GF180 and SKY130 PDKs. - Implemented bi-directional and tri-state pad modules for GF180 and SKY130 PDKs in tc_io.sv. - Enhanced dependency lock validation to include submodule checks in dependency_lock.py. - Updated setup_helpers.py to support selective submodule initialization. - Created a comprehensive testbench for PDK cells in tc_pdk_cells_tb.sv. - Added tests for dependency helper functions and tech cell configurations to ensure proper error handling.
This commit is contained in:
24 files changed
+956
-41
No files matched your search
@@ -34,6 +34,7 @@ from scripts.regress import ( # noqa: E402
|
||||
pdk_pr_commands,
|
||||
regression_environment,
|
||||
)
|
||||
from scripts import setup_helpers # noqa: E402
|
||||
from scripts.setup_helpers import download_file, ensure_git_repo # noqa: E402
|
||||
|
||||
|
||||
@@ -192,6 +193,44 @@ def test_dependency_helpers_are_idempotent(tmp_path: Path) -> None:
|
||||
assert downloaded.stat().st_mtime_ns == first_mtime
|
||||
|
||||
|
||||
def test_dependency_helper_limits_recursive_submodules(monkeypatch, tmp_path: Path) -> None:
|
||||
commands: list[tuple[str, ...]] = []
|
||||
revision = "a" * 40
|
||||
|
||||
def record(command, *, cwd=None) -> None:
|
||||
del cwd
|
||||
commands.append(tuple(command))
|
||||
|
||||
def git_output_stub(repo: Path, *args: str) -> str:
|
||||
del repo
|
||||
if args == ("rev-parse", "HEAD"):
|
||||
return revision
|
||||
if args == ("status", "--porcelain"):
|
||||
return ""
|
||||
raise AssertionError(f"unexpected git command: {args}")
|
||||
|
||||
monkeypatch.setattr(setup_helpers, "run", record)
|
||||
monkeypatch.setattr(setup_helpers, "git_output", git_output_stub)
|
||||
ensure_git_repo(
|
||||
"https://example.com/pdk.git",
|
||||
tmp_path / "pdk",
|
||||
revision,
|
||||
recursive=True,
|
||||
submodules=("libraries/sky130_fd_sc_hd/latest",),
|
||||
)
|
||||
|
||||
assert commands[-1] == (
|
||||
"git",
|
||||
"submodule",
|
||||
"update",
|
||||
"--init",
|
||||
"--depth",
|
||||
"1",
|
||||
"--",
|
||||
"libraries/sky130_fd_sc_hd/latest",
|
||||
)
|
||||
|
||||
|
||||
def test_make_dry_run_and_validation_do_not_write_filelists() -> None:
|
||||
def build_state() -> dict[str, tuple[int, int]]:
|
||||
build = ROOT / "build"
|
||||
@@ -255,6 +294,9 @@ def test_dependency_lock_and_config_key_include_a_fixed_timestamp(tmp_path: Path
|
||||
lock = load_lock(ROOT / "config/dependencies.lock.json")
|
||||
assert lock["schema_version"] == 1
|
||||
assert len(lock["sources"]["mpw"]["revision"]) == 40
|
||||
assert lock["sources"]["pdk_sky130"]["submodules"] == [
|
||||
"libraries/sky130_fd_sc_hd/latest"
|
||||
]
|
||||
|
||||
command = (
|
||||
sys.executable,
|
||||
@@ -292,6 +334,16 @@ def test_dependency_lock_and_config_key_include_a_fixed_timestamp(tmp_path: Path
|
||||
else:
|
||||
raise AssertionError("invalid dependency lock was accepted")
|
||||
|
||||
invalid_submodules = json.loads(json.dumps(lock))
|
||||
invalid_submodules["sources"]["pdk_sky130"]["submodules"] = ["../outside"]
|
||||
broken.write_text(json.dumps(invalid_submodules), encoding="utf-8")
|
||||
try:
|
||||
load_lock(broken)
|
||||
except LockError as error:
|
||||
assert "submodule" in str(error)
|
||||
else:
|
||||
raise AssertionError("invalid submodule path was accepted")
|
||||
|
||||
|
||||
def test_regression_runner_uses_one_build_timestamp(monkeypatch) -> None:
|
||||
monkeypatch.setenv("BUILD_TIMESTAMP", "2026-07-21-10-39")
|
||||
|
||||
Reference in new issue
Block a user