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

czero.eqz and czero.neq are both emitting the same Sail function #49

Open
ThinkOpenly opened this issue Feb 3, 2025 · 0 comments
Open
Labels
help wanted Extra attention is needed

Comments

@ThinkOpenly
Copy link
Owner

    {
      "mnemonic": "czero.eqz",
[...]
      "function": "{\n  let value = X(rs1);\n  let condition = X(rs2);\n  let result : xlenbits = if (condition != zeros()) then zeros()\n\t\t\t\t\t\t    else value;\n  X(rd) = result;\n  RETIRE_SUCCESS\n}",
      "description": "TBD"
    },
    {
      "mnemonic": "czero.nez",
[...]
      "function": "{\n  let value = X(rs1);\n  let condition = X(rs2);\n  let result : xlenbits = if (condition != zeros()) then zeros()\n\t\t\t\t\t\t    else value;\n  X(rd) = result;\n  RETIRE_SUCCESS\n}",

The first, for czero.eqz, should be == where currently it is !=.

The Sail code is unusual, providing 2 function clause execute functions where usually there is one with a match statement:

function clause execute (ZICOND_RTYPE(rs2, rs1, rd, RISCV_CZERO_EQZ)) = {
  let value = X(rs1);
  let condition = X(rs2);
  let result : xlenbits = if condition == zeros() then zeros()
                                                    else value;
  X(rd) = result;
  RETIRE_SUCCESS
}

function clause execute (ZICOND_RTYPE(rs2, rs1, rd, RISCV_CZERO_NEZ)) = {
  let value = X(rs1);
  let condition = X(rs2);
  let result : xlenbits = if (condition != zeros()) then zeros()
                                                    else value;
  X(rd) = result;
  RETIRE_SUCCESS
}
```
@ThinkOpenly ThinkOpenly added good first issue Good for newcomers help wanted Extra attention is needed and removed good first issue Good for newcomers labels Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant