Skip to content

RISC-V lifter: compressed instructions, fences and atomics - #221

Merged
palmskog merged 6 commits into
masterfrom
riscv_lifter
Nov 3, 2026
Merged

palmskog merged 6 commits into
masterfrom
riscv_lifter

Conversation

@didriklundberg

@didriklundberg didriklundberg commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Additions to the RISC-V lifter:

  • 16-bit instructions from the C extension
  • FENCE and FENCE.I (lifts to no-ops)
  • AMOs and LR.W/LR.D
  • New C and A sections in selftest_riscv

There are some other additions coming up that requires updating the RISC-V L3 model, I will make separate PRs for that later.

@palmskog palmskog left a comment •

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.

@didriklundberg could you add some small "smoke test" example of a RISC-V program with compressed instructions being lifted via lift_da_and_store? Maybe copy one of the simpler ones in examples/riscv like swap to swap_compressed and only have swapScript.sml.

That would increase confidence that the existing machinery works with the extensions.

@palmskog palmskog left a comment

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.

This looks good in general, but could we have an example compressed program that's lifted (and can hopefully be verified), see suggestion on how to cobble that together quickly.

Co-authored-by: Karl Palmskog <palmskog@gmail.com>
@didriklundberg

Copy link
Copy Markdown
Member Author

@didriklundberg could you add some small "smoke test" example of a RISC-V program with compressed instructions being lifted via lift_da_and_store? Maybe copy one of the simpler ones in examples/riscv like swap to swap_compressed and only have swapScript.sml.

That would increase confidence that the existing machinery works with the extensions.

That's easily done, but are you sure you want more than the instructions added to selftest_riscv.sml? I am planning to do a larger example later anyway, so might as well avoid clutter.

@palmskog

Copy link
Copy Markdown
Collaborator

@didriklundberg but can't we have a small example, possibly even with compilation commands documented in README? selftests are one thing, but an "integration test" would build confidence in the changes. See also the conflict due to merging the misc fixes.

@didriklundberg

Copy link
Copy Markdown
Member Author

@didriklundberg but can't we have a small example, possibly even with compilation commands documented in README? selftests are one thing, but an "integration test" would build confidence in the changes. See also the conflict due to merging the misc fixes.

Sure, let's add a small example. I'll also sort the conflict.

@palmskog

palmskog commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

@didriklundberg I will merge this when CI concludes, heads up that I just changed swap_compressed directory to swap-compressed for consistency.

@palmskog

palmskog commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Failure is CI timeout, merging.

@palmskog
palmskog merged commit a5df5b3 into master Nov 3, 2026
3 of 4 checks passed
@palmskog
palmskog deleted the riscv_lifter branch November 3, 2026 11:44
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