Binary Addition and Subtraction
Tom Kelliher, CS 220
Oct. 10, 2001
Read 3.10
Decoders, encoders, muxes.
- Binary Adders
- Unsigned binary subtraction; complements.
Combined signed addition/subtraction.
- Two half-adders and an OR gate give us a full binary adder. In the
text, note how an earlier computed XOR is used to eliminate a gate from the
carry equation.
- Full binary adder: three inputs, two outputs.
- Ripple carry adder: example of reuse and divide and conquer.
- Wire together n full binary adders in order to add two n bit
numbers.
Wiring example.
- Running time of a ripple carry adder.
Running time of a full binary adder is O. Ripple carry adder?
Excessive!!!
- An O (!!!) adder.
- Important equations (briefly explain):
Carry generate at bit position i: .
Carry propagate at position i: .
- Carry-in is .
.
.
.
Etc.
- What's the circuit depth of ?
- What's wrong with this picture?
- Carry lookahead addition.
- A different type of divide and conquer adder using a tree
hierarchy to compute and distribute carry information.
- What's the height of a binary tree?
(CLA is not binary, more like quad, but that's ok.)
- What's the running time of a CLA?
Unsigned here means we can use a minus sign. Realistic?
Let A = 110101 and B = 011010. Compute A - B and B - A.
A - B: fine. B - A: borrow out of msb.
- Actual value computed: .
- We want .
- So, compute .
The borrow into the msb leads us to the notion of complements.
Used for signed representations.
- Diminished radix complement: 1's complement.
- The 1's complement of an n bit binary number A is .
- What's the bit representation of ? The one's complement
of A? A plus its one's complement?
- Radix complement: 2's complement.
- The 2's complement of an n bit binary number A is .
- 1's complement plus one.
Two's complement of A? A plus its two's complement?
Adding to subtract:
- Denote the 2's complement of B as .
Recall .
- .
Note we should get a carry out of the msb when we perform .
- Work the two examples again.
Thomas P. Kelliher
Tue Oct 9 11:22:14 EDT 2001
Tom Kelliher