1034 Chap 2
1034 Chap 2
1034 Chap 2
Logic Gates
Gates
A gate is a device that performs a basic
operation on electrical signals
Gates are combined into circuits to perform
more complicated tasks
NOT Gate
A NOT gate accepts one input value
and produces one output value
input output
A B
OR Gate
If both inputs are 0, output is 0
Otherwise, output is 1
XOR Gate
An XOR gate produces 0 if its inputs are match, and a 1
otherwise
NAND Gates
The NAND gates are essentially the opposite of
the AND gates.
NOR GATES
The NOR gates are essentially the
opposite of the OR gates.
n-input Gates
Because + and * are binary operations, they can be
cascaded together to OR or AND multiple inputs.
A A
B A+B+C B ABC
C
A A
B A+B+C B ABC
C C
NAND and NOR as Universal Logic Gates
Any logic circuit can
be built using only
NAND gates, or only
NOR gates. They are
the only logic gate
needed.
Combinational
7
3
(AB + AC)
Truth Table
Since this circuit has 3 inputs, eight rows are required to describe all
possible input combinations: (23=8)
This same circuit using Boolean algebra:
(AB + AC)
Combinational Logic
Consider the following Boolean expression: A(B + C)
x x+y
y
(x+y)y
Answer: (x+y)y _
Exercise 2
Find the output of the following circuit
x
x xy xy
y
y
___
_ _
Answer: xy
Exercise 3
Write the circuits for the following Boolean
algebraic expressions
__
a) x+y
x
x x+y
y
Exercise 4
Sketch the circuits for the following Boolean
algebraic
_____
expressions
b) (x+y)x
x x+y
x+y (x+y)x
y
Exercise 5
Implement the following truth table.
A B C
0 0 0
0 1 1
1 0 1
1 1 0
3-26
Exercise 5
Writing xor using and/or/not
____
x y (x + y)(xy) x
1
y
1
xy
0
1 0 1
0 1 1
0 0 0
x x+y (x+y)(xy)
y
xy xy
Exercise 6
Complete the truth A B A.B A.B A+B P
table for this circuit
and name the
0 0
equivalent primitive
function/gate.
0 1
1 0
1 1
Exercise 7
Can implement ANY truth table with AND, OR,
NOT.
A B C D
0 0 0 0 1. AND combinations
that yield a "1" in the
0 0 1 0
truth table.
0 1 0 1
0 1 1 0
1 0 0 0 2. OR the results
1 0 1 1 of the AND gates.
1 1 0 0
1 1 1 0
Example
Consider a buzzer which sounds when :
• The lights are on and
• The door is open and A
Alarm
• No key is in the ignition B system P
Active
C
lights A
Implementation as a
circuit using logic gates door B P buzzer
keys C
How to add binary numbers
Consider adding two 1-bit binary numbers x and y
0+0 = 0
0+1 = 1
x
y Sum
Carry
Definition: Minterm
Product term in which all variables appear once
(complemented or not)
For n variables, there will be 2n minterms
34
Maxterms
Sum term in which all variables appear once
(complemented or not)
35
Minterm related to Maxterm
Minterm and maxterm with same subscripts are
complements
Example
m j Mj
m3 XYZ X Y Z M 3
36
Sum of Product (SOP)
OR all of the minterms of truth table row with a
1
37
Product of Maxterms
Recall that maxterm is true except for its own
case
So M1 is only false for 001
38
Product of Sum (POS)
Can express F as AND of all rows that should
evaluate to 0
F M1 M 3 M 4 M 6
or
F ( X Y Z )( X Y Z )
( X Y Z )( X Y Z )
39
Canonical and Standard Forms
We need to consider formal techniques for the
simplification of Boolean functions.
Minterms and Maxterms
Sum-of-Minterms and Product-of-Maxterms
Dec 8, 2021 40
Definitions
Dec 8, 2021 41
Truth Table notation for Minterms
and Maxterms
Minterms and x y z Minterm Maxterm
Maxterms are easy 0 0 0 x’y’z’ = m0 x+y+z = M0
to denote using a 0 0 1 x’y’z = m1 x+y+z’ = M1
truth table. 0 1 0 x’yz’ = m2 x+y’+z = M2
Example: 0 1 1 x’yz = m3 x+y’+z’= M3
Assume 3 variables1 0 0 xy’z’ = m4 x’+y+z = M4
x,y,z 1 0 1 xy’z = m5 x’+y+z’ = M5
(order is fixed) 1 1 0 xyz’ = m6 x’+y’+z = M6
1 1 1 xyz = m7 x’+y’+z’ = M7
Dec 8, 2021 45
Read
Lab 1
Quick read
Just to see if it all makes sense
http://www.cs.unc.edu/~lastra/comp160/Labs/index.html
46
C
A F
B
C
A G