93
6 - 1 Chapter 7 The Design of Sequential Systems

6 - 1 Chapter 7 The Design of Sequential Systems

Embed Size (px)

Citation preview

Page 1: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 1

Chapter 7

The Design of Sequential Systems

Page 2: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 2

Chapter 7 The Design of Sequential Systems

Five additional Continuing Examples(CE)

CE7. A Mealy system with one input x and one output z such that z = 1 at a clock time iff x is currently 1 and was also 1 at the previous two clock times.

CE8. A Moore system with one input x and one output z, the output of which is 1 iff three consecutive 0 inputs occurred more recently than three consecutive 1 inputs.

CE9. A Moore system with no inputs and three outputs, that represent a number from 0 to 7, such that the outputs cycle through the sequence 0 3 2 4 1 5 7 and repeat on consecutive clock inputs.

Page 3: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 3

Chapter 7 The Design of Sequential Systems

CE11. A bus controller that receives requests on separate lines, R0 to R3, from four devices desiring to use the bus. It has four outputs, G0 to G3, only one of which is 1, indicating which device is granted control of the bus for that clock period

CE10. A Moore system with two inputs, x1 and x2, and three outputs, z1, z2, and z3, that represent a number from 0 to 7, such that the output counts up if x1 = 0 and down if x1 = 1, and recycles if x2 = 0 and saturates if x2 = 1. Thus, the following output sequences might be seen

x1 = 0, x2 = 0: 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 …x1 = 0, x2 = 1: 0 1 2 3 4 5 6 7 7 7 7 7 7 7 7 7 …x1 = 1, x2 = 0: 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 …x1 = 1, x2 = 1: 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 …

Page 4: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 4

Chapter 7 The Design of Sequential Systems

• For Larger system,

Step 1 : From a word description, determine what to be stored in memory, that is, what are the possible states.

Step 2 : If necessary, code the inputs and outputs in binary.

Step 3 : Derive a state table or state diagram to describe the behavior of the system.

Step 4 : Use state reduction techniques to find a state table that produces the same input/output behavior, but has fewer

states.

Step 5 : Choose a state assignment, that is, code the states in binary.

Step 6 : Choose a flip flop type and derive the flip flop input maps or tables.

Step 7 : Produce the logic equation and draw a block diagram (as in the

case of combinational systems).

Page 5: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 5

Chapter 7 The Design of Sequential Systems

q q1 q2

A 0 0

B 0 1

C 1 0

D 1 1

q q1 q2

A 0 0

B 1 1

C 1 0

D 0 1

q q1 q2

A 0 0

B 0 1

C 1 1

D 1 0

(a) (b) (c) P 328

Page 6: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 6

Chapter 7 The Design of Sequential Systems

• The first half of the design truth table corresponds to the first column of

the state table(x = 0).• The next state is 0 0 for the first four rows, since each of the states go

to state A on a 0 input.• The second half of the table corresponds to x = 1.

q x q1 q2 q1* q2*

A 0 0 0 0 0

B 0 0 1 0 0

C 0 1 0 0 0

D 0 1 1 0 0

A 1 0 0 0 1

B 1 0 1 1 0

C 1 1 0 1 1

D 1 1 1 1 1

P 328

Page 7: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 7

6 - 7Chapter 7 The Design of Sequential Systems

• For a Moore system,

• A separate table for the output, since it depends only on the two state variables.

q q1 q2 z

A 0 0 0

B 0 1 0

C 1 0 0

D 1 1 1

P 329

Page 8: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 8

6 - 8Chapter 7 The Design of Sequential Systems

• The equations,q1

* = xq2 + xq1

q2* = xq’2 + xq1

z = q1q2

• This SOP solution requires 4 two-input AND gates and 2 two-input OR gates. P 329

Page 9: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 9

6 - 9Chapter 7 The Design of Sequential Systems

• Example 7.1

• Design truth table:

x q1 q2 q1* q2*

A 0 0 0 0 0

D 0 0 1 0 0

C 0 1 0 0 0

B 0 1 1 0 0

A 1 0 0 1 1

D 1 0 1 0 1

C 1 1 0 0 1

B 1 1 1 1 0

q q1 q2 z

A 0 0 0

D 0 1 1

C 1 0 0

B 1 1 0

P 330

Page 10: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 10

6 - 10Chapter 7 The Design of Sequential Systems

• The resulting maps:

• The resulting maps:q1

* = xq’1q’2 + xq1q2

q2* = xq’1 + xq’2

z = q’1q2

• This implementation requires an extra gate and three extra gate inputs.

0 1

00

01

11

10

q1 *

q1 q2

x

1

1

0 1

00

01

11

10

q2*

q1 q2

x

1

1

1

P 330

Page 11: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 11

6 - 11Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The flip flop design table is most readily obtained from the state dia-gram.

• For each line of the truth table equivalent of the state table, and for each

flip flop.• Its present value and the desired next state.

q q* Input(s)

0 0

0 1

1 0

1 1

0 1D

1

0

10

P 331

Page 12: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 12

6 - 12Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The diagram indicates that if the flip flop is in state 0 and the desired next state is also 0, the only path is D = 0.

• When the D flip flop.• Don’t separate columns in the truth table for D1 and D2.• They are identical to the q1

* and q2* columns.

D1 = xq2 + xq1

D2 = xq’2 + xq1

q q* D

0 0 0

0 1 1

1 0 0

1 1 1

P 331

Page 13: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 13

6 - 13Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

P 331

Page 14: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 14

6 - 14Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• Repeat the process for the JK flip flop.

• To go from state 0 to state 0.• Two choices : J = 0 and K = 0, or J = 0 and K = 1 (J must be 0 and it does not

matter what K is – K is a don’t care.)

0 1JK0001

0010

1011

0111

q q* J K

0 0 0 X

0 1 1 X

1 0 X 1

1 1 X 0P 332

Page 15: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 15

6 - 15Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The truth table for the design requires four more columns for the four flip flop inputs.

x q1 q2 q1* q2* J1 K1 J2 K2

0 0 0 0 0 0 X 0 X

0 0 1 0 0 0 X X 1

0 1 0 0 0 X 1 0 X

0 1 1 0 0 X 1 X 1

1 0 0 0 1 0 X 1 X

1 0 1 1 0 1 X X 1

1 1 0 1 1 X 0 1 X

1 1 1 1 1 X 0 X 0

P 332

Page 16: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 16

6 - 16Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The flip flop input equations areJ1 = xq2 K1 = x’ z = q1q2

J2 = x K2 = x’ + q’1 • This requires just 2 two-input AND gates, 1 two-input OR gate, and a NOT

for x’, by far the least expensive solution.

0 1

00

01

11

10

J1

q1 q2

x

X X

0 1

00

01

11

10

J2

q1 q2

x

1

1

0 1

00

01

11

10

J3

q1 q2

x

1

1

0 1

00

01

11

10

J4

q1 q2

x

11

1

X X

1

X XX X

X X X X

X X

X X

P 332

Page 17: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 17

6 - 17Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• Example 7.2• The state diagram for the SR flip flop.

• The resulting SR flip flop design table is

0 1SR0001

0010

1 0

0 1

q1 q* S R

0 0 0 X

0 1 1 0

1 0 0 1

1 1 X 0

P 333

Page 18: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 18

6 - 18Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• Following the same technique as for JK flip flop.

x q1 q2 q1* q2* S1 R1 S2 R2

0 0 0 0 0 0 X 0 X

0 0 1 0 0 0 X 0 1

0 1 0 0 0 0 1 0 X

0 1 1 0 0 0 1 0 1

1 0 0 0 1 0 X 1 0

1 0 1 1 0 1 0 0 1

1 1 0 1 1 X 0 1 0

1 1 1 1 1 X 0 X 0

P 333

Page 19: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 19

6 - 19Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The input equations areS1 = xq2 R1 = x’ z = q1q2

S2 = xq’2 R2 = x’ + q’1q2 • This requires 4 two-input AND gates, 1 two-input OR gate, and 1 NOT gate

for x’.

0 1

00

01

11

10

S1

q1 q2

x

X

0 1

00

01

11

10

R1

q1 q2

x

1

1

0 1

00

01

11

10

S2

q1 q2

x

1

1

0 1

00

01

11

10

R2

q1 q2

x

11

1

X

1

XX X

X

X

X

P 334

Page 20: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 20

6 - 20Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• Example 7.3• The state diagram for the T flip flop.

• There is only one way to get from any state to any other state.

0 1T

1

0

00

q1 q* T

0 0 0

0 1 1

1 0 1

1 1 0

P 334

Page 21: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 21

6 - 21Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The truth table for the system design becomes

x q1 q2 q1* q2* T1 T2

0 0 0 0 0 0 0

0 0 1 0 0 0 1

0 1 0 0 0 1 0

0 1 1 0 0 1 1

1 0 0 0 1 0 1

1 0 1 1 0 1 1

1 1 0 1 1 0 1

1 1 1 1 1 0 0

P 335

Page 22: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 22

6 - 22Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The input equations areT1 = x’q1 + xq’1q2

T2 = x’q2 + xq’2 + x q’1q2

z = q1q2

• This requires 4 two-input AND gates, 1 three-input AND gate, 1 two-input and 1 three-input OR gate, and 1 NOT gate for x.

0 1

00

01

11

10

T1

q1 q2

x

1

0 1

00

01

11

10

T2

q1 q2

x

1

1

1 1

1

1

1

P 335

Page 23: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 23

6 - 23Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The JK solution never requires more logic than either the SR or the T.• All of the X’s in the SR solution are also X’s on the JK maps.• The JK maps have additional don’t care.• The JK flip flop would behave like a T.• The relationship between the D and JK design is not quite so clear.

• The input equations for any flip flop are derived from the q and q* columns for that flip flop.

P 336

Page 24: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 24

6 - 24Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The shaded columns on the q1* map, together with the JK flip flop

design table are used, row by row, to produce the shaded columns on the J1 and K1 maps. P 337

Page 25: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 25

6 - 25Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• To get the second column of the J1 and K1 maps.

P 337

Page 26: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 26

6 - 26Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• To find J and K for flip flop q2,

• This same technique can be used with the other type of flip flops. P 338

Page 27: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 27

6 - 27Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The quick method for JK flip flop design takes advantage of a prop-erty

of JK flip flops.

• Half of each map contains don’t cares.• Each of the 1’s on the map has a don’t care eliminate the variable in-

volved.

0 1

00

01

11

10

J1

q1 q2

x

X

0 1

00

01

11

10

K1

q1 q2

x

1

1

0 1

00

01

11

10

J2

q1 q2

x

1

1

0 1

00

01

11

10

K2

q1 q2

x

11

1

X

1

XX X

X

X

X

X

X

X

X

X X

X X

x q2 x’ q2’ x q1’ x’ q1’x’ q2 x q1 x’ q1

x q1’

P 339

Page 28: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 28

6 - 28Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• Advantage of this property by utilizing the equation.q* = Jq’ + K’q

• when q = 0,q* = J ∙ 1 + K’ ∙ 0 = J

• when q = 1,q* = J ∙ 0 + K’ ∙ 1 = K’

• The part of the map of q* for which that variable is 0 is the map for J

and the part for which that variable is 1 is the map for K’

Page 29: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 29

6 - 29Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The three variable map has been reduced to 2 two-variable maps, one for J and the other for K’.• The variable q1 has been eliminated; that was used to choose the sec-

tion of the original map.

J1 = xq2 K’1 = x or K1 = x’

• Be careful in using the map for K’1; the two rows are reversed, that is,

the q2 = 1 row is on the top.

P 339

Page 30: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 30

6 - 30Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The q2 = 0 portion of the map consists of the first and last rows• The q2 = 1 portion is made up of the middle two rows.

• The other methods,J2 = x K2 = x’ + q’1

• It is really only necessary to plot maps of q* for each variable.

P 340

Page 31: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 31

6 - 31Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• Example 7.4• The state table and the state assignment.

• Following truth table (including a column with the state name)

q* z

q x = 0 x = 1 x = 0 x = 1

A B C 1 1

B A B 1 0

C B A 1 0

q q1 q2

A 1 1

B 1 0

C 0 1

x q1 q2 q1* q2* z

- 0 0 0 X X X

C 0 0 1 1 0 1

B 0 1 0 1 1 1

A 0 1 1 1 0 1

- 1 0 0 X X X

C 1 0 1 1 1 0

B 1 1 0 1 0 0

A 1 1 1 0 1 1 P 341

Page 32: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 32

6 - 32Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The resulting maps for the output and for D flip flop inputs follow.

• The resulting equation z = x’ + q1q2

D1 = x’ + q’1 + q’2

D2 = xq’2 + x’q2

0 1

00

01

11

10

z

q1 q2

x

1

X

1

1

X

1

0 1

00

01

11

10

q1 *

q1 q2

x

1

X

1

1

1

X

1

0 1

00

01

11

10

q2 *

q1 q2

x

X

1

1

X

1

P 341

Page 33: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 33

6 - 33Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The equations for the flip flop inputs follow.J1 = 1 K1 = xq2

J2 = x’ K2 = x’

x q1 q2 q1* q2* z J1 K1 J1 K2

- 0 0 0 X X X X X X X

C 0 0 1 1 0 1 1 X X 1

B 0 1 0 1 1 1 X 0 1 X

A 0 1 1 1 0 1 X 0 X 1

- 1 0 0 X X X X X X X

C 1 0 1 1 1 0 1 X X 0

B 1 1 0 1 0 0 X 0 0 X

A 1 1 1 0 1 1 X 1 X 0

P 342

Page 34: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 34

6 - 34Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• Example 7.5• One larger example

• The first issue is to make a state assignment.

q*

q x = 0 x = 1 z

S1 S2 S1 0

S2 S3 S1 0

S3 S4 S1 0

S4 S4 S5 1

S5 S4 S6 1

S6 S4 S1 1

P 342

Page 35: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 35

6 - 35Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The first assignment just uses the first six binary number.

• The second assignment uses an assignment meant to reduce the combinational logic.

q A B C

S1 0 0 0

S2 0 0 1

S3 0 1 0

S4 0 1 1

S5 1 0 0

S6 1 0 1

q A B C

S1 0 0 0

S2 1 0 1

S3 1 0 0

S4 1 1 1

S5 0 1 1

S6 0 1 0

P 342

Page 36: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 36

6 - 36Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The left half of the map corresponds to x = 0, and the right half to x =1.• Since S1 goes to S2 when x = 0, the upper left square for the maps become 0, 0,

and 1.

P 343

Page 37: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 37

6 - 37Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

DA = xAC’ + xBCDB = x’A + x’B + x’CDC = x’A + x’B + x’C’ + AC’ z = A + BC

P 343

Page 38: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 38

6 - 38Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• Using AND and OR gates, this requires 13 gates with 30 inputs.• To implement this with JK flip flops,

P 344

Page 39: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 39

6 - 39Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

P 344

Page 40: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 40

6 - 40Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The map for JA has don’t cares in the two columns for which A is 1 and the map for KA has X’s in the two columns for which A is 0.• Rows of don’t cares are seen in the maps for B* and C*.

JA = xBC JB = x’A + x’C JC = x’ + AKA = x’ + C KB = x KC = x + A’B’

• The output does not depend on the flip flop type.z = A + BC

• This requires 11 gates and 22 inputs.

A B C Gates Inputs

D D JK 13 28

D JK D 13 29

JK D D 12 27

D JK JK 12 25

JK D JK 12 25

JK JK D 12 26

D D D 13 30

JK JK JK 11 22 P 345

Page 41: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 41

6 - 41Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

• The first eight rows are completed for the output column z, since z is not a function of the input x.

x A B C z A* B* C* JA KB JB KB JC KC

S1 0 0 0 0 0 1 0 1 1 X 0 X 1 X

- 0 0 0 1 X X X X X X X X X X

S6

0 0 1 0 1 1 1 1 1 X X 0 1 X

S5 0 0 1 1 1 1 1 1 1 X X 0 X 0

S3 0 1 0 0 0 1 1 1 X 0 1 X 1 X

S2

0 1 0 1 0 1 0 0 X 0 0 X X 1

- 0 1 1 0 X X X X X X X X X X

S4 0 1 1 1 1 1 1 1 X 0 X 0 X 0

S1 1 0 0 0 0 0 0 0 X 0 X 0 X

- 1 0 0 1 X X X X X X X X X

S6 1 0 1 0 0 0 0 0 X X 1 0 X

S5 1 0 1 1 0 1 0 0 X X 0 X 1

S3 1 1 0 0 0 0 0 X 1 0 X 0 X

S2 1 1 0 1 0 0 0 X 1 0 X X 1

- 1 1 1 0 X X X X X X X X X

S4 1 1 1 1 0 1 1 X 1 X 0 X 0 P 346

Page 42: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 42

6 - 42Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

P 347

Page 43: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 43

6 - 43Chapter 7 The Design of Sequential Systems

7.1 FLIP FLOP DESIGN TECHNIQUES

DA = x’DB = x’B + BC + x’AC’DC = AB + x’C’ + {x’B or x’A’}

• This requires a total of 9 gates with 20 inputs.• The equations of JK version.

JA = x’ KA = xJB = x’AC’ KB = xC’JC = x’ KC = B’ + xA’ x = B

• This requires 5 gates with 10 inputs, significantly better than the D solution.

Page 44: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 44

6 - 44Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS

• Counters• Asynchronous counters : those that do not require a clock input.• Most counters are devices with no data input, that go through a fixed se-

quence of states on successive clocks.• The output is often just the state of the system, that is, the contents of all of the

flip flops.• 4-bit binary counter : one with four flip flops that cycles through the se-

quence0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, . . .

• There are really no new techniques required for this design.• The state table and the truth table are the same.• The flip flops are labeled D, C, B, and A, which is the common practice.

Page 45: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 45

6 - 45Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERSD C B A D* C * B* A*

0 0 0 0 0 0 0 1

0 0 0 1 0 0 1 0

0 0 1 0 0 0 1 1

0 0 1 1 0 1 0 0

0 1 0 0 0 1 0 1

0 1 0 1 0 1 1 0

0 1 1 0 0 1 1 1

0 1 1 1 1 0 0 0

1 0 0 0 1 0 0 1

1 0 0 1 1 0 1 0

1 0 1 0 1 0 1 1

1 0 1 1 1 1 0 0

1 1 0 0 1 1 0 1

1 1 0 1 1 1 1 0

1 1 1 0 1 1 1 1

1 1 1 1 0 0 0 0

P 348

Page 46: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 46

6 - 46Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS

DD = DC’ + DB’ + DA’ + D’CBADC = CB’ + CA’ + C’BADB = B’A + BA’DA = A’

P 349

Page 47: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 47

6 - 47Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS

• This solution would require 12 gates with 30 gate inputs.• Exclusive-OR gates available.

DD = D(C’ + B’ + A’) + D’CBA = D(CBA)’ + D’(CBA) = D CBADC = C(B’ + A’) + C’BA = C(BA)’ + C’(BA) = C BADB = B’A + BA’ = B ADA = A’

• This would only require two AND gates and three Exclusive-OR gates.• JK design,

P 349

Page 48: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 48

6 - 48Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS

• This produces the equationsJD = KD = CBAJC = KC = BAJB = KB = AJA = KA = 1

• Extend the design to 5 flip flops, counting to 31 by adding flip flop E with inputsJE = KE = DCBA

P 350

Page 49: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 49

6 - 49Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS

• Up/down counter : one that can count in either direction, depending on a

control input.• Control input x : counter counts up when x = 0 and down when x = 1.

x C B A C * B* A*

0 0 0 0 0 0 1

0 0 0 1 0 1 0

0 0 1 0 0 1 1

0 0 1 1 1 0 0

0 1 0 0 1 0 1

0 1 0 1 1 1 0

0 1 1 0 1 1 1

0 1 1 1 0 0 0

1 0 0 0 1 1 1

1 0 0 1 0 0 0

1 0 1 0 0 0 1

1 0 1 1 0 1 0

1 1 0 0 0 1 1

1 1 0 1 1 0 0

1 1 1 0 1 0 1

1 1 1 1 1 1 0

P 350

Page 50: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 50

6 - 50Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS

JA = KA = 1JB = KB = x’A + xA’ JC = KC = x’BA + xB’A’

• Just as in the case of the 4- and 5-bit up counters, this pattern continues, yieldingJD = KD = x’CBA + x C’B’A’JE = KE = x’DCBA + xD’C’B’A’

P 351

Page 51: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 51

6 - 51Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS

P 351

Page 52: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 52

6 - 52Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS

• Example 7.6• Design a counter that goes through some sequence of states that are not in

numeric order0, 3, 2, 4, 1, 5, 7, and repeat

• The cycle is 7 states; it never goes through state 6.

q1 q2 q3 q1* q2* q3*

0 0 0 0 1 1

0 0 1 1 0 1

0 1 0 1 0 0

0 1 1 0 1 0

1 0 0 0 0 1

1 0 1 1 1 1

1 1 0 X X X

1 1 1 0 0 0 P 352

Page 53: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 53

6 - 53Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS

• The table is repeated below with columns for inputs to SR flip flops; use the quick method for JK flip flops.

q1 q2 q3 q1* q2* q3* S1 R1 S2 R2 S3 R3

0 0 0 0 1 1 0 X 1 0 1 0

0 0 1 1 0 1 1 0 0 X X 0

0 1 0 1 0 0 1 0 0 1 0 X

0 1 1 0 1 0 0 X X 0 0 1

1 0 0 0 0 1 0 1 0 X 1 0

1 0 1 1 1 1 X 0 1 0 X 0

1 1 0 X X X X X X X X X

1 1 1 0 0 0 0 1 0 1 0 1

P 352

Page 54: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 54

6 - 54Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS

• For D flip flops• Use the q1*, q2*, q3* columns.

D1 = q’2q3 + q2q’3

D2 = q’1q’2q’3 + q’1q2q3 + q1q’2q3

D3 = q’2

• This solution requires 4 three-input gates and 3 two-input gates. P 352

Page 55: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 55

6 - 55Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS

• The maps and equations for the SR solution follow.• S and R are both don’t cares for all three flip flops.

P 353

Page 56: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 56

6 - 56Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS

S1 = q2’q3 + q2q3’ R1 = q2’q3’ + q2q3 = S1’ = q2’q3’ + q1q2

S2 = q1’q2’q3’ + q1q2’q3 R2 = q1q2 + q2q3’S3 = q2’ R3 = q2

• Even taking advantage of the sharing or using a NOT for R1, this requires more logic than the D solution. P 353

Page 57: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 57

6 - 57Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS

• The quick method for JK flip flops,

J1 = q2’q3 + q2q3’ K1 = q3’ + q2

J2 = q1’q3’ + q1q3 K2 = q1 + q3’J3 = q2’ K3 = q2

• Even taking advantage of the sharing or using a NOT for R1, this requires more logic than the D solution.

P 354

Page 58: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 58

6 - 58Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS

• This solution requires 8 two-input gates, although the gate for K1 could be replaced by a NOT gate and the gate for K2 could be eliminated, since by choosing the don’t cares as 1’s in both places.

K1 = J1’ and K2 = J2

• Example 7.6(Cont.)• Assume (state 1 1 0)

q1 = 1, q2 = 1, and q3 = 0

• For D flip flops,D1 = q’2q3 + q2q’3 = 00 + 11 = 1D2 = q’1q’2q’3 + q’1q2q3 + q1q’2q3 = 001 + 011 + 100 = 0D3 = q’2 = 0

• The system would go to state 4 (1 0 0) on the first clock and continue through the sequence from there.

Page 59: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 59

6 - 59Chapter 7 The Design of Sequential Systems

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS

• Note that there are no labels on the paths, since there is no input to the system, and the output is just equal to the state. (Moore system)

• A state diagram, showing the behavior of the system designed with D or SR flip flops, including what happens if the system starts in the unused state.

P 355

Page 60: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 60

6 - 60Chapter 7 The Design of Sequential Systems

7.3 DESIGN OF ASYNCHRONOUS COUNTERS

• Binary counter are sometimes designed without a clock input.• They are constructed from the same clocked flip flops

(typically JK) as synchronous counters.• But each flip flop is triggered by the transition of the previous one.

• Count : when the Count signal goes from 1 to 0, flip flop A is triggered.• It started out at 0 : it goes to 1• The 0 to 1 transition on the output of A, and thus on the clock input of B, has no effect.

: when the next negative transition on Count occurs, A will go from 1 to 0, causing the clock input to B to do the same.

J

K

A 1

Count

J

K

B

1

P 355

Page 61: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 61

6 - 61Chapter 7 The Design of Sequential Systems

7.3 DESIGN OF ASYNCHRONOUS COUNTERS

• There are two things that are different about this timing diagram form the previous ones.• Since the Count signal is not necessarily a clock, it might be rather irregular.• The delay from the clock is much greater : The first flip flop (A) changes

shortly after the negative edge of the clock, but the second flip flop (B) does not change until somewhat after A changes.

Count

A

B

P 356

Page 62: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 62

6 - 62Chapter 7 The Design of Sequential Systems

7.3 DESIGN OF ASYNCHRONOUS COUNTERS

• Note that the flip flops (BA) go through the sequence 00, 01, 10, 11, and repeat. Thus, this is a 2-bit counter.

J

K

D

1

J

K

C

1

J

K

B

1

J

K

A 1

Count

P 356

Page 63: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 63

6 - 63Chapter 7 The Design of Sequential Systems

7.3 DESIGN OF ASYNCHRONOUS COUNTERS

• Notice that A changes one unit of time after the trailing edge of the clock, B one unit after a trailing edge of A, C after B, and D after C. • Thus, the change in D occurs 4 units after the clock.

• Notice also that this counter does go through the sequence 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 and would continue through 11, 12, 13, 14, 15, 0, …

• The advantage of the asynchronous counter : the simplicity of the hardware.• There is no combinational logic required.

• The disadvantage of the asynchronous counter : speed.• The state of the system is not established until all of the flip flops have

completed their transition, which, in this case, is four flip flop delays. P 357

Page 64: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 64

6 - 64Chapter 7 The Design of Sequential Systems

7.3 DESIGN OF ASYNCHRONOUS COUNTERS

• Example 7.7• Design an asynchronous base-12 counter using JK flip flops with active

low clears and NAND gates.• The easiest way to do this is to take the 4-bit binary counter and reset it when it

reaches 12.• Thus, the following circuit computes (DC)’ and uses that to reset the counter.

P 358

Page 65: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 65

6 - 65Chapter 7 The Design of Sequential Systems

7.3 DESIGN OF ASYNCHRONOUS COUNTERS

• As can be seen from the timing diagram below, the counter cycles0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, (12), 9

• where it remains in state 12 for a short time.• Note that there is a delay from the time that A changes to when B changes

and so forth.• The count is only valid after the last flip flop settles down.

P 358

Page 66: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 66

6 - 66Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• Continuing Examples• Although the statement of CE6 does not include the term Moore, the

wording of the problem implies a Moore system.

• That of CE7 is a Mealy model.

CE6. A system with one input x and one output z such that z = 1 iff x has been 1 for at least three consecutive clock times.

x 0 1 1 0 1 1 1 0 0 1 0 1 1 1 1 1 0 0

z ? 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 0

P 359

Page 67: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 67

6 - 67Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• The first step in this problem is to determine what needs to be stored in memory.• There are two approaches to step 1 for this problem.

1. Store the last three inputs.2. Store in memory the number of consecutive 1’s.(A - none , B - one , C - two , D - three or more)

q1* q2* q3*

q1 q2 q3 x = 0 x = 1 z

0 0 0 0 0 0 0 0 1 0

0 0 1 0 1 0 0 1 1 0

0 1 0 1 0 0 1 0 1 0

0 1 1 1 1 0 1 1 1 0

1 0 0 0 0 0 0 0 1 0

1 0 1 0 1 0 0 1 1 0

1 1 0 1 0 0 1 0 1 0

1 1 1 1 1 0 1 1 1 1 P 359

Page 68: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 68

6 - 68Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• This approach required only four states, whereas the first approach required eight.• The first approach : uses three flip flops.• The second approach : uses only two flip flops.

• This is not of a difference.

q*

q x = 0 x = 1 z

A A B 0

B A C 0

C A D 0

D A D 1

P 359

Page 69: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 69

6 - 69Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• The next step in the design process is to reduce the state table, if possible, to one with fewer states.• That is beyond the scope of this book.

• For the first approach, the state assignment has already been made. (flip flops q1, q2, and q3)

• The flip flop inputs require no logic for D flip flops.D1 = q2 D2 = q3 D3 = x

• For JK flip flops.J1 = q2 J2 = q3 J3 = xK1 = q’2 K2 = q’3 K3 = x’

• For either type of flip flop, one AND gate is needed for z:z = q1q2q3

• For the second approach,D1 = q1

* = xq2 + xq1 or J1 = xq2 K1 = xD2 = q2

* = xq2’ + xq1 or J2 = x K2 = x’ + q1

x = q1q2

Page 70: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 70

6 - 70Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

CE7. A system with one input x and one output z such that z = 1 at a clock time iff x is currently 1 and was also 1 at the previous two clock times.

• Another way of wording this same problem is

CE7#. A Mealy system with one input x and one output z such that z = 1 iff x has been 1 for three consecutive clock times.

Page 71: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 71

6 - 71Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• Two approaches for this problem.• For the first approach : only store the last two inputs. (rather than three for

the Moore model)

• For the second approach : store in memory the number of consecutive 1’s, as follows

(A - none, B - one, C - two or more)• That is sufficient information since the output is 1 iff there were previously two

or more 1’s and the present input is a 1.• If the present input is a 0, the next state is A.

q1* q2* z

q1 q2

x = 0 x = 1 x = 0 x = 1

0 0 0 0 0 1 0 0

0 1 1 0 1 1 0 0

1 0 0 0 0 1 0 0

1 1 1 0 1 1 0 1

P 361

Page 72: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 72

6 - 72Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

q* z

q x = 0 x = 1 x = 0 x = 1

A A B 0 0

B A C 0 0

C A C 0 1 P 361

Page 73: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 73

6 - 73Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• Basically, the Moore model output is the same as the Mealy, but delayed by one clock period.• The Mealy model has a glitch when x is still 1 in state C.• The Moore model does not have any false outputs, since z depends only on the

flip flops, all of which change at the same time.

A B C C C C C C A B C A B C C A B

A B C D D D D D A B C A B C D A B

P 362

Page 74: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 74

6 - 74Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• Example 7.8• Design both a Moore and a Mealy system with one input x and one output z

such that z = 1 iff x has been 1 for exactly three consecutive clock times.

x 0 1 1 1 1 1 1 1 0 1 1 0 1 1 1 0 1z-Mealy 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0*

z-Moore 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0

• For the Mealy model, (need five states)A - none, that is, the last input was 0B - one 1 in a rowC - two 1’s in a rowD - three 1’s in a row E - too many (more than 3) 1’s in a row

Page 75: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 75

6 - 75Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• The state diagram begins like that of the previous solution.

• The implementation of this system requires three flip flops. P 363

Page 76: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 76

6 - 76Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• For the Moore model,• A state D to indicate exactly three 1’s.• From there, it goes to E on another 1, indicating too many 1’s.• State F is reached on a 0 input; it is the state with a 1 output.

q*

q x = 0 x = 1 z

A A B 0

B A C 0

C A D 0

D F E 0

E A E 0

F A B 1

P 363

Page 77: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 77

6 - 77Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• Example 7.9• Design a Mealy system whose output is 1 iff the input has been 1 for three

consecutive clocks, but inputs are nonoverlapping.

x 0 1 1 1 1 1 1 1 0 1 1 0 1 1 1 0 1z 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0

• As in CE7, only three states are needed.

P 364

Page 78: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 78

6 - 78Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• Example 7.10• Design a Mealy system where the inputs are considered in blocks of three.

• The output is 1 iff the input is 1 for all three inputs in a block• That 1 output cannot occur until the third input is received.

x 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1z 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0

• where the blocks are indicated by extra space.

q* z

q x = 0 x = 1 x = 0 x = 1

A C B 0 0

B E D 0 0

C G F 0 0

D A A 0 1

E A A 0 0

F A A 0 0

G A A 0 0 P 364

Page 79: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 79

6 - 79Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• But that creates two extra states.

• Note that the paths out of C and of E are denoted as X/0.• Input is don’t care.• That path is followed and the output is 0.

• Notice that the next state and output sections of the last three rows of the state table are identical. P 365

Page 80: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 80

6 - 80Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• Example 7.11• Design a Mealy system whose output is 1 for every third 1 input.

• The initial state, A, is used for no 1’s or a multiple of three 1’s.• When a 0 is received, the system stays where it is, rather than returning to the

initial state, since a 0 does not interrupt the count of three 1’s.

x 0 1 1 1 1 1 1 1 0 1 1 0 1 0 1 0 0 1 0 1z 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0

P 366

Page 81: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 81

6 - 81Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• Example 7.12

CE8. Design a Moore system whose output is 1 iff three consecutive 0 inputs occurred more recently than three consecutive 1 inputs.

x 1 1 1 0 0 1 0 1 1 1 0 0 1 0 0 0 0 1 1 1 1 0 1

z ? ? ? 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0• The initial state S1

P 366

Page 82: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 82

6 - 82Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

P 367

Page 83: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 83

6 - 83Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• Example 7.13• Design a Mealy system whose output is 1 iff there have been exactly two

1’s followed by a 0 and then a 1.a. Assume overlapping is allowed.b. Assume overlapping is not allowed.

• When a.

x 0 0 1 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1

z 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0

• The underlines indicate the 1101 pattern.• The double underline is not an acceptable pattern since it does not begin

with exactly two 1’s.

Page 84: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 84

6 - 84Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

A

B

C E

0/0

1/0

1/0

0/0 1/1

nowhere, lastinput = 0

two 1’s

0110

One 1

P 368

Page 85: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 85

6 - 85Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

P 368

Page 86: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 86

6 - 86Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• There are two interpretations to consider in the nonoverlapping case.• The first is shown as b-1.

• A second interpretation(perhaps a little far-fetched).

x 0 0 1 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1

b-1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0

x 0 0 1 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1

b-2 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0

Page 87: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 87

6 - 87Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

P 369

Page 88: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 88

6 - 88Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• Example 7.14CE11. Design a Moore model bus controller that receives requests on

separate lines, R0 to R3, from four devices desiring to use the bus.

• It has four outputs, G0 to G3, only one of which is 1, indicating which device is granted control of the bus for that clock period.

• The low number device has the highest priority, if more than one device requests the bus at the same time.

• The bus controller has five states:

A: idle, no device is using the busB: device 0 is using the busC: device 1 is using the busD: device 2 is using the busE: device 3 is using the bus

Page 89: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 89

6 - 89Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

P 370

Page 90: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 90

6 - 90Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• The system remains in the idle state if there are no requests.• It goes to the highest priority state when there are one or more requests.

• If the idle period is not necessary, the state diagram becomes much more complex.

q q* G0G1G2G3

R0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

R0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

R0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

R0 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1

A A E D D C C C C B B B B B B B B 0 0 0 0

B A E D D C C C C B B B B B B B B 1 0 0 0

C A E D D C C C C B B B B C C C C 0 1 0 0

D A E D D C C D D B B D D B B D D 0 0 1 0

E A E D E C E C E B E B E B E B E 0 0 0 1

P 371

Page 91: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 91

6 - 91Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• A preemptive controller.• Where a high-priority device will take control from a lower priority one, even

if the lower priority one is still using the bus.P 371

Page 92: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 92

6 - 92Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

P 372

Page 93: 6 - 1 Chapter 7 The Design of Sequential Systems

6 - 93

6 - 93Chapter 7 The Design of Sequential Systems

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS

• Although the state diagram for this version would require the same 20 paths as was needed for the second version, the logic is much simpler.• The condition for going to state B, from each state is 1XXX(R1), to C is

01XX(R1’R2), to D is 001X(R1’R2’R3), and to E is 0001(R1’R2’R3’R4).

q q* G0G1G2G3

R0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

R0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

R0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

R0 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1

A A E D D C C C C B B B B B B B B 0 0 0 0

B A E D D C C C C B B B B B B B B 1 0 0 0

C A E D D C C C C B B B B B B B B 0 1 0 0

D A E D D C C C C B B B B B B B B 0 0 1 0

E A E D D C C C C B B B B B B B B 0 0 0 1

P 372