Skip to content

Commit 28082d3

Browse files
authored
Update Zicond instructions
* Complete czero instructions * Syntax and style change * Fix Sail code in `czero.eqz`
1 parent 3d4ad09 commit 28082d3

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

arch/inst/Zicond/czero.eqz.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
$schema: "inst_schema.json#"
44
kind: instruction
55
name: czero.eqz
6-
long_name: No synopsis available.
6+
long_name: Conditional zero, if condition is equal to zero.
77
description: |
8-
No description available.
8+
If rs2 contains the value zero, this instruction writes the value zero to rd. Otherwise, this instruction
9+
copies the contents of rs1 to rd.
10+
This instruction carries a syntactic dependency from both rs1 and rs2 to rd. Furthermore, if the Zkt
11+
extension is implemented, this instruction’s timing is independent of the data values in rs1 and rs2.
912
definedBy: Zicond
1013
assembly: xd, xs1, xs2
1114
encoding:
@@ -24,12 +27,13 @@ access:
2427
vu: always
2528
data_independent_timing: false
2629
operation(): |
30+
X[rd] = (X[rs2] == 0) ? 0 : X[rs1];
2731
2832
sail(): |
2933
{
3034
let value = X(rs1);
3135
let condition = X(rs2);
32-
let result : xlenbits = if (condition != zeros()) then zeros()
36+
let result : xlenbits = if (condition == zeros()) then zeros()
3337
else value;
3438
X(rd) = result;
3539
RETIRE_SUCCESS

arch/inst/Zicond/czero.nez.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
$schema: "inst_schema.json#"
44
kind: instruction
55
name: czero.nez
6-
long_name: No synopsis available.
6+
long_name: Conditional zero, if condition is nonzero.
77
description: |
8-
No description available.
8+
If rs2 contains a nonzero value, this instruction writes the value zero to rd. Otherwise, this
9+
instruction copies the contents of rs1 to rd.
10+
This instruction carries a syntactic dependency from both rs1 and rs2 to rd. Furthermore, if the Zkt
11+
extension is implemented, this instruction’s timing is independent of the data values in rs1 and rs2.
912
definedBy: Zicond
1013
assembly: xd, xs1, xs2
1114
encoding:
@@ -24,6 +27,7 @@ access:
2427
vu: always
2528
data_independent_timing: false
2629
operation(): |
30+
X[rd] = (X[rs2] != 0) ? 0 : X[rs1];
2731
2832
sail(): |
2933
{

0 commit comments

Comments
 (0)