Skip to content

Conversation

@nabudahab
Copy link

@nabudahab nabudahab commented Dec 30, 2025

Summary

This PR introduces a new command-line argument --pc-harts to allow specifying different start addresses (PCs) for different harts. This feature is particularly valuable for RTL co-simulation workflows, where the simulator must exactly match the behavior of the RTL design. In these scenarios, the Boot ROM is often bypassed or disabled, and each hart is released from reset at a specific entry point defined by the hardware configuration.

Problem

Currently, Spike defaults to setting the PC for all harts to the ELF entry point or the address specified by --pc.

However, in many bare-metal verification environments and Asymmetric Multi-Processing (AMP) configurations, harts often have distinct reset vectors. For example, a dual-core system might require:

  • Hart 0 to fetch from 0x2000
  • Hart 1 to fetch from 0x4000

Achieving this previously required modifying the C++ source code or relying on a complex bootloader/bootrom to diverge the harts.

Solution

I have added the --pc-harts flag which parses a comma-separated list of HartID:Address pairs.

Usage Example:
spike -p2 --pc-harts=0:0x0,1:0x200 my_program.elf

Implementation Details

  • Added argument parsing for --pc-harts in spike_main/spike.cc.
  • Logic applies the PC overrides to the respective processor_t states after simulation initialization but before the run loop begins.

Testing

Verified using a dual-core bare-metal assembly test (with the boot ROM disabled) where Hart 0 and Hart 1 must execute distinct code sections located at 0x0 and 0x200 respectively. Confirmed that both harts start at the correct overridden addresses.

nabudahab and others added 3 commits December 30, 2025 09:27
Currently, the --pc flag sets the entry point for all processors globally,
or relies on the ELF entry point. This is insufficient for asymmetric
multi-processing (AMP) setups or bare-metal RTL verification where
different harts must begin execution at distinct physical addresses
(e.g., Hart 0 at 0x2000, Hart 1 at 0x4000).

This patch adds the --pc-harts=<H:A,...> argument, allowing users to
explicitly override the start PC for specific hart IDs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant