LDCO notes
LDCO notes
[Information Technology]
Logic Design & Computer Organization
[214442]
• How can a circuit "remember" anything, when it’s just a bunch of gates
that produce outputs according to the inputs?
• The basic idea is to make a loop, so the circuit outputs are also inputs
• Here is one initial attempt, shown with two equivalent layouts:
• Latch / One bit memory cell, as the name suggests can store ‘one’bit (logic
0 or logic 1) information.
• It can be built using NAND or NOR gates.
• A one bit memory cell using NAND gates is as shown in the next figure
• It is also known as ‘S-R’(Set-Reset) latch.
• This circuit has two stable states: ‘1 state’ (output Q = 1) and ‘0 state’
(output Q = 0).
• ‘1 state’ is also called as ‘set state’ and the ‘0 state’ is known as ‘reset
state’. The digital information gets locked or latched in this circuit.
• Therefore it is known as S-R i.e. set-reset latch.
The S-R Latch Circuit
• Let’s use NOR gates instead of inverters. The SR latch below has two
inputs S and R, which will let us control the outputs Q and Q'
• Here Q and Q' feed back into the circuit. They’re not only outputs,
they’re also inputs!
• To figure out how Q and Q' change, we have to look at not only the
inputs S and R, but also the current values of Q and Q':
Qnext = (R + Q'current)'
Q'next = (S + Qcurrent)'
• Let’s see how different input values for S and R affect this thing
The S-R Latch Circuit
Storing a Value: SR = 00
• What if S = 0 and R = 0?
• The equations on the right reduce to:
Qnext = (0 + Q'current)' = Qcurrent
Q'next = (0 + Qcurrent)' = Q'current
• So when SR = 00, then Qnext = Qcurrent
Whatever value Q has, it keeps
Qnext = (R + Q’current )’
• This is exactly what we need to store values in Q’next = (S + Qcurrent)’
the latch
The S-R Latch Circuit
Setting the Latch: SR = 10
• What if S = 1 and R = 0?
• Since S = 1, Q’next is 0, regardless of Qcurrent:
Q’next = (1 + Qcurrent)’ = 1’= 0
• Then, this new value of Q’ goes into the top NOR
gate, along with R = 0
Qnext = (0 + 0)’= 0’= 1
• So when SR = 10, then Q’next = 0 and Qnext = 1
• This is how you set the latch to 1. The S input Qnext = (R + Q’current)’
stands for “set” Q’next = (S + Qcurrent)’
• Once Qnext becomes 1, the outputs will stop
changing. This is a stable state
The S-R Latch Circuit
Resetting the Latch: SR = 01
• What if S = 0 and R = 1?
• Since R = 1, Qnext is 0, regardless of Qcurrent:
• The input signals for the NAND latch are the complement of the
signals for the NOR latch, hence the name S’R’latch
• You can derive this table by writing equations for the outputs in terms
of the inputs and the current state, just as we did for the SR latch
An SR Latch with a Control Input
C S R S’ R’ Q
0 x x 1 1 No change
1 0 0 1 1 No change
1 0 1 1 0 0 (reset)
1 1 0 0 1 1 (set)
1 1 1 0 0 Avoid!
An SR Latch with a Control Input
period
• The time between two consecutive ticks is called the clock period
• The clock frequency is the inverse of the clock period. The unit of
measurement for frequency is the hertz
• Clocks are often used to synchronize circuits
• Duty-cycle
– Fraction of the total period that a digital waveform is in the HIGH
state
– Usually expressed as % of period
Clock Pulse Definition
• An edge triggered flip-flop changes state either at the positive edge (rising
edge) or a the negative edge (falling edge) of the clock pulse
• Its sensitive to inputs only at this transition of the clock
• Each flip-flop can be either positive edge triggered (no bubble at the C
input) or negative triggered (bubble at the C input)
SR Flip Flop
• The circuit of clocked S-R flip flop shown earlier switches to either set
state or reset state when the power is turned on i.e. the state of the circuit is
uncertain.
• In many applications it is required to define the initial state of the flip flop
when the power is turned on.
• This is accomplished by using the preset & clear inputs.
• Preset & clear inputs are known as asynchronous inputs as they do not
work in synchronism with the clock.
• Clocked S-R flip flop with preset & clear inputs can be obtained by using
N1 and N2 NAND gates as 3 input gates as shown in the next figure.
S-R Flip Flop: Preset & Clear Inputs
• We know that in case of clocked S-R flip flop, for the input condition S = R
= 1 both the outputs Q and Q# try to become 1, which is not allowed and
therefore this input condition is prohibited.
• This drawback can be eliminated by converting S-R flip flop into a JK flip
flop.
• The data input J is ANDed with Q# to obtain S input and the data input K is
ANDed with Q to obtain R input as shown in figure.
• When J = K = 0, output of both AND gates is 0. Therefore, S and R both
become 0. So next state output Qn + 1 remains same as that of present state
output Qn.
JK Flip Flop
• The race around condition can be eliminated if tON is made smaller than the
propagation delay ∆t.
• It can also be eliminated using the master slave JK (MSJK) flip flop.
JK Flip Flop
• The operation of JK flip flop can be expressed with the truth table.
Inputs Output
Jn Kn Qn + 1
0 0 Qn
0 1 0
1 0 1
1 1 Qn#
• Master slave JK flip flop is a cascade of two S-R flip flops as shown in
figure
Master Slave JK (MSJK) Flip Flop
• As shown in figure, outputs of slave are fed back to the inputs of master.
Also clock is directly applied to the master while it is inverted and then
applied to the slave.
• When CLK=1, the master is enabled and the slave is disabled. The outputs
of master Qm and Qm# respond to the inputs J and K according to the truth
table. As long as CLK=1, Q & Q# outputs do not change as the slave is
disabled and therefore the fed back inputs of master also do not change.
• When CLK= 0, the slave is enabled and the master gets disabled. The
outputs Q and Q# change according to the outputs of the master Qm and
Qm#. As long as CLK = 0, Qm and Qm# outputs do not change as the master
is disabled and therefore Q and Q# outputs also retain their new values.
• Thus the race around condition gets eliminated.
Master Slave JK (MSJK) Flip Flop
• The state of the master slave JK flip flop, changes at the negative transition
of the clock pulse.
• The logic symbol of master slave JK flip flop is shown below,
• The symbol ‘>’ at the CLK input indicates that output changes when the
clock makes a transition.
• The bubble indicates that the output changes when there is a negative
transition of the clock (i.e. when the clock changes from 1 to 0).
D Flip Flop
Input Output
Dn Qn + 1
0 0
1 1
• Here Dn represents the present state input and Qn + 1 represents the next
state output.
• From truth table, it is clear that output is same as that of input therefore it is
known as ‘data’flip flop.
T Flip Flop
Input Output
Tn Qn + 1
0 Qn
1 Qn#
• Here Tn represents the present state input, Qn represents the present state
output and Qn + 1 represents the next state output.
Excitation Table of Flip Flop
Qn Qn + 1 Sn Rn
0 0 0 X
0 1 1 0
1 0 0 1
1 1 X 0
Excitation table of S-R flip flop
SR excitation table 1 0 0 1
1 0 0 1
Qn Qn+1 S R
1 1 0 1
0 0 0 X
1 1 1 1
0 1 1 0
1 0 0 1
1 1 X 0
J K Flip Flop
D Qn+1 D Qn Qn+1
0 0 0 0 0
1 1 0 1 0
1 0 1
1 1 1
D excitation table
Qn Qn+1 D
0 0 0
0 1 1
1 0 0
1 1 1
T Flip Flop
• The 74AHC/AHCT74 are high-speed Si-gate CMOS devices and are pin
compatible with low power Schottky TTL (LSTTL).
• It is a 14 - pin IC which consists of two D flip-flops.
• The two flip-flops have separate preset and clear inputs.
• The 74AHC/AHCT74 dual positive-edge triggered, D-type
• flip-flops with individual data (D) inputs, clock (CP) inputs, set (SD) and
reset (RD) inputs; also complementary Q and Q outputs.
• The set and reset are asynchronous active LOW inputs and operate
independently of the clock input.
Study of IC 7474
PINNING
Study of IC 7474
• FUNCTION TABLES
Study of IC 7476
• The logic state of J and K inputs must not be allowed to change while the
clock is HIGH.
• The data is transferred to the outputs on the falling edge of the clock pulse.
A LOW logic level on the preset or clear inputs will set or reset the outputs
regardless of the logic levels of the other inputs.
• The logic symbol of two flip-flops with pin numbers is as shown in next
figure.
Study of IC 7476
• Pin Diagram:
Study of IC 7476
• Function Table
Inputs Outputs
PR CLR CL K J K Q Q#
L H X X X H L
H L X X X L H
L L X X X H H
(Invalid output)
H H same as
L L present state
H H L H L H
H H H L H L
H H H H Toggle
Application of flip-flops
Counters
• A circuit that counts electrical pulses, applied as input to it is known
as counter.
• In practice, these circuits are used as event counters i.e. to count
number of events occurred. Electrical pulses are generated
corresponding to the occurrence of an event and these pulses are
given as input to the counters.
• A counter with n flip flops has 2n possible states. Therefore a three
bit up counter can count from 0 to 7 while a four bit down counter
can count from 15 down to 0.
• A n bit counter is built with n flip flops. Therefore a three bit
counter circuit has three flip flops.
Counters
• Truth Table:
Q2 Q1 Q0 State of
counter
0 0 0 0
0 0 1 1
0 1 0 2
0 1 1 3
1 0 0 4
1 0 1 5
1 1 0 6
1 1 1 7
Mod 8 Ripple Up Counter
Circuit Diagram:
Mod 8 Ripple Up Counter
Waveforms:
Mod 8 Ripple Down Counter
• Truth Table:
Q2 Q1 Q0 State of
counter
1 1 1 7
1 1 0 6
1 0 1 5
1 0 0 4
0 1 1 3
0 1 0 2
0 0 1 1
0 0 0 0
Mod 8 Ripple Down Counter
Circuit Diagram:
Mod 8 Ripple Down Counter
Waveforms:
4 Bit Up Down Counter
4 bit Controlled Asynchronous Up / Down counter :
• As name indicates an up/ down counter which can count both in upward &
downward direction.
• It is also called as forward/backward counter or bidirectional counter so a
control signal or a mode signal M is required to choose the direction of
counting.
• When M=1 Q0 is transmitted to clock of FF 1 and so on which results in
up counting & when M=0 Q0 is transmitted to clock of FF 1 and so on
which results in down counting.
Mod 5 Ripple Up Counter
BCD Ripple Up Counter
Drawbacks of ripple counter
• The clock ripples through the circuit, like the ripple in water. Therefore
asynchronous counters are known as ripple counters.
• The asynchronous counters are slower than synchronous counters.
• Another drawback of asynchronous counters is that they can generate
straight binary sequences in up or down direction while synchronous
counters can be designed for any count sequence.
• Also we have to use JK or T flip flops only in the design of asynchronous
counters.
Applications of Asynchronous Counters
• Counting device
• Digital clock
• Frequency divider circuits
Counters
• For the design of synchronous counter, first find out the number of flip
flops required.
• Then prepare a table consisting of present state, next state and
determine the flip flop inputs which must be present to obtain the next
state using the excitation table of the flip flop.
• Prepare k-map for each flip flop input and obtain the simplified
expressions from which complete the circuit diagram.
3 Bit Synchronous Counter
Q2 Q1 Q0 Q2 Q2 Q0 J2 K2 J1 K1 J0 K0
0 0 0 0 0 1 0 x 0 X 1 x
0 0 1 0 1 0 0 x 1 X x 1
0 1 0 0 1 1 0 x x 0 1 x
0 1 1 1 0 0 1 x x 1 x 1
1 0 0 1 0 1 x 0 0 X 1 X
1 0 1 1 1 0 x 0 1 X x 1
1 1 0 1 1 1 x 0 x 0 1 X
1 1 1 0 0 0 x 1 x 1 x 1
3 Bit Synchronous Counter
K-Map
Q1Q0 00 01 11 10 Q1Q0 0 01 11 10 Q1Q0 0 01 11 10
0 0
Q2 Q2 Q2
0 0 0 1 0 0 X X X X 0 0 1 X X
1 X X X X 1 0 0 1 0 1 0 1 X X
Q1Q0 0 01 11 10
Q1Q0 0 01 11 10
0 0
Q1Q0 0 01 11 10 Q2
Q2
0 0 X 1 1 X
Q2 0 1 X X 1
1 1 X X 1 1 X 1 1 X
0 X X 1 0
1 X X 1 0
K1= Q0 J0 = 1 K 0= 1
3 Bit Synchronous Counter
Logic Diagram:
3 bit Synchronous down counter:
This is used to count from 7-0 i.e.(111-000).for this also 2 IC’s of
7
State table for synchronous down counter :
Present state Next state Flip flop 3 Flip flop 2 Flip flop 1
Q2 Q1 Q0 Q2 Q1 Q0 J2 K2 J1 K1 J0 K0
1 1 1 1 1 0 X 0 X 0 X 1
1 1 0 1 0 1 X 0 X 1 1 X
1 0 1 1 0 0 X 0 0 X X 1
1 0 0 0 1 1 X 1 1 X 1 X
0 1 1 0 1 0 0 X X 0 X 1
0 1 0 0 0 1 0 X X 1 1 X
0 0 1 0 0 0 0 X 0 X X 1
0 0 0 1 1 1 1 X 1 X 1 X
3 bit Synchronous down counter:
• K-Map :
Q1Q0 0 01 11 10
Q1Q0 0 01 11 10 Q1Q0 0 01 11 10 0
0 Q2
Q2 0
Q2 0 1 0 X X
0 1 0 0 0 0 X X X X 1 1 0 X X
1 X X X X 1 1 0 0 0
• K1= Q0 J0= 1 K 0= 1
3 bit Synchronous down counter:
Logic Diagram :
3 bit Controlled up / down synchronous counter:
• State Table for 3 bit Controlled Up-Down Synchronous
Counter.
Control Present State Next State Input for Flip-flop
input M
Q2 Q1 Q0 Q2 Q1 Q0 J2 K2 J1 K1 J0 K0
0 0 0 0 0 0 1 0 X 0 X 1 X
0 0 0 1 0 1 0 0 X 1 X X 1
0 0 1 0 0 1 1 0 X X 0 1 X
0 0 1 1 1 0 0 1 X X 1 X 1
0 1 0 0 1 0 1 X 0 0 X 1 X
0 1 0 1 1 1 0 X 0 1 X X 1
0 1 1 0 1 1 1 X 0 X 0 1 X
0 1 1 1 0 0 0 X 1 X 1 X 1
1 1 1 1 1 1 0 X 0 1 X 1 X
1 1 1 0 1 0 1 X 0 X 0 X 1
1 1 0 1 1 0 0 X 0 X 1 1 X
1 1 0 0 0 1 1 X 1 0 X X 1
1 0 1 1 0 1 0 0 X 1 X 1 X
1 0 1 0 0 0 1 0 X X 0 X 1
1 0 0 1 0 0 0 0 X X 1 1 X
1 0 0 0 1 1 1 1 X 1 X X 1
3 bit Synchronous down counter:
• K MAPs: 00 01 11 10 0 0 1 1
Q1Q0 Q1Q0 Q1Q0 0 1 1 0
1
00 01 11
MQ2 0 MQ2 MQ2
00 1 X X 1 00 X 1 1 X 00 0 1 X X
01 1 X X 1 01 X 1 1 X 01 0 1 X X
11 1 X X 1 11 X 1 1 X 11 1 X 0 X
10 1 X X 1 10 X 1 1 X 10 1 X 0 X
J0 = 1 K0 = 1 J1 = M Q0 + M Q0
3 bit Synchronous down counter:
Q1Q 0 1
Q1Q 0 1 0 00 11
1 0 Q1Q 0 1
0 00 11
1 0 0 00 11
MQ2 1 0
MQ2
00 0 0 1 0 MQ2
00 X X 1 0 01 X X X X 00 X X X X
01 X X 1 0 11 X X X X 01 0 0 1 0
11 X 0 X 1 10 1 0 0 0 11 1 0 0 0
10 X 0 X 1
10 X X X X
K1 = M Q0 + M Q0 J2 = M Q0 Q1 + M Q0 Q1 KC = M Q0 Q1 + M Q0 Q
3 bit Synchronous down counter:
Logic Diagram:
Advantage of synchronous counter
• Clock impulses are given are same for all the flip flops so it is very easy to
design any circuit.
• Performance of synchronous is much better.
• Circuit is more liable and portable.
• Propagation delay time is reduced.
• Can operate at a much higher frequency than the asynchronous counters
Applications of Synchronous Counters
• Digital clock
• Frequency divider circuits
• Frequency counters
• Used in analog to digital converters
List the Synchronous Counter ICs
• Since the o/p from the divide by 2 section is not internally connected to
the succeeding stages. The device may be operated in various counting
modes. In a BCD counter the CP1 input must be externally connected to
QA o/p. The CP0 i/p receives the incoming count producing a BCD count
sequence. It is also provided with additional gating to provide a divide
by 2 counter and binary counter for which the count cycle length is
divide by 5. The device may be operated in various counting modes.
• There are 2 reset inputs R0(1) and R0(2) both of which need to be
connected to the ‘logic 1’for clearing all flip flops.
Basic internal Structure of IC 7490:
Pin diagram of IC 7490
Function tables of IC 7490
• Function Table of MOD-2 counter:
Input A Output Count
clock
0 0
1 1
QD QC QB QA Count
0 0 0 0 0
0 0 0 1 1
0 0 1 0 2
0 0 1 1 3
0 1 0 0 4
0 1 0 1 5
0 1 1 0 6
0 1 1 1 7
1 0 0 0 8
1 0 0 1 9
Timing diagram of mod10:
CLK
QA
QB
QC
QD
Design of Mod-7 Counter using IC 7490:
0 0 0 0 0
0 0 0 1 1
0 0 1 0 2
0 0 1 1 3
0 1 0 0 4
0 1 0 1 5
0 1 1 0 6
Design of Mod-99 using IC 7490
PL U/D G CLK Dn
Parallel load L X X X L L
L X X X H H
Count up H L 0 ↑ X Count up
Hold(No
H X H X X No change
change)
Pin Diagram :
Function table of IC 74191
Pin details
Clk Pulses QA QB QC QD
0 0 0 0 0
1 0 0 0 1
2 0 0 1 0
3 0 0 1 1
4 0 1 0 0
5 0 1 0 1
6 0 1 1 0
7 1 1 1 1
8 1 0 0 0
9 1 0 0 1
10 1 0 1 0
11 1 0 1 1
12 1 1 0 0
13 1 1 0 1
14 1 1 1 0
15 1 1 1 1
Logic Diagram
no connection
NC
Clock
D3 D2 D1 D0 PL
14 9 10 1 15 11
IC 74191
G RC NC
U/D MAX / MIN NC
UP/Down 5
13 RC
G4
7 6 2 3 12
Q3 Q2 Q1 Q0
TC Outputs
CLK Pulses Q3 Q2 Q1 Q0
0 1 1 1 1
1 1 1 1 0
2 1 1 0 1
3 1 1 0 0
4 1 0 1 1
5 1 0 1 0
6 1 0 0 1
7 0 0 0 0
8 0 1 1 1
9 0 1 1 0
10 0 1 0 1
11 0 1 0 0
12 0 0 1 1
13 0 0 1 0
14 0 0 0 1
15 0 0 0 0
Logic diagram of down counter
no connection
vcc vcc
U/D D3 D2 D1 D0
PL
Clk
Clock IC 74191
G
RC
NC
MAX / MIN NC
G
Q3 Q2 Q1 Q0
TC
Outputs
Steps-
Preset Count
CLOCK D3 D2 D1 D0
TC
U/D 74191
RC
G
PL
Up/down Q3 Q2 Q1 Q0 PL
Q3 Q2 Q1 Q0
Combinational Circuit
Mod 10 counter
Clock pulse
1 0 1 0 1
2 0 1 1 0
3 0 1 1 1
4 1 0 0 0
5 1 0 0 1
6 1 0 1 0
7 1 0 1 1
8 1 1 0 0
9 1 1 0 1
10 1 1 1 1
11 1 1 1 1
Mod 10 Counter
Registers
D Q D Q D Q
Q Q Q
• Basic registers are easy to build. We can store multiple bits just by putting a
bunch of flip-flops together.
• A 4-bit register with its internal implementation is as shown below
– This register uses D flip-flops
– All the flip-flops share a common CLK and CLR signal
142
Shift Registers
Q0-Q3 = 1011
• The current Q3 (0 in this example) will be lost on the next cycle
Q0(t+1) = SI
Q1(t+1) = Q0(t)
Q2(t+1) = Q1(t)
Q3(t+1) = Q2(t)
Serial in/shift right/serial out Serial in/shift left/serial out Parallel in/serial out
Data in
Data in
• Serial transfer
– Information is transferred one bit at a time
– Shifts the bits out of the source register into the destination register
• Parallel transfer:
– All the bits of the register are transferred at the same time
• For example:
– Older printers use parallel data transfer
– USB devices use serial data transfer
Parallel Data Transfer
Parallel data transfer moves data from one register to another at one time
Reg. A Reg. B
clock
1 bit
signal
Reg. A Reg. B
clock
Usual implementation is with a shift register
Serial Data Transfer (Cont.)
Parallel
Transmit
Data
‘n’ bits
load 1 bit signal
(serial data)
L
S Reg. A (P to S) Reg. B (S to P)
‘n’ bits
clock
Parallel
Receive
Data