-
Notifications
You must be signed in to change notification settings - Fork 241
Add reserved_behaviour.AMOCAS_odd_registers config #1403
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
base: master
Are you sure you want to change the base?
Conversation
|
Nice! I think maybe it would make more sense to have a fine grained config where the behaviour for each kind of reserved behaviour can be controlled. The spec isn't very clear about the semantics of reserved behaviour in general (sometimes it is UNSPECIFIED but not always), so I think it's easiest if we're explicit about it. Also we probably want an enum rather than a bool to allow more possible behaviour options in future. Something like: |
|
Also I reckon we should add another function to use for this instead of |
|
Beyond @Timmmm's comments, I think we should also avoid using the term "strict" to describe the mode that terminates the simulation because of potential confusion with the Ssstrict extension (which requires most reserved behavior to throw an exception). |
Changes Introduced in the new Commit
Questions for Clarification
|
7e84535 to
058e0dd
Compare
Timmmm
left a comment
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.
Would it be appropriate to introduce a dedicated exception type for reserved_behaviour?For instance, when config base.reserved_behaviour.amocas_odd_registers = "exception", we could return a specific exception type, such as:
Sounds like a good idea to me!
Should we implement a unified handler function to manage exceptions raised by reserved behaviours,or would it be preferable to define a dedicated handler for each reserved behaviour individually, for example:
Yeah I think so, like the existing internal_error function.
|
After reviewing the sail-riscv source code, I found that when the registers |
Timmmm
left a comment
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.
Some code fixes needed but the idea looks good to me now.
I'm curious what the motivation for adding the flag for this particular reserved behaviour is, or was it just randomly picked from the list in #775 ?
model/extensions/A/zaamo_insts.sail
Outdated
| )) | ||
| width <= xlen_bytes | ( | ||
| (op == AMOCAS & width <= xlen_bytes * 2 ) | ||
| & |
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.
@Alasdair does Sail guarantee short-circuit boolean operator semantics? Presumably yes; just thought I'd double check.
|
In the latest commit, I added the ReservedBehaviourPolicy enum and the reserved_behaviour function.
|
Timmmm
left a comment
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.
LGTM, just a few minor tweaks.
Also we might want to use the barbarian American spelling of behaviour without the u. They do have nukes...
|
last commit,Change behaviour to behavior, change Exit to Fatal, and make other minor adjustments |
Timmmm
left a comment
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.
LGTM, thanks!
Test Results2 115 tests 2 115 ✅ 17m 54s ⏱️ Results for commit 84b34f5. ♻️ This comment has been updated with latest results. |
|
last commit, Remove previously ignored redundant function declaration: reserved_behavior_exit |
|
last commit, change enum name ReservedBehaviorPolicy to AmocasOddRegisterReservedBehavior. |
|
Hello, I’ve tried adding the configuration option into platform_config.sail, but I ran into some issues. let amocas_odd_register_reserved_behavior : AmocasOddRegisterReservedBehavior = config base.reserved_behavior.amocas_odd_registerHowever, since the AmocasOddRegisterReservedBehavior enum is defined in types.sail, and in model/riscv.sail_project the types.sail file is listed after platform_config.sail, platform_config.sail cannot find AmocasOddRegisterReservedBehavior. |
I think it's probably fine to move it to |
|
Yeah, moving to |
|
last commit, |
Timmmm
left a comment
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.
LGTM
… odd-number registers
…with Illegal_Instruction
Signed-off-by: Tim Hutt <[email protected]>
Signed-off-by: Tim Hutt <[email protected]>
…nfig.sail, and add the variable amocas_odd_register_reserved_behavior in platform_config.sail.
Signed-off-by: Tim Hutt <[email protected]>
Signed-off-by: Tim Hutt <[email protected]>
Signed-off-by: Tim Hutt <[email protected]>
pmundkur
left a comment
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 added some minor cleanup and rebased.
Add a configuration option to control the behaviour when executing AMOCAS instructions that are reserved due to the use of odd register indices.
This is the first setting we've added to control reserved behaviour. It allows two options: a fatal error that stops the simulation, or to treat it as an illegal instruction (the default choice).
See #775