Skip to content

Add the Shvsatpa extension and vsatp mode config options - #1906

Open
Nadime Barhoumi (nadime15) wants to merge 3 commits into
riscv:masterfrom
nadime15:add-extension-shvsatpa
Open

Add the Shvsatpa extension and vsatp mode config options#1906
Nadime Barhoumi (nadime15) wants to merge 3 commits into
riscv:masterfrom
nadime15:add-extension-shvsatpa

Conversation

@nadime15

@nadime15 Nadime Barhoumi (nadime15) commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Adds Shvsatpa along with extensions.H.vsatp_modes, mirroring the hgatp mode options from #1893.

We have satp (Svnn), vsatp (Svnn), and hgatp (SvXnn).

The translation modes for satp enforce a dependency. For example, supporting Sv57 without supporting Sv48 is not possible. I can't find anywhere in the spec that explicitly says whether this dependency also applies to vsatp, but I'm pretty sure the same rules apply there.

hgatp however, is a bit strange in this regard, because it is allowed to support Sv57x4 without supporting Sv48x4, etc.

On top of that, both vsatp and hgatp need to support Bare, since that is their reset value and they are WARL.

So vsatp gets the same ordering checks as satp, and Bare stays unconditional for vsatp. Keeping Bare unconditional also fixes a regression from #1894. legalize_satp is shared between satp and vsatp, so gating Bare on Svbare applied to vsatp too, which according to the spec is incorrect since vsatp.MODE (and hgatp.MODE) resets to 0.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

Test Results

9 217 tests  ±0   9 217 ✅ ±0   1h 50m 0s ⏱️ +31s
    1 suites ±0       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit e268a57. ± Comparison against base commit 6f6f2ab.

♻️ This comment has been updated with latest results.

@nadime15 Nadime Barhoumi (nadime15) added the extension Adds support for a RISC-V extension label Aug 25, 2026
Comment thread README.md Outdated
Comment thread model/postlude/validate_config.sail
Comment thread model/core/sys_regs.sail
Comment thread model/core/sys_regs.sail
Adds Shvsatpa along with `extensions.H.vsatp_modes`, mirroring the `hgatp` mode
options from riscv#1893.

We have satp (Svnn), vsatp (Svnn), and hgatp (SvXnn).

The translation modes for satp enforce a dependency. For example, supporting
Sv57 without supporting Sv48 is not possible. I can't find anywhere in the spec
that explicitly says whether this dependency also applies to vsatp, but I'm
pretty sure the same rules apply there.

hgatp however, is a bit strange in this regard, because it is allowed to support
Sv57x4 without supporting Sv48x4, etc.

On top of that, both vsatp and hgatp need to support Bare.

So `vsatp` gets the same ordering checks as `satp`, and Bare stays unconditional
for it. Keeping Bare unconditional also fixes a regression from riscv#1894. `legalize_satp`
is shared between `satp` and `vsatp`, so gating Bare on Svbare applied to `vsatp`
too, which according to the spec forbids since `vsatp.MODE` (and `hgatp.MODE`)
resets to 0.
Comment thread model/postlude/validate_config.sail Outdated
Comment thread model/core/sys_regs.sail
];
// NOTE: Sv32 is not listed because VSXLEN=XLEN here, hstatus.VSXL is
// read-only. It could be added if changing VSXL is supported.
let sv39_supported = currentlyEnabled(Ext_Sv39) & (not(is_vsatp) | sys_vsatp_sv39_supported);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Unless I am getting my parentheses mixed up, this doesn't seem right. This currently requires always requires Sv39 to be supported, but I don't think that is required for vsatp. Shouldn't it be the following instead:

Suggested change
let sv39_supported = currentlyEnabled(Ext_Sv39) & (not(is_vsatp) | sys_vsatp_sv39_supported);
let sv39_supported = (currentlyEnabled(Ext_Sv39) & not(is_vsatp)) | sys_vsatp_sv39_supported;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension Adds support for a RISC-V extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants