Behavior:imm = distance to label in bytes = {immS[12:1],0} pc <= (R[rs1] comp R[rs2] ? pc + imm:pc + 4)
Compares register rs1 to rs2. If comparison is true then pc is updated with pc + imm, otherwise pc becomes pc + 4. Comparison type is defined by operation.
Operator
Complete Representation
BEQ
branch if equal
BNE
branch if not equal (!=)
BLT
branch if less than (<)
BGE
branch if greater than or equal (>=)
BLTU
branch if less than using unsigned numbers (< unsigned)
BGEU
branch if greater than or equal using unsigned numbers (>= unsigned)
3.2 UJ-type
3.2.1 JAL
Unconditional Jump
opcode = JAL = 1101111
Assembly instr: JAL rd,label
Behavior:imm = distance to label in bytes = {immU{20:1},0} pc[rd] <= pc + 4; pc <= pc + imm
Promblem:what is the structure of pc?what is pc[rd]?
3.2.2 I-type JAL
Unconditional Jump
opcode = JALR = 1100111
Behavior: imm = SignExtend(immI) pc[rd] <= pc + 4; pc <= (R[rs1]+imm) & ~0x01