ECE 3504 Digital Design 1 gggg

Report 6 Downloads 102 Views
ECE 3504 Digital g Design g 1 Section 6e: Dense State Assignments

The Design Process Read the statement of the problem. A. Settle the requirements of the specification. B. Determine the appropriate model. II. Model the system. A. Create a state state-transition transition diagram. B. Create a state-transition table. III. Eliminate redundant states. IV. Make a state assignment. A Apply Armstong A. Armstong’ss method to obtain maximal adjacencies OR B. Use a one-hot code state assignment V. Realize the circuit. A Select A. S l the h flflip-flop fl type. B. Use the appropriate excitation table to derive logic equations. C. Draw the circuit diagram for the logic equations. D. Simulate the circuit to judge its effectiveness. E. Evaluate the cost and speed of the realization. I.

State Assignments y

Now that we have a minimal table, we must make a state assignment.

y

The circuit must have enough flip-flops flip flops to assign a unique code to each state.

Dense State Assignments y

To minimize the number of flip flip-flops, flops, recall that n state variables are sufficient to generate 2n different binary codes. codes

y

Let x be the number of states in the minimal i i l state table. bl IIn a “d “dense”” state assignment, implementing the state machine requires r flip-flops, where: r = ⎡⎡logg2 x⎤⎤

y

⎡x⎤ is the ceiling of x – the smallest integer greater than or equal to x. x

Dense State Assignments y

Instead of making an arbitrary state assignment or haphazardly trying different assignments, we will use a strategy that tries to maximize the number of pairs of adjacent logic values in the Karnaugh maps that will ill produce d the h state and d output equations.

y

Our hypothesis is that maximizing the number of adjacent pairs of ones and zeros in the maps p will tend to group those logic values together, thereby simplifying the logic equations. equations

Dense State Assignments Both maps have the same numbers of 1s and 0s, but the map p on the right g has a simpler p implementation. Note the adjacency of its 1s.

AB

CD

CD

00 01 11 10

00 01 11 10

00 0

0

1

0

00 0

0

1

0

01 0

1

0

0

01 1

0

0

0

11 1

0

0

0

11 1

0

0

0

10 0

0

0

1

10 0

0

1

0

AB

Dense State Assignments y

This method uses five quantitative rules. We will apply the rules to the minimized state table and use them to count the number of adjacent pairs of logic values that will occur in the Karnaugh maps if two states h have logically l i ll adjacent dj state codes. d

y

The adjacent pairs that the rules predict depend only on whether or not the two states in question have logically g y adjacent j codes. Theyy do not depend on what codes are assigned.

Notation y

y

y y

y

Let A, B, C, etc., be distinct states of the table, as represented by its rows. L t x1 and Let d x2 be b di distinct ti t input i p t combinations of the table, as represented by its columns. δ(A,x1) is the next state of state A for input x1. λi(A,x1) is the ith Mealy output of state A for input x1. ◦ If λ(A,x1) = 01, then λ1(A,x1) = 0, and λ2(A,x (A x1) = 1. 1 λi(A) indicates the ith Moore output of state A.

Rule 1 If δ(A,x1) = δ(B,x1), then r vertical adjacent j ppairs will occur if A and B receive adjacent state codes. What are we trying to find? Two states that have the same next state.

Rule 1 Consider the partial state table shown below: x1x2 00

01

A A / 11

E / 10

B

C / 11

B / 01

11

C C / 10

r=3

D B / 10 E

10

A / 11 NS / z1z2

Rule 1 y

y

y

In the previous state table, table state B’s next state for input x1x2 = 00 is B. State D’s next state for input x1x2 = 00 is also B. Therefore, states B and D have the same next state for the same input. If states B and D receive adjacent codes, we will obtain 3 adjacent pairs of logic values in the state variable Karnaugh maps, regardless of how B and D are made adjacent.

Rule 1 Suppose pp that an arbitraryy state assignment g gives g state B the code y1y2y3 = 111 and gives state D the code y1y2y3 = 110. The next state code Th d off state 111 for f input i 00 iis 111. The next state code of state 110 for input 00 is also 111. We can enter this information into the Karnaugh maps: y1y2y3 000 001 011

x1x2 00 01 11 10 00 01 11 10 00 01 11 10 00 01 11 10 00 01 11 10

010 100 101 111 110 y1 +

y2+

y3+

z1

z2

What if the states are assigned g different adjacent codes?

Applying the State Assignment Rules y

Since the number of adjacent pairs does not depend specifically on the state codes that we assign, we can count the number of adjacent pairs that occur for each of the rules if a given pair of states receives adjacent state codes before we actually make the assignment.

y

We can apply the state assignment rules to each pair of states in a state table and summarize the information i another in h mileage il chart. h W We will ill see an example once we have studied each of the state assignment rules.

Rule 2 If x1 and x2 are adjacent input codes, then r – 1 horizontal adjacent pairs will occur if δ(A,x1) and δ(A,x2) receive adjacent dj state codes. d What are we trying to find? The next states of a present state for adjacent input combinations.

Rule 2 Consider the partial state table shown below: x1x2 00

01

A A / 11

E / 10

B

C / 11

B / 01

11

C C / 10

r=3

D B / 10 E

10

A / 11 NS / z1z2

Rule 2 y

y

y

State B B’ss next state for input x1x2 = 00 is B. State B’s next state for input x1x2 = 01 is C. States B and C are therefore the next states of the same present state for adjacent input codes. codes If states B and C receive adjacent codes, then we will obtain 2 adjacent pairs of logic values in the state variable Karnaugh maps, maps regardless of how the designer makes B and C adjacent.

Rule 2 Continuingg with the arbitraryy state assignment g from the previous example, let’s give state C the code y1y2y3 = 101. State B already has the code y1y2y3 = 111. The next state code of state 111 for input 00 is 111. The next state code of state 111 for input 01 is 101. We can enter this information into the Karnaugh maps:

y1y2y3 000 001

x1x2 00 01 11 10 00 01 11 10 00 01 11 10 00 01 11 10 00 01 11 10

011 010 100 101 B

111

1

1

1

D

110

1

1

1

y1+

y2+

y3+

z1

z2

Rule 3 If δ(A,x1) = A and δ(B,x1) = B, or if δ(A,x1) = B and δ(B,x1) = A, then r – 1 vertical adjacent pairs will occur if A and B receive adjacent state codes. codes What are we trying to find? Two states that both have themselves as their next states states, or that both have each other as their next states.

Rule 3 Consider the partial state table shown below: x1x2 00

01

A A / 11

E / 10

B

C / 11

B / 01

11

C C / 10

r=3

D B / 10 E

10

A / 11 NS / z1z2

Rule 3 y

y y

State A A’ss next state for input x1x2 = 00 is A. State B’s next state for input x1x2 = 00 is B. States A and B therefore both go themselves for the same input. If states A and B receive adjacent codes, then we will obtain 2 adjacent pairs of logic values in the state variable Karnaugh maps, regardless of how the designer makes A and B adjacent. adjacent

Rule 3 Continuingg with the arbitraryy state assignment g from the previous example, let’s give state A the code y1y2y3 = 011. State B already has the code y1y2y3 = 111. The next state code of state 011 for input 00 is 011. The next state code of state 111 for input 00 is 111. We can enter this information into the Karnaugh maps:

y1y2y3 000 001

x1x2 00 01 11 10 00 01 11 10 00 01 11 10 00 01 11 10 00 01 11 10

011 010

C B D

100 101 111

1 1

1 0

1 1

110

1

1

1

y1+

y2+

y3+

z1

z2

Rule 4 In Mealy circuits, if λi(A, x1) = λi(B, x1) then one vertical adjacent pair will occur in column x1 on the Karnaugh map for output zi if A and B receive adjacent state codes. codes What are we trying to find? Two states that have the same output as compared bit output, bit-by-bit by bit.

Rule 4 Consider the partial state table shown below: x1x2 00

01

A A / 11

E / 10

B

C / 11

B / 01

11

C C / 10

r=3

D B / 10 E

10

A / 11 NS / z1z2

Rule 4 y

y

y

State A A’ss output for input x1x2 = 00 is z1z2 = 11. State B’s output for input x1x2 = 00 is z1z2 = 01 States A and B therefore have one matching output bit for the same input. (In this case, it’s z2.) If states A and B receive adjacent codes, then we will obtain 1 adjacent pair of logic values in the state variable Karnaugh maps, regardless of how A and B are made adjacent.

Rule 4 In our arbitraryy state assignment, g state A alreadyy has the code y1y2y3 = 011 and state B already has the state code y1y2y3 = 111. The output z1z2 off state 011 for Th f iinput 00 iis 11. 11 The output z1z2 of state 111 for input 00 is 01. We can enter this information into the Karnaugh maps:

y1y2y3 000 001 A

C B D

011 010

x1x2 00 01 11 10 00 01 11 10 00 01 11 10 00 01 11 10 00 01 11 10

0

1

1

111

1 1

1 0

1 1

110

1

1

1

100 101

y1+

y2+

y3+

z1

z2

Rule 4 In Moore circuits, if λi(A) = λi(B) then one adjacent j ppair will occur on the Karnaugh map for output zi if A and B are assigned adjacent dj state codes. d

Rule 4 In this case, states A and B have one matching output – z2. y Since Moore outputs have no input d dependence, d we do d nott countt the th single occurrence of Rule 4 for each input. Instead, we only count it once. y

00

x1x2 01 11

A

A

E

11

B

B

C

01

C

C

10

D

B

10

E

A

11 NS

10

z1z2

r=3

Rule 5 If A and B already have adjacent state codes, and if δ(A,x1) = C and δ(B 1) = D δ(B,x D, then h r – 1 verticall adjacent pairs will occur if C and D also already have adjacent state codes. Wait! What? If the point of this exercise is to make a state assignment, how can we know at this point which states already l d have h adjacent d state codes? d ?

Rule 5 If A and B already have adjacent state codes, and if δ(A,x1) = C and δ(B 1) = D δ(B,x D, then h r – 1 verticall adjacent pairs will occur if C and D also already have adjacent state codes. What are we trying to find? After making the assignment, two adjacent present states whose next states are also adjacent.

Rule 5 Consider the partial state table shown below: x1x2 00

01

A A / 11

E / 10

B

C / 11

B / 01

11

C C / 10

r=3

D B / 10 E

10

A / 11 NS / z1z2

Rule 5 y y

y

y

Suppose that states A and B have already received adjacent state codes. State A’s next state for input x1x2 = 01 is E. E State B B’ss next state for input x1x2 = 01 is C. Therefore, states C and E are the next states of two states that are already adjacent. If states C and E have already received adjacent state codes in our assignment, then we will obtain 2 additional adjacent pairs of logic values l iin the h state variable i bl K Karnaughh maps.

Rule 5 In our arbitraryy state assignment, g let’s give g state E the code y1y2y3 = 001. States A and B have adjacent codes. E and C are the h next states off A and d B respectively, i l and dE and C also have adjacent codes. We would already have filled this information into the Karnaugh map as a result of the assignment. Let’s see what happens:

E A

C B D

y1y2y3 000 001 011 010

x1x2 00 01 11 10 00 01 11 10 00 01 11 10 00 01 11 10 00 01 11 10

0

1

1

1 1

1 0

111

1 1

1 0

1 1

0 1

1 1

110

1

1

1

100 101

y1+

y2+

y3+

z1

z2

Applying the State Assignment Rules y

y

Create a mileage chart for the reduced state table. Each box of the mileage chart compares the two states on the left and bottom axes that meet at that box. box Apply the first four state assignment rules to determine the number of pairs of adjacent logic values that would result from each pair of states receiving adjacent codes. Record this information in the appropriate box.

Applying the State Assignment Rules x1x2 A B C F H

00 B / 11 C / 01 B / 11 C / 11 B / 11

01 11 C / 00 B / 11 F / 10 B / 10 A / 00 B / 11 F / 11 B / 00 C / 00 B / 11 NS / z1z2

10 B / 11 B / 01 F / 11 H / 00 F / 11

I

II

B III IV Legend C F H A

B

C

F

Applying the State Assignment Rules To make the state assignment, assignment use a Karnaugh map whose variables correspond p to the state variables of the function. y Placing a state in a particular b off the box h map assigns i that h code to the state. y Assign codes to the states to in a way that maximizes the total number of adjacencies found in the mileage chart. y

Applying the State Assignment Rules 6 B

4

I

4 0 3

III IV Legend

14 0 6

C

16 8 2 0 9

F

5

4 12 3

4

25

0 9 H

10 19

2 3

2 0 0 3 17

9 4 0 2 9

9

0

8 0 A

2 2 3 19

4 0 B

y1

0 1

01

11

0 7

8 2 C

2 F

y2y3 00

II

y2y3 10

00 y1

0 1

01

11

10

Applying the State Assignment Rules After making the assignment, assignment calculate the number of additional Rule 5 adjacencies j that result. y Repeat the last two steps to obtain b i severall candidate did state assignments. Choose the one with the greatest number of total adjacencies. If there is more than one, implement each one and select the one with the lowest cost. y

Applying the State Assignment Rules x1x2 A B C F H

00 B / 11 C / 01 B / 11 C / 11 B / 11

01 11 C / 00 B / 11 F / 10 B / 10 A / 00 B / 11 F / 11 B / 00 C / 00 B / 11 NS / z1z2

10 B / 11 B / 01 F / 11 H / 00 F / 11

y2y3 00 01 11 10 y1

0

H

A

1

C

B

F

Applying the State Assignment Rules y

There are multiple state assignments that will produce the same numbers of adjacent j pairs. How do we choose a good one? ◦ Choose Ch one that h populates l the maps with ones. ◦ Choose one that populates the maps with zeros. ◦ Obey the constraints of the flip-flop. This actually creates another design trade-off.