Webcentive RISC-V Reference

bge

Branch if greater than or equal

Extension
RV32I/RV64I base integer
XLEN
RV32 and RV64
Assembly (riscv-unified-db)
bge xs1, xs2, imm
Length
32-bit

Encoding

31252420191514121176210
imm[12|10:5]rs2rs1101imm[4:1|11]1100011

Match 0x00005063, mask 0x0000707f. Source: bge bimm12hi rs1 rs2 bimm12lo 14..12=5 6..2=0x18 1..0=3 in riscv-opcodes/extensions/rv_i.

FieldBitsriscv-opcodes name
imm[12|10:5]31:25bimm12hi
rs224:20rs2
rs119:15rs1
imm[4:1|11]11:7bimm12lo

Description

Branch to PC + imm if the signed value in register xs1 is greater than or equal to the signed value in register xs2.

Raise a MisalignedAddress exception if PC + imm is misaligned.

Description from riscv-unified-db, reformatted.

Operation

XReg lhs = X[xs1];
XReg rhs = X[xs2];

if ($signed(lhs) >= $signed(rhs)) {
  jump_halfword($pc + $signed(imm));
}

Pseudocode in riscv-unified-db’s IDL, quoted unchanged.

Specification and related pages