-
Notifications
You must be signed in to change notification settings - Fork 25
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
Update Zicond instructions #452
base: main
Are you sure you want to change the base?
Conversation
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.
It's fine as-is, I just have a few nits that could be addressed, at your option.
arch/inst/Zicond/czero.eqz.yaml
Outdated
XReg input2 = X[rs2]; | ||
XReg output = 0; | ||
|
||
if(input2 != 0) { |
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 is totally stylistic, but it might be more compact/readable using the ternary operator in a single line:
X[rd] = (X[rs2] == 0) ? 0 : X[rs1];
arch/inst/Zicond/czero.nez.yaml
Outdated
XReg input2 = X[rs2]; | ||
XReg output = 0; | ||
|
||
if(input2 == 0) { |
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.
similar:
X[rd] = (X[rs2] != 0) ? 0 : X[rs1];
(also, I think what you wrote here is backwards)
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.
It shouldn't be? Xreg = 0 unless the condition is NOT met. So the "if" in my case here would be the opposite of the instruction condition. Might seem counterintuitive I suppose but I'm pretty sure it's correct. Regardless, the more compact way you suggested is better and more readable, so I'll just change it to that
Updated instructions in Zicond. Also fixed an error in the generated SAIL code that caused both instructions to have the same operation.