czero.nez

Conditional zero, if condition is nonzero

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.

Assembly format

czero.nez rd, rs1, rs2

Decode Variables

Bits<5> rs2 = $encoding[24:20];
Bits<5> rs1 = $encoding[19:15];
Bits<5> rd = $encoding[11:7];

Execution

  • IDL

  • Sail

X[rd] = (X[rs2] != 0) ? 0 : X[rs1];
{
  let value = X(rs1);
  let condition = X(rs2);
  let result : xlenbits = if (condition != zeros()) then zeros()
						    else value;
  X(rd) = result;
  RETIRE_SUCCESS
}

Encoding

svg

Defining extension

  • Zicond, version >= Zicond@1.0.0

Access

M HS U VS VU

Always

Always

Always

Always

Always

Containing profiles

  • Mandatory: RVA23M64, RVA23S64, RVA23U64, RVB23M64, RVB23S64, RVB23U64

  • Optional: