Add Spike support to ACT4 to enable H testgen for CVW Hypervisor Testing#916
Add Spike support to ACT4 to enable H testgen for CVW Hypervisor Testing#916TnnsBeast wants to merge 4 commits intoriscv:act4from
Conversation
jordancarlin
left a comment
There was a problem hiding this comment.
I haven’t reviewed the hypervisor specific parts yet, but here’s an initial round of comments on the spike integration.
3d0cb3f to
54094a3
Compare
jordancarlin
left a comment
There was a problem hiding this comment.
The Spike side of things is getting close. Here is round 2 of feedback.
I still haven't reviewed the actual hypervisor test generator in detail, but I left a few high level comments on it.
| objdump_exe: riscv64-unknown-elf-objdump # executable name on $PATH or full path to executable, optional | ||
| ref_model_exe: spike # executable name on $PATH or full path to executable | ||
| ref_model_type: spike | ||
| ref_model_args: "--isa=rv64gch_zicntr_zihpm_zicbom_zicboz_sstc_svpbmt_svadu" |
There was a problem hiding this comment.
Could we generate this from the UDB extensions list instead of needing to specify the list of extensions in yet another place? The framework already produces a file called extensions.txt in each config's work directory with the list of extensions. Maybe just combine all of the items in that list and stick XLEN on the beginning of it?
framework/src/act/makefile_gen.py
Outdated
| ref_model_debug_flags = config.ref_model_type.debug_flags.format(sig_trace_file=sig_trace_file) | ||
| ref_model_debug_line = f"\t\t{ref_model_debug_flags} \\\n" if ref_model_debug_flags else "" |
There was a problem hiding this comment.
Can this be simplified to the following?
| ref_model_debug_flags = config.ref_model_type.debug_flags.format(sig_trace_file=sig_trace_file) | |
| ref_model_debug_line = f"\t\t{ref_model_debug_flags} \\\n" if ref_model_debug_flags else "" | |
| ref_model_debug_line = f"\t\t{config.ref_model_type.debug_flags.format(sig_trace_file=sig_trace_file)} \\\n" |
54094a3 to
e7423a4
Compare
There was a problem hiding this comment.
Pull request overview
Adds initial Hypervisor (H) privileged test generation and extends the ACT4 framework to support Spike as an alternate reference model, along with new Core-V Wally (CVW) hypervisor-enabled core configurations for rv32/rv64.
Changes:
- Introduces a new privileged test generator for the H extension (
priv/extensions/h.py). - Adds Spike reference-model support to ACT4 config + Makefile generation (signature/debug flags and optional ref model args).
- Adds new CVW hypervisor-enabled core configs (
cvw-rv32gch,cvw-rv64gch) and updates CI exclusions.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| generators/testgen/src/testgen/priv/extensions/h.py | Adds an H-extension privileged CSR access test generator. |
| framework/src/act/makefile_gen.py | Generalizes signature generation to support non-Sail ref models and optional ref-model args. |
| framework/src/act/config.py | Adds spike as a reference model type and supports ref_model_args. |
| config/cores/cvw/cvw-rv64gch/test_config.yaml | New CVW rv64gch config using Spike as reference model. |
| config/cores/cvw/cvw-rv64gch/sail.json | Provides memory/platform config (used by tooling) for the new core config. |
| config/cores/cvw/cvw-rv64gch/rvtest_config.svh | Coverage defines for the new rv64gch config. |
| config/cores/cvw/cvw-rv64gch/rvtest_config.h | C header defines for the new rv64gch config. |
| config/cores/cvw/cvw-rv64gch/rvmodel_macros.h | DUT macros for termination/I/O and platform hooks for rv64gch. |
| config/cores/cvw/cvw-rv64gch/link.ld | Linker script for rv64gch. |
| config/cores/cvw/cvw-rv64gch/cvw-rv64gch.yaml | UDB architecture configuration for rv64gch with H enabled. |
| config/cores/cvw/cvw-rv32gch/test_config.yaml | New CVW rv32gch config using Spike as reference model. |
| config/cores/cvw/cvw-rv32gch/sail.json | Provides memory/platform config (used by tooling) for the new core config. |
| config/cores/cvw/cvw-rv32gch/rvtest_config.svh | Coverage defines for the new rv32gch config. |
| config/cores/cvw/cvw-rv32gch/rvtest_config.h | C header defines for the new rv32gch config. |
| config/cores/cvw/cvw-rv32gch/rvmodel_macros.h | DUT macros for termination/I/O and platform hooks for rv32gch. |
| config/cores/cvw/cvw-rv32gch/link.ld | Linker script for rv32gch. |
| config/cores/cvw/cvw-rv32gch/cvw-rv32gch.yaml | UDB architecture configuration for rv32gch with H enabled. |
| .github/workflows/regress.yml | Excludes H from the QEMU regression build matrix. |
| FAST=True \ | ||
| EXTENSIONS= \ | ||
| EXCLUDE_EXTENSIONS=Sm,ExceptionsZc,Zaamo,Zalrsc,Zabha,Zacas,ZacasZabha \ | ||
| EXCLUDE_EXTENSIONS=Sm,ExceptionsZc,Zaamo,Zalrsc,Zabha,Zacas,ZacasZabha,H \ |
There was a problem hiding this comment.
Now that H tests are generated, excluding H only for the QEMU job can leave the Spike job generating/running H tests while its run_cmd ISA string still doesn’t include h. That mismatch can cause illegal-instruction failures when Spike runs the generated H CSR accesses. Either add H to the Spike job’s EXCLUDE_EXTENSIONS too, or update the Spike --isa strings/Spike config to actually enable the H extension.
| ################################## | ||
| # priv/extensions/h.py | ||
| # | ||
| # H privileged extension test generator. | ||
| # nchulani@g.hmc.edu Feb 2026 | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| ################################## |
There was a problem hiding this comment.
The privileged extension generator modules in this directory use capitalized filenames matching the testsuite name (e.g., Sm.py, ZicsrF.py, ExceptionsZc.py). For consistency (and easier discovery/grep), consider renaming this module to H.py to match the @add_priv_test_generator("H", ...) testsuite key.
| ref_model_sig_flags = config.ref_model_type.signature_flags.format(sig_file=sig_file, granularity=int(xlen / 8)) | ||
| ref_model_args_line = f"\t\t{config.ref_model_args} \\\n" if config.ref_model_args else "" | ||
| ref_model_debug_line = "" | ||
| if debug: | ||
| ref_model_debug_flags = config.ref_model_type.debug_flags().format(sig_trace_file=sig_trace_file) | ||
| ref_model_debug_line = f"\t\t{ref_model_debug_flags} \\\n" if ref_model_debug_flags else "" | ||
| ref_model_config_line = "" | ||
| if config.ref_model_type == RefModelType.SAIL: | ||
| sail_config_path = config.dut_include_dir / "sail.json" | ||
| if common_e_ext is not None: | ||
| sail_config_path = generate_sail_config(xlen, common_e_ext, sail_config_path, base_dir) | ||
| ref_model_config_line = f"\t\t--config {sail_config_path} \\\n" |
There was a problem hiding this comment.
ref_model_args now affects the signature-generation command line, but the common-test grouping hash (compute_config_hash) does not include ref_model_type/ref_model_args. This can cause ACT to reuse a common directory (and therefore reuse signatures/results) across runs/configs that differ only in Spike/Sail args, producing stale or incorrect self-checking ELFs. Include config.ref_model_type and config.ref_model_args in the hash inputs so changes invalidate the common cache.
| @@ -0,0 +1,375 @@ | |||
| { | |||
| "$schema": "/home/jcarlin/riscv-projects/sail-riscv/build/sail_riscv_config_schema.json", | |||
There was a problem hiding this comment.
The Sail config $schema points to a developer-local absolute path (/home/jcarlin/...). This is non-portable and will break schema-aware tooling for other users/CI. Use the repo’s standard /opt/riscv/share/sail-riscv/sail_riscv_config_schema.json path (as in other sail.json files) or omit $schema entirely.
| "$schema": "/home/jcarlin/riscv-projects/sail-riscv/build/sail_riscv_config_schema.json", | |
| "$schema": "/opt/riscv/share/sail-riscv/sail-riscv_config_schema.json", |
| @@ -0,0 +1,375 @@ | |||
| { | |||
| "$schema": "/home/jcarlin/riscv-projects/sail-riscv/build/sail_riscv_config_schema.json", | |||
There was a problem hiding this comment.
The Sail config $schema points to a developer-local absolute path (/home/jcarlin/...). This is non-portable and will break schema-aware tooling for other users/CI. Use the repo’s standard /opt/riscv/share/sail-riscv/sail_riscv_config_schema.json path (as in other sail.json files) or omit $schema entirely.
| "$schema": "/home/jcarlin/riscv-projects/sail-riscv/build/sail_riscv_config_schema.json", | |
| "$schema": "/opt/riscv/share/sail-riscv/sail_riscv_config_schema.json", |
Description
Adds Spike support to ACT4 framework. Introduces 2 new cvw cores cvw-rv32gch and cvw-rv64gch with hypervisor enabled to allow for testing of CVW hypervisor development with Spike as reference model. PR will be updated with corresponding CVW hypervisor PR.
Related Issues
NA
Ratified/Unratified Extensions
List Extensions
Hypervisor
Reference Model Used
Mandatory Checklist:
Optional Checklist:
Ran generated H tests on cvw-rv32gch and cvw-rv64gch, both with self checking against corresponding Spike config.