2
\$\begingroup\$

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?

\$\endgroup\$
3
  • \$\begingroup\$ Yet another homework question. \$\endgroup\$ – Brian Carlton Oct 25 '11 at 16:42
  • 4
    \$\begingroup\$ @Brian Carlton What's wrong with that? \$\endgroup\$ – AndrejaKo Oct 25 '11 at 17:10
  • \$\begingroup\$ I guess this is not my strong point :) with little useful help in school ... \$\endgroup\$ – Jiew Meng Oct 26 '11 at 0:04
1
\$\begingroup\$

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...

\$\endgroup\$
4
  • \$\begingroup\$ Ok, now what should the ALUOp bits be for immediate instructions? do I use the unused 11? \$\endgroup\$ – Jiew Meng Oct 26 '11 at 0:34
  • \$\begingroup\$ @jiewmeng, for any question you need to ask exactly what you are needing explained. If you then have further full questions you should ask them as another question. Please take the time to formulate exactly what you are looking for, often that process will answer most questions. \$\endgroup\$ – Kortuk Oct 26 '11 at 6:27
  • \$\begingroup\$ @Kortuk, I'll keep that in mind ... sometimes I rush to ask questions. Updated my qn too \$\endgroup\$ – Jiew Meng Oct 26 '11 at 7:17
  • \$\begingroup\$ @jiewmeng, for this site to garner great answers it needs great questions. Just advice for asking questions here. \$\endgroup\$ – Kortuk Oct 26 '11 at 7:26
0
\$\begingroup\$

I avoided this problem by adding 2 more bit line to ALUOp. So now all the I-type instructions that could not be decoded by the ALUContol block, had 2 additional ALUOp bit and I could now decode 24 more instructions.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.