-
Notifications
You must be signed in to change notification settings - Fork 175
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
Improve store-conditional speculative failures and exception priority #681
base: master
Are you sure you want to change the base?
Conversation
@Alasdair if you could shed any light on what rmem is expecting here that would be great! |
55e8a23
to
e2f1189
Compare
model/riscv_insts_aext.sail
Outdated
MemValue(false) => { X(rd) = zero_extend(0b1); cancel_reservation(); RETIRE_SUCCESS }, | ||
MemException(e) => { handle_mem_exception(vaddr, e); RETIRE_FAIL } | ||
/* Get the address, X(rs1) (no offset). | ||
* Extensions might perform additional checks on address validity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this was only moved around, but the indentation looks odd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ha that is due to a slight bug in the VSCode "sticky tabs" option I use. It more or less makes stupid space-based indentation act as if glorious tabs had been used instead, but it seems like increasing/decreasing indentation on lines with incomplete "tabs" doesn't quite work correctly (technically my fault because I implemented that feature).
I changed it to line comments which I think are just better anyway.
e2f1189
to
551485c
Compare
1. Move `speculate_conditional()` to the same place as `match_reservation()`. I am not 100% sure about this change because I'm not sure what rmem is (and it has a comment about allowing it to fail very early), but it doesn't make sense to me that SC could spuriously fail in a place where it shouldn't be allowed in the sequential model. Codasip uses `speculate_conditional()` to force spurious SC failures into the model (so it matches the DUT), and this is the right place for that use. 2. Do an explicit access check before checking the reservation. Without this you never get an access fault for accesses to memory that doesn't exist or doesn't support LR/SC. 3. Move `cancel_reservation()` to the end of the function. This doesn't change any functionality, I think it's just clearer and makes it obvious that the omission of `cancel_reservation()` in the `MemException(e)` branch was not a mistake.
551485c
to
1e52b56
Compare
speculate_conditional()
to the same place asmatch_reservation()
. I am not 100% sure about this change because I'm not sure what rmem is (and it has a comment about allowing it to fail very early), but it doesn't make sense to me that SC could spuriously fail in a place where it shouldn't be allowed in the sequential model.Codasip uses
speculate_conditional()
to force spurious SC failures into the model (so it matches the DUT), and this is the right place for that use.Do an explicit access check before checking the reservation. Without this you never get an access fault for accesses to memory that doesn't exist or doesn't support LR/SC.
Move
cancel_reservation()
to the end of the function. This doesn't change any functionality, I think it's just clearer and makes it obvious that the omission ofcancel_reservation()
in theMemException(e)
branch was not a mistake.