You are on page 1of 28

Switching Circuits & Logic Design

Analysis of Clocked Sequential Circuits


Professor Chien-Mo James Li
Graduate Institute of Electronics Engineering
National Taiwan University
Logic Design

NTUEE C.M. Li

Review
1. what are D-FF, T-FF, JK-FF?
2. please fill in the truth table

Q Q+ | D
Q Q+ | J K

3. draw the state table of a simple counter

Design using D-FF


Design using JK-FF

Logic Design

NTUEE C.M. Li

Flow of Design a Sequential Ckt.


specification
Ch 14
State graph
State Table
Ch 12

Ch 13

K-map
FF, Comb Logic
NTUEE C.M. Li

Logic Design

Objective of this Chapter


Analyze sequential circuits

Logic Design

NTUEE C.M. Li

Outline

A Sequential Parity Checker.


Analysis by Signal Tracing and Timing Charts.
State Tables and Graphs.
General Models for Sequential Circuits.

Logic Design

NTUEE C.M. Li

Parity
What is parity?

Total number of 1s in a sequence


Odd parity
Even parity
Example
Odd parity of 8 bits

Why parity?

Used for error checking in communication

Logic Design

NTUEE C.M. Li

Block diagram of Parity Checker


Sequential parity checker

Z=1 when total number of 1 input received is odd

Fig. 13-1
Logic Design

NTUEE C.M. Li

Waveforms
Assume: Negative edge triggered

Fig. 13-2

Logic Design

NTUEE C.M. Li

State Graph
S0 = total number of 1 inputs received is even
S1 = total number of 1 inputs received is odd
More details later

Fig. 13-3

Logic Design

NTUEE C.M. Li

State Table
Table 13-1

Design using TFF

Present
State

Next state

Present
Output (Z)

X=0

X=1

S0

S0

S1

S1

S1

S0

Tab. 13-3 (a)


Q+

X=0

X=1

X=0

X=1

Tab. 13-3 (b)

Fig. 13-4
Logic Design

NTUEE C.M. Li

10

Outline

A Sequential Parity Checker.


Analysis by Signal Tracing and Timing Charts.
State Tables and Graphs.
General Models for Sequential Circuits.

NTUEE C.M. Li

Logic Design

11

Signal Tracing
What is signal tracing?

Given a circuit, Given a sequence of inputs


Find
Circuit states
Circuit output sequences

How?

1. Assume initial state of FF


2. For first input, determine circuit output(s) and FF inputs
3. Determine new state of FF after the next active clock edge
See next slide
4. Repeat 2 ~ 4 for each input

Logic Design

NTUEE C.M. Li

12

Moore vs. Mealy Sequential Circuit


Moore circuits (or Moore machines)

Output depends only on present state

Mealy circuits (or Mealy machines)

Output depends on BOTH present state and input

Logic Design

NTUEE C.M. Li

13

Edward F. Moore (1925-2003, USA)


Edward F. Moore was a professor of mathematics and computer

sciences at the University of Wisconsin-Madison from 1966 until he


retired in 1985.
He was a pioneer of Automata theory and introduced what are now
know as Moore machines, named after him. He also invented a well
known algorithm for finding the minimum state equivalent Finite
Automaton.
His Gedanken (thought) paper , which appeared in the Annals of
Mathematics in 1956 together with his work on switching theory and
logic, initiated a vigorous research area. He proposed an elegant
form of a universal Turing machine at a time when few people had a
good grasp of the meaning of Turing machines as models of
computers.
Animals and plants can reproduce themselves, but it was only recently shown
that machines can be made which also reproduce themselves. Other kinds
of self-reproducing machines will be described, and one simple mechanical
model, with no electrical or magnetic complications, will be there in working
order for the audience to inspect and operate.
14

Logic Design

NTUEE C.M. Li

Example Moore Circuit


Output depends only on present state
Fig 13-5

NTUEE C.M. Li

Logic Design

15

Timing Chart

Fig. 13-6
Logic Design

NTUEE C.M. Li

16

G. H. Mealy (?, USA)


G. H. Mealy, a state machine pioneer, who wrote A Method for
Synthesizing Sequential Circuits, Bell System Tech. J. vol 34, pp.
10451079, September 1955.

Mealy machines provide a rudimentary mathematical model for


cipher machines. Considering the input and output alphabet the
Latin alphabet, for example, then a mealy machine can be designed
that given a string of letters (a sequence of inputs), it can process it
into a ciphered string (a sequence of outputs). However, although
you could probably use a Mealy model to describe Enigma, the state
diagram would be too complex to provide feasible means of
designing complex ciphering machines.

Logic Design

NTUEE C.M. Li

17

Example Mealy Circuit


Output depends on BOTH present state and input

Fig. 13-7

Logic Design

NTUEE C.M. Li

18

Timing Chart

Fig. 13-8
NTUEE C.M. Li

Logic Design

19

False Output
What is false output?

After changes state and


before inputs change
The output may temporarily assume as incorrect value
Why?
Old input + new state
Produce false output
Also known as (AKA)
Glitches or spikes
Only Mealy circuits have false outputs
Output of Mealy machine is trustable only immediately before
active clock edge
Q: why Moore machine has no false output?

Logic Design

NTUEE C.M. Li

20

False Output (2)


False output in parenthesis

X=1

A=0 0
B=0 1
Z=1 (0) 1

Logic Design

0
1
1
1
0 (1) 0

1
1
1

NTUEE C.M. Li

0
0

21

FFT
Q: Since Mealy circuits have false outputs, why do we need Mealy?

Logic Design

NTUEE C.M. Li

22

Outline

A Sequential Parity Checker.


Analysis by Signal Tracing and Timing Charts.
State Tables and Graphs.
General Models for Sequential Circuits.

NTUEE C.M. Li

Logic Design

23

State Table and State Graph


Signal tracing is too slow

Need systematic way to analyze sequential circuits

State table

The table that describe the relationship of the present state and
next state
Of course the output can also be described
Aka transition table

State Graph

The graph that describe the relationship of the present state and
next state

Logic Design

NTUEE C.M. Li

24

Steps to Analyze Circuits


1. initial state

Input equations, output equations

2 next-state equation
3. next-state map
4. state table
5. state graph

Logic Design

25

NTUEE C.M. Li

Review
Characteristic equations (CH 11)

Memorize them, very important!!

Q+ = S + RQ (SR=0)
Q+ = GD + GQ
Q+ = D
Q+ = DCE + Q CE
Q+ = JQ + KQ
Q+ = T Q = TQ + TQ

Logic Design

(S-R latch or flip-flop )


(gated D latch )
(D flip-flop )
(D-CE flip-flop )
(J-K flip-flop )
(T flip-flop )

NTUEE C.M. Li

(13-1)
(13-2)
(13-3)
(13-4)
(13-5)
(13-6)

26

Moore Example
Fig 13-5

1. input equations DA=


output equation Z=
2. next-state equations A+=
3. Next-state map

DB =
B+=

Fig 13-5

27

NTUEE C.M. Li

Logic Design

4. State Table
State Table 13-2(b)

Transition Table 13-2(a)

AB
X=0

A+ B+
X=1

00=S0, 01=S1
11=S3,10=S3

PS
X=0

NS
X=1

00

10

01

S0

S3

S1

01

00

11

S1

S0

S2

11

01

11

S2

S1

S2

10

11

01

S3

S2

S1

Logic Design

NTUEE C.M. Li

28

5. State graph
TABLE 13-2 (b)
Fig 13-9

PS

NS

X=0

X=1

S0

S3

S1

S1

S0

S2

S2

S1

S2

S3

S2

S1

29

NTUEE C.M. Li

Logic Design

Mealy Example
1. input equation

JA=
JB=

KA=
KB=

2. next-state equation

A +=
B +=

output equation
Z=

Logic Design

NTUEE C.M. Li

Fig. 13-10

30

3. next-state map

Output map

31

NTUEE C.M. Li

Logic Design

4. State Table
State Table 13-3 (b)

Transition Table 13-3 (a)

A+ B+

AB

X=0

X=1

Z
X=0 =1

S0

S0

S1

S1

S1

S2

S2

S2

S0

S3

S3

S1

X=0

X=1

Z
X=0 =1

00

00

01

01

01

11

11

11

00

10

10

01

Logic Design

PS

NTUEE C.M. Li

NS

32

5. State Graph
Fig 13-11

PS

NS
X=0

X=1

Z
X=0 =1

S0

S0

S1

S1

S1

S2

S2

S2

S0

S3

S3

S1

X
Z

33

NTUEE C.M. Li

Logic Design

Compare State Table


Moore

Mealy

PS
X=0

NS
X=1

PS

NS
X=0

X=1

Z
X=0 =1

S0

S3

S1

S0

S0

S1

S1

S0

S2

S1

S1

S2

S2

S1

S2

S2

S2

S0

S3

S2

S1

S3

S3

S1

Logic Design

NTUEE C.M. Li

34

Compare State Graph


Moore

Mealy

X
X

NTUEE C.M. Li

Logic Design

35

Serial Adder Example


What is serial adder?

X=Xn-1 x1x0 Y=yn-1y1y0


Binary numbers are fed in serially, one pair of bits at a time
Subscript represents clock cycle index

Fig. 13-12
Logic Design

NTUEE C.M. Li

36

Parallel Adder
Fig 4-3
All inputs are fed simultaneously in parallel

37

NTUEE C.M. Li

Logic Design

State Table
Fig 13-12 (b)

Logic Design

xi

yi

ci

ci+1

si

NTUEE C.M. Li

38

Timing Chart
Aka. timing diagram

Fig. 13-13

Immediately before clock edge


Logic Design

NTUEE C.M. Li

39

State Graph
xi yi / si

w/ carry

w/o carry

Fig. 13-14
Logic Design

NTUEE C.M. Li

40

4-state example
TABLE 13-4
Present
State

Next State
X1X2
=00

01

10

S0

S3

S2

S1

S0

S2
S3

Logic Design

Present Output(Z1Z2)

11

X1X2
=00

01

10

11

S1

S0

00

10

11

01

S1

S2

S3

10

10

11

11

S3

S0

S1

S1

00

10

11

01

S2

S2

S1

S0

00

00

01

01

NTUEE C.M. Li

41

4-state example

Fig. 13-15
Logic Design

NTUEE C.M. Li

42

FFT
When do you need serial adders?

Logic Design

NTUEE C.M. Li

43

Outline

A Sequential Parity Checker.


Analysis by Signal Tracing and Timing Charts.
State Tables and Graphs.
General Models for Sequential Circuits.

Logic Design

NTUEE C.M. Li

44

General Models for Mealy Circuits


m inputs, X1 Xm
n outputs, Z1 .. Zn
K FFs, Q1 ,, Qk

f(X, Q)

Z = f(X, Q) output
Q+ = g(X, Q) next state

g(X, Q)

Fig. 13-17
Logic Design

45

NTUEE C.M. Li

General Models for Moore Circuits


m inputs, X1 Xm
n outputs, Z1 .. Zn
K FFs, Q1 Qk

Z = f(Q) output function, also (S)


Q+ = g(X, Q) next state function, also (S, X)

g(X,Q)

f(Q)

Fig. 13-19
Logic Design

NTUEE C.M. Li

46

Comparison
Moore Circuits

Electronic Alarm clock


Mealy Circuits
Traditional alarm clock

Logic Design

47

NTUEE C.M. Li

Review, CH11
Setup time (tsu)

time that D must be stable before the active edge of clock


Propagation time (tp)
time from clock changes until output Q changes
Combinational Circuit Delay (tc) was called td in CH11
time to propagate through combinational logic gate (no clock)

Fig. 11-16

Logic Design

NTUEE C.M. Li

48

CH 11

Tclk, min = Tp+Tc+Tsu

CH13, Now with Mealy

Tclk, min = Tx+Tc+Tsu


Tx means delay of input

Logic Design

NTUEE C.M. Li

49

Outline

A Sequential Parity Checker.


Analysis by Signal Tracing and Timing Charts.
State Tables and Graphs.
General Models for Sequential Circuits.

Logic Design

NTUEE C.M. Li

50

Construction of Timing Charts

P 406
1. state change occurs AFTER active clock edge
2. input stable immediately BEFORE and AFTER active clock edge
3. Moore: output change only when state change
Mealy: output change whenever input change
4. Mealy has false outputs
5. How to use state table to draw Mealy outputs?
a. Draw Present State (PS)
b. Draw Next State (NS)
c. Use NS and OLD input to draw false output
d. Use NS and NEW input to draw real output
6. Mealy: read output just BEFORE active edge

Logic Design

51

NTUEE C.M. Li

This is a

simplified
version of Fig
13-6
ABD
B is new state +
old input
D is new state +
new input

Logic Design

New state

New state

Old input

New input

NTUEE C.M. Li

52

Continued from

last figure
X changes
at time C
ABCD

Logic Design

NTUEE C.M. Li

53

NTUEE C.M. Li

54

Continued from

last figure
DEF

Logic Design

Apply input

right before
clock edges
X=010
Observe output
right before
clock edges
Z=110

0
1

1
1

NTUEE C.M. Li

Logic Design

0
0
55

Next Time
ch 9 Multiplexers Decoders and PLD
ch 11 Latches and FF
ch 12 Registers and Counters
ch 13 Analysis of Clock Sequential Ckts
ch 14 Derivation of State Graphs and
Tables
ch 16 Sequential Ckt Design
ch 18 Ckts for Arith. Operations
final exam

Logic Design

NTUEE C.M. Li

56

You might also like