The operand2 source handler is responsible for generating the second operand for the ALU operation, which is determined by the instruction format. The following table shows the various instruction formats and the corresponding second operand generated by the operand2 source handler:
I31 | I30 | I24 | I13 | N |
---|---|---|---|---|
0 | 0 | 0 | 0 | Imm || 0b0000000000 |
0 | 0 | 0 | 1 | Imm || 0b0000000000 |
0 | 0 | 1 | 0 | Imm || 0b0000000000 |
0 | 0 | 1 | 1 | Imm || 0b0000000000 |
0 | 1 | 0 | 0 | Imm (sign extended) |
0 | 1 | 0 | 1 | Imm (sign extended) |
0 | 1 | 1 | 0 | Imm (sign extended) |
0 | 1 | 1 | 1 | Imm (sign extended) |
1 | 0 | 0 | 0 | R |
1 | 0 | 0 | 1 | Imm12-0 (sign extended) |
1 | 0 | 1 | 0 | 0b0000...000 || R4-0 |
1 | 0 | 1 | 1 | 0b0000...000 || Imm4-0 |
1 | 1 | 0 | 0 | R |
1 | 1 | 0 | 1 | Imm12-0 (sign extended) |
1 | 1 | 1 | 0 | R |
1 | 1 | 1 | 1 | Imm12-0 (sign extended) |
-
R
(input) 32bit number- Register: The value of a register is used as the second operand. The register number is specified by the instruction.
-
Imm
(input) 22bit number- Immediate: A 13-bit or 22-bit immediate value is used as the second operand. The value is sign-extended to 32 bits if necessary.
-
IS
(input) 4bit number- Memory: The value at a memory location is used as the second operand. The address is calculated based on the contents of a register and an immediate offset value.
-
N
(output) 32bit number- Operand B: the N Output which is used as input operand for the Arithmetic Logic Unit (ALU)