You are on page 1of 21

ITBP205

Digital Design and Computer


Organization
Unit 9
Sequential Circuits Design
Prof. Walid Ibrahim

Outline
Design Steps

Sequence Detectors

Arbitrary Counters
2

Generic Design Procedure


If the number of states and the transitions
between them can be extracted from the problem
description (e.g., counters), use the problem
description to generate the state table directly.
Otherwise, convert the problem description to
state diagram first.

From the state diagram, count the number of


states, and decide on the number of FFs (N)
needed.
2N-1 < number
of states 2N
Based on the number and the types of FFs to be
used (JK, D, or T), calculate the number of rows
and columns of the state table
.
3

Generic Design Procedure,


cont.
Assign a binary code to each state

Draw the state table and use the information


in the state diagram to complete the
Current
following
columns
Input
Next state
Output
state
For each FF and each row of the state table, use
the FF excitation table to find the FF input values
that are needed to generate the next state from
the current state.
Use K-Map to simplify the equations for the FF
inputs and the circuit outputs as a function of the
current state and inputs.
Draw the circuit
4

Sequence Detectors
A sequence Detector is a special kind of sequential
circuit that looks for a special bit pattern in some
input.
The circuit has only one input: X and one output: Z,
which is 1 when the desired pattern is detected.
For example the input and output for a circuit that
detects the bit pattern 1001 looks like
X: 11100110100100110
Z: 00000100000100100
Here, one input and one output bit appear every clock
cycle.
This requires a sequential circuit because the circuit
has to remember the inputs from previous clock
cycles
5

Example
Design a circuit that detects the sequence
011010 using D, T, and JK FFs.

Since the number of states, and the


transition between them are not clear,
we should start by converting the
problem to a sequence diagram.

Step 1: Mealy Sequence


Diagram
The number of state in the mealy state diagram =
sequence length.
In this example (011010) we need the following 6
states
A: Empty , B: 0, C: 01, D: 011,

E: 0110,

F: 01101

0/1
1/0
1/0

0/0
1/0

0/0
A

0/0

1/0

1/0

0/0

1/0

0/0
E
0
1

0
00
01

01
010
011

011
0110
0111

0110
01100
01101
7

01101
011010
011
011

Step 2: Number of FFs

Number of stats = 6
2N-1 < 6 2N N = 3
Number of Rows = 23+1 = 16
Number of Columns:
1 (input) +
1 (output)+
3 (current state) +
3 (current state) +
1 (D)
1 (T)
+ 2 (J , K) = 12
8

0/0
1/0
1/0

0/0
1/1

0/0
A

0/0

1/0

1/0

0/0

0/0

Current State
Input
Next State
Output
A
0
B
0
A
1
A
0
B
0
B
0
B
1
C
0
C
0
B
0
C
1
D
0
D
0
E
0
D
1
A
0
E
0
B
0
E
1
F
0
F
0
B
1
F
1
D
0
9

1/0

Step 3: Assign a Code for


each State

A 000
D 011

B 001
E 100

Current StateInput
Next
A
0
A
1
B
0
B
1
C
0
C
1
D
0
D
1
E
0
E
1
F
0
F
1

State
Output
B
0
A
0
B
0
C
0
B
0
D
0
E
0
A
0
B
0
F
0
B
1
D
0

C 010
F 101

Current State
InputNext StateOutput
Q2 Q1 Q0 X Q2*Q1*Q0* Z
0
0
0
0
0
0 0 1
0
0
0
0
1
0 0 0
0
0
0
1
0
0 0 1
0
0
0
1
1
0 1 0
0
0
1
0
0
0 0 1
0
0
1
0
1
0 1 1
0
0
1
1
0
1 0 0
0
0
1
1
1
0 0 0
0
1
0
0
0
0 0 1
0
1
0
0
1
1 0 1
1
1
0
1
0
0 0 1
0
1
0
1
1
0 1 1
10

Step 4: Find the FFs inputs


Current State
InputNext StateFlip
Q2 Q1 Q0 X Q2*Q1*Q0* D2
0 0 0
0
0 0 1
0 0 0
1
0 0 0
0 0 1
0
0 0 1
0 0 1
1
0 1 0
0 1 0
0
0 0 1
0 1 0
1
0 1 1
0 1 1
0
1 0 0
0 1 1
1
0 0 0
1 0 0
0
0 0 1
1 0 0
1
1 0 1
1 0 1
0
0 0 1
1 0 1
1
0 1 1
1 1 0
0
X X X X
1 1 0
1
X X X X
1 1 1
0
X X X X
1 1 1
1
X X X X

Flop inputs
Output
T1 J0 K0
Z
0 1 X
0
0 0 X
0
0 X 0
0
1 X 1
0
1 1 X
0
0 1 X
0
1 X 1
0
1 X 1
0
0 1 X
0
0 1 X
0
0 X 0
1
1 X 0
0
X X X
X
X X X
X
X X X
X
X X X
X
11

Step 5: Find output and FF inputs


equations
T1

D2

Q0X

Q0X

0
0

0
1

1
1

0
0

1
0

0
0

0
Q2Q 1

J0

1
1

1
0

0
0

0
Q2Q 1

1
1

0
1

1
X

1
0

1
0

1
1

1
1

1
K0
0

1
0

0
Q2Q 1

0
Q2Q 1

1
1

1
1

0
0

1
Q0X
0
0

0
1

1
1

0
0

Q0X
0
0

0
1

1
Q0X
0
0

0
1

0
0

0
Q2Q 1

1
0

1
1

1
0

Step 6: Draw the Circuit


Q2Q0'X
Q1Q0X'

D2

SET

CLR

Q1X'
Q0X

T1
D

SET

Q2
Q2
Q1

X
CLR

Q2
Q1
X'

J0

Q1
Q2X

SET

Q1
Q0

K0 CLR Q0
CLK

13

Moore Sequence Diagram


The number of state in the state diagram of moore
sequence detectors = sequence length + 1.
In this example (011010), 7 states are needed
A: Empty , B: 0, C: 01, D: 011,

E: 0110,

F: 01101, G: 011010

14

Exercise

Use JK, D, and T Flip Flops to


design a sequential circuit that
detects the sequence 110011.
The circuit has one input X, and
one output Z. The output should
be one when the sequence is
detected, otherwise the output
should be zero.

15

Design of Arbitrary
Counters

The number of FFs required to


design a counter is the same as
the number of bits.

For example: A 3-bit counter needs


three FFs.
Counters do not have output
signal, the output is the display of
the current state.
Since the states and the
transitions between them are
already known, there is no need to
draw the state diagram.
16

Count up and down


Use D FFs to design a three bit counter
that has one input X. The counter count
upward (000 111) if X = 1, and counts
downward (111 000) if X = 0.
Number of FFs: 3
Number of states: 23 = 8
Number of Rows in the State Table :
23+1 = 16

Number of Columns in the State Table


:
1 (input) + 3 (current state) + 3 (next state) + 3
(FFs inputs) = 10
17

State Table
Current State
InputNext State
Flip Flop inputs
Q2 Q1 Q0 X Q2*Q1*Q0* D2 D1 D0
0 0 0
0
1 1 1
0 0 0
1
0 0 1
0 0 1
0
0 0 0
0 0 1
1
0 1 0
0 1 0
0
0 0 1
0 1 0
1
0 1 1
0 1 1
0
0 1 0
0 1 1
1
1 0 0
1 0 0
0
0 1 1
1 0 0
1
1 0 1
1 0 1
0
1 0 0
1 0 1
1
1 1 0
1 1 0
0
1 0 1
1 1 0
1
1 1 1
1 1 1
0
1 1 0
1 1 1
1
0 0 0
18

FF inputs
D2
0
0
0
0

0
1

1
1
1
0

1
1

0
0
0
0

1
1

Q0X

1
0

0
Q2Q 1

D1

Q0X

1
1

1
1

0
1

0
0

0
Q2Q 1

1
1

1
0

1
1

1
1

1
0

Q0X
0
0

1
1

0
Q2Q 1
1

D
0

0
1

1
0

19

Exercises
Use D, T, and JK FFs to design a three bit
counter that has one input X. The
counter count odd (1, 3, 5, 7) if X = 1,
and counts even (0, 2, 4, 6) if X = 0. If
the X = 0 and the current number is odd,
the counter will go to the next even
number. likewise, if X = 1 and the current
number of even the counter goes to the
next odd number.
Design a 4 bit counters that goes through
the following sequence: 0, 3, 5 , 2, 6, 1,
4, 8, 12, 11, 13, 7, 10, 14, 15, 9, 0.

20

Exercise
Design a digital circuit that has one
output signal Z. The signal Z
controls the dispense of soft drinks
in a vending machine. The machine
accepts three types of coins: 25 fils,
50 fils, and 1 AED. The output signal
Z should be one if the value of the
coins the customer enters is 1.5 AED
or more.

21

You might also like