Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Zcmt extension #757

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

nadime15
Copy link

@nadime15 nadime15 commented Feb 26, 2025

Hi everyone,

This pull request adds support for the Zcmt extension.

I’ve also included some simple tests, which can be found here.

Reading from the jump table vector requires Execute permission and supports both little and big endian formats. The current RISC-V Sail model only allows little-endian access, but I will add big-endian support after #751 is merged.

One observation: at some point, it might make sense to introduce a more general interface for load and store. Since the Zcmp (#730) extension also requires these operations, a shared implementation could help reduce code duplication.


type target_address = bits(xlen)

union FJT_Result = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably just use result(target_address, unit)

Copy link
Author

Choose a reason for hiding this comment

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

Could you explain a bit more about this and how I should modify the code?


function clause execute (CM_JALT(index)) = {
let base : bits(xlen) = jvt.bits & ~(zero_extend(0x3F));
let index : bits(xlen) = zero_extend(index);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe you can delete this line.

Copy link
Author

Choose a reason for hiding this comment

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

This wont compile, I get:

Failed to prove constraint: 8 == 32

But I think it makes sense, imagine shifting bits to the left. Since the bit width of index remains the same (without extending), the two (or three) most significant bits would be lost.

@nadime15
Copy link
Author

Hi @Timmmm, thanks for the suggestions! I've incorporated them and left some comments about a few small issues I ran into.

@nadime15 nadime15 requested a review from Timmmm February 27, 2025 18:37
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.

2 participants