Logic Gates - Theory
Logic Gates - Theory
3:
Logic Gates
2
Logical Gates and Combinatorial Circuits
3
Logical Gates and Combinatorial Circuits
4
Logical Gates and Combinatorial Circuits
5
Logical Gates and Combinatorial Circuits
In circuitry theory, NOT, AND, and OR gates are the
basic gates. Any circuit can be designed using these
gates. The circuits designed depend only on the
inputs, not on the output. In other words, these circuits
have no memory. Also these circuits are called
combinatorial circuits.
The symbols NOT gate, AND gate, and OR gate are
also considered as basic circuit symbols, which are
used to build general circuits.
6
Logical Gates and Combinatorial Circuits
7
8
9
10
11
12
13
14
15
Draw a circuit diagram for = (xy' + x'y)z.
16
17
18
19
A circuit for two light switches
EXAMPLE 3, p. 714
F(x,y)=1 when the light is on
F(x,y)=0 when the light is off
When both switches are closed, the light is on:
F(1,1)=1, this implies
When we open one switch, the light is off:
F(1,0)=F(0,1)=0
When the other switch is also open, the light is on:
F(0,0)=1
20
Thus, we get:
21
22
23
24
25
26
27
28
29
30
Logical Gates and Combinatorial Circuits
A NOT gate can be
implemented using a
NAND gate (a).
An OR gate can be
implemented using
NAND gates (c).
31
Logical Gates and Combinatorial Circuits
32
Adders: Logical gates to add two numbers
33
How to add binary numbers
Consider adding two 1-bit binary numbers x and y
0+0 = 0
0+1 = 1
x y Carry Sum
1+0 = 1
0 0 0 0
1+1 = 10
0 1 0 1
1 0 0 1
1 1 1 0
Carry is x AND y
Sum is x XOR y
The circuit to compute this is called a half-adder
34
= s (sum)
c (carry)
x y s c
1 1 0 1
1 0 1 0
0 1 1 0
0 0 0 0
35
A full adder is a circuit that accepts as input thee bits x, y, and c, and
produces as output the binary sum cs of a, b, and c.
c X HA S
s
Y C
x X HA S
c
y
Y C
x 1 1 1 1 0 0 0 0
y 1 1 0 0 1 1 0 0
c 1 0 1 0 1 0 1 0
s (sum) 1 0 0 1 0 1 1 0
c (carry) 1 1 1 0 1 0 0 0
36
The full adder
The full circuitry of the full adder
c
s
x
y
c
37
Adding bigger binary numbers
We can use a half-adder and full adders to
compute the sum of two Boolean numbers
1 0 0
1 1 0 0
+1 1 1 0
? 0 1 0
38
Adding bigger binary numbers
Just chain one half adder and full adders together,
e.g., to add x=x3x2x1x0 and y=y3y2y1y0 we need:
x0 X HA S
s0
y0 Y C
x1
C
X
FA S
s1
y1 Y C
x2
C
X
FA S
s2
y2 Y C
x3
C
X
FA S
s3
y3 Y C
c
39
Adding bigger binary numbers
A half adder has 4 logic gates
A full adder has two half adders plus a OR gate
Total of 9 logic gates
To add n bit binary numbers, you need 1 HA and n-1 FAs
To add 32 bit binary numbers, you need 1 HA and 31
FAs
Total of 4+9*31 = 283 logic gates
To add 64 bit binary numbers, you need 1 HA and 63
FAs
Total of 4+9*63 = 571 logic gates
40
More about logic gates
To implement a logic gate in hardware, you use a
transistor
Transistors are all enclosed in an “IC”, or
integrated circuit
The current Intel Pentium IV processors have 55
million transistors!
41
Flip-flops
Consider the following
circuit: R S Function
R 1 0 Reset
Q
0 1 Set
1 1 Hold
0 0 1/1
Q’
S
42
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
That’s about 43 million transistors!
In reality, those transistors are split into 9 ICs of
about 5 million transistors each
43