unit 1
unit 1
LOGIC GATES
Digital Computers
- Imply that the computer deals with digital information, i.e., it deals
with the information that is represented by binary digits
- Why BINARY ? instead of Decimal or other number system ?
1 7
6
5 signal
4
3 range
2
0 1
0
binary octal
Binary Binary
Digital Digital
. Gate Output
Input .
Signal . Signal
Logic Circuits
• A set of logic gates are cascaded to form a logic circuit such as
multiplexers, registers, arithmetic logic units (ALUs) and computer
memory. Of course microprocessor.
COMBINATIONAL GATES
Name Symbol Function Truth Table
A B X
A X=A•B 0 0 0
AND X or 0
1
1
0
0
0
B X = AB
1 1 1
A B X
A 0 0 0
OR X X=A+B 0 1 1
B 1 0 1
1 1 1
A X
I A X X = A’ 0
1
1
0
A X
Buffer A X X=A 0 0
1 1
A B X
A 0 0 1
NAND X X = (AB)’ 0
1
1
0
1
1
B 1 1 0
A B X
A 0 0 1
NOR X X = (A + B)’ 0
1
1
0
0
0
B 1 1 0
A B X
A X=AB
XOR X or 0 0 0
Exclusive OR 0 1 1
B X = A’B + AB’ 1 0 1
1 1 0
A B X
A X = (A B)’
XNOR X or
0
0
0
1
1
0
Exclusive NOR
or Equivalence B X = A’B’+ AB 1 0 0
1 1 1
BOOLEAN ALGEBRA
Boolean Algebra
Truth Table
- Table that describes the Output Values for all the combinations
of the Input Values, called MINTERMS
- n input variables → 2n minterms
Boolean F = x + y’z
Function
x
F
Logic y
Diagram
z
EQUIVALENT CIRCUITS
(2) A
B
C F
(3) A
B
F
C
A,B,...,Z,a,b,...,z A’,B’,...,Z’,a’,b’,...,z’
(p + q) (p + q)’
AND OR
OR AND
SIMPLIFICATION
Truth Boolean
Table Function
Unique Many different expressions exist
Simplification from Boolean function
Truth
Table
Simplified
Karnaugh Boolean
Map Function
Boolean
function
KARNAUGH MAP
1 0 1 1 1 1
F(x) = (1)
1-cell
x y F
x0 1
0 0 0
y x0 1
0 1 1
0 0 1 y
0 0 1
1 0 1 1 2 3
1 1 1 1 1 0
F(x,y) = (1,2)
Computer Organization Computer Architectures Lab
Digital Logic Circuits 14 Map Simplification
KARNAUGH MAP
Karnaugh Map for an n-input digital logic circuit (n-variable sum-of-products
form of Boolean Function, or Truth Table) is
- Rectangle divided into 2n cells
- Each cell is associated with a Minterm
- An output(function) value for each input value associated with a
mintern is written in the cell representing the minterm
→ 1-cell, 0-cell
1 0 1 1 1 1
F(x) = (1)
1-cell
x y F
x0 1
0 0 0
y x0 1
0 1 1
0 0 1 y
0 0 1
1 0 1 1 2 3
1 1 1 1 1 0
F(x,y) = (1,2)
Computer Organization Computer Architectures Lab
Digital Logic Circuits 15 Map Simplification
KARNAUGH MAP
x y z F
0 0 0 0
yz y yz
0 0 1 1
0 1 0 1 x 00 01 11 10 x 00 01 11 10
0 1 1 0 0 0 1 3 2 0 0 1 0 1
1 0 0 1 x 1 4 5 7 6
1 0 1 0 1 1 0 0 0
1 1 0 0 z
1 1 1 0 F(x,y,z) = (1,2,4)
wx w
u v w x F
0 0 0 0 0 uv 00 01 11 10
0 0 0 1 1 00 0 1 3 2 v
0 0 1 0 0
0 0 1 1 1 01 4 5 7 6
0 1 0 0 0
u 11
12 13 15 14
0 1 0 1 0
0 1 1 0 1
0 1 1 1 0 10 8 9 11 10
1
1
0
0
0
0
0
1
1
1
x
1 0 1 0 0 wx
1 0 1 1 1 uv 00 01 11 10
1 1 0 0 0 00 0 1 1 0
1 1 0 1 0
1 1 1 0 1
1 1 1 1 0 01 0 0 0 1
11 0 0 0 1
10 1 1 1 0
F(u,v,w,x) = (1,3,6,8,9,11,14)
Computer Organization Computer Architectures Lab
Digital Logic Circuits 16 Map Simplification
F(x,y) = (2,3)
= xy’+ xy
=x
u’v’w’x’+u’v’w’x+u’vw’x’+u’vw’x+uvw’x’+uvw’x+uv’w’x’+uv’w’x
= u’v’w’(x’+x) + u’vw’(x’+x) + uvw’(x’+x) + uv’w’(x’+x)
= u’(v’+v)w’ + u(v’+v)w’
= (u’+u)w’ = w’
wx
uv w uv w V’
1 1 1 1 1 1
w’
1 1
v v
1 1
u u 1 1 1 1 u
1 1 1 1 1 1
x x
MAP SIMPLIFICATION
wx
uv 00 01 11 10 w
00 1 1 0 1 1 1 0 1
01 0 0 0 0 0 0 0 0
v
11 0 1 1 0 0 1 1 0
10 0 1 0 0 u
0 1 0 0
x
F(u,v,w,x) = (0,1,2,9,13,15)
(0,1), (0,2), (0,4), (0,8) Merge (0,1) and (0,2)
Adjacent Cells of 1 --> u’v’w’ + u’v’x’
Adjacent Cells of 0 Merge (1,9)
(1,0), (1,3), (1,5), (1,9) --> v’w’x
... Merge (9,13)
... --> uw’x
Adjacent Cells of 15 Merge (13,15)
(15,7), (15,11), (15,13), (15,14) --> uvx
x’
y’ x
z’
x’ z
y F F
z’ y
x
y z
z’
I AND OR
F(x,y,z) = (0,2,6) y
F’ = xy’ + z
1 0 0 1 z
x 0 0 0 1 F = (xy’)z’
= (x’ + y)z’
x z
y’
x
y
F
z
I OR AND
x
F
y
z
Computer Organization Computer Architectures Lab
Digital Logic Circuits 22 Combinational Logic Circuits
Not Gate
S -Close V-out = 0
S - Open V-out =1
NOR Gate
NAND Gate
CMOS Circuits
CMOS Circuits
Vt is a threshold voltage
IC Circuits
Flip-flops
• Flip-flops are fundamental building blocks in digital electronic circuits, prim
arily used for storing and transferring binary data (1s and 0s). They are a typ
e of bistable multivibrator, which means they have two stable states: they ca
n store either a "0" or a "1.
• The circuit can "flip" from one state (0) to another (1) and "flop" back to the
original state. This alternating between two stable states when triggered by
a clock or input signal gives rise to the term "flip-flop."
0-State 1-State
SR FLIP- FLOP
In order to be used in the computer circuits, state of the flip flop should have input terminals and
output terminals so that it can be set to a certain state, and its state can be read externally.
If S is set to 1 with R equal to 0, Q and Q’ will become 1 and 0 respectively, and remain in this state
after S is returned to 0. Hence, this circuit constitutes a memory element. Or a latch.
Q is considered as output and Q’ is not used in practice. S and R are called set and reset.
R S R Q(t+1)
Q 0 0 Q(t)
0 1 0
1 0 1
S Q’ 1 1 indeterminate
Basic Latch
(forbidden) implemented with
NOR gates
D-LATCH
D-Latch
Forbidden input values are forced not to occur
by using an inverter between the inputs
D Q
D Q(t+1)
0 0
1 1 Cl Q’
• D flip-flop samples the D input at the time the clock is high and stores the
information until subsequent clock pulse arrives
clr(clear)
S P Q S P Q
c c
R clr Q’ R clr Q’
S P Q S P Q
c c
R clr Q’ R clr Q’
Characteristics
- State transition occurs at the rising edge or
falling edge of the clock pulse
Latches
• Two gated latches can be connected to form the master-slave organization eliminates this problem.
• The first, the master is connected to the inputs and its output is connected to slave. When Clock =1, a
1to0 transition of the clock isolates the master from the input and transfers the contents of the master
stage to the slave stage.
• The function of the slave is to hold the value at the output of the flipflop while master stage is being
set up to the next state value determined by the input.
• The new state is transferred from master to the slave after the 1 to 0 transition on Clock.
• At this stage the master is isolated from the inputs so that further changes in the latch input will not
affect this transfer.
T Flip-flop
JK Flip-flop
• JK flip-flop combines the behavior of SR and T flip-flops
• The first 3 entries in the truth table defines the same behavior as SR flip-flop
• When J=K=1, the next state is defined as the complement of the present state of the flip-flop. i.e.
when J=K=1 the flip-flop toggles, reversing its present state.
• JK flip-flop is versatile, it can be used to store data like RS flip-flop. It can also be used to built
counters and shift registers, because it behaves like T flip-flop when its inputs are connected
together.
• It consists of D flip-flops connected so that each clock pulse will cause the transfer of the
state of Fi to Fi+1, effecting a “right Shift”.
• Data is shifted serially into and out of the register
• The rotation of the data can be implemented by connecting Out to In
Counters
• Another application of flip-flops is implementation of counter circuits
• Counters are also used to generate control and timing signals.
• A 3 bit counter with T flip-flops is shown here
• When T input is 1, the flip-
flop toggles, i.e. for each
successive pulse Q0 to
change from 1 state to 0
state and back to 1 state.
• i.e. the output waveform of
Q0 has half frequency of
the clock.
• Q1 has the half frequency
of Q0, Similarly, Q2 has
half frequency of Q1
• Hence it is also called a
ripple counter, because
the effect of an input clock
pulse ripples through the
counter.
ENCODER/DECODER
Octal-to-Binary Encoder
D1 A0
D2
D3 A1
D4
D5 A2
D6
D7
2-to-4 Decoder
D0
E A1 A0 D0 D1 D2 D3 A0 D1
0 0 0 0 1 1 1
0 0 1 1 0 1 1 D2
0 1 0 1 1 0 1
0 1 1 1 1 1 0
1 d d 1 1 1 1 A1 D3
E
Decoders
MULTIPLEXER
4-to-1 Multiplexer
Select Output
S1 S0 Y
0 0 I0
0 1 I1
1 0 I2
1 1 I3
I0
I1
Y
I2
I3
S0
S1
Sequential Circuits
• A combinational circuit is the one whose output is determined entirely by its present inputs.
• Examples: Multiplexers and decoders
• Sequential circuits output depends on both the present inputs and on the sequence of previous
inputs.
CLOCK PERIOD
Clock period determines how fast the digital circuit operates.
How can we determine the clock period ?
Usually, digital circuits are sequential circuits which has some flip flops
FF FF ... FF
C
Combinational .
.
. Logic .
. Circuit .
Combinational
FF Logic FF
Circuit
FF Setup Time
FF Delay Combinational logic Delay FF Hold Time
td
ts,th
clock period T = td + ts + th
Computer Organization Computer Architectures Lab
Digital Logic Circuits 54 Sequential Circuits
DESIGN EXAMPLE
Design Procedure:
Specification State Diagram State Table
Excitation Table Karnaugh Map Circuit Diagram
Example: 2-bit Counter -> 2 FF's
x=0 current next
state input state FF inputs
00 A B x A B Ja Ka Jb Kb
x=1 x=1 0 0 0 0 0 0 d 0 d
0 0 1 0 1 0 d 1 d
x=0 01 11 x=0 0 1 0 0 1 0 d d 0
0 1 1 1 0 1 d d 1
x=1 1 0 0 1 0 d 0 0 d
x=1 1 0 1 1 1 d 0 1 d
10 1 1 0 1 1 d 0 d 0
x=0 1 1 1 0 0 d 1 d 1
B B B B
d d d d
1 d d x 1 d x d 1 x
x x
d d 1
A A A 1 d A
d 1 J Q A J Q B
d d d d C C
Ja Ka Jb Kb K Q' K Q'
clock
Ja = Bx Ka = Bx Jb = x Kb = x
Clock
I0 I1 I2 I3
Shift Registers
Serial Serial
D Q D Q D Q D Q Output
Input C C C C
Clock
Q Q Q Q
D C D C D C D C
A0 A1 A2 A3
Q Q Q Q
J K J K J K J K
Clock
Counter
Enable
Output
Carry
MEMORY COMPONENTS
0
Logical Organization
words
(byte, or n bytes)
N-1
Random Access Memory
k address lines
2k Words
Read (n bits/word)
Write
m x n ROM
(m=2k)
TYPES OF ROM
ROM
- Store information (function) during production
- Mask is used in the production process
- Unalterable
- Low cost for large quantity production --> used in the final products
INTEGRATED CIRCUITS