-
Notifications
You must be signed in to change notification settings - Fork 76
feat: added sie and sccountinhibit yaml files #1046
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: main
Are you sure you want to change the base?
Conversation
spec/std/isa/csr/scountinhibit.yaml
Outdated
| reset_value(): | | ||
| return COUNTINHIBIT_EN[0] ? UNDEFINED_LEGAL : 0; | ||
| sw_write(csr_value): | | ||
| if (implemented_csr?(CsrName::menvcfg) && CSR[menvcfg].CDE == 1'b0) { |
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.
Checking if menvcfg is implemented is correct, but it strays from how we have been handling these types of cases. Usually, we check for the extension that defines what is needed (in this case, S ~> 1.11). In IDL, this would be implemented_version?(ExtensionName::S, "~> 1.11")
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've updated the condition (implemented_version?(ExtensionName::Sm, ">=1.12")) to first check if menvcfg is there, then raise exceptions based on menvcfg.CDE.
spec/std/isa/csr/scountinhibit.yaml
Outdated
| return COUNTINHIBIT_EN[0] ? UNDEFINED_LEGAL : 0; | ||
| sw_write(csr_value): | | ||
| if (implemented_csr?(CsrName::menvcfg) && CSR[menvcfg].CDE == 1'b0) { | ||
| if (mode() == PrivilegeMode::M) { |
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.
The spec says:
When menvcfg.CDE=0, attempts to access scountinhibit raise an illegal instruction exception.
So an Illegal Instruction should raise even in M mode.
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.
The condition is already there for M mode. I think you're talking about S mode which was missing, right? Let me know if I'm overlooking something!
spec/std/isa/csr/scountinhibit.yaml
Outdated
| if (mode() == PrivilegeMode::M) { | ||
| raise(ExceptionCode::IllegalInstruction, mode(), $encoding); | ||
| } | ||
| } else if (implemented_csr?(CsrName::menvcfg) && CSR[menvcfg].CDE == 1'b1) { |
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.
This check is too restrictive. It won't raise a Virtual Instruction if menvcfg is not implemented, but it should.
To fix, I think you just need to make this an "else".
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've updated the conditions. Please have a look and suggest any further improvement if needed.
spec/std/isa/csr/scountinhibit.yaml
Outdated
| reset_value(): | | ||
| return COUNTINHIBIT_EN[2] ? UNDEFINED_LEGAL : 0; | ||
| sw_write(csr_value): | | ||
| if (implemented_csr?(CsrName::menvcfg) && CSR[menvcfg].CDE == 1'b0) { |
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.
Same comments as above
| definedBy: S | ||
| description: | | ||
| sie.STIE is the interrupt-enable bit for supervisor-level timer interrupts. | ||
| sw_write(csr_value): | |
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.
This (and all other bits in sie) needs to account for mideleg to determine if the bit has any effect
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 placed a check of respective bits from mideleg.
Closes #563
Depends on #891
#910 has sieh.yaml that needs to serve as alias for sie which is in this PR!