czero.eqz

Conditional zero, if condition is equal to zero.

This instruction is defined by:

  • Zicond, version >= 0

This instruction is included in the following profiles:

  • RVA23U64 (Mandatory)

  • RVB23U64 (Mandatory)

Encoding

svg

Assembly format

czero.eqz rd, rs1, rs2

Synopsis

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.

Access

M HS U VS VU

Always

Always

Always

Always

Always

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
}