Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

Analyzing Sequential Circuit

with JK Flip Flop

SLIDES WERE ADOPTED AND MODIFIED, WITH MANY THANKS, FROM PREVIOUS VERSIONS
BELONG TO:
PROF. IBRAHIM KAMEL
PROF. AHMAD ALMULHEM, KFUPM

Sequential circuit analysis 1


Example: Analyzing Sequential Circuit with JK FF
• Here is a sequential circuit with two JK flip-flops. There is one
input, X, and one output, Z.
• The values of the flip-flops (Q1Q0) form the state, or the
memory, of the circuit.
• The flip-flop outputs also go back into the primitive gates on the
left. This fits the general sequential circuit diagram at the
bottom.

2
J-K Flip-flop

 J-K flip-flop. J Q
CLK
C
K Q'
 Characteristic table.
Q J K Q(t+1)
J K Q(t+1) Comments 0 0 0 0
0 0 Q(t) No change 0 0 1 0
0 1 0 Reset 0 1 0 1
1 0 1 Set 0 1 1 1
1 1 Q(t)' Toggle 1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 0
 Characteristic table.
Q(t+1) = J.Q' + K'.Q
J-K Flip-flop 3
Creating state table
• A basic state table for our example circuit
is shown below.
• Remember that there is one input X, one
output Z, and two flip-flops Q1Q0.
• The present state Q1Q0 and the input will
determine the next state and the output.

Present State Input Next State output


Q1 Q0 x Q1 Q0 z
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
4
The outputs are easy
• The output depends on the current state –
Q0 and Q1 – as well as the inputs.
• From the diagram, you can see that

Z = Q1Q0X

Output at the current time

Present State Input Next State output

Q1 Q0 x Q1 Q0 z
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
5
Flip-flop input equations
• Finding the next states is harder. To do this, we have to figure out how
the flip-flops are changing.
Step 1:
Find Boolean expressions for the flip-flop inputs.
i.e. How do the inputs (say, J & K) to the flipflops
depend on the current state and input
Step 2:
Use these expressions to find the actual flip-flop input values for
each possible combination of present states and inputs.
i.e. Fill in the state table (OR with new intermediate columns)
Step 3:
Use flip-flop characteristic tables or equations to find the next
states, based on the flip-flop input values and the present states.

6
Step 1: Flip-flop input equations
• For our example, the flip-flop
input equations are:

J0 = X + Q 1
K0 = X’

J1 = X’ Q0
K1 = X + Q 0

• Each JK flip-flops have two


inputs, J and K. (D and T flip-
flops have one input each.)

7
Step 2: Flip-flop input values
• With these equations, we can make a table showing J1, K1, J0 and K0 for
the different combinations of present state Q1Q0 and input X.

J1 = X’ Q0 J0 = X + Q 1
K1 = X + Q 0 K0 = X’

Present State Input Flip Flops Inputs Next State output


Q1 Q0 x J1 K1 J0 K0 Q1 Q0 z
0 0 0 0 0 0 1 0
0 0 1 0 1 1 0 0
0 1 0 1 1 0 1 0
0 1 1 0 1 1 0 0
1 0 0 0 0 1 1 0
1 0 1 0 1 1 0 0
1 1 0 1 1 1 1 0
1 1 1 0 1 1 0 1

8
Step 3: Find the next states
• Finally, use the JK flip-flop characteristic tables or equations to find
the next state of each flip-flop, based on its present state and inputs.
• The general JK flip-flop characteristic equation is:

Q(t+1) = K’Q(t) + JQ’(t)

• In our example circuit, we have two JK flip-flops, so we have to apply


this equation to each of them:

Q1(t+1) = K1’Q1(t) + J1Q1’(t)


Q0(t+1) = K0’Q0(t) + J0Q0’(t)

• We can also determine the next state for


each input/current state combination J K Q(t+1) Operation
directly from the characteristic table. 0 0 Q(t) No change
0 1 0 Reset
1 0 1 Set
1 1 Q’(t) Complement

9
Step 3 Concluded
• Finally, here are the next states for Q1 and Q0, using these equations:

Q1(t+1) = K1’Q1(t) + J1Q1’(t)


Q0(t+1) = K0’Q0(t) + J0Q0’(t)

Present State Input Flip Flops Inputs Next State output


Q1 Q0 x J1 K1 J0 K0 Q1 Q0 z
0 0 0 0 0 0 1 0 0 0
0 0 1 0 1 1 0 0 1 0
0 1 0 1 1 0 1 1 0 0
0 1 1 0 1 1 0 0 1 0
1 0 0 0 0 1 1 1 1 0
1 0 1 0 1 1 0 0 1 0
1 1 0 1 1 1 1 0 0 0
1 1 1 0 1 1 0 0 1 1

10
Getting the state table columns straight
• The table starts with Present State and Inputs.
– Present State and Inputs yield FF Inputs.
– Present State and FF Inputs yield Next State, based on the flip-
flop characteristic tables.
– Present State and Inputs yield Output.
• We really only care about FF Inputs in order to find Next State.
• Note: the outputs occur this cycle and the next state in the next cycle

Present State Input Flip Flops Inputs Next State output


Q1 Q0 x J1 K1 J0 K0 Q1 Q0 z
0 0 0 0 0 0 1 0 0 0
0 0 1 0 1 1 0 0 1 0
0 1 0 1 1 0 1 1 0 0
0 1 1 0 1 1 0 0 1 0
1 0 0 0 0 1 1 1 1 0
1 0 1 0 1 1 0 0 1 0
1 1 0 1 1 1 1 0 0 0
1 1 1 0 1 1 0 0 1 1
11
State diagrams
• We can also represent the state table graphically with a state diagram.
• A diagram corresponding to our example state table is shown below.

input output
Present State Input Next State output
0/0 1/0
Q1 Q0 x Q1 Q0 z
0 0 0 0 0 0
1/0
0 0 1 0 1 0 00 01
0 1 0 1 0 0
0 1 1 0 1 0 1/1
0/0 1/0 0/0
1 0 0 1 1 0
1 0 1 0 1 0
1 1 0 0 0 0 0/0
11 10
1 1 1 0 1 1
state
12
Analysis: Example #2
 Given a sequential circuit with two JK flip-flops A and B, and one
input x.

J Q A

x K Q'

J Q B

K Q'

CP

•Obtain the flip-flop input functions from the circuit:

– JA = B JB = x'
– KA = B.x' KB = A'.x + A.x' = A  x

13
Analysis: Example #2
 Flip-flop input functions:
– JA = B JB = x'
0 1
– KA = B.x’ KB = A'.x + A.x' = A  x
0 0
1 1
J K Q(t+1) Comments 1 0
1 1
0 0 Q(t) No change
1 0
0 1 0 Reset
0 0
1 0 1 Set
1 1
1 1 Q(t)' Toggle

Q(t+1) = J.Q' + K'.Q Present Next


state Input state Flip-flop inputs
A B x A B JA KA JB KB
0 0 0 0 1 0 0 1 0
0 0 1 0 0 0 0 0 1
0 1 0 1 1 1 1 1 0
0 1 1 1 0 1 0 0 1
1 0 0 1 1 0 0 1 1
1 0 1 1 0 0 0 0 0
1 1 0 0 0 1 1 1 1
1 1 1 1 1 1 0 0 0
Analysis: Example #2

 Draw the state diagram from the state table.

Present Next
state Input state Flip-flop inputs
A B x A B JA KA JB KB 1 1
0 0 0 0 1 0 0 1 0
0 0 1 0 0 0 0 0 1
0 1 0 1 1 1 1 1 0 0 11
0 1 1 1 0 1 0 0 1 00
1 0 0 1 1 0 0 1 1
1 0 1 1 0 0 0 0 0
1 1 0 0 0 1 1 1 1
1 1 1 1 1 1 0 0 0 0 0 0

1 10
01
1

15
Analysis: Example #3

 Derive the state table and state diagram of the following circuit.

J Q A J Q B

K Q' K Q'

CP
y
x

 Flip-flop input functions:


– JA = B JB = KB = (A  x)' = A.x + A'.x'
– KA = B'
y=ABx
16
Analysis: Example #3

 Flip-flop input functions:


JA = B JB = KB = (A  x)' = A.x + A'.x'
KA = B'
 State table: Q(t+1) = J.Q' + K'.Q
y=ABx
Present Next
state Input state Output Flip-flop inputs
A B x A B y JA KA JB KB
0 0 0 0 1 0 0 1 1 1
0 0 1 0 0 1 0 1 0 0
0 1 0 1 0 1 1 0 1 1
0 1 1 1 1 0 1 0 0 0
1 0 0 0 0 1 0 1 0 0
1 0 1 0 1 0 0 1 1 1
1 1 0 1 1 0 1 0 0 0
1 1 1 1 0 1 1 0 1 1
17
Analysis: Example #3

 State diagram:
Present Next
state Input state Output Flip-flop inputs
A B x A B y JA KA JB KB
0 0 0 0 1 0 0 1 1 1 1/1
0 0 1 0 0 1 0 1 0 0
0 1 0 1 0 1 1 0 1 1
0 1 1 1 1 0 1 0 0 0 0/1
1 0 0 0 0 1 0 1 0 0 00 10
1 0 1 0 1 0 0 1 1 1
1 1 0 1 1 0 1 0 0 0
1 1 1 1 0 1 1 0 1 1
0/0 0/1
1/1
1/0

1/0 11
01

0/0
18
Analyzing Sequential Circuit with

T Flip Flop

BASED ON SLIDES FROM UNIVERSITY OF ILLINOIS BY HOWARD HUANG

Sequential circuit analysis 19


Example: Analyzing Sequential Circuit with T FF

• Analyze this circuit?


• Is this a sequential
circuit? Why?
• How many inputs?
• How many outputs?
• How many states?
• What type of memory?
Characteristic Equation for the T Flip-flop
 T flip-flop: single-input version of the J-K flip flop,
formed by tying both inputs together.
 Characteristic table.
T CLK Q(t+1) Comments T J Q
0  Q(t) No change
CLK C
1  Q(t)' Toggle K
Q'

Q T Q(t+1)
 Characteristic table. 0 0 0
0 1 1
1 0 1
Q(t+1) = T.Q' + T'.Q 1 1 0

T Flip-flop 21
Example: Analyzing Sequential Circuit with T FF
(cont.)

Start with filling the present states and the input:

Present State Input Next State Output


A B x A B y
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

22
Example: Analyzing Sequential Circuit with T FF
(cont.)

From the Diagram: Y = AB

Present State Input Next State Output


A B x A B y
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1

23
Example: Analyzing Sequential Circuit with T FF
(cont.)

T Flip Flop (review):


Characteristic Tables:

T Q(t+1)
0 Q(t)
1 Q’(t)

Characteristic Equation:

Q(t+1) = TQ’ + T’Q


Example: Analyzing Sequential Circuit with T FF
(cont.)

State equations:
TA = BX
TB = X
by substitution:
A(t+1) = TAA’ + TA’A
B(t+1) = TBB’ + TB’B
Example: Analyzing Sequential Circuit with T FF
(cont.)

Fill in the FF inputs from the state equations:

Present State Input Flip Flop Inputs Next State Output


State equations:
TA = BX A B x TA TB A B y
TB = X 0 0 0 0 0 0
by substitution: 0 0 1 0 1 0
A(t+1) = TAA’ + TA’A 0 1 0 0 0 0
B(t+1) = TBB’ + TB’B 0 1 1 1 1 0
1 0 0 0 0 0
1 0 1 0 1 0
1 1 0 0 0 1
1 1 1 1 1 1

26
Example: Analyzing Sequential Circuit with T FF
(cont.)

From the characteristic equation of the T FF: Q(t+1) = TQ’ + T’Q,


We fill the next state

Present State Input Flip Flop Inputs Next State Output

A B x TA TB A B y
0 0 0 0 0 0 0 0
0 0 1 0 1 0 1 0
0 1 0 0 0 0 1 0
0 1 1 1 1 1 0 0
1 0 0 0 0 1 0 0
1 0 1 0 1 1 1 0
1 1 0 0 0 1 1 1
1 1 1 1 1 0 0 1

27
Example: Analyzing Sequential Circuit with T FF
(cont.)

Present Out
Input Next State
State put
A B x A B y
0 0 0 0 0 0
0 0 1 0 1 0
0 1 0 0 1 0
0 1 1 1 0 0
1 0 0 1 0 0
1 0 1 1 1 0
1 1 0 1 1 1
1 1 1 0 0 1

You might also like