The input of the ALU control is the 6-bit opcode of an instruction or the 6-bit funct field of an R-type instruction.
All R-type instructions use the opcode “000000” and the funct parameter contains the necessary control codes to differentiate the different instructions.
The output of an ALU control is a 4-bit encoding.
Note that the 4-bit encoding here is different from the one in the textbook.
Other binary encodings are also possible.
The idea is to choose a binary encoding that will minimize the logic.
Few comments about the table include:
|
|
Input |
Output |
4-bit Encoding |
Op6 |
funct6 |
ALUctl |
R-type |
add |
ADD |
0000 |
R-type |
sub |
SUB |
0010 |
R-type |
and |
AND |
0100 |
R-type |
or |
OR |
0101 |
R-type |
xor |
XOR |
0110 |
R-type |
slt |
SLT |
1010 |
addi |
x |
ADD |
0000 |
slti |
x |
SLT |
1010 |
andi |
x |
AND |
0100 |
ori |
x |
OR |
0101 |
xori |
x |
XOR |
0110 |
lw |
x |
ADD |
0000 |
sw |
x |
ADD |
0000 |
beq |
x |
SUB |
0010 |
bne |
x |
SUB |
0010 |
j |
x |
x |
x |
|