Вы находитесь на странице: 1из 27

Switching Circuits & Logic Design

Derivation of State Graph and Tables


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

NTUEE C.M. Li

Objective of this Chapter


Learn how to draw State Graph and State table

From a given specification

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
Logic Design

NTUEE C.M. Li

Outline

Design of a Sequence Detector.


More Complex Design Problems.
Guidelines for Construction of State Graphs.
Serial Data Code Conversion.
Alphanumeric State Graph Notation.

Logic Design

NTUEE C.M. Li

Sequence Detector
Job Statement

Please design a sequence detector that has one input one output
Output =1 when input sequence is 101

Example sequence
X

time

10 11 12 13 14

Fig. 14-1
Logic Design

NTUEE C.M. Li

Design Flow

1. Mealy or Moore?
2. draw state graph
3. Turn state graph to state table
4. K map
5. circuit design

Logic Design

NTUEE C.M. Li

Partial State Graph (1)


Lets start from Mealy
S0 is initial state

If receive 0, stay in S0
If receive 1, go to S1

Fig. 14-2

NTUEE C.M. Li

Logic Design

Partial State graph (2)


If receive 101

Output 1
Go to state S1 (why not S0?)

Fig. 14-3
Logic Design

NTUEE C.M. Li

Complete State Graph (3)


Check if every state that has 2 emanating arc

Fig. 14-4

NTUEE C.M. Li

Logic Design

Graph to Table
State Table

TABLE 14-1

Transition Table

TABLE 14-2

Present
State

Next state
X=0

X=1

X=0

X=1

S0

S0

S1

S1

S2

S1

S2

S0

S1

A +B +

AB

Logic Design

Present Output

X=0

X=1

X=0

X=1

00

00

01

01

10

01

10

00

01

NTUEE C.M. Li

10

Table to K-map
Next-state map
Output map

Fig. 14-5
NTUEE C.M. Li

Logic Design

11

Final Design Done


Mealy machine design

Fig. 14-5
Logic Design

NTUEE C.M. Li

12

Redo Design in Moore


State graph for Moore machine is DIFFERENT from state graph for
MEALY
Because
Moore machine: Z = f(PS)
Mealy machine: Z = f(X, PS)

Logic Design

NTUEE C.M. Li

13

Partial State Graph for Moore (1)


Same sequence detector

Fig. 14-5
Logic Design

NTUEE C.M. Li

14

Complete State Graph


Note S3 needed

Fig. 14-6

15

NTUEE C.M. Li

Logic Design

Graph into Table


State Table

X=0

X=1

Present
Output (Z)

S0

S0

S1

S1

S2

S1

S2

S0

S3

S3

S2

S1

TABLE 14-3

Transition table

Present
State

Next state

TABLE 14-4
A +B +

Logic Design

AB

X=0

X=1

00

00

01

01

11

01

11

00

10

10

11

01

NTUEE C.M. Li

16

Table to K-map
Your exercise

17

NTUEE C.M. Li

Logic Design

Comparison of State Graphs


Moore reliable, Moore hardware

Moore

Logic Design

Mealy

NTUEE C.M. Li

18

Outline

Design of a Sequence Detector.


More Complex Design Problems.
Guidelines for Construction of State Graphs.
Serial Data Code Conversion.
Alphanumeric State Graph Notation.

NTUEE C.M. Li

Logic Design

19

More Complex Design


Two examples

1. Mealy sequence detector


2. Moore odd/even parity detector

Logic Design

NTUEE C.M. Li

20

Example 1. Mealy Sequence Detector


Specification

Please design a sequence detector that has one input X and one
output Z
Output Z=1 when input sequence 010 or 1001 detected
X

time

1
0

1
1

1
2

1
3

1
4

1
5

1
6

NTUEE C.M. Li

Logic Design

21

Partial State Graph

Assume Mealy machine


First consider the 010 sequence
Fig 14-7
Why Arc a ?
0101

State

Sequence

S0

Reset

S1

S2

01

S3

010

Logic Design

NTUEE C.M. Li

22

Partial State Graph (2)


Fig 14-8
Then consider input sequence 1001
Where does arc e go to?

1001

NTUEE C.M. Li

Logic Design

23

Complete State Graph (3)


Fig 14-9
Now consider the other sequences

Other than 010 and 1001


Arc f: 000
Arc g: 011
Arc h: 111
Arc i: 1000
State

Sequence

S0

Reset

S1

0 (but not 10)

S2

01

S3

10

S4

1 (but not 01)

S5

100

Logic Design

*note this change

NTUEE C.M. Li

24

Example 2 : Moore Parity Detector


Specification

Please design a parity detector that has one input and one output
Output = 1 if input sequence is odd parity and at least two
consecutive zeros has been received
Partial state graph
For parity checking

Fig. 14-10
NTUEE C.M. Li

Logic Design

25

Partial State Graph (2)


Detects if two consecutive zeros

Fig. 14-11
Logic Design

NTUEE C.M. Li

26

Complete State Graph (3)

Before 00

After 00

Fig. 14-12
Logic Design

NTUEE C.M. Li

27

Outline

Design of a Sequence Detector.


More Complex Design Problems.
Guidelines for Construction of State Graphs.
Serial Data Code Conversion.
Alphanumeric State Graph Notation.

Logic Design

NTUEE C.M. Li

28

Guidelines for State Graph

1. construct sample I/O sequence


2. find initial state
3. construct partial graph for sequence that produce output 1
4. construct partial graph for sequence that must be remembered
5. think twice if you need to create a new state or not
6. make sure there is ONE and ONLY ONE emanating arc for each
state for each combination of input
7 check your graph by applying the input sequence

Logic Design

NTUEE C.M. Li

29

Three examples
Example 1. Mealy sequence detector (reset every 4 inputs)
Example 2 . Moore sequence detector (skip)
Example 3. Moore sequence detector (skip)

Logic Design

NTUEE C.M. Li

30

Example 1
Specification:

Design a Sequence detector with one input and one output


Inputs sequence is grouped in 4
Reset after four bits
Output = 1 if input = 0101 or 1001
Partial state graph

Fig. 14-13
X

0101 0010 1001 0100

0001 0000 0001 0000


No one here
NTUEE C.M. Li

Logic Design

31

Complete State Graph


Q: when receive two consecutive zeros, why s1 to s5,

why not S1 to S1? i.e. Why new state s5 is needed?

State

Sequence

S0

Reset

S1

S2

S3

10 or 01

S4

010 or 100

S5

Two inputs, no
1 output

S6

Three inputs,
no 1 output
Fig. 14-14

Logic Design

NTUEE C.M. Li

32

Example 2
Specification

Design a sequence detector that has one input X and two outputs
Z1 and Z2
Z1 = 1 when input is 100 AND no 010 occurs before
Z2=1 when input is 010

100110010

1010010110100

Z1

001000100

0000000000000

Z2

000000001

0101001000010

NTUEE C.M. Li

Logic Design

33

Partial State Graph (1)


Consider 100 and 010 sequences

Before 010 occurs

Fig. 14-15
Logic Design

NTUEE C.M. Li

34

Partial State Graph (2)


After 010 occurs

Fig. 14-16 (a)

Logic Design

35

NTUEE C.M. Li

Complete Graph

Fig. 14-16 (b)

Logic Design

After 010 occurs


NTUEE C.M. Li

36

Example 3
Self study

Fig. 14-17
Logic Design

NTUEE C.M. Li

37

Outline

Design of a Sequence Detector.


More Complex Design Problems.
Guidelines for Construction of State Graphs.
Serial Data Code Conversion.
Alphanumeric State Graph Notation.

Logic Design

NTUEE C.M. Li

38

Serial Communication system


Transmitter and receiver

Clock or no clock
Only one data bit at a time

Fig. 14-18

NTUEE C.M. Li

Logic Design

39

Four Coding Schemes

NRZ = Non-return to zero: 0=low; 1=high


NRZI = non-return-to-zero-inverted: 0=unchange; 1 = toggle
RZ = return-to-zero: 0=low, 1=high-low
Manchester: 0 = rising; 1 = falling

Fig. 14-19
Logic Design

NTUEE C.M. Li

40

Design
Specification

Design a serial code converter


Convert NRZ into Manchester code

Fig. 14-20 (a)

41

NTUEE C.M. Li

Logic Design

Ideal Timing Chart


Note: clcok2 is 2X faster than data rate

Negative edge triggered

1 clock period

Fig. 14-20 (b)


Logic Design

NTUEE C.M. Li

42

Design in Mealy
State Graph
State Table

Fig 14-20 (d)

PS

NS
X=0

NS
X=1

Z
X=0

Z
X=1

S0

S1

S2

S1

S0

S2

S0

Fig. 14-20 (c)

Q: why only one emanating arc of state S1 ?

Dont care state transition


Incompletely specified state transition

Logic Design

NTUEE C.M. Li

43

FFT
False output is BAD

Why?

Fig. 14-20 (b)


Logic Design

NTUEE C.M. Li

44

Redesign in Moore
Table 14-21 (c)

1 is impossible

0 is impossible
Fig. 14-21 (b)
NTUEE C.M. Li

Logic Design

45

Timing Chart of Moore


No false output

Fig. 14-21 (a)


Logic Design

NTUEE C.M. Li

46

FFT
Q1: have you notice any difference between output waveforms of

Mealy and Moore? (ignore false output)


Q2: Does it matter?

Logic Design

NTUEE C.M. Li

47

Outline

Design of a Sequence Detector.


More Complex Design Problems.
Guidelines for Construction of State Graphs.
Serial Data Code Conversion.
Alphanumeric State Graph Notation.

Logic Design

NTUEE C.M. Li

48

Alphanumeric State Notation


What is that?

State graph labeled with alphanumeric input variables


Rather than 0s and 1s
Advantages
Make it clear and simpler for us to read and understand

NTUEE C.M. Li

Logic Design

49

Example
Specification

Design a sequence detector that has two inputs F/R, three


outputs Z1, Z2, Z3
Output = Z1 Z2 Z3 if input = FFF
Output = Z3 Z2 Z1 if input = RRR
Partial State Graph
Alphanumeric label

Fig. 14-22
Logic Design

NTUEE C.M. Li

50

Complete State Graph


Note: F has higher priority over R

When F = 1, R is dont care

Fig. 14-22
Logic Design

NTUEE C.M. Li

51

Final Check
Make sure all input labels on emanating arcs from a state is

complete
i.e. ORing all Boolean expressions equals one
F+FR+FR=1
Make sure no emanating arc overlap
i.e. ANDing every pair of Boolean expressions equals zero
F. FR =0
F. FR=0
FR. FR=0

Logic Design

NTUEE C.M. Li

52

FFT
False output is BAD

Why?

Fig. 14-20 (b)


NTUEE C.M. Li

Logic Design

53

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

54

Вам также может понравиться