Skip to content

Add Spike support to ACT4 to enable H testgen for CVW Hypervisor Testing#916

Open
TnnsBeast wants to merge 4 commits intoriscv:act4from
TnnsBeast:act4_htests
Open

Add Spike support to ACT4 to enable H testgen for CVW Hypervisor Testing#916
TnnsBeast wants to merge 4 commits intoriscv:act4from
TnnsBeast:act4_htests

Conversation

@TnnsBeast
Copy link

@TnnsBeast TnnsBeast commented Feb 9, 2026

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

  • Ratified

List Extensions

List the extensions that your PR affects. In case of unratified extensions, please provide a link to the spec draft that was referred to make this PR.

Hypervisor

Reference Model Used

  • SAIL
  • Spike

Mandatory Checklist:

  • All tests are compliant with the test-format spec present in this repo ?
  • [] Ran the new tests on RISCOF with SAIL/Spike as reference model successfully ?
  • Ran the new tests on RISCOF in coverage mode
  • Link to Google-Drive folder containing the new coverage reports (See this for more info): < SPECIFY HERE >

Optional Checklist:

  • Were the tests hand-written/modified ?
  • Have you run these on any hard DUT model ? Please specify name and provide link if possible in the description
  • If you have modified arch_test.h Please provide a detailed description of the changes in the Description section above.

Ran generated H tests on cvw-rv32gch and cvw-rv64gch, both with self checking against corresponding Spike config.

@TnnsBeast TnnsBeast marked this pull request as draft February 9, 2026 17:50
@TnnsBeast TnnsBeast marked this pull request as ready for review February 9, 2026 18:27
Copy link
Collaborator

@jordancarlin jordancarlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven’t reviewed the hypervisor specific parts yet, but here’s an initial round of comments on the spike integration.

@TnnsBeast TnnsBeast force-pushed the act4_htests branch 2 times, most recently from 3d0cb3f to 54094a3 Compare February 12, 2026 22:55
Copy link
Collaborator

@jordancarlin jordancarlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment on lines 133 to 134
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 ""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be simplified to the following?

Suggested change
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"

@jordancarlin jordancarlin added the ACT4 Issues or PRs applicable to ACT4 label Feb 20, 2026
Copilot AI review requested due to automatic review settings February 26, 2026 19:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 270 to +272
FAST=True \
EXTENSIONS= \
EXCLUDE_EXTENSIONS=Sm,ExceptionsZc,Zaamo,Zalrsc,Zabha,Zacas,ZacasZabha \
EXCLUDE_EXTENSIONS=Sm,ExceptionsZc,Zaamo,Zalrsc,Zabha,Zacas,ZacasZabha,H \
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +7
##################################
# priv/extensions/h.py
#
# H privileged extension test generator.
# nchulani@g.hmc.edu Feb 2026
# SPDX-License-Identifier: Apache-2.0
##################################
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 150 to +161
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"
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,375 @@
{
"$schema": "/home/jcarlin/riscv-projects/sail-riscv/build/sail_riscv_config_schema.json",
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
"$schema": "/home/jcarlin/riscv-projects/sail-riscv/build/sail_riscv_config_schema.json",
"$schema": "/opt/riscv/share/sail-riscv/sail-riscv_config_schema.json",

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,375 @@
{
"$schema": "/home/jcarlin/riscv-projects/sail-riscv/build/sail_riscv_config_schema.json",
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
"$schema": "/home/jcarlin/riscv-projects/sail-riscv/build/sail_riscv_config_schema.json",
"$schema": "/opt/riscv/share/sail-riscv/sail_riscv_config_schema.json",

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ACT4 Issues or PRs applicable to ACT4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants