The S-type (store) instruction operates on two registers and one immediate operand. There are two immediate fields that together form a 12-bit signed immediate value. Figure 1 illustrates the instruction format for an S-type instruction, showing how the register, opcode, and immediate fields are segregated.
Figure 1: Instruction Format
- Opcode: The opcode or operation code is a 7-bit field that defines the type of operation to be performed.
- Function Field: This 3-bit
funct3field, known as the control bits, determines the specific operation to be executed such as store byte (sb), store half (sh) and store word (sw). - Registers: The register
rs1is the base address of source register andrs2is the value to be stored to memory. - Immeditate Field: The two immediate fields together make up 12-bit signed offset number for the base address in
rs1.
Below is table that describes the list of S-type instructions.
Table 1:
S-type Instruction
| funct3 | opcode | Description | Instruction |
|---|---|---|---|
| 000 | 0100011 (35) | store byte | sb rs2, imm(rs1) |
| 001 | 0100011 (35) | store half | sh rs2, imm(rs1) |
| 010 | 0100011 (35) | store word | sw rs2, imm(rs1) |