feat: update nmi2apb formal design and properties for user IP integration

- Expanded psel_comb and psel_q to 10 bits in nmi2apb_formal.sv and nmi2apb_formal_props.v.
- Added user_ip interface and corresponding formal slave instance in nmi2apb_formal_design.
- Implemented migration of legacy user-extension includes to user_extensions.svh in generate_mpw.py.
- Enhanced configured_filelist function to accept require_files parameter in export_soc_sources.py.
- Updated tests to validate user extension migration and formal design changes.
This commit is contained in:
maksyuki committed 2026-07-26 09:59:44 +08:00
1 parent 7a604ec86b
commit b09e1dff35
8 files changed
+4147 -942

No files matched your search

+6 -2
View File
@@ -32,6 +32,7 @@ from scripts.check_c_warnings import self_owned_warnings # noqa: E402
from scripts.check_format import format_files # noqa: E402
from scripts.dependency_lock import LockError, load_lock # noqa: E402
from scripts.generate_mpw import ( # noqa: E402
migrate_user_extension_includes,
migrate_user_gpio_interfaces,
remove_legacy_picorv32_entry,
)
@@ -144,7 +145,9 @@ def test_source_export_selects_the_requested_management_core(tmp_path: Path) ->
source_export.generate_user_extensions(
ROOT / "rtl/mini/integration/user_extensions.json", user_extensions_dir
)
filelist = source_export.configured_filelist(arguments, generated_dir, user_extensions_dir)
filelist = source_export.configured_filelist(
arguments, generated_dir, user_extensions_dir, require_files=False
)
assert f"+define+CORE_{core}" in filelist.defines
assert any(path.name == source_name for path in filelist.files)
@@ -273,7 +276,7 @@ def test_formal_result_summary_requires_every_passing_step(tmp_path: Path) -> No
def test_legacy_user_gpio_interface_is_migrated_in_generated_source(tmp_path: Path) -> None:
source = tmp_path / "user_ip_design.sv"
source.write_text(
"""`include "user_extensions.svh"
"""`include "mdd_config.svh"
module user_ip_design (gpio_if.dut gpio);
logic value;
assign gpio.gpio_oe = value;
@@ -287,6 +290,7 @@ endmodule
encoding="utf-8",
)
assert migrate_user_extension_includes(tmp_path) == [source]
assert migrate_user_gpio_interfaces(tmp_path) == [source]
migrated = source.read_text(encoding="utf-8")
+8
View File
@@ -141,10 +141,18 @@ def test_topology_always_adds_the_user_apb_target(tmp_path: Path) -> None:
interfaces = (tmp_path / "rtl/soc_apb_interfaces.svh").read_text(encoding="utf-8")
declarations = (tmp_path / "rtl/soc_apb_declarations.svh").read_text(encoding="utf-8")
response = (tmp_path / "rtl/soc_apb_response_mux.svh").read_text(encoding="utf-8")
formal_design = (ROOT / "rtl/mini/formal/nmi2apb_formal.sv").read_text(encoding="utf-8")
formal_properties = (ROOT / "rtl/mini/formal/nmi2apb_formal_props.v").read_text(
encoding="utf-8"
)
assert "apb4_if u_user_ip_apb_if (clk_i, rst_n_i);" in interfaces
assert "localparam int NSLV = 10;" in declarations
assert "s_psel_q[9]" in response
assert "apb4_pure_if user_ip ();" in formal_design
assert ".user_ip (user_ip)" in formal_design
assert "logic [ 9:0] psel_comb" in formal_design
assert "wire [ 9:0] psel_comb" in formal_properties
def test_topology_rejects_unknown_or_non_native_regions(tmp_path: Path) -> None: