Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

jmawet
Copy link
Collaborator

@jmawet jmawet commented Feb 1, 2025

Updated instructions in Zicond. Also fixed an error in the generated SAIL code that caused both instructions to have the same operation.

@jmawet jmawet requested a review from dhower-qc as a code owner February 1, 2025 23:10
Copy link
Collaborator

@ThinkOpenly ThinkOpenly left a 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 Show resolved Hide resolved
arch/inst/Zicond/czero.eqz.yaml Show resolved Hide resolved
XReg input2 = X[rs2];
XReg output = 0;

if(input2 != 0) {
Copy link
Collaborator

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];

XReg input2 = X[rs2];
XReg output = 0;

if(input2 == 0) {
Copy link
Collaborator

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)

Copy link
Collaborator Author

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

@jmawet jmawet requested a review from dhower-qc February 4, 2025 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants