-
Notifications
You must be signed in to change notification settings - Fork 212
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 RISC-V A ISA extension (atomic memory access) #651
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
increase simulation's IMEM size to 32kB
clean-up & add LR/SC test cases
-> SoC bus request bus: add "is reservation set operation" signal -> CPU control bus: add "is reservation set operation" signal
LR/SC only!
d-cache: enfore uncached access if atomic operation
* add reservation set controller * add A ISa extension
add new A extension add missing B extension
If pipelined mode is disabled the RX path needs to be registered.
add lots of details + LR/SC accesses
add new section for the reservation set controller and the atomic/LR/SC bus transactions and protocol
FTR A extension implemented, documented and tested ✔️ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
experimental
Experimental feature
HW
hardware-related
risc-v compliance
Modification to comply with official RISC-V specs.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR provides a first version of the core that supports the RISC-V
A
ISA extension for atomic memory accesses. The basic idea as well as many of the hardware aspects were triggered by @NikLeberg in #573 (👍).ℹ️ This is a quite simple/straightforward approach of implementing LR/SC operations. The handling of those operations is done by the memory/bus system instead of the CPU core. More in-depth information can be found at the bottom of this post.
lr.w
) and store-conditional (sc.w
) instructions are supported. The remaining read-modify-write instructions (likeamoswap
) are not supported and will raise an illegal instruction exception when executed. However, these unsupported instructions can be emulated using LR/SC combinations. An emulation library for the missing AMO operations and an according test program will be provided.A
extension is enabled via the newCPU_EXTENSION_RISCV_A
processor generic.A
instructions are tightly coupled to the memory/bus system of the processor. Besides the CPU-internal logic for executing LR/SC instructions a new bus module ("Reservation Set Control") is added that keeps track of the LR/SC reservation set. (see image below).AMO_RVS_GRANULARITY
).More Information
🔍 How do atomic memory accesses / LR/SC combinations work on a hardware level (NEORV32 data sheet)?
A
ISA extension: docs: A ISA Extension💾 How to emulate AMO operations using LR/SC combinations (NEORV32 software framework)?
neorv32_cpu_amo.c
sw/example/atomic_test
TODO
The reservation set controller already provides an external interface so other external cores could "snoop" and invalidate the state of the reservation set. However, this interface is not available yet. Maybe this could be integrated into the processor's Wishbone bus... 🤔