CS E6831 04f NOTES S. H. Unger

CLUSTERING METHOD FOR OPTIMIZING STATE ASSIGNMENTS

(Based on: Armstrong, D. B., "A Programmed Algorithm for Assigning Internal Codes to Sequential Machines", IRE Trans. Elecron. Computers, vol. EC-11, No. 4, pp. 466-472, Aug., 1962 )

Try to choose state assignments that maximize the number of adjacencies among 0- and 1-points of the Y-functions. The assumption is that, if there are many such adjacencies, the functions are likely to be simpler. But no guarantees!

Three criteria are used to assign scores to various assignments. These are based on NS (nest-state) entries in the flow table. Assume k y-variables will be used. Note that N(r, I) is the next-state entry in row-r, input-column-I.

1. If, for input-I, N(i, I) = N(j, I), then making i and j adjacent assures k adjacencies.

Example: In the table below, the column-11 entries in rows-1 and 3 are both 2. So if the y-states assigned to rows 1 and 3 differ in only one variable, we are assured k=2 adjacencies.

2. If, for some input I, the entries N(i, I), and N(j, I) are both i or j, but not the same, then making i and j adjacent assures k-1 adjacencies.

Example: In column-10, the NS entries in rows-1 and 4 are 1 and r. So giving 1 and 4 adjacent y-states assures k-1=1 adjacency. In column-11, the NS entry for row-2 is 3, and for row-3 is 2, so giving 2 and 3 state assignments differing in only one y-variable assures us of k-1=1 adjacency.

3. If, for some row of the flow table, NS entries i and j appear in adjacent columns (i.e., columns differing in one input variable) then making i and j adjacent, assures k-1 adjacencies.

It is important to understand that adjacent 0's count the same as adjacent 1's and are just as useful for making functions realizable with fewer gate inputs.

Construct a pair chart for the flow-table rows, and indicate the total number of assured adjacencies for each pair as indicated by 1-3 above. (See page 158 of the text, Fig. 6.2, for an example of a pair chart, used for a different purpose.) Then find a state assignment that maximizes the total score.

Example:

AB

00 01 11 10

----------------------

1 2 4 2 1

2 4 2 3 3

3 3 1 2 4

4 3 3 3 4

----------------------

Scoring chart

In the pair-chart below, the entry in row-3, column-2 is 2. This gives the total number of assured adjacencies (according to the 3 rules above) if flowtable rows 3 and 2 are given state assignments that are "adjacent" in the sense that they differ in only one y-variable. The "score" of 2 is arrived at by assigning 1 point, according to rule-2 for the 3 and 2 NS entries in rows-2 and 3 of column-11. Another point is added for the NS entries of 2 and 3 in adjacent columns of row-2.

1

---

| 3 | 2

--------

| 3 | 2 | 3

------------

|1 | 6 | 8 | 4

-------------

Clearly we should choose a state assignment that makes 4 adjacent to 2

and 3, since the score for 3-4 is 8 and that for 2-4 is 6, the two highest scores by far.

Assignments are shown below on 2-dimensional K-map. We might, for example, set y1=0 for left-column containing rows 1 and 3, and y2=0 for the top row, containing 1 and 2.

1 2

3 4

The total score would be 2+3+6+8=19

Alternatives are 1 2 with score 2+1+2+8=13

4 3

and 1 3 with a score of 3+1+2+6=12

4 2

The actual costs in gi (assuming double-rail inputs for all variables)

is, respectively, 28, 33, and 40, which does track the scores.

We could also include the output function in the scoring. This is left as one of the HW problems.

This procedure, for all but the simplest cases, is not one we would enjoy executing by hand, but it is not difficult to program, and execution times are not unreasonable for many problems.

.