Ch4 - 3 Adder-Subtractor

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Adder and Subtractor

Dr. Ala Altaweel

Slides were adopted and modified, with many thanks, from previous
versions belong to:
Prof. Ibrahim Kamel
example: binary adder
Design a circuit that adds two n-bit binary
numbers
0 0
0 1
Add two 5-bit
-- -- numbers:
0 1 1 1
1 1 01001
0 1 +11010
-- ---- --------------
1 10 1 0 0 0 11

carry
24/10/2009 cs221 – sherif khattab 5
Binary add/subtract
we can follow the same steps as before:
l step 1: specification

- 2n inputs
- n+1 outputs
- truth table
l step 2: simplification
l step 3: implementation

24/10/2009 cs221 – sherif khattab 6


Binary add/subtract
we will take another approach
- bottom-up approach
- building circuit in blocks

24/10/2009 cs221 – sherif khattab 7


Designing a Full Adder using Half Adder

Half adder Full adder


1 1 1
1 1
1
---- ----
1
10 10
----
10 1
----

24/10/2009 cs221 – sherif khattab


smallest block: half-adder
l circuit that adds two bits (half-adder)
l 2 inputs (x and y) and 2 outputs (Sum and
Carry)

24/10/2009 cs221 – sherif khattab 9


half-adder
l step 1: specification
l step 2: simplification
- S = x'y + xy'
- C = xy

l step 3: implementation

24/10/2009 cs221 – sherif khattab 10


Full-adder: one step up

l 3 inputs (two bits


and carry)
l 2 outputs: sum
and carry

24/10/2009 cs221 – sherif khattab 12


Designing 1-bit full adder

l K-Maps:

S = A’B’ Cin + A’BCin’+AB’Cin’+ABCin


Cout = ACin + BCin + AB
S = A’(B’Cin + BCin’)+A(B’Cin’+BCin)
S = A’(B Å Cin)+A(B Å Cin)’
S = A Å B Å Cin
Designing 1-bit full adder
l Logic Diagram:
4-bit binary adder: one step up
l adds two 4-bit binary numbers (add an input
carry)
l K-map design: 9 inputs ... too much

24/10/2009 cs221 – sherif khattab 15


4-bit binary adder: one step up
l adds two 4-bit binary numbers (add an input
carry) 1001
l using four full adders: + 1011
--------------

24/10/2009 cs221 – sherif khattab 16


example: binary subtractor
l subtracts two n-bit binary numbers
l how many inputs? outputs?
7 0111 0111 1's complement
- 5 - 0101 +1010 of 0101
------ --------- + 1
--------- 2's complement
10010 of 0101
7 0111 0111
- 9 -1001 + 0110
2's complement
------ --------- + 1
of 1001
---------
01110
24/10/2009 cs221 – sherif khattab 17
example: binary subtractor
A – B = A + (1's complement of B) + 1

24/10/2009 cs221 – sherif khattab 18

You might also like