Java Notes
Java Notes
UNIT – III
Sequential Logic: Latches versus Flip Flops – SR, D, JK, Master Slave Flip Flops – Excitation
table – Conversion of Flip flops – Counters: Asynchronous, synchronous, decade, presettable –
Shift Registers: types, applications – Ring counter – Analysis and design of clocked sequential
circuits – Mealy and Moore models – State machine notations – state reduction techniques.
2 MARKS
1. Why J-K Flip Flop is called Master Flip Flop? (APRIL 2011)
Master-slave flip flop is designed using two separate flip flops. Out of these, one acts as
the master and the other as a slave. The figure of a master-slave J-K flip flop is shown below.
From the above figure you can see that both the J-K flip flops are presented in a series
connection. The output of the master J-K flip flop is fed to the input of the slave J-K flip flop.
The output of the slave J-K flip flop is given as a feedback to the input of the master J-K flip
flop. The clock pulse [Clk] is given to the master J-K flip flop and it is sent through a NOT Gate
and thus inverted before passing it to the slave J-K flip flop.
A register capable of shifting the binary information held in each cell to its
neighboringcell, in a selected direction, is called a shift register. The logical configuration of a
shiftregister consists of a chain of flip‐flops in cascade, with the output of one flip ‐flop
connectedto the input of the next flip‐flop. All flip‐flops receive common clock pulses,which
activate the shift of data from one stage to the next.
4. Define Flip-Flop and write some common types of Flip-Flops. (APRIL/MAY 2012)
What is Flip-Flop? (APRIL 2013 - IT)
The memory elements used in clocked sequential circuits are called flip-flops. These
circuits are binary cells capable of storing one bit of information. Binary information can
enter a flip- flop in a variety of ways a few that gives rise to different types of flip-flops.
D flip flop
T flip flop
JK flip flop
SR flip flop
5. Explain Binary Ripple counters. (APRIL/MAY 2012)
A register that goes through a prescribed sequence of states upon the application of input
pulses is called a counter. The input pulses may be clock pulses, or they may originate from
some external source and may occur at a fixed interval of time or at random. An n ‐bit binary
counter consists of n flip‐flops and can count in binary from 0 through 2n - 1. Counters are
available in two categories: ripple counters and synchronous counters.
7. What is Latches? (APRIL 2013 - IT)
A latch is an electronic logic circuit that has two inputs and one output. One of the inputs
is called the SET input; the other is called the RESET input.
Latch circuits can be either active-high or active- low. The difference is determined by whether
the operation of the latch circuit is triggered by HIGH or LOW signals on the inputs.
`The problem of race around condition can solved by edge triggering flip flop. The term
edge triggering means that the flip- flop changes state either at the positive edge or negative edge
of the clock pulse and it is sensitive to its inputs only at this transition of the clock.
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
The three basic types are introduced here: S-R, J-K and D.
9. What are hazards? (or) Define essential hazard. (NOV 2011) (APRIL/MAY 2014).
Hazards in any system are obviously an un-desirable effect caused by either a deficency in the
system or external.influences. In digital logic hazards are usually refered to in one of three ways:
Static Hazards
Dynamic Hazards
Function Hazards
These logic hazards are all subsets of the same problem: - When changes in the input variables
do not change the output due to some form of delay caused by logic elements (NOT, AND, OR
gates etc), this results in the logic not performing its function properly.
A register is a group of flip‐flops, each one of which shares a common clock and is
capable of storing one bit of information. An n ‐bit register consists of a group of n flip‐flops
capable of storing n bits of binary information. In addition to the flip ‐flops, a register may have
combinational gates that perform certain data‐processing tasks. In its broadest definition, a
register consists of a group of flip‐flops together with gates that affect their operation.
During the design process we usually know the transition from present state to
next state and wish to find the flip flop input conditions that will cause the required transition. A
table which lists the required inputs for a given chance of state is called an excitation table.
Synchronous counter
Asynchronous counter
i) UP counter
ii) DOWN counter
iii) Modulo –N counter
iv) UP/DOWN counter
In an asynchronous counter, the clock pulse is applied to the first flip flops. The
change of state in the output of this flip flop serves as a clock pulse to the next flip flop and so
on. Here all the flip flops do not change state at the same instant and hence speed is less.
11 MARKS
1. Explain in detail about the SR latch/SR Flip. (11) (APR'13 - IT)
An SR latch is shown in figure 13.3. The latch Truth table is shown in the following table.
The two inputs, S and R denote ``set'' and ``reset'' respectively.
The latch has memory, and the present output is dependent on the state of the latch.
Thus the output at instant, denoted by Qn is dependent on output at (n-1)th instant, denoted
by Qn-1.
S R
1 0 1 0
0 1 0 1
1 1 0 0
0 0
Note that in state, Qn both and are 0, which seems absurd. Thus,
conventionally, the state is said to be ``not allowed''.
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
A similar latch, known as latch is constructed using NAND gates (as opposed to
NOR gates for latch). The students should again check that the working of the latch
coheres with that of the truth table.
0 1 1 0
1 0 0 1
0 0 1 1
1 1
To avoid ``race'' between the inputs, to have a control on when the input affects the latch, the
circuit 13.5 is often implemented.
S R Qn+1
0 0 Qn
0 1 1
1 0 0 Fig. SR flip flop
1 1 *
Qn Qn+1 R S
0 0 X 0
0 1 0 1
1 0 1 0
Table(a): RS truth table 1 1 0 X
Table(b): RS Excitation table
The inputs have an effect on the latch only when , otherwise, the previous state is
maintained. The input may be a clock, so that whatever transitions in and take place
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
before the clock changes to do not affect the outputs, and only when the inputs have
become stable is the system affected.
The circuit diagram and truth-table of a J-K flip flop is shown below.
The behavior of inputs J and K is same as the S and R inputs of the S-R flip flop.
The letter J stands for SET and the letter K stands for CLEAR.
When both the inputs J and K have a HIGH state, the flip- flop switch to the complement
state.
So, for a value of Q = 1, it switches to Q=0 and for a value of Q = 0, it switches to Q=1.
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
The circuit includes two 3- input AND gates.
The output Q of the flip flop is returned back as a feedback to the input of the AND along
with other inputs like K and clock pulse [CP].
So, if the value of CP is ’1′, the flip flop gets a CLEAR signal and with the condition that
the value of Q was earlier 1.
Similarly output Q’ of the flip flop is given as a feedback to the input of the AND along
with other inputs like J and clock pulse [CP].
So the output becomes SET when the value of CP is 1 only if the value of Q’ was earlier
1.
The output may be repeated in transitions once they have been complimented for J=K=1
because of the feedback connection in the JK flip-flop.
This can be avoided by setting a time duration lesser than the propagation delay through
the flip-flop.
J K Qn+1 The restriction on the pulse width can be eliminated with a
0 0 Qn
master-slave or edge-triggered construction.
0 1 0
1 0 1
Qn Qn+1 J J
1 1
0 0 0 X
0 1 1 X
1 0 X 1
1 1 X 0
D FLIP FLOP
The circuit diagram and truth table is given below.
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
D flip flop is actually a slight modification of the above explained clocked SR flip-
flop.
From the figure you can see that the D input is connected to the S input and the
complement of the D input is connected to the R input.
The D input is passed on to the flip flop when the value of CP is ’1′.
When CP is HIGH, the flip flop moves to the SET state. If it is ’0′, the flip flop
switches to the CLEAR state.
T FLIP FLOP
This is a much simpler version of the J-K flip flop. Both the J and K inputs are
connected together and thus are also called a single input J-K flip flop.
When clock pulse is given to the flip flop, the output begins to toggle.
Here also the restriction on the pulse width can be eliminated with a master-slave
or edge-triggered construction.
Take a look at the circuit and truth table below.
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
Analysis describes what a given circuit will do under certain operating conditions.
The behavior of a clocked sequential circuit is determined from the inputs, the outputs,
and the state of its flip-flops.
The outputs and the next state are both a function of the inputs and the present state.
The analysis of a sequential circuit consists of obtaining a table or a diagram for the time
sequence of inputs, outputs, and internal states.
It is also possible to write Boolean expressions that describe the behavior of the
sequential circuit. These expressions must include the necessary time sequence, either
directly or indirectly.
A state table and state diagram are then presented to describe the behavior of the
sequential circuit.
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
The procedure for analysis of synchronous sequential circuits can be summarized by a list
of recommended steps:
1. From the given logic diagram, obtain the state equation.
2. From the state equation, generate the state table.
3. Draw the state diagram using state table.
4. The steps presented in this example are summarized below:
State equation
The behavior of a clocked sequential circuit can be described algebraically by means of
state equations.
A state equation (also called a transition equation ) specifies the next state as a function
of the present state and inputs.
State Table
The time sequence of inputs, outputs, and flip- flop states can be enumerated in a state
table (sometimes called a transition table ).
The table consists of four sections labeled present state, input, next state, and output .
The present-state section shows the states of flip- flops A and B at any given time t .
The input section gives a value of x for each possible present state.
The next-state section shows the states of the flip-flops one clock cycle later, at time
t + 1.
The output section gives the value of y at time t for each present state and input condition.
State Diagram
The information available in a state table can be represented graphically in the form of a
state diagram.
In this type of diagram, a state is represented by a circle, and the (clock-triggered)
transitions between states are indicated by directed lines connecting the circles.
The binary number inside each circle identifies the state of the flip- flops.
The directed lines are labeled with two binary numbers separated by a slash.
The input value during the present state is labeled first, and the number after the slash
gives the output during the present state with the given input.
For example, the directed line from state 00 to 01 is labeled 1/0, meaning that when the
sequential circuit is in the present state 00 and the input is1, the output is 0.
After the next clock cycle, the circuit goes to the next state, 01.
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
5. A sequential circuit has two D flip- flop, one inputs x, and one output y. Derive the state
table and state diagram of the sequential circuit.
SOLUTION:
1. State equation
A(t+1)=Ax+Bx
B(t+1)=Ax’
Y=Ax’+Bx’
2. State table
3. State diagram
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
6. Construct a JK flip- flop using a D flip- flop, a 4-to-1-line multiplexer and an inverter.
Solution:
Multiplexer
SET
S1 D D Q
0
1 S4 clk
CLR Q
C1 C2 ENB
J K
7. A sequential circuit has one flip-flop Q, two inputs x and y, and one output S. It consists
of a full-adder circuit connected to a D flip-flop, as shown. Derive the state table and
state diagram of the sequential circuit.
X S
Y
C
FA
SET
Q
Q
SET
DD
Q
Q CLR
CLR
CLK
Solution:
1. FA equations: S X Y Q
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
C = XY + XQ + YQ
2. Input equation:
DQ = C
= XY + XQ + YQ (from the FA equations or from the K- map)
3. Characteristic equation:
Q(t+1) = D = XY + XQ + YQ
4. State equation:
Q(t+1) = C
5. State Table:
PRESENT NEXT
STATE INPUTS STATE OUTPUT
Q X Y Q S
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
State Diagram:
10/1
00/0 01/0
01/1 10/0
11/1
11/0
0 1
00/1
8. A sequential circuit has two JK flip-flops A and B and one input x. The circuit is
described by the following flip- flop input equations :
JA = x KA = B'
JB = x KB = A
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
(a) Derive the state equation A(t+1) and B(t+1) by substituting the input equations for the
J and K variables.
(b) Draw the state diagram of the circuit.
Solution:
1. State equation:
Q(t+1) = JQ' + K'Q
2. Characteristic equation:
A (t+1) = XA' + BA
B (t+1) = XB' + A'B
3. State Table:
PRESENT
STATE INPUT NEXT STATE FLIP-FLOP INPUTS
A B X A B JA KA JB KB
0 0 0 0 0 0 1 0 0
0 0 1 1 1 1 1 1 0
0 1 0 0 1 0 0 0 0
0 1 1 1 1 1 0 1 0
1 0 0 0 0 0 1 0 1
1 0 1 0 1 1 1 1 1
1 1 0 1 0 0 0 0 1
1 1 1 1 0 1 0 1 1
4. State Diagram:
0
1
00 11
0, 1
1 0
01 10
1
Solution:
States b,e are the same ,we will replace state e with state b .
States d,h are the same ,we will replace state h with state d .
11. Starting from state a, and the input sequence 01110010011,determine the output
sequence for:
(a) the state table of the previous problem and
(b) the reduced state table from the previous problem. Show that the same output sequence
is obtained for both.
Solution:
(a) using the state table
state a f b c e d g h g g h a
input 0 1 1 1 0 0 1 0 0 1 1
output 0 1 0 0 0 1 1 1 0 1 0
(b) Using the reduced state table
state a f b a b d g d g g d a
input 0 1 1 1 0 0 1 0 0 1 1
output 0 1 0 0 0 1 1 1 0 1 0
The same output sequence is obtained for both.
12. Design a sequential circuit with two D flip- flops A and B, and one input x. When x=0,
the state of the circuit remains the same. When x=1, the circuit goes through the state
transitions from 00 to 01 to 11 to 10 back to 00, and repeats.
Solution:
1. State Diagram: 0 0
1
00 01
1 1
11 10
1
0
0
2. State Table:
PRESENT
STATE INPUT NEXT STATE
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
A B X A B
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 1
1 0 0 1 0
1 0 1 0 0
1 1 0 1 1
1 1 1 1 0
3. Characteristic equation:
Q(t+1) = D
K-maps :
DA BX
BX
A 00
00 01
01 11
11 10
10
0 1
DA = BX + AX'
1 1 1 1
DB
BX
A 0 1 11 10
0 1 1 1
1 1
DB = A'X + BX'
Circuit Diagram :
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
SET
D Q A
CLR Q
SET B
D Q
CLR Q
CLK
13. Design a sequential circuit with two JK flip-flops A and B and two inputs E and x.
If E =0 ,the circuit remains in the same state regardless of the value of x. When E =1 and
x=1, the circuit goes through the state transitions from 00 to 01 to 10 to 11 back to 00,and
repeats. When E =1 and x=0, the circuit goes through the state transitions from 00 to 11 to
10 to 01 back to 00,and repeats.
Solution:
00,01 00,01
1. State Diagram:
11
00 01
10
11 10
10 11
10
11 10
11
00,01
00,01
2. State Table:
PRESENT
STATE INPUT NEXT STATE FLIP-FLOP INPUTS
A B E X A B JA KA JB KB
0 0 0 0 0 0 0 X 0 X
0 0 0 1 0 0 0 X 0 X
0 0 1 0 1 1 1 X 1 X
0 0 1 1 0 1 0 X 1 X
0 1 0 0 0 1 0 X X 0
0 1 0 1 0 1 0 X X 0
0 1 1 0 0 0 0 X X 1
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
0 1 1 1 1 0 1 X X 1
1 0 0 0 1 0 X 0 0 X
1 0 0 1 1 0 X 0 0 X
1 0 1 0 0 1 X 1 1 X
1 0 1 1 1 1 X 0 1 X
1 1 0 0 1 1 X 0 X 0
1 1 0 1 1 1 X 0 X 0
1 1 1 0 1 0 X 0 X 1
1 1 1 1 0 0 X 1 X 1
K-maps : EX
JA AB 00 01 11 10
0 0 0 0 1
KA
EX
EX
AB
AB 0 1 11
11 10
10
0
0 X X X X
1
1 X X X X
11
11 0 0 1 0
10
10 0 K0A = B EX +0B'EX' = E1(B X)'
EX
JB
AB 0 1 11 10
0 0 0 1 1
1 X X X X
11
11 X X X X
10
10 0 0 1 1
JB = E
KB EX
AB
AB 0 1 11 10
0
0 X X X X
11 0 0 1
OLLEGE O 1
1
10 X X X X
F
C11SE
10
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
KB = E
Circuit Diagram :
A
B SET
J Q A
E
K CLR Q
SET B
J Q
K CLR Q
CLK
This sequential circuit behaves like a 2-bit up-down-counter, with E the enable of the whole
counter, and resets when it finishes counting, when X=1, it behaves like an up-counter, when
X=0, it behaves like a down-counter
A decimal counter follows a sequence of ten states and returns to 0 after the count of 9.
Such a counter must have at least four flip- flops to represent each decimal digit, since a decimal
digit is represented by a binary code with at least four bits. The sequence of states in a decimal
counter is dictated by the binary code used to represent a decimal digit. If BCD is used, the
sequence of states is as shown in the state diagram of Fig. 2.
Signals that affect the flip-flop transition depend on the order in which they change from
1 to 0. Theoperation of the counter can be explained by a list of conditions for flip- flop
transitions. These conditions are derived from the logic diagram and from knowledge of how a
JK flip-flop operates. Remember that when the CP input goes from I to 0, the flip-flop is set if J
= I, is cleared if K = I, is complemented if J = K = I, and is left unchanged if J = K = 0. The
following are the conditions for each flip- flop state transition:
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
1. Q1is complemented on the negative edge of every count pulse.
2, Q2is complemented if Q8= 0 and Q1goes from I to o. Q2is cleared if Q8 =and Q1
goes from 1 to 0.
3. Q4is complemented when Q2goes from I to o.
4. Q8is complemented when Q4 Q2 = 11 and Q, goes from I to o. Q8 is cleared ifeither
Q4 or Q2is 0 and Q1goes from 1 to 0.
Figure.1:BCD counter
Ring counter
A ring counter is a circular shift register with only one flip- flop being set at any
particular time; all others arecleared. The single bit is shifted from one flip- flop to the other to
produce the sequence of timing signals. The below figure shows a 4-bit shift register connected
as a ring counter. The initial value of the register is 1000, which produces the variable T0. The
single bit is shifted right with every clock pulse and circulates back from T3to T0.
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
Johnson counter
A k-bit ring counter circulates a single bit among the flip-flops to provide k
distinguishablestates.
The number of states can be doubled if the shift register is connected as a switch-tail ring
counter.
A switch-tail ring counter is a circular shift register with the complement output of the
last flip- flop connected to the input of the first flip- flop.
In general, a k-bit switch-tail ring counter will go through a sequence of 2k states.
Starting from all 0's, each shift operation inserts 1's from the le ft until the register is filled
with all 1's.
In the following sequences, 0's are inserted from the left until the register is again filled
with all 0's.
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
18. What is register? Explain the types of shift register.
Register
Register is a group of flip flops for storing binary information.
Shift register
A register capable of shifting its binary information either to the right or to the left is
called a shift register.
The serial transfer of information from register A to register B is done with shift registers,
as shown in the block diagram of Figure.
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
State equation
CS T34-DIGITAL SYSTEM DESIGN Y2/S3
20. Explain in detail Mealy and Moore Models of Finite State Machines.
In a Moore model, the outputs of the sequential circuit are synchronized with the clock,
because they depend only on flip-flop outputs that are synchronized with the clock.
In a Mealy model, the outputs may change if the inputs change during the clock cycle.
Moreover, the outputs may have momentary false values because of the delay
encountered from the time that the inputs change and the time that the flip-flop outputs
change.
In order to synchronize a Mealy- type circuit, the inputs of the sequential circuit must be
synchronized with the clock and the outputs must be sampled immediately before the
clock edge. The inputs are changed at the inactive edge of the clock to ensure that the
inputs to the flip- flops stabilize before the active edge of the clock occurs.
Thus, the output of the Mealy machine is the value that is present immediately
before the active edge of the clock.