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

Merged
merged 4 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 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..
jmawet marked this conversation as resolved.
Show resolved Hide resolved
definedBy: Zicond
assembly: xd, xs1, xs2
encoding:
Expand All @@ -24,12 +27,21 @@ access:
vu: always
data_independent_timing: false
operation(): |
XReg input1 = X[rs1];
XReg input2 = X[rs2];
XReg output = 0;

if(input2 != 0) {
ThinkOpenly marked this conversation as resolved.
Show resolved Hide resolved
output = input1;
}

X[rd] = output;

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()
jmawet marked this conversation as resolved.
Show resolved Hide resolved
else value;
X(rd) = result;
RETIRE_SUCCESS
Expand Down
16 changes: 14 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,15 @@ access:
vu: always
data_independent_timing: false
operation(): |
XReg input1 = X[rs1];
XReg input2 = X[rs2];
XReg output = 0;

if(input2 == 0) {
ThinkOpenly marked this conversation as resolved.
Show resolved Hide resolved
output = input1;
}

X[rd] = output;

sail(): |
{
Expand Down
Loading