In the Patterson & Hennessy book,
This is for these 4 instructions, if I need to implement instructions like andi, addi, ori, j, etc, do I add on to this table? Or do I do something else?
UPDATE
If I do add on, I think the hard part is the ALUOp. There are only 2 bits, I think I need the below operations. And I added what my idea of an implementation. Whats the correct MIPS implementation tho?
instr ALUOp
--------+------
AND 0000
OR 0001
add 0100
sub 0101
slt 0111
funct 1xxx
Where the MSB (bit 3) is a "see funct" bit (R-Type instructions). bit 2 will be "use ALU" bit. Then the last 2 is the operation bits. I saw various implementations, where there are more instructions like NOR, XOR, shift etc. Is there no standard or most commonly used standard?
Best Answer
If the hardware defined in your datapath supports the new instructions without adding any new control signals, then yes, just go ahead and extend the table to the right!
Augmented answer per augmented question:
The answer depends entirely on the datapath and what your control signals mean... I presume the ALUOp bits are each respectively the select signal for a 2x1 MUX, each of which in turn selects the operand inputs to your ALU. In that way they can be used to select either a value from a register or the immediate from the instruction itself. So for immediate instructions, you are probably going to choose the "register" input for operand 1 and the "immediate" inupt for operand 2...