Skip to content

Commit

Permalink
Update Zicond instructions
Browse files Browse the repository at this point in the history
* Complete czero instructions
* Syntax and style change
* Fix Sail code in `czero.eqz`
  • Loading branch information
jmawet authored Feb 11, 2025
1 parent 3d4ad09 commit 28082d3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 7 additions & 3 deletions arch/inst/Zicond/czero.eqz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
$schema: "inst_schema.json#"
kind: instruction
name: czero.eqz
long_name: No synopsis available.
long_name: Conditional zero, if condition is equal to zero.
description: |
No description available.
If rs2 contains the value zero, this instruction writes the value zero to rd. Otherwise, this instruction
copies the contents of rs1 to rd.
This instruction carries a syntactic dependency from both rs1 and rs2 to rd. Furthermore, if the Zkt
extension is implemented, this instruction’s timing is independent of the data values in rs1 and rs2.
definedBy: Zicond
assembly: xd, xs1, xs2
encoding:
Expand All @@ -24,12 +27,13 @@ access:
vu: always
data_independent_timing: false
operation(): |
X[rd] = (X[rs2] == 0) ? 0 : X[rs1];
sail(): |
{
let value = X(rs1);
let condition = X(rs2);
let result : xlenbits = if (condition != zeros()) then zeros()
let result : xlenbits = if (condition == zeros()) then zeros()
else value;
X(rd) = result;
RETIRE_SUCCESS
Expand Down
8 changes: 6 additions & 2 deletions arch/inst/Zicond/czero.nez.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
$schema: "inst_schema.json#"
kind: instruction
name: czero.nez
long_name: No synopsis available.
long_name: Conditional zero, if condition is nonzero.
description: |
No description available.
If rs2 contains a nonzero value, this instruction writes the value zero to rd. Otherwise, this
instruction copies the contents of rs1 to rd.
This instruction carries a syntactic dependency from both rs1 and rs2 to rd. Furthermore, if the Zkt
extension is implemented, this instruction’s timing is independent of the data values in rs1 and rs2.
definedBy: Zicond
assembly: xd, xs1, xs2
encoding:
Expand All @@ -24,6 +27,7 @@ access:
vu: always
data_independent_timing: false
operation(): |
X[rd] = (X[rs2] != 0) ? 0 : X[rs1];
sail(): |
{
Expand Down

0 comments on commit 28082d3

Please sign in to comment.