|
| Subtract Magnitudes |
|
|
Operation | Add magnitudes | When A>B | When A<B | When A=B |
(+A)+(+B) | +(A+B) |
|
|
|
(+A)+(-B) |
| +(A-B) | -(B-A) | +(A-B) |
(-A)+(-B) |
| -(A-B) | +(B-A) | +(A-B) |
(-A)+(-B) | -(A+B) |
|
|
|
(+A)-(+B) |
| +(A-B) | -(B-A) | +(A-B) |
(+A)-(-B) | +(A+B) |
|
|
|
(-A)-(+B) | -(A+B) |
|
|
|
(-A)- (-B) |
| -(A-B) | +(B-A) | +(A-B) |
Pi = Ai ⊕ Bi Gi = Ai · Bi The output sum and carry can be expressed as Sumi = Pi ⊕ Ci Ci+1 = Gi + (Pi · Ci) |
C1 = G0 + P0 · C0 C2 = G1 + P1 · C1 = G1 + P1 · G0 + P1 · P0 · C0 C3 = G2 + P2 · C2 = G2 P2 · G1 + P2 · P1 · G0 + P2 · P1 · P0 · C0 C4 = G3 + P3 · C3 = G3 P3 · G2 P3 · P2 · G1 + P3 · P2 · P1 · G0 + P3 · P2 · P1 · P0 · C0 |
To multiply (23) and (19)
(23) 10111(Multiplicand) (19) 10011(Multiplier) 10111 10111 00000 + 00000 10111
(437) 110110101 Product |
- When two bits Qn and Qn + 1 are 00 or 11, we simply perform the arithmetic shift right operation (ashr) to the partial product AC. And the bits of Qn and Qn + 1 is incremented by 1 bit.
- If the bits of Qn and Qn + 1 is shows to 01, the multiplicand bits (M) will be added to the AC (Accumulator register). After that, we perform the right shift operation to the AC and QR bits by 1.
- If the bits of Qn and Qn + 1 is shows to 10, the multiplicand bits (M) will be subtracted from the AC (Accumulator register). After that, we perform the right shift operation to the AC and QR bits by 1.