Discrete Structure Lecture 5
Discrete Structure Lecture 5
Lecture 5
Previous Lecture Summery
3
Todays Lecture Outline
• NAND and NOR Gates
• Basics of Boolean Algebra
• Decimal and Binary numbers
• Half Adders
• Circuits using Half adders
a. ∼P ≡ P ↓ P
b. P ∨ Q ≡ (P ↓ Q) ↓ (P ↓ Q)
c. P ∧ Q ≡ (P ↓ P) ↓ (Q ↓ Q)
b. (P ↓ Q) ↓ (P ↓ Q)
Decimal representations
More generally, decimal notation is based on the fact that any positive
integer can be written uniquely as a sum of products of the form
d ·10n
where each n is a nonnegative integer and each d is one of the decimal
digits 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9. The word decimal comes from the Latin
root deci, meaning “ten.”
Boolean Algebra
27 = 16 + 8 + 2 + 1
= 1·24 + 1·23 + 0·22 + 1·21 + 1·20.
Boolean Algebra
Any integer can be represented uniquely as a sum of products of the form
d ·2n
where each n is an integer and each d is one of the binary digits (or bits) 0
or 1.
Converting binary to decimal
Represent 110101 in decimal notation.
Addition in Binary Notation
Add 11012 and 1112 using binary notation.
Solution: Because 210 = 102 and 110 = 12, the translation of 110 +
110 = 210 to binary notation is
• Carry is x AND y
• Sum is x XOR y
• The circuit to compute this is called a half-adder.
Circuit of Half Adder
• Sum = x XOR y
• Carry = x AND y
x
y Sum
Carry
Using Half adders
1 0 0
1 1 0 0
+1 1 1 0
? 0 1 0
How to fix that
• We need to create an adder that can take a carry bit as an
additional input
Inputs: x, y, carry in
Outputs: sum, carry out
• This is called a full adder
Will add x and y with a half-adder
Will add the sum of that to the
carry in
• What about the carry out?
It’s 1 if either (or both):
x+y = 10
x+y = 01 and carry in = 1
The Full adder
Parallel Adder Circuits
Two full-adders and one half-adder can be used together to build a
circuit that will add two three-digit binary numbers PQR and STU to
obtain the sum WXYZ. Such a circuit is called a parallel adder.
Parallel adders can be constructed to add binary numbers of any
finite length.
The Full adder
The full circuitry of the full adder
c
s
x
y
c
Lecture summary
• Boolean Algebra