510.84 |no. 1034-1041 1980 icopy 3 inc. I //*/-6 Report No * UIUCDCS - R - 8 °-10^0 UILU-ENG 80 1740 AUTOMATIC CELL GENERATION FOR RECURRENCE STRUCTURES by Avinoam Bilgory and Daniel D. Gajski November 1980 NSF-OCA-MCS76-81686-000052 m • *i DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAIGN URBANA, ILLINOIS Digitized by the Internet Archive in 2013 http://archive.org/details/automaticcellgen1040bilg Report No. UIUCDCS-R-80-1040 Automatic Cell Generation for Recurrence Structures by Avinoam Bilgory and Daniel D. Gajski November 1980 Department of Computer Science University of Illinois at Urbana-Champaign Urbana, Illinois 61801 This work was supported in part by the National Science Foundation under Grant No. US NSF MCS76-81686. Abstract The cell generation module of a Gate-to-Silicon compiler is described. In this paper the cell generation is restricted to Boolean recurrence structures which appear to be the most difficult for syn- thesis. The fastest solution of the recurrence can be achieved by the semigroups approach in time proportional to the logarithm of the recurrence length. The solution is accomplished by a network that requires up to 4 different types of cells. Given a Boolean recurrence of any order, the cell generator module generates the Boolean equations of these cells. Index Terms: Gate compilers Logic-design automation Boolean-recurrence solvers Table of Contents Section Page 1. Introduction 1 2. Definitions and Basic Ideas 5 3. Network Structure for Serial Solution 13 4. Network Structure for Parallel Solution 21 5. The Programs and their Role 33 5.1. PREPRC 34 5.2. BINREC 42 5.3. MINIMZ 50 6. Examples 55 List of References 68 - 1 - 1» Introduction This document describes the cell generation module of a gate-to- silicon compiler. Such a compiler takes as an input a functional (behavioral) description of a logic module or unit and environmental and technologi- cal constraints. The former are examplified by time delay from inputs to outputs of the module or area of silicon to be occupied by the module in the final layout of the chip, and the later specify the rules of the process used to manufacture the chip like minimum line width, line capa- citances etc. The input description is in a high-level language in which only Boolean variables, scalars and arrays are allowed. For exam- ple, a 32-bit binary adder can be described as follows: S : C(0) = CIN DO I = 1,32 S 2 : C(I) = A(I)*B(I) + (A(I) + B(I))*C(I-1) END DO I = 1,32 S : S(I) = A(I) © B(I) © C(I-l) END - 2 - The above description can be used for variety of implementation styles. For example, if the delay time specified is relatively slow with respect to technology used the 32-bit adder will be implemented as a ripple-carry adder. If a faster version is required the look-ahead- carry adder will be used. For different delay times different number of bits will be looked ahead. Similarly, different layouts will be produced for different time delays. The compiler consists basically of four modules: 1. Boolean Analyzer partitions the input description into blocks with easily recognizable structure. For example, the statements S and S~ will be recognized as a recurrence system while the statement S~ is detected to be a vector operation. The Boolean Analyzer performs certain transformations on the initial description to achieve an optimal parti- tioning of statements. For example, if statements S~ and S_ are inside one DO loop the Boolean Analyzer will distribute the DO loop into two as given above. 2. Cell Generator consists of several submodules, each for one type of a block recognized by the Boolean Analyzer. Each submodule gen- erates the functional description of the basic cells used to synthesize the given block. For the statement S_ the basic cell is described by the equation S = A © B © C. On the other hand there will be three basic - 3 - cells generated for the recurrence block. Namely, CELL 1: P = A*B, Q = A + B CELL 2: P = PI + Q1*P2, Q = Q1*Q2 CELL 3: X - P + Q*X0 3. Silicon Compiler generates automatically the stick diagram of each cell and after compaction translates it into a layout using rules of technology chosen. Each cell can be manually designed, if desired. Such a manual design can be selectively applied to complex or large cells. The electrical and geometrical parameters of each cell like width, height and sizes of devices are passed to the next module. 4. Structure Generator attempts to obtain the best possible struc- ture for the given functional description and environmental parameters. It specifies the number of different cell types, the position of each cell in the final layout and the interconnections between the cells. In this paper the cell generation is restricted to recurrence structures which appear to be the most difficult for synthesis. A Boolean recurrence of any order can be solved serially in time propor- tional to the recurrence length n using n basic cells. The parallel solution on the other hand generates the result in time proportional to - 4 - log n with area proportional to n log n. In this case the recurrence solver may require up to four different types of cells which are called nodes in the text that follows. Section 2 describes the basic idea and introduces some definitions. Section 3 describes the well known serial solution to Boolean recurrences, while section 4 introduces the parallel solution. Section 5 is a description of the programs that generate the nodes' equations, then examples are brought in section 6. - 5 - 2. Definitions and Basic Ideas The basic ideas presented in this section appear in [1], and more detailed in [2], section 2. A recurrence system of the first order R(l) is a quadruple , where K = K.xK_x...xK is the Cartesian product of sets of coefficients, X = X.xX~x»»»xX is the Cartesian product of sets of vari- ables, x Q eX is the initial value and F = {f : X ♦ X | keK}. Usually, the set F is given in a compound form as the recurrence expression . For example, if A, B, C, D and X are sets of real numbers, then R.(l) = may have F : x. = (a.+b.x. ,)/(c.-M .x, .), with +, juxtaposition and / denoting addition, multiplication and division of real numbers. For Boolean recurrences which are the subject of this report, we will always have K = {0,1} for all p, Kpx ,F-> where F_: x. = a i +b i x i _i* In this case, +, juxtaposition and denote Boolean operators OR, AND and NOT. The functions in the set F can be extended to sequences of coeffi- cients, so that for all k ,k , , • • • ,k. eK, - 6 - f k k ... k (x) = f k (f k ... k (x)) i i-1 1 i i— 1' ' l Then the solution of the recurrence system R(l) of length n, denoted by R, is the sequence x = fi i ( x n) n k , • • . ,k. n' 1 n-1 k ..... ,k. n- 1 1 x l = f k 1 (x o ) for given k ,k ,,.«•, k.eK and x A eX. Using the associativity rule, we ° n n-1 1 ° get for all i, Ki is the recurrence semigroup. Every function (called mapping later in the text) f, is given a *i unique binary code, which is called the mapping code . The code assign- ment has a great influence on the evaluation complexity of f ,, . R i The solution of every recurrence system therefore can be decomposed into three subproblems: (a) The computation of the functional composition f, , = K i f, of o...of of for all i, ll, after it is transformed into a first order recurrence. A recurrence system of m-th order R(m) is a quadruple where x n ■ (x rt ,x . , . . . ,x , , ) is a vector of initial values and F = {f. : —0 0-1 -m+1 k X ♦ X | keK}. The transformation of R(m) into R(l) is done by grouping each m x.-s together, as well as each m f, -s, in the following manner: X — (X ,X , , t •< iX.jX, ) -m. m m-1 2 1 -2m " (x 2m ,X 2m-l'*" ,X m+2 ,X m+l ) -im " (x im ,X im-l ,, "' X (i-l)m+2 ,X (i-l)m+l ) and - 10 - 4 If If V V^V''V * > If' » If' ' m m— l L l m m— 1 ^ l —If If V If ~ ^ V * If' »•••#*!-' » If' ' ^ : 2m ,K 2m-^••• , m+2' m+1 K 2m K 2m-1 m+2 Vl — jf v if v ' V * V > ,,, >fv' » V ' im ,K im-l , * ,,,K (i-l)nH-2 ,K (i-l)nri-l im im-1 (i-l)nrf2 (i-l)nrfl where V = f k (i-l)nr+-l (i-l)nrfl V = f k ° f k (i-l)m+2 K (i-l)ntf2 (i-l)nrH - 11 - (i-l)uri-j K (i-l)m+j (i-l)m+j-l (i-l)m+2 *(i-l)m+l f k' = f k ° f k °---°f k °f k im-1 im-1 im-2 (i-l)m+2 (l-l)nri-l f k' = f k ° f k °--- of k of k K im *im K im-1 (i-l)m+2 K (i-l)mfl. Each individual component of x. is given by — 1m d-D^j - f Vn^ - (i - 1)m) for all j, Kj, is equal to the solution R of the transformed system R(l). In fact, the length of the transformed recurrence is reduced by a factor of m, but the tree-nodes of the transformed recurrence tend to be more com- plex, and unlike the first order recurrence, zero-level-nodes are intro- duced. Therefore, the solution of a high order recurrence is more com- plex, in general. - 13 - 3^ Network Structure for Serial Solution The serial network utilizes n identical nodes, which will be called serial-nodes . Figure 1 shows the structure of a serial network that produces the solution B<4,1> of a recurrence system B(l). x an ^ k. are Boolean vectors, in the general case, that is, x^eB.xB-x. • «xB , and k.eB.xB.x. . .xB where B. = {0,1}. — i 1 2 s J h f -• *4 -3 -2 2S 3 ^ *2 ^1 'So Figure 1. Serial network structure for B<4,1>. Adopting the terminology of finite state machines, the inputs from - 14 - the right side of each node define the present state. The next state is a function of the present state and the inputs entering the top of the node: —± ~ ^_-f , 2Lf_i'* For every present state and input there exists the next state. We can look at the input k_. as defining a mapping (called a function in section 2) f, from the set of states X to the same set of states: *i = ^i-i)- For k. t k we may have f, = f, . The total number of mappings is 1 J -i -j bounded. If the cardinality of k is denoted by C(k. ), then there are at cocp most 2 mappings. A serial-node for B„(l) (see section 2) and the three different mappings defined by the input bits a and b are shown in figure 2. Figure 3 shows the structure of a serial network that produces the solution B<4,2> of a second order recurrence system B(2), for which x. = - 15 - k i-l x. 1 (b) Figure 2. Recurrence system B (1): (a) Serial-node in the serial net- work, (b) Mappings. Example: B_(2) = and F_: x. = a-x.-x.- + The serial-node in the serial network and the mappings are shown in figure 4. Vi-r Any Boolean recurrence of order m>l can be transformed into a first order Boolean recurrence, by grouping each m nodes together (using the idea presented section 2). Figure 5 shows the result of applying this transformation on the serial network that produces the solution B<4,1>, - 16 - ^4 -3 *A m « *3 h m ' *l ^0 2-1 Figure 3. Serial network structure for B<4,2>. described in figure 3. The serial-node is surrounded with a dashed box. In fact, the resulting serial network can be viewed as producing the solution B<2,1>. Now -2i-l !: f k 21 _ 1 ( -2i-2 , -2i-3 ) -2i ' f k 2i ( -2i-r-2i-2 ) - 17 - i-1 i-2 a.b.= 1 l 00 01 10 11 X i-l X i-2 = 00 01 1 1 10 1 1 11 1 1 (a) (b) Figure 4. Recurrence system B o(2): (a) Serial-node in the serial net- work, (b) Mappings. f k 21 (f k 2i _ 1 ( -2i-2'-2i-3 ), -2i-2 ) f k 2i ,k 2i _ 1 ( -2i-2 ,X -2i-3 ) ' - 18 - h r *2 r -- i I f K4- Tl *4 5-1 f ' "I ^4 -3 -2 *1 Figure 5» Serial network structure for B<4,2> transformed into serial network structure for B<2,1>. Each two states grouped together are evaluated in parallel, reduc- ing the length of the recurrence by a factor of 2. However, it might not necessarily result in increasing the speed in general, because the part of the serial-node that evaluates f tends to be more complex. For example, transforming B„(2) into first order recurrence yields the following serial-node functions: - 19 - f : X 2i-1 a 2i-l x 2i-2 x 2i-3 + b 2i-l x 2i-2 which is the same as in the original serial network, and f ' : x 2i = a 2i x 2i-l x 2i-2 + b 2i x 2i-l " a 2i-l b 2i x 2i-2 x 2i-3 + (a 2i b 2i-l + b 2i b 2i-l )x 2i-2 which is somewhat more complex than f. The serial-node in the transformed network is shown in figure 6. - 20 - Figure 6» Transformed recurrence system B»(2): serial-node in the serial network. - 21 - 4. Network. Structure for Parallel Solution Depending on the time when x~ is available and the time when the solution x, , . . . ,x has to be stable, different networks can be con- —1 — n ' structed. Figure 7 shows the network that produces the solution B<8,1> in the fastest way, assuming the pre-node, tree-node and out-node have the same delay d, and x~ is available 4d after the k _ s. If the time constrains are released, such that the solution might be achieved in more time, or x~ is available earlier, a network with less tree-nodes can be constructed. However, the tree-nodes and the pre-nodes of this network are the same as those of the fastest network. Figure 8 shows an example of such a network, which will be called hybrid network, for it is a mixture of serial and parallel networks. In the extreme case, when x rt is available at the same time as the k.-s and the -H) — i solution can be stable after sufficient long time, then the serial net- work (described in section 3) results. Unlike the serial network, the number of different mappings here is C(k ± ) not bounded by 2 .If the number of the Boolean equations describ- ing F is b, then the number of states is bounded by s = 2 and the g number of mappings is bounded by s . For example, F in B (1) is described by one equation, therefore b=l, s=2 and s =4. - 22 - *S8 ^7 ^6 -5 ^4 -3 -2 -1 SK1K13SIKKS pre-nodes *■ tree-nodes out-nodes Figure 7. Parallel network structure for B<8,1>. As an example, figure 9 shows the tables and the nodes of the recurrence system B„(l). The multiplication table (figure 9-b) is evaluated by composing each pair of mappings (see figure 2-b). This composition will be called multiplication from now on. From the mappings table, we have: - 23 - pre-nodes: ^^ tree-nodes out-nodes •□ Figure 8. Hybrid network structure for B<8,1>. M or f. El* El - l, the parallel network contains gen- erally 4 different types of nodes: pre-nodes, tree-nodes and out-nodes as in the first order recurrence network, and a zero-level-node (see section 2). An example of a parallel network for a second order recurrence is shown in figure 10. The network in figure 10 can be viewed as a network that produces the solution B<4,1> for a first order recurrence system B(l). Essen- tially the same methods for solving the first order recurrence apply - 27 - ^3 ii7 ^6 -5 ^4 -3 -2 -1 SS^KiEi^Sigi p - nodes zero-level-nodes ► tree-nodes out-nodes Figure 10 » Parallel network structure for B<8,2>. here. In general, the zero-level-node for Boolean recurrence of order m can be constructed in two ways, as shown In figure 11, for m=4. The nodes in figure 11-a are the tree-nodes with some constant - 28 - (a) (b) Figure 11 * Zero-level-node for B(4): (a) Constructed from degenerated tree-nodes, (b) Constructed independently. inputs in their disconnected lines. Therefore their Boolean functions can be simplified. The nodes in figure 11-b are different from each other, and are called part 1, part 2 and part 3 of the zero-level-node (in general there are m-1 such parts). Their Boolean functions are defined by the conversion of the codes for the f, -s into the codes for the f, ,-s, as outlined in section 2. Th e recurrence system B_(2) is used as an example. The vari ous - 29 - tables and nodes are shown in figure 12. The mappings f . , f», f~ and f, are assigned the codes 00, 01, 10 and 11 respectively, the same as the input (p.,q.| in figure 12-a). The generation of the tables was done in the following order: 1. Zero-level conversion table (figure 12-b). Each pair of two possi- ble input mappings (f ,f ) (total of 16) were multiplied to form a two-mappings group (f of f ) t which is the output of the zero- level-node. No new mapping has been generated in this step. The result is 10 different groups, each containing two mappings: f f • ff f f • f f • f f • ff'ff-ff-ff* 11* 2* 1* 12' 2' 2' 13' 1- 3» i 3> 23' 4 3' 14' f 4'V 2. Multiplication table (figure 12-c). Each pair of groups (f.,f .), (f ,f ) (not necessarily distinctive) generated in step 1 were com- posed to form a group ((f ,,f )o(f ,f )). From now on, composition of groups will be called g-multiplication, to distinguish from com- position of mappings, which is called simply multiplication. Compo- sition of a mapping and a group will be called m-multiplication. Two additional groups have been created: fo>f, and f,,f.. Each of the additional groups was g-multiplied by the other groups the same way as the first 10 groups, but no new group has been generated. Also, no new mapping has been generated in this step. - 30 - In this step, groups are g-multiplied by groups , but it is suffi- cient to hold in the mappings table only the result of the m- raultiplication of a mapping by a group . Thus, evaluation of group g-multiplication from the table is done by using distributivity: (f,,f,)°(f ,f ) - f<°(f ,f ),f 4 °(f ,f ). i* y p* q' i p' q" j p' q' For example, (f 2 ,f 3 )°(f 4 ,f 3 ) - f 2 °(f 4> f 3 ),f 3 o(f ^f^) = f^fj. The evaluation of the nodes' Boolean equations was done after the tables were encoded, by using Quine-McCluskey minimization technique [3]. Generally, if a new mapping is generated during step 1 or step 2, it is appended to the mappings table. In the example above, no new map- ping was generated in either step, so the original mappings table has not been changed and still contains only the original four mappings. This fact and the assignment of the input bits as the mappings codes result in a pre-node which is the identity, i.e., e = a and f. = b., so in fact, in this case there exists no pre-node at all. - 31 - f l f 2 f 3 f 4 p i q i = 00 01 10 11 x x,= 00 01 1 1 10 1 1 11 1 1 x i = p iV-i + q i x o (a) f l' f l + f V f l f l' f 3 * f l' f 3 f 2' f l * V f l f 2 ,f 3 " f 3 ,f 3 f 3' f l >f 2> f l f 3 ,f 3 * f 2 ,f 3 f 4> f l * f 2* f l f 4' f 3 * V f 3 f l' f 2 * f l' f 2 f l> f 4 * f l' f 4 f 2' f 2 * f 2' f 2 f 2' f 4 * f 4> f 4 f 3 ,f 2 * t v t 2 f 3' f 4 * f l' f 4 f 4 ,f 2 ♦ f 2 ,f 2 f 4> f 4 * V f 4 p 2i e 2i-l f 2i q 2i = e 2i f 2i-l + f 2i f 2i-l (b) f l' f l f 2 .f, f l' f 2 f 2' f 2 f,,f 3 £ 3 ,f 3 f 2 ,f 3 £ 4' f 3 f r f 4 V f 4 f 3' f l V £ l f l £ 1 f l £ 1 f l f l f l f l f l f l f l h f l £ 2 f l f 2 f l £ 2 f l f 3 h f 4 f l f 4 f 3 f 4 f 3 f l f l f 2 f l £ 3 f l h h f 4 f l f l f l f 4 f l f 2 £ 2 f 2 f 3 f 3 f 4 f 4 f 4 f 4 f 3 f 4 P k = P i p 2j p 2j-1 + q i p 2j q k = p i q 2j q 2j-l + q i q 2j (c) Figure 12 . Recurrence system B o(2): (a) Mappings table and out-node function, (b) Zero-level conversion table and zero-level-node function. (c) Multiplication table and tree-node function. (continued on next page). - 32 - (d) p i q i P 2j l 2j p 2j-l q 2j-l Pi *1 i -• (e) (f) M Figure 12 (continued). Recurrence system B-(2): (d) Zero-level-node, (e) Tree-node, (f) Out-node. - 33 - _5 . The Programs and their Role Three programs participate in the nodes' equations generation: PREPRC, BINREC, and MINIMZ. Their sequence of running and the I/O files for each program are shown in figure 13. (Recurrence Boolean equations description) PREPRC BINREC MINIMZ Q Nodes' Boolean equations D Figure 13 . Programs' sequence - 34 - _5. 1_ PREPRC This program preprocesses the Boolean equations description. Its main input is the description of the Boolean equations in a table form, which will be clear from the examples. Additional inputs are the order of the recurrence, the number of Boolean equations in the recurrence function F, the cardinality of k_ and the starting state x*. Let the input bits be given each a binary value, independently. Then the certain image of the input bits is called a pattern . The out- put of the program is the file MAPS, of which the main part is the ini- tial mappings table, which defines the next state for every given present state and input pattern. If the number of Boolean equations is b, then the number of states is at most 2 . If the number of input bits is k, then the number of different input patterns is at most 2 . How- ever, two or more input patterns can define the same mapping, so the number of mappings is less or equal to the number of different input patterns. The input patterns corresponding to a particular mapping are called the natural assignment of that mapping, the natural assignments are also part of the program output. Additional outputs are the states' codes. Figure 14 shows the input to PREPRC and the initial mappings table for recurrence system B-(l). - 35 - L i-1 M-l a i b i a i b i a i b i a.b. i i 1 1 1 1 x i = a i + Vi-i (a) M-l 00 01 1- 1 2 3 1 1 2 2 1 2 1 1 2 +■ natural assignment «■ mapping # present state // (b) Figure 14 » Recurrence system B (1): (a) Input table. (b) Initial map- pings table. - 36 - Notes: (1) The state // and the mapping // are shown here only for clear- ness. (2) The dash (-) denotes a don't care bit (0 or 1). In certain cases, assuming a specified initial state, there are states that are unreachable. In order to get a simpler initial mappings table, those states have to be eliminated. Example for such a case Is the comparator. Its recurrence system is B,(l) = , with V x i ' x i-l + a i b i y i-T y i = y i-l + a iVi-l' Figure 15-a shows the input table. Figure 15-b shows the original initial mappings table, implied by the equations of F,. For the comparator to function properly, it is necessary to assume that the initial state is x y = 00. States 00, 01 and 10 can be reached from state 00, while 11 cannot be reached from any state, other than itself. Therefore, state 11 is eliminated and we end up with a simpler initial mappings table, shown in figure 15-c. - 37 - As a final example, we will consider the second order Boolean recurrence system B~(2), whose input table and the resulting initial mappings table are shown in figure 16. - 38 - v i-l M-l i-1 i-1 c i-l y i-l x i-l y i-l x i-l y i-l x i-l y i-l a i b i a i b i a i b 1 a l b l a. b. i l a l b i a i b i a.b. l l 1 1 1 1 1 1 1 1 1 1 Xj = = Vi + a iVi-: y i-i + a iVi-i (a) Figure 15 . Recurrence system B,(l): (a) Input table. (continued on next page). - 39 - a iV 00 01 10 11 x i-l y i-l = 00 00 01 10 00 01 01 01 01 01 10 10 10 10 10 11 11 11 11 11 (b) : i-i y i-r 00,11 01 10 1 2 3 00 1 1 2 3 01 2 2 2 2 10 3 3 3 3 + natural assignment ♦ mapping # present state # (c) Figure 15 (continued). Recurrence system B,(l): (b) Initial mappings table before eliminating state 11. (c) Initial mappings table. - 40 - w i-l M-l k i-2 '1-2 c i-l x i-2 x i-l x i-2 x i-l x i-2 x i-l x i-2 a i b i a i b i a i b i a i b i 1 1 1 1 x i " a i x i-l x i-2 + b i x i-l (a) Figure 16 . Recurrence system B„(2): (a) Input table. (continued on next page). - 41 - x i-l x i-2 s 00 01 10 11 2 3 4 00 1,1 1 1 1 01 1,2 1 2 2 10 2,1 2 1 2 11 2,2 2 1 2 * natural assignment * mapping // previous and present state #'s (b) Figure 16 (continued). Recurrence system B_(2): (b) Initial mappings table. - 42 - !5.2_ BINREC This program receives the file MAPS generated by the program PREPRC and produces the file MPMT, of which the main part is the mappings table and the multiplication table, and for recurrences of order m>l, also the zero-level conversion table. Additional outputs are the mappings' natural assignments and the states' codes, as passed in the file MAPS. As shown in section 4, the zero-level conversion table defines the zero-level-node, the mappings table defines the out-node and the multi- plication table defines the tree-node. The algorithm that evaluates the tables has two parts. The first part evaluates the zero-level conver- sion table, than the second part evaluates simultaneously the two other tables. Before the presentation of the algorithm, we will introduce the data structures for the tables. The tables, after the execution of the algorithm on the recurrence system B_(2) (refer to figure 12), are shown in figure 17. The representation of the mappings table (two-dimensional array MP) in figure 17-a is self explanatory. There is no need for columns or rows headings, since the mappings numbers and the states numbers form the indices to this array. Column j corresponds to mapping f , while the - 43 - row is computed in somewhat different manner. If we look at the pairs of states as an ordered set, then pair 1,1 is related to row 1, pair 1,2 to row 2, 2,1 to 3 and 2,2 to 4. In the case of a first order recurrence, the situation is degenerated to a simple order, that is, row i corresponds to state number i. The representation of the multiplication table (two-dimensional array MT) is shown in figure 17-b. Here there is no need for rows head- ings, since row i corresponds to mapping f . The columns headings are the numbers of the mappings that form a group. The representation of the zero-level conversion table (one- dimensional array ZERO) is shown in figure 17-c. The zero-level conver- sion table contains pointers to the columns headings of the multiplica- tion table. The index to the table is a simple function of the numbers of the mappings in the input group of mappings. In this example, the number of mappings in the initial mappings table is LI=4. If we want to know to which group of mappings is f^»f . converted, we look at the entry with the index r = (j-l)*LI + (1-1) + 1. The contents ZERO[r] are the index of the mappings group in array MT. For example, fo>f? is converted to f,»f 2 » since r = (2-l)*4 + (3-1) +1=7, ZERO[7]=3, and the mappings group in the heading of column 3 of MT is f.,f_. In the case of a first order recurrence, this array is not needed (it degenerates to the - 44 - 1 1 1 1 1 1 2 2 1 2 1 2 1 2 1 2 MP (a) 1 2 1 2 1 3 2 4 1 4 3 4 1 1 2 2 3 3 3 3 4 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 3 2 4 1 4 3 4 1 1 2 1 3 1 3 1 4 1 1 1 1 2 2 2 3 3 4 4 4 4 3 4 MT (b) 10 10 ZERO (c) Figure 17 . Data structures for recurrence system B_(2): (a) Array MP: mappings table. (b) Array MT: multiplication table, (c) Array ZERO: zero-level conversion table. - 45 - ordered set of mappings numbers, that is, 1,2,... ). The indexing shown for the three arrays can be easily generalized to higher order recurrences. The arrays hold the information needed with no redundancy, there- fore the utilized memory space is minimal, yet the access to the data does not require too much manipulation. Part (a) of_ the algorithm This part evaluates array ZERO and some of the columns headings of array MT. For a recurrence of order m, each group of m mappings f. ,...,f. ,f is converted by the zero-level-node to f , , . . . ,f ,,f . , V L 2 h m X 2 X l where V = f i x l x l f i' - f i of i x 2 2 x l - 46 - v - f i°—°w mm 2 1 If the number of mappings in the mappings table is LI, then each index i takes the values 1 to LI, therefore LI different groups are converted. Every f ,,..., f ,,f , group is appended to MT, if it is not already m 2 1 there, and the corresponding entry in ZERO is evaluated. If new mappings are generated during this part of the algorithm (one or few among the mappings f ,,..., f.,), they are appended to MP. 2 m Note: Part (a) of the algorithm might be skipped for first order recurrence, since always f., = f . 1 1 1 Part (b) of_ the algorithm This part completes the evaluation of arrays MP and MT. The evaluation is done in a finite number of passes over the groups of map- pings that are stored in the columns headings of MT. - 47 - On the first pass, every pair of mappings groups is g-multiplied (including g-multiplication of a group by itself), and the corresponding entries in MT are evaluated, if not already evaluated in a former g- multiplicatlon. If, for example, in the second order recurrence we com- pute f ,f ■ (f.,f )o(f ,f ) then in the column corresponding to the mappings group f ,f , u is stored in row i and v is stored in row j, if not stored there yet. If a new mappings group is generated, it is appended to MT. If new mappings are generated, they are appended to MP. If new mappings groups were generated in the first pass, a second pass is performed, in which only pairs that were not g-multiplied in the first pass are taken into account. Additional passes are performed if necessary, until no new mappings group is generated. Since the semigroup is finite, the algorithm is guaranteed to terminate. Figure 18 shows some typical snapshots of arrays MP and MT during the execution of part (b) of the algorithm. Shaded areas show the evaluated entries. - 48 - Note: Each pass corresponds to a g-raulti plication of mappings groups at some different level of the tree-like network, i.e., first pass - to level 1 (right below the zero-level), second pass - to level 2, and so on. If there are more levels than passes, then the last pass corresponds to all of the remaining levels. Since the number of mappings groups is different at each level, a dif- ferent type of node can be constructed for each level. However, for the sake of uniformity (which is a major consideration in VLSI design), one type of node is designed, which suits all of the mappings groups. - 49 - LI MP m Figure 18 . Development of MP and MT during execution of part (b) of the algorithm: (a) After part (a), just before part (b). (b) After first pass, (c) After second pass, (d) After third (in this case last) part. - 50 - 5.3 MINIMZ This program receives the file MPMT generated by the program BINREC and computes the Boolean equations of the nodes. The complexity of these Boolean equations heavily depends on the encoding of each mapping, making code assignment very important. Since checking every possible assignment is not practical, some heuristic approaches are taken in order to get the (near) optimal solu- tion. In fact, for some well known Boolean recurrences (such as the adder, comparator and others) the optimal solution is achieved. The code assignment is done in one or two modes, and in one, two or three sub-modes, as will be explained below. The two modes are: (a) Natural assignment . Each of the initial mappings is assigned its natural assignment code (see section 5.1). If a mapping has more than one code of natural assignment (see, for example, figure 15-c), then only the first one is used. However, if several natural assignment codes are combined through don't cares (see, for example, figure 14-b), then the code with the don't care is assigned as it is. Then attempt is made to reduce the number of - 51 - bits in the code (this can be done if 2 is greater or equal to twice the number of the initial mappings, where b is the number of the bits in the code). If the mappings table contains only the ori- ginal initial mappings, that is, no new mappings have been added, then we are done. If new mappings have been added, they are assigned codes by performing the following steps: 1. If the number of mappings in the mappings table is such that the code must be expanded, then the codes already assigned to the initial mappings are augmented with sufficient number of bits, which are initially set to the don't care value. 2. If an initial mapping has natural assignment codes which are not assigned to that mapping (recall that only the first code is assigned), they are assigned to the additional mappings in the mappings table. If every mapping is now assigned a code - we are done, otherwise next step must be carried out. 3. If a mapping has a code which contains at least one don't care bit (which must be true if this step is reached), its code can be split into two codes: one has instead of the don't care and the other has 1. The other bits are left unchanged. One code is assigned to the mapping which originally was assigned the splitted code, and the other - to a mapping that has not - 52 - been assigned any code yet. Generally, there is no preferance as to which mapping is assigned the code with the don't care changed to and which mapping is assigned the other. However, in the case In which the Boolean recurrence function is defined by just one equation, some improvement can be achieved by making the code similar to the mapping. This is done the following way. Fisrt, the states that construct the mappings are regarded as having the values and 1 instead of 1 and 2, respectively. Then, if the don't care is, say, in position r of the code, it is replaced by the value of the state in posi- tion r of the mapping. This heuristic gives better results in some cases. The mappings table is scanned from right to left, splitting the codes that contain the don't cares, until all the mappings have been assigned codes. Sometimes one scan or less is enough, but sometimes more than one scan is needed, generally if some codes contain more than one don't care each. The reason for scanning from right to left is that this way more don't cares are left in the codes of the initial map- pings, resulting in a simpler pre-node. - 53 - (b) Mappings assignment . This assignment is applicable only in the case in which the Boolean recurrence function is defined by just one equation. In this case, the states 1 and 2 are regarded as and 1, respectively, then each mapping's code is taken as the sequence of the states in the mapping. Since the mappings are dif- ferent from each other, the code is guaranteed to be legal (that is, no more than one mapping is assigned the same code). Then attempt is made, as in the natural assignment mode, to reduce the number of bits in the code. Now we have a lot of freedom, the amount of which depends on the number of mappings and the number of bits in the code: we can leave the codes as they are, or change some of the zeroes or some of the ones or some combination of zeroes and ones into don't cares. Among all these possibilities, the three sub-modes have been chosen, as follows: (a) No change of ones and zeroes into don't cares, that is, the code is left untouched. (b) Changing as many zeroes as possible into don't cares, then as many ones as possible into don't cares. - 54 - (c) Same as (b), except first the ones are changed, then the zeroes. Sub-mode (a) can always be accomplished, but sometimes sub-mode (b) or (c) or both cannot. After the assignment is determined, the Boolean equations of the nodes are evaluated, in the sum of products form, using Quine-McCluskey method for minimization [3]. - 55 - 6^ Examples The examples show the solutions of the following Boolean recurrences systems: B-(l), B,(l) and B_(2). The input format is as follows: (a) Comment line. (b) Recurrence parameters: order, number of equations, number of input bits (represented by decimal numbers) and the initial state code (in the form of separated binary digits), in one line. (c) Table(s) describing the Boolean equation(s). The right portion of these lines can be used for comments. The main output is the Boolean equations of the nodes. X' denotes the complement of X. Example of the notation is shown in figure 19, for the four types of nodes, assuming third order recurrence with two bits for mapping code and one bit for state code. This notation can be easily generalized for any order recurrence and any number of bits for mapping and state codes. Notes: (1) For the first order Boolean recurrence, the zero-level-node does not exist, therefore the pre-node has a different notation for its outputs. - 56 - (2) The term bunch Is equivalent to group of mappings in the text. (a) (b) E3 F3 E2 F2 El Fl E2 F2 El Fl (c) P Q P3 Q3 P2 Q2 PI Ql PO QO P Q (d) (e) Figure 19 . Notation of the input and output lines: (a) Pre-node for Boolean recurrence of orderM. (b) Pre-node for first order Boolean recurrence. (c) Zero-level-node. (d) Tree-node. (e) Out-node. B 2 (l) X i-i n •~ - ii B 4 (D >- i ■•—•• x it X >- CO *- I — f-f I— 4 «X X 1X1 II * l-t I— I >- u_ tH " * * 11 * * *"N ■*■ 1— 1 * •W * >- *• * * *• ■fc *■ N ** .<-•* * T-l * ! * I— l * *W * >- *■ ** *• -■ * *""V * 1— 1 4* •w *■ iXi *• * * ^-N ■J* I-* * •w* * -• •+■ CD -I- Z + - - 63 - B 4 U> co LU - II CD LU LU o K- % II h-i cc CC (25 3 ^s + II CO LL. 1- O 1-1 II CO -f- 1 "» II - i-l II CO O * 1 II CD o 1-H o o tfi -»- LU H «W II z a ■«• ■X- C5 X II »-i o 1 1-1 * ^ o i-i *• * II LU - *■ •w * * i* *■ * * * * * w * * - 64 - -*- *• * * B 3 (2) * *• *■ * * *• * * *■ * * * «"*» * •1-1 * 1 * ►H * >^* * X * ■X *■ •-»» * h- 1 ** ■w* * « 4* * •+• * * .-^ * CM * 1 * 1-4 * *^ * X * ■X * * * *-•* * T-t * 1 * 1— 1 * >-* •X- X *■ ■X * ^H •* 1— 1 •X v>/ * UI _1 I o isL UI Nl t-». h h cm cm cm cm rorororo i «r s 1— i-H LU O LU M O f-t O ft © O *-• ft ■^ cm ro *r 11 LU II Lu LU a o 2: 1 _i LU > LU _J I O l£ LU N LU X li- CO z z CD i— i i_< CO CO ■*> -t- X UJ 2 T-! -f- CJ k-« i I -t- _J *_* + 2: UJ X + z I r> i 3S -f- ♦* i _J UJ i C5 •t- II CO UJ _i UJ ■■-) x-i -t- II f- Ui r> ! 1— 1 ill. a UJ -i- + II z 1— 1 UJ b O ■*• *r 1— 1 + II UJ _i a: T"f z cm CM O «"». -r II z ■JJ i UJ u_ 1 C3 C5 Z cm -H II z i O M -* UJ I ! -+- II CO UJ CC CM UJ ■+■ H- 1— — 4- II 1— 1 cc UJ UJ U_ cc _J X -+- II CO Cl. N X h- O O O *• -4- II CO h- -+- u_ CJ s -t- II <£ ■X- * ^s -t- II u. % ^ s tH + II CO i-l T-l T-I T-l 1 -1- II CO © i-H O f-i 1 UJ u_ la- a •^ ■+■ II z •1-t * •*■ 's* * X + II 1— « O O •>-* *-< i CM cm CM CM *■ ■+■ II u_