bne

Branch if not equal

This instruction is defined by:

Encoding

svg

Synopsis

Branch to PC + imm if the value in register xs1 is not equal to the value in register xs2.

Raise a MisalignedAddress exception if PC + imm is misaligned.

Access

M

HS

U

VS

VU

Always

Always

Always

Always

Always

Decode Variables

Bits<13> imm = {$encoding[31], $encoding[7], $encoding[30:25], $encoding[11:8], 1'd0};
Bits<5> xs2 = $encoding[24:20];
Bits<5> xs1 = $encoding[19:15];

Execution

  • Pruned, XLEN == 64

  • Original

XReg lhs = X[xs1];
XReg rhs = X[xs2];
if (lhs != rhs) {
  %%LINK%func;jump_halfword;jump_halfword%%($pc + $signed(imm));
}
XReg lhs = X[xs1];
XReg rhs = X[xs2];
if (lhs != rhs) {
  %%LINK%func;jump_halfword;jump_halfword%%($pc + $signed(imm));
}

Exceptions

This instruction may result in the following synchronous exceptions:

  • InstructionAddressMisaligned