COMPSCI 210
Semester 1 - 2015
Tutorial 2: Logic Gates
Review of Boolean algebra
Example 1 . Write the truth table for : B+(BA)=F(AB)
A B AB F(AB)
0 0 0 0
0 1 0 1
1 0 0 0
1 1 1 1
2
Exercise 1: write a truth table for:
___
a) (x+y+z)(xyz)
_ _
b) (XYZ) + (XY) (Z+Y)
_
c) PT(P+Z)
3
Basic logic gates
Not x
x
x xy x xyz
And y y
z
x x+y x x+y+z
Or y
y
z
x xy
Nand y
x+y
Nor x
y
xy
Xor x
y
4
NAND Gate
NOT-AND
X X
W Z
Z
Y Y
W =
_ X.Y
____ NAND
____
Z = W = X.Y
Z = X.Y
nand(Z,X,Y)
X Y Z
0 0 1
0 1 1
1 0 1
1 1 0
5
NOR Gate
NOR
NOT-OR
X W X
Z Z
Y Y
_______
W = X + Y Z = (X + Y)
_ _______ nor(Z,X,Y)
Z = W = (X + Y)
X Y Z
0 0 1
0 1 0
1 0 0
1 1 0 6
Rosen, 10.3 question 1
Find the output of the following circuit
x x+y
y (x+y)y
y
__
Answer: (x+y)y
7
Rosen, 10.3 question 2
Find the output of the following circuit
x
x xy xy
y
y
___
__
Answer: xy
8
Rosen, 10.3 question 6
Write the circuits for the following Boolean
algebraic expressions
__
a) x+y
x x+y
x
y
9
Rosen, 10.3 question 6
Write the circuits for the following Boolean
algebraic
_______
expressions
b) (x+y)x
x x+y
x+y (x+y)x
y
10
Example
Draw the circuit diagram to implement the
expression x ( A + B )( B + C )
11
Create truth table for the following circuit:
A B X
0 0 0
0 1 1
1 0 1
1 1 1
12
Exercise 2: Create truth table for the following
circuit:
13
Exercise 3: Draw the truth table for this
decoder:
14
Exercise 3 - Solution
A B Q0 Q1 Q2 Q3
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1 15
De Morgans Theorem
NOT all variables
Change . to + and + to .
NOT the result_______
______ _______
__ __ __ __
(X . Y) = (X + Y) = X + Y
--------------------------------------------
__________ __ __
(X + Y) = X . Y
__ __
X+Y=
16
Memory
A flip-flop holds a single bit of memory
The bit flip-flops between the two NAND gates
In reality, flip-flops are a bit more
complicated
Have 5 (or so) logic gates (transistors) per flip-flop
Consider a 1 Gb memory chip
1 Gb = 8,589,934,592 bits of memory
Thats about 43 million transistors!
In reality, those transistors are split into 9 ICs
of about 5 million transistors each
17