An approach to microprogram optimization through bit dimension reduction in a given control store specification

An approach to microprogram optimization through bit dimension reduction in a given control store specification

Comput & Elect Engng Vol 6, pp 93-97 © Pergamon Press Ltd, 1979 Pnnted m Great Britain 004%790617910601-.0093150200/0 AN APPROACH TO MICROPROGRAM OP...

372KB Sizes 6 Downloads 25 Views

Comput & Elect Engng Vol 6, pp 93-97 © Pergamon Press Ltd, 1979 Pnnted m Great Britain

004%790617910601-.0093150200/0

AN APPROACH TO MICROPROGRAM OPTIMIZATION THROUGH BIT DIMENSION REDUCTION IN A GIVEN CONTROL STORE SPECIFICATIONS" SUNIL R. DAS,:~ ZEN CHEN and C. L. SHENG Institute of Computer Science, National Chiao Tung University, Hsinchu, Tatwan, Republic of China (Received 14 September 1978; received for publication 7 February 1979)

Abstract--Given a particular ROM specification,and word dimension, control memory can be reduced by reducing the bit dimension, at the expense of flexibihty.This problem of bit dimension reduction of control memory in a mlcroprogrammeddigital computer was first considered by Schwartz. The problem was later reformulated by Grasselli and Montanari m the framework of switching theory, reducing the mare mmlmtzationproblem to a ~et coveringproblem of the prime imphcant type. Starting with the same basic formulaUon as of Grasselh and Montanari, Das et al. subsequently developed an approach that helps to arrive at a solution with less computation in general. The present paper investigates the problem of bit dimension reduction m a control memory specificationbased on the switchingtheory formuiaUonof Das et al., and developsa simpldiedmethodologyfor a good "engineeringreduction", or, if necessary,to arrive at a minimal soluhon.

I. INTRODUCTION The application of microprogramming in present day computers is very rapidly increasing, and evidence indicates that microprogramming will play a major role in the next generation of computer systems. Microprogram optimization is one way to increase efficiency, and optimization can be crucial in some applications. Optimization refers to a reduction or minimization of execution time of microprograms, or of the control store size, B x W, where W represents the word dimension of the control store which is the number of words of control store required or used for a certain application, and B represents the bit dimension which is the number of bits per word of control store. The various optimization strategies[I-7] can be broadly classified under four categories: bit dimension reduction, word dimension reduction, state reduction, and heuristic reduction. An analysis and comparison of the above techniques reveal that though microprograra optimization is an extremely important aspect, it is unfortunate that the efforts, probably with only a few exceptions, represent strategies which are either infeasible or undesirable in a practical environment. Much of the efforts on optimization has been devoted to obtaining the absolute minimal solutions rather than good "engineering reductions". Whether the reduction is being performed with respect to the bit dimension, the word dimension, or the number of states, the optimum solution is obtained by techniques that use exhaustive enumeration. These techniques require a great deal of effort, and there is no guarantee that any significant reduction can ultimately be realized. It is thus doubtful that an optimum solution can be justified even if the niicrocode produced is frequently executed. The use of heuristics can decrease this overhead to some extent. The heuristic reduction techniques appear to be more useful in the sense that, though they do not guarantee optimality of solutions, they can provide some reduction with little effort. Thus, for the majority of the techniques, much further work remains to be done before any practical applications can be foreseen. Given a particular ROM specification, and word dimension W, control memory can be reduced by reducing the bit dimension B, at the expense of flexibility. This problem of bit dimension reduction of control memory was first considered by Schwartz[l] who proposed the following model of a ROM. The ROM is an array of storage elements consisting of W words (or microinstructions) of B bits each, where each word specifies one or more elementary operations (or microoperations) of the control part which can be executed in parallel. Since the ~'Thisresearch was supported in part by the National Science Council of the Republic of China. ~Sunil R. Des was formedy with the Del~artment of Electrical Engineering, Faculty of Science and Engineering, University of Ottawa, Ottawa, Ontario, Canada, and with the Institute of Radiophysics and Electronics, University of Calcutta, Calcutta, West Bengal, India. 93

94

S R Das et al

sequencing of ROM words is of no concern, it was assumed that all B bits are used for specifying microoperations. Schwartz, although admitting that the problem is that of minimizing B, has been unable to provide a scheme achieving th~s result, and has instead given an exhaustive search algorithm for finding a partition of the subcommands set into the minimal number of groups. The problem was later reformulated by Grasselli and Montanan[2] in the framework of switching theory, reducing the main minimization problem to a set covering problem of the prime implicant type. Starting with the same basic formulation as of Grasselh and Montanari, Das et al. [3] subsequently developed an approach that solves a number of small cover tables rather than a single big one, and arrives at a solution with less computation m general. The present paper investigates the problem of bit dimension reduction m a control memory specification based on the switching theory formulation of Das et al., and develops a simplified methodology for a good "engineering reduction", or, ff necessary, to arrive at a minimal solution. 2 BACKGROUND

In the Schwartz model, the ROM is considered an array of storage elements comprised of W words of B bits each, where each word specifies one or more microoperations of the control part which can be executed in parallel. The sequencing of ROM words is of no concern. It as hence assumed that the words do not contain address fields, and all B bits are used for specifying microoperations. Table 1 gives an example of a ROM specification. Table 1 A ROM speoficatmn Words

M~crooperattons

1 2 3 4

a,b,c,d,e,f ~,g,h,t a,b,h,t,l d. h k

5

Lh

There may be several ways of coding the B bits to reduce size. However, one important consideration, flexibility, must be kept in mind: the control microprogram be readily modifiable. There are two extreme possibilities while encoding the ROM [2-4]. (1) Each bit of W is used to encode one microoperation. The number of distmct microoperations will generally be very large compared to the actual number of microoperations in any word. Hence this method is extremely inefficient with regard to the bit dimension B. Using this method, the ROM specification of Table 1 will reqmre B = I 1. The advantage in this case is maximum flexibility. Since no combinational circuit is required at the output of the ROM, the ROM contents can be arbitrarily changed. (2) The ROM words are minimally encoded. In the example of Table 1, since there are five unique words, B = [log2 5] = 3 would suffice to specify any one word. A combinational network at the output will be required then to decode the 3-bit specification, and provide the desired signals for individual microoperations. In general, this combinational network can be very large and quite complicated. In fact, all of the advantages of mlcroprogramming are lost. The ROM is used only to sequence words in the microprogram, since the ROM word address is already an encoding of the corresponding word. There is also a substantial loss of flexibility. Since the combinational circuit is already fixed, no new words can be generated, and any changes m the microprogram would have to result in a word already in the system [4]. In overcoming these difficulties, Schwartz takes a midway position. The bit dimension is partitioned into different groups. Each group represents a number of microoperations, no two of which occur together in the same word. The essential feature, however, is that each group represents only one microoperation in any given word. Unfortunately, Schwartz was unable to provide a scheme to minimize B. He instead gives an algorithm that partitions the subcommands set into a minimal number of groups. Grasselli and Montanari subsequently pointed out that a minimum group solution does not necessarily imply a minimum B solution. For the ROM in Table 1, the minimum group solution of Schwartz is: {a}, {b, g}, {c, j, k}, {d, i}, {e, h}, {jr}. The

An approachto m~croprogramoptimization

95

number of groups is 6, and B = 10 (each group also contains the microoperation NO OP). The solution given by Grasselli and Montanari for the problem is: {a}, {b}, {c}, {d, g, j}, {e}, {f, i, k}, {h}. The number of groups in this case is 7, and B = 9. Grasselli and Montanari reformulated the Schwartz model for minimizing B in the framework of switching theory. The main minimization problem was reduced to a set covering problem of the prime implicant type. The ROM words Wa, Wb. . . . . Wt are considered as sets of microoperations: W a .= {Sal , Sa2 . . . . .

Sam},

Wb = {Sbl, Sb2. . . . . Sbn}, W, = {S,~,S,2..... S,,}.

A compatibility relation is defined among the microoperations as follows: two microoperations S, and $I are compatible if S, E Wh implies Sj~ Wh, for all h. Otherwise, S, and S~ are incompatible[6, 8]. Note here that compatibility or incompatibility is not an equivalence relation. A compatibility class (CC) of microoperations C, is a class whose members are all pairwise compatibles. A maximal compatibility class (MCC) is a compatibility class to which no microoperations can be added without violating pairwise compatibility among members of the class. Similarly, a maximal incompatibility class (MIC) of microoperations can be defined. A minimal solution then is a collection of compatibility classes A = {C,~,C,2..... C,h} such that (1) every microoperation S, is contained in at least one compatibility class in A; and (2) the quantity B =E~=~ [Iog:(#C,n + I)] is minimal, where #C,, denotes the number of microoperations in class C,,, and [I] denotes the least integer > L A I is added to each #C,, in order to include the microoperation NO OP. B is referred to as the cost of the minimal solution, whereas the quantity w, = [log2(#C, + I)] as the cost of class C,. Grasselli and Montanari show that the only classes that need be considered for a minimal solution are prime compatibility classes defined as follows: (I) C, is nonmaximal and #C, = 2h - I, h = I,2 .... ; and (2) C, is maximal and #C, # 2k, k = l, 2 ..... The minimal solution is next obtained by solving a covering table of the prime implicant type. The table has a column j corresponding to every microoperation Sj and a row i corresponding to every prime class C, [9]. The cost of a row i is the cost of the corresponding class C,. The objective is to select rows so that the total cost is minimized, while at the same time every column of the table is covered. To solve this covering problem the authors[2] present a well known technique of integer programming. The proposed algorithm also takes advantage of some special characteristics of the covering table to diminish the efforts needed for obtaining a solution. Das et al. start with the same basic formulation as of Grasselli and Montanari; however, in order to minimize the computational requirements, they start directly with the set of maximal compatibility classes (MCC's) of microoperations whose number is usually small. The basic procedure is as follows. Given a set of microoperations {St, $2. . . . . Sk} and a set of MCC's {Urnl, Cm2 Cmn} obtained from the set of microoperations, a table is constructed by writing SI, Sz ..... Sk in a row and by entering C,,j below S, if S, ~ C,,r This table is called a CM cover table which is analogous to a cover table used in the simplification of switching functions [9]. The set of MCC's corresponding to Table 1 are: Cl={a,g,k}, C2={b,g,k}, C3={c,j,k}, .....

C4={d,g,j}, C,={d,i}, C6={e,g,j,k}, C7={e,h}, Cs={e,i,k}, C9={f,g,j,k}, C,o={f,i,k}. The corresponding CM cover table is given in Table 2. Table 2. CM covertable a*

b*

c*

d

e

CI

C~

C3

C4 C~

C6 C7 C8

f

g

C9 Ca C~o C2 C4 C6 C9

h*

C7

z

j

C5 C3 Cs C~ Clo C6 C~

k

CI C2 C3 C6 Cs C9 Cio

96

S R DAS et al

The MCC's that appear alone m some columns of the CM cover table are called globally essential; the corresponding microoperations heading these columns are called globally distinguished microoperations, which are identified by means of asterisks (*) over them. If Ca be a globally essential MCC in a column headed by a mlcrooperation S,, then ewdently Cm or a subclass of C,, containing S, must appear in all the solutions of a CM cover table The CM cover table ~s next solved and all the irredundant solutions are obtained. The following irredundant solutions are obtained from the CM cover table in Table 2:(11 C)C,.C~C4CTCto. (21 CIC2C3C4C7C8C9, (3) CIC2C3C.~C7Clo, (4) CIC2C3C5C7C9. These solutmns are irredundant because if any class is dropped from any solution, the solution ~s no longer vahd in that at least one mtcrooperation will not be covered. The following procedure ~s then carried out for each irredundant solution Ij. A table called a solution CM cover table ~s constructed slmdar to the CM cover table, considering only classes belongmg to II. The table corresponding to the solutton C~C2C3C4C7C~o is shown in Table 3. In a solution CM cover table, m addition to the globally essential MCC's, there may be other MCC's that appear alone in some columns. These are termed locally essential MCC's, and the correspondmg microoperations are called locally distinguished microoperations, identified by asterisks underneath them. Table 3 indicates, for example, that microoperation a can be covered only by C~ or a subclass of C~ containing a. Also, microoperations g, j, k can be covered by more than one MCC. To find the different covers, a reduced table lS constructed (Table 4). This table is solved and lrredundant soluttons C~C3, C~C4, C,_C3, C2C4, C3C4, and C4C~0 are found. For each of these solutions the following procedures are adopted. Suppose it is decided to cover g, j, k by C~ and C4. Then retaining g, t, k in C3 and C4, and deletmg thetr appearance from all other MCC's, the following solutions are obtained: {a}, {b}, {c,j,k}, {e,h}, {d,g}, {f, i}; {a}, {b}, {c,k}, {e,h}, {d,g,j}. {f,i} After going through all the iterations, the minimal solution is finally obtained. The essential approach here ~s thus to solve a number of small cover tables rather than a big one. It is conjectured that the overall effort required to determine the mimmal solution IS reduced m general Fable 4 Reduced solution (M co~tr table

Table 3 SolutionCM cover table a*

b*

c*

d,

e.

]',

g

h**

l,

j

/~

~ .

C,

C4

C~

Cz C~ C,o

.

.

.

.

.

.

.

.

.

C ('~

! .

.

.

.

.

.

.

.

.

.

.

.

,

.

i-, (

C,.

3 REDUCTION METHODOLOG'~ We now develop a simplified methodology for achievmg reduction of memory bit dimension in a given control store specification, starting with the set of MCC's of microoperatlons. Let m denote the number of microoperations in the largest maximal incompatibility class (MIC). It is known[6,8] that there always exist m compatible classes whose set union will cover all microoperations. Also, the number of groups in a minimal group solution corresponds to the number m of microoperations in the largest MIC. It has also been shown by Srtmant et al. [61 that in a solution with m groups, the cost B is opttmum if the solutton is a partition with m blocks of which m - 1 blocks contain one microoperation each, whereas the remaining block contains the rest of the microoperations n - m + 1, n being the total number of m~crooperations. Further, such an optimum cost partition is not feasible if k =< n - m, where k ~s the number of microoperations in the largest MCC, n and m being as defined before. Considering, for example, the ROM specification of Table 1, we have k = 4, n = 11, and m = 6. (The ~et of MIC's can be readily found from Table 1.) Now since k = 4 < n - m = 11 - 6 = 5. there cannot be any feasible partition of six blocks with cost Boot = m - 1 + [log2 (n - m + 2)] = 8. This means that for the ROM specification of Table 1, there can be no solution of cost B = 8. Equtpped with this information, we can present a simplified methodology for an "engineering reduction" as follows. (1) Given a control store specification, find the set of MCC's of microoperattons. Find also the largest MIC of microoperations. (2) Find Boot = m - 1 + [log2 (n - m + 2)1, and check if there

An approach to microprogramoptimization

97

can be any solution feasible with cost Bopt. (3) Find one of the irredundant solutions/i of the CM cover table following the procedure of Das[9]. Note also globally essential MCC's, if any, and corresponding globally distinguished microoperations. (4) Form a solution CM cover table with classes o f / I and find the minimal cost solution corresponding to/s following the procedure of Das et al. [3]. The solution thus obtained, if not minimal considering the overall problem, will be very close to a minimal solution. In case the solution obtained from/~ is only near-minimal, to find a minimal solution we may have to try other irredundant solutions of the CM cover table. It is guessed that a minimal solution can, in general, be obtained in only few trials. Considering our previous example we see that if we decide to cover g, j, k by C4 and C1o, we get a solution: {a}, {b}, {c}, {e, h}, {d, g, j}, {]', i, k} whose cost B = 9. Since there cannot be any feasible solution with cost B = 8, the above solution with cost B = 9 must be a minimal solution. REFERENCES 1. S J Schwartz, An algorithm for minimizingread only memones for machine control. Proc. lOth Ann IEEE Syrup. Switching and Automata Theory, 28-33 (1968). 2. A. Grasselli and U. Montanari, On the minimizationof READ-ONLYmemoriesin mlcroprogrammeddigital computers. IEEE Trans. Comput C-19, Ill1-1114 (Nov. 1970). 3. S. R. Das, D. K. Banerjl and A. Chattopadhyay, On control memory minimization in microprogrammed digital computers. 1EEE Trans. Comput. C-22, 845--848(Sept. 1973). 4. T. Agerwala,Microprogramoptimization: a survey. IEEE Trans. Comput. C-25,962-973(Oct. 1976). 5. C. Montangero,An approach to the opUmalspecificationof read-onlymemoriesm mlcroprogrammeddigital computers. 1EEE Trans. Comput. C-23, 375-389(Apr. 1974). 6 P K. Snmani, B. P Slnha and A. K. Choudhury, On certain inveshgatlons on control memory minimizaUon in microprogrammeddigital computers J. Instn. Electron. Telecom. Engrs. 23, 542-548(Sept 1977). 7 M. Tsuchiya and M J. Gonzalez, Toward optimization of horizontal mlcroprograms. IEEE Trans. Comput. C-25, 992-999 (Oct. 1976). 8 M.C. Paull and S. H. Unger, Minimizingthe number of states m incompletelyspecifiedsequential switchingfunctions. IRE Trans. Electron Comput EC-g,356-367(Sept. 1959) 9. S. R. Das, An approach for simplifyingswitching functions by utilizing the cover table representation, IEEE Trans. Comput. C-20, 355-359(Mar. 1971).