| ALU: 1-bit | ||||||||||||||
| How about subtraction? | ||||||||||||||
| We can use the adder to add the negated form of the operand | ||||||||||||||
| a - b = a + (-b) | ||||||||||||||
| Add an inverter to the circuit to negate b | ||||||||||||||
| This gives 1's complement | ||||||||||||||
| How do we get 2C value? | ||||||||||||||
| Use cin = 1 for least significant bit | ||||||||||||||
| a + ~b + 1 = a + (~b + 1) = a + (-b) = a - b | ||||||||||||||
| Another MUX with control input Binvert |
|
|||||||||||||
| can select b or -b | ||||||||||||||
| 1-bit ALU with subtraction | ||||||||||||||
| (Fig. 4.16) | ||||||||||||||