c.beqz
Branch if Equal Zero
This instruction is defined by:
Synopsis
C.BEQZ performs conditional control transfers. The offset is sign-extended and added to the pc to form the branch target address. It can therefore target a ±256 B range. C.BEQZ takes the branch if the value in register rs1' is zero.
It expands to beq rs1, x0, offset
.
Decode Variables
Bits<9> imm = {$encoding[12], $encoding[6:5], $encoding[2], $encoding[11:10], $encoding[4:3], 1'd0};
Bits<3> xs1 = $encoding[9:7];
Execution
-
Pruned, XLEN == 64
-
Original
if ((%%LINK%csr_field;misa.C;CSR[misa].C%% == 1'b0)) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
if (X[%%LINK%func;creg2reg;creg2reg%%(xs1)] == 0) {
%%LINK%func;jump;jump%%($pc + $signed(imm));
}
if (%%LINK%func;implemented?;implemented?%%(ExtensionName::C) && (%%LINK%csr_field;misa.C;CSR[misa].C%% == 1'b0)) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
if (X[%%LINK%func;creg2reg;creg2reg%%(xs1)] == 0) {
%%LINK%func;jump;jump%%($pc + $signed(imm));
}