I-type
I-Format Instruction Layout
The
funct7
andrs2
fields from R-format are replaced by 12-bit signed immediate,imm[11:0]
(in range [-2048, 2047]).Remaining fields (
rs1
,funct3
,rd
,opcode
) same as R-format.Immediate is always sign-extended to 32-bits before use in an arithmetic operation.
I-immediate
I-Format Arithmetic Instructions
Adding I-Format arithmetic instructions to datapath
I-Format Load Instructions
Load instructions are also I-type.
Reg[rd] <- Mem[Reg[rs1] + offset]
The 12-bit immediate is added to the base address in
rs1
to form the memory addressThe value loaded from memory is stored in register
rd
Note that the funct3
field is to specify the width (i.e., the amount of bytes) and signedness of load data.
Adding load instructions to datapath
Last updated