Files
retroSoC/tests/test_mgmt_core_spec.py
T
maksyuki 8d735aafbd feat: refactor tests and update configurations for OpenC906 migration
- Adjusted slot assignments in  to reflect new peripheral mappings.
- Updated  to validate new OpenC906 configurations, including generator and profile checks.
- Modified  to reference the new Std-series VexiiRiscv generator.
- Changed cache maintenance instructions in  to align with C906 specifications.
- Revised assertions in  to account for internal unit removals.
- Updated  to reflect changes in peripheral interface counts and policies.
- Added new test file  to ensure preservation of the frozen HP configuration in the Std-series generator.
2026-10-10 15:15:21 +08:00

99 lines
4.2 KiB
Python

"""Keep the boot display aligned with the fixed Hazard3 management-core integration."""
import re
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
BOOTER = ROOT / "crt/src/service/booter.c"
SOFTWARE_MAKE = ROOT / "rtl/mk/software.mk"
MGMT_CORE = ROOT / "rtl/ip/core/mgmt_core_wrapper.sv"
MGMT_DEBUG = ROOT / "rtl/ip/core/mgmt_debug_wrapper.sv"
AHBL_TO_AXI4 = ROOT / "rtl/ip/interconnect/ahbl2axi4.sv"
VEXII_CONFIG = ROOT / "scripts/vexiiriscv/GenerateRetroSocStd.scala"
def test_booter_prints_the_fixed_hazard3_specification() -> None:
booter = BOOTER.read_text(encoding="utf-8")
software_make = SOFTWARE_MAKE.read_text(encoding="utf-8")
management_core = MGMT_CORE.read_text(encoding="utf-8")
management_debug = MGMT_DEBUG.read_text(encoding="utf-8")
ahbl_to_axi4 = AHBL_TO_AXI4.read_text(encoding="utf-8")
assert "DEF_VAL += -DRS_SOC_MGMT_JTAG_IDCODE=0x$(JTAG_IDCODE)U" in software_make
assert "Management-Core Specification:" in booter
assert "Management Processor:" not in booter
assert "User Processors:" in booter
assert "Core: Hazard3(single hart), 3-stage pipeline" in booter
assert "Base: RV32IMAC_Zicsr" in booter
assert "Bit manipulation: Zba_Zbb_Zbc_Zbkb_Zbkx_Zbs" in booter
assert "Other: Zifencei_Zilsd_Xh3BextM_Xh3IRQ" in booter
assert "Not present: U-mode PMP Zcb_Zclsd_Zcmp_Xh3PMPM_Xh3Power" in booter
assert "IRQ: %u external + software + timer; Xh3IRQ, 4 priority levels" in booter
assert "AHB5 manager -> AHB-Lite/AXI4 fabric" in booter
assert "Single-beat access; no burst or exclusive transactions" in booter
assert "RS_SOC_MGMT_JTAG_IDCODE" in booter
assert "RISC-V JTAG DTM/DM, IDCODE 0x%08x" in booter
assert "One hart: halt/resume, 2 breakpoints; no system-bus access" in booter
assert "AHB-Lite NSEQ subset" not in booter
assert "external cache/coherency handshake" not in booter
assert "TCK/TMS/TDI/TRST_n/TDO" not in booter
assert "instruction injection" not in booter
assert "exact execute-address hardware breakpoints" not in booter
for parameter in (
".EXTENSION_A (EnableAtomics)",
".EXTENSION_C (1)",
".EXTENSION_M (1)",
".EXTENSION_ZBA (1)",
".EXTENSION_ZBB (1)",
".EXTENSION_ZBC (1)",
".EXTENSION_ZBKB (1)",
".EXTENSION_ZBKX (1)",
".EXTENSION_ZBS (1)",
".EXTENSION_ZIFENCEI (1)",
".EXTENSION_ZILSD (1)",
".EXTENSION_XH3BEXTM (1)",
".EXTENSION_XH3IRQ (1)",
".U_MODE (0)",
".PMP_REGIONS (0)",
".BREAKPOINT_TRIGGERS(2)",
".NUM_IRQS (ExternalIrqCount)",
".IRQ_PRIORITY_BITS (2)",
):
assert parameter in management_core
assert re.search(r"parameter int ExternalIrqCount\s*= 30", management_core)
assert re.search(r"parameter bit EnableAtomics\s*= 1'b1", management_core)
assert ".HAVE_SBA(0)" in management_debug
assert "ahbl.htrans == AHBL_TRANS_NSEQ" in ahbl_to_axi4
assert "axi4.awlen = 8'd0;" in ahbl_to_axi4
assert "axi4.arlen = 8'd0;" in ahbl_to_axi4
assert "axi4.awlock = `AXI4_LOCK_NORM;" in ahbl_to_axi4
assert "axi4.arlock = `AXI4_LOCK_NORM;" in ahbl_to_axi4
def test_booter_prints_present_hp_core_specification() -> None:
booter = BOOTER.read_text(encoding="utf-8")
for text in (
"High-Performance-Core Specification:",
"Core: T-Head OpenC906(hart 1), dual-issue in-order",
"Base: RV64IMAFDC_Zicsr_Zifencei (RV64GC)",
"Mode: M/S/U; Sv39 MMU",
"IRQ: internal CLINT/PLIC (T-Head c900 layout)",
"PLIC: 0x08000000; SoC external source n -> ID n+16",
"CLINT: 0x0c000000; MSIP/MTIMECMP/SSIP/STIMECMP",
"No MMIO mtime; software reads the time CSR",
"LP->HP notification: mailbox doorbell (PLIC ID 18)",
"Bus: AXI4 via core BIU; MMIO downsized to AXI32",
):
assert text in booter
assert "rs_sysctrl_get_hp_status(&status)" in booter
assert "!status.present" in booter
# The retired VexiiRiscv Mini configuration is preserved as the frozen
# Std-series generator asset (covered by tests/test_std_vexiiriscv.py).
assert VEXII_CONFIG.is_file()