|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ALU: 1-bit |
|
|
|
|
|
|
|
This ALU can perform
most of the data operations in the MIPS instruction set |
|
|
Another operation, useful
for branching: set on less than (slt) |
|
|
Set the lsb to 1 if rs
< rt, and 0 otherwise |
|
|
|
If (a-b) is negative,
then a < b: |
(a - b) < 0 |
|
|
|
|
|
|
|
(a - b) + b < 0 + b |
|
|
|
|
|
|
a < b |
|
|
|
|
|
Result is same as sign
bit from subtraction: Connect sign bit from adder to lsb of output |
|
Unfortunately, we can
only do 1 ALU operation at a time (add or slt) |
|
|
|
Need a new 1-bit ALU for the msb |
|
|
|
|
|
|
|
|
with an extra output from
adder |
|
|
|
|
|
|
Extra output: Set |
|
|
|
|
|
|
Additional MUX data
input: Less |
|
|
|
|
|
|
|
0 for all except lsb |
|
|
|
|
|
|
|
Set
value for lsb |
|
|
|
|
|
|
|
Also add overflow
detection |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1-bit ALU with set on
less than |
|
|
|
|
|
|
(Fig. 4.17b) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|