The I-type (Immediate) instruction performs operations using one register and one immediate operand. The result of the operation is stored in the destination register rd
. Figure 1 illustrates the instruction format for an I-type instruction, showing how the opcode, source register rs1
, immediate value, and function fields are structured.
Figure 1: Instruction Format
- Opcode: The opcode or operation code is a
7-bit
field that defines the type of operation to be performed on the data stored in the source registers. - Destination Register: Stores the result of the operation in the destination register
rd
. - Function Fields: This 3-bit
funct3
field, known as the control bits, determines the specific operation to be executed.- Source Registers: A single source register
rs1
of 5-bit field holds the address of the input operand.
- Source Registers: A single source register
- Immediate Field: The immediate oprand used to I-type instruction.
Note: The immediate is 12-bit signed (two’s complement) number for all I-type instruction except immediate shit instructions (slli, srli, srai).
Below is table that describes the list of I-type instructions.
funct7 | funct3 | opcode | Description | Instruction |
---|---|---|---|---|
- | 000 | 0000011 (3) | load byte: signExt[7:0] | lb rd, imm(rs1) |
- | 001 | 0000011 (3) | load half: signExt[7:0] | lh rd, imm(rs1) |
- | 010 | 0000011 (3) | load word (31:0) | lw rd, imm(rs1) |
- | 100 | 0000011 (3) | load byte unsigned: zeroExt[7:0] | lbu rd, imm(rs1) |
- | 101 | 0000011 (3) | load half unsigned: zeroExt[15:0] | lhu rd, imm(rs1) |
- | 000 | 0010011 (19) | add immediate: signExt | addi rd, rs1, imm |
0000000 | 001 | 0010011 (19) | shift left logical: signExt | slli rd, rs1, imm |
- | 010 | 0010011 (19) | set less than: signExt | slti rd, rs1, imm |
- | 011 | 0010011 (19) | set less than unsigned: signExt | sltiu rd, rs1, imm |
- | 100 | 0010011 (19) | xor immediate: signExt | xori rd, rs1, imm |
0000000 | 101 | 0010011 (19) | shift right logical | srli rd, rs1, uimm |
0100000 | 101 | 0010011 (19) | shift right arithmetic | srai rd, rs1, uimm |
- | 110 | 0010011 (19) | or immediate: signExt | ori rd, rs1, imm |
- | 111 | 0010011 (19) | and immediate: signExt | andi rd, rs1, imm |
- | 000 | 1100111 (103) | jump and link register | jalr rd, label |