Presentation is loading. Please wait.

Presentation is loading. Please wait.

COE 561 Digital System Design & Synthesis Sequential Logic Synthesis Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum.

Similar presentations


Presentation on theme: "COE 561 Digital System Design & Synthesis Sequential Logic Synthesis Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum."— Presentation transcript:

1 COE 561 Digital System Design & Synthesis Sequential Logic Synthesis Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals [Adapted from slides of Prof. G. De Micheli: Synthesis & Optimization of Digital Circuits] Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum & Minerals [Adapted from slides of Prof. G. De Micheli: Synthesis & Optimization of Digital Circuits]

2 2 OutlineOutline n Modeling synchronous circuits State-based models. Structural models. n State-based optimization methods State minimization. State encoding State encoding for two-level logic Input encoding Output encoding State encoding for multiple-level logic n Structural-based optimization methods Retiming n Modeling synchronous circuits State-based models. Structural models. n State-based optimization methods State minimization. State encoding State encoding for two-level logic Input encoding Output encoding State encoding for multiple-level logic n Structural-based optimization methods Retiming

3 3 Synchronous Logic Circuits n Interconnection of Combinational logic gates. Synchronous delay elements E-T or M-S registers. n Assumptions No direct combinational feedback. Single-phase clocking. n Interconnection of Combinational logic gates. Synchronous delay elements E-T or M-S registers. n Assumptions No direct combinational feedback. Single-phase clocking.

4 4 Modeling Synchronous Circuits n State-based model Model circuits as finite-state machines. Represented by state tables/diagrams. Lacks a direct relation between state manipulation and corresponding area and delay variations. Apply exact/heuristic algorithms for State minimization. State encoding. n Structural models Represent circuit by synchronous logic network. Apply Retiming. Logic transformations. n State-based model Model circuits as finite-state machines. Represented by state tables/diagrams. Lacks a direct relation between state manipulation and corresponding area and delay variations. Apply exact/heuristic algorithms for State minimization. State encoding. n Structural models Represent circuit by synchronous logic network. Apply Retiming. Logic transformations.

5 5 State-Based Optimization

6 6 Formal Finite-State Machine Model n Defined by the quintuple ( , , S, , ). n A set of primary inputs patterns . n A set of primary outputs patterns . n A set of states S. n A state transition function  :   S  S. n An output function :   S   for Mealy models : S   for Moore models. n Defined by the quintuple ( , , S, , ). n A set of primary inputs patterns . n A set of primary outputs patterns . n A set of states S. n A state transition function  :   S  S. n An output function :   S   for Mealy models : S   for Moore models.

7 7 State Minimization n Aims at reducing the number of machine states reduces the size of transition table. n State reduction may reduce the number of storage elements. the combinational logic due to reduction in transitions n Completely specified finite-state machines No don't care conditions. Easy to solve. n Incompletely specified finite-state machines Unspecified transitions and/or outputs. Intractable problem. n Aims at reducing the number of machine states reduces the size of transition table. n State reduction may reduce the number of storage elements. the combinational logic due to reduction in transitions n Completely specified finite-state machines No don't care conditions. Easy to solve. n Incompletely specified finite-state machines Unspecified transitions and/or outputs. Intractable problem.

8 8 State Minimization for Completely-Specified FSMs n Equivalent states Given any input sequence the corresponding output sequences match. n Theorem: Two states are equivalent iff they lead to identical outputs and their next-states are equivalent. n Equivalence is transitive Partition states into equivalence classes. Minimum finite-state machine is unique. n Equivalent states Given any input sequence the corresponding output sequences match. n Theorem: Two states are equivalent iff they lead to identical outputs and their next-states are equivalent. n Equivalence is transitive Partition states into equivalence classes. Minimum finite-state machine is unique.

9 9 AlgorithmAlgorithm n Stepwise partition refinement. n Initially  1 = States belong to the same block when outputs are the same for any input. n Refine partition blocks: While further splitting is possible  k+1 = States belong to the same block if they were previously in the same block and their next-states are in the same block of  k for any input. n At convergence Blocks identify equivalent states. n Stepwise partition refinement. n Initially  1 = States belong to the same block when outputs are the same for any input. n Refine partition blocks: While further splitting is possible  k+1 = States belong to the same block if they were previously in the same block and their next-states are in the same block of  k for any input. n At convergence Blocks identify equivalent states.

10 10 Example … n  1 = {(s1, s2), (s3, s4), (s5)}. n  2 = {(s1, s2), (s3), (s4), (s5)}. n  2 = is a partition into equivalence classes States (s1, s2) are equivalent. n  1 = {(s1, s2), (s3, s4), (s5)}. n  2 = {(s1, s2), (s3), (s4), (s5)}. n  2 = is a partition into equivalence classes States (s1, s2) are equivalent.

11 11 … Example … Original FSM Minimal FSM

12 12 … Example {OUT_0} = IN_0 LatchOut_v1' + IN_0 LatchOut_v3' + IN_0' LatchOut_v2' v4.0 = IN_0 LatchOut_v1' + LatchOut_v1' LatchOut_v2' v4.1 = IN_0' LatchOut_v2 LatchOut_v3 + IN_0' LatchOut_v2' v4.2 = IN_0 LatchOut_v1' + IN_0' LatchOut_v1 + IN_0' LatchOut_v2 LatchOut_v3 sis> print_stats pi= 1 po= 1 nodes= 4 latches= 3 lits(sop)= 22 #states(STG)= 5 {OUT_0} = IN_0 LatchOut_v1' + IN_0 LatchOut_v2 + IN_0' LatchOut_v2' v3.0 = IN_0 LatchOut_v1' + LatchOut_v1' LatchOut_v2‘ v3.1 = IN_0' LatchOut_v1' + IN_0' LatchOut_v2' sis> print_stats pi= 1 po= 1 nodes= 3 latches= 2 lits(sop)= 14 #states(STG)= 4 Original FSM Minimal FSM

13 13 Computational Complexity n Polynomially-bound algorithm. n There can be at most |S| partition refinements. n Each refinement requires considering each state Complexity O(|S| 2 ). n Actual time may depend upon Data-structures. Implementation details. n Polynomially-bound algorithm. n There can be at most |S| partition refinements. n Each refinement requires considering each state Complexity O(|S| 2 ). n Actual time may depend upon Data-structures. Implementation details.

14 14 State Minimization for Incompletely-Specified FSMs … n Applicable input sequences All transitions are specified. Does not lead to any unspecified transition. n Compatible states Given any applicable input sequence the corresponding output sequences match. n Theorem: Two states are compatible iff they lead to identical outputs (when both are specified), their next-states are compatible (when both are specified). n Compatibility is not an equivalency relation (not transitive). n Applicable input sequences All transitions are specified. Does not lead to any unspecified transition. n Compatible states Given any applicable input sequence the corresponding output sequences match. n Theorem: Two states are compatible iff they lead to identical outputs (when both are specified), their next-states are compatible (when both are specified). n Compatibility is not an equivalency relation (not transitive).

15 15 An Interesting Example n Moore machine with 3-states. n Replace don’t care output of s1 by 0 → Can’t be minimized. n Replace don’t care output of s1 by 1 → Can’t be minimized. n Replacing don’t cares with all possible assignments does not guarantee a minimum solution. n Maximal compatible classes (s1, s2)  (s1, s3) (s1, s3)  (s1, s2) n Machine can be reduced to two states. n Moore machine with 3-states. n Replace don’t care output of s1 by 0 → Can’t be minimized. n Replace don’t care output of s1 by 1 → Can’t be minimized. n Replacing don’t cares with all possible assignments does not guarantee a minimum solution. n Maximal compatible classes (s1, s2)  (s1, s3) (s1, s3)  (s1, s2) n Machine can be reduced to two states. InputStateN- State Out 0s1s2- 1s1s3- 0s2-0 1 s10 0s3s11 1s3-1 InputStateN- State Out 0AA0 1AB0 0BA1 1BB1

16 16 … State Minimization for Incompletely Specified FSMs n Minimum finite-state machine is not unique. n Implication relations make problem intractable. n Example Replace * by 1. {(s1, s2), (s3), (s4), (s5)}. Replace * by 0. {(s1, s5), (s2, s3, s4)}. Compatible states (s1, s2). Incompatible states (s1, s3), (s1, s4), (s2, s5), (s3, s5), (s4, s5). If (s3, s4) are compatible then (s1, s5) are compatible. n Minimum finite-state machine is not unique. n Implication relations make problem intractable. n Example Replace * by 1. {(s1, s2), (s3), (s4), (s5)}. Replace * by 0. {(s1, s5), (s2, s3, s4)}. Compatible states (s1, s2). Incompatible states (s1, s3), (s1, s4), (s2, s5), (s3, s5), (s4, s5). If (s3, s4) are compatible then (s1, s5) are compatible.

17 17 Compatibility and Implications … n Compatible pairs (s1, s2) (s1, s5)  (s3, s4) (s2, s4)  (s3, s4) (s2, s3)  (s1, s5) (s3, s4)  (s2, s4) and (s1, s5) n Incompatible pairs (s2, s5), (s3, s5) (s1, s4), (s4, s5) (s1, s3) n Compatible pairs (s1, s2) (s1, s5)  (s3, s4) (s2, s4)  (s3, s4) (s2, s3)  (s1, s5) (s3, s4)  (s2, s4) and (s1, s5) n Incompatible pairs (s2, s5), (s3, s5) (s1, s4), (s4, s5) (s1, s3)

18 18 … Compatibility and Implications n A class of compatible states is such that all state pairs are compatible. n A class is maximal If not subset of another class. n Closure property A set of classes such that all compatibility implications are satisfied. n The set of maximal compatibility classes Satisfies always the closure property. May not provide a minimum solution. n Minimum covers may involve compatibility classes that are not necessarily maximal. n A class of compatible states is such that all state pairs are compatible. n A class is maximal If not subset of another class. n Closure property A set of classes such that all compatibility implications are satisfied. n The set of maximal compatibility classes Satisfies always the closure property. May not provide a minimum solution. n Minimum covers may involve compatibility classes that are not necessarily maximal.

19 19 Maximal Compatible Classes n (s1, s2) n (s1, s5)  (s3, s4) n (s2, s3, s4)  (s1, s5) n Cover with MCC has cardinality 3. n Minimum cover: {(s1, s5), (s2, s3, s4)}. n Minimum cover has cardinality 2. n (s1, s2) n (s1, s5)  (s3, s4) n (s2, s3, s4)  (s1, s5) n Cover with MCC has cardinality 3. n Minimum cover: {(s1, s5), (s2, s3, s4)}. n Minimum cover has cardinality 2. InputStateN-StateOutput 0AB1 1AA0 0BB0 1BA1 Reduced Table

20 20 Finding Maximal Compatible Classes … n Knowing that s i and s j are two incompatible states implies that no maximal compatible class will contain both s i and s j. n Every set of states that does not contain any incompatible pair is a compatible set. n Associate a variable x i to state s i such that x i =1 implies that s i is an element of the set. n Write a conjunction of two-literal clauses. n Each clause corresponds to an incompatible pair. n Convert the expression into a prime and irredundant sum-of-product form. n Every term corresponds to a maximal compatible set and represents the sets that do no appear in the prime implicant. n Knowing that s i and s j are two incompatible states implies that no maximal compatible class will contain both s i and s j. n Every set of states that does not contain any incompatible pair is a compatible set. n Associate a variable x i to state s i such that x i =1 implies that s i is an element of the set. n Write a conjunction of two-literal clauses. n Each clause corresponds to an incompatible pair. n Convert the expression into a prime and irredundant sum-of-product form. n Every term corresponds to a maximal compatible set and represents the sets that do no appear in the prime implicant.

21 21 … Finding Maximal Compatible Classes n Example Incompatible pairs (s2, s5), (s3, s5) (s1, s4), (s4, s5) (s1, s3) Two-literal Clauses (x 2 ’+x 5 ’) (x 3 ’+x 5 ’) (x 4 ’+x 5 ’) (x 1 ’+x 4 ’) (x 1 ’+x 3 ’) Prime and Irredundant sum-of-product = (x 2 ’ x 3 ’ x 4 ’+x 5 ’) (x 1 ’+ x 3 ’x 4 ’) = x 1 ’ x 2 ’ x 3 ’ x 4 ’+ x 1 ’x 5 ’+ x 2 ’ x 3 ’ x 4 ’+ x 3 ’x 4 ’ x 5 ’ = x 1 ’x 5 ’+ x 2 ’ x 3 ’ x 4 ’+ x 3 ’x 4 ’ x 5 ’ Maximal Compatible Classes x 1 ’x 5 ’ → (S 2,S 3,S 4 ) x 2 ’ x 3 ’ x 4 ’→ (S 1,S 5 ) x 3 ’x 4 ’ x 5 ’ → (S 1,S 2 ) n Example Incompatible pairs (s2, s5), (s3, s5) (s1, s4), (s4, s5) (s1, s3) Two-literal Clauses (x 2 ’+x 5 ’) (x 3 ’+x 5 ’) (x 4 ’+x 5 ’) (x 1 ’+x 4 ’) (x 1 ’+x 3 ’) Prime and Irredundant sum-of-product = (x 2 ’ x 3 ’ x 4 ’+x 5 ’) (x 1 ’+ x 3 ’x 4 ’) = x 1 ’ x 2 ’ x 3 ’ x 4 ’+ x 1 ’x 5 ’+ x 2 ’ x 3 ’ x 4 ’+ x 3 ’x 4 ’ x 5 ’ = x 1 ’x 5 ’+ x 2 ’ x 3 ’ x 4 ’+ x 3 ’x 4 ’ x 5 ’ Maximal Compatible Classes x 1 ’x 5 ’ → (S 2,S 3,S 4 ) x 2 ’ x 3 ’ x 4 ’→ (S 1,S 5 ) x 3 ’x 4 ’ x 5 ’ → (S 1,S 2 )

22 22 Formulation of the State Minimization Problem n A class is prime, if not subset of another class implying the same set or a subset of classes. n Compute the prime compatibility classes. n Select a minimum number of PCC such that all states are covered. all implications are satisfied. n Binate covering problem. n Upper bound on optimum solution given by Cardinality of set of maximal compatible classes and Original state set cardinality. n Lower bound on optimum solution given by A unate cover solution that disregards implications. n A class is prime, if not subset of another class implying the same set or a subset of classes. n Compute the prime compatibility classes. n Select a minimum number of PCC such that all states are covered. all implications are satisfied. n Binate covering problem. n Upper bound on optimum solution given by Cardinality of set of maximal compatible classes and Original state set cardinality. n Lower bound on optimum solution given by A unate cover solution that disregards implications.

23 23 Setting Up Covering Problem … n All states must be contained in at least one compatible class (covering). n All compatible classes implied by any compatible class must be contained in a compatible class in the solution (closure). n Associate a variable c i to the i-th compatible class such that c i =1 implies that class i is part of the solution. n We write a Boolean formula (product of sum form) to express the conditions for a set of compatible classes to represent a closed cover. Terms representing covering constraints Terms representing closure constraints. n All states must be contained in at least one compatible class (covering). n All compatible classes implied by any compatible class must be contained in a compatible class in the solution (closure). n Associate a variable c i to the i-th compatible class such that c i =1 implies that class i is part of the solution. n We write a Boolean formula (product of sum form) to express the conditions for a set of compatible classes to represent a closed cover. Terms representing covering constraints Terms representing closure constraints.

24 24 … Setting Up Covering Problem … n Maximal compatibles classes c 1 :(s1, s2) c 2 :(s1, s5)  (s3, s4) c 3 :(s2, s3, s4)  (s1, s5) n Covering constraints s1: (c 1 + c 2 ) s2: (c 1 + c 3 ) s3: (c 3 ) s4: (c 3 ) s5: (c 2 ) n Closure constraints c 2 → c 3 : (c 2 ’ + c 3 ) c 3 → c 2 : (c 3 ’ + c 2 ) n Maximal compatibles classes c 1 :(s1, s2) c 2 :(s1, s5)  (s3, s4) c 3 :(s2, s3, s4)  (s1, s5) n Covering constraints s1: (c 1 + c 2 ) s2: (c 1 + c 3 ) s3: (c 3 ) s4: (c 3 ) s5: (c 2 ) n Closure constraints c 2 → c 3 : (c 2 ’ + c 3 ) c 3 → c 2 : (c 3 ’ + c 2 )

25 25 … Setting Up Covering Problem n Binate covering problem (c 1 + c 2 ) (c 1 + c 3 ) (c 2 ) (c 3 ) (c 2 ’ + c 3 ) (c 3 ’ + c 2 ) =(c 1 + c 2 c 3 ) (c 2 ) (c 3 ) (c 2 ’ + c 3 ) (c 3 ’ + c 2 ) = (c 2 c 3 ) (c 2 ’ + c 3 ) (c 3 ’ + c 2 ) = (c 2 c 3 ) n Minimum cover: {c 2 c 3 }. n Minimum cover: {(s1, s5), (s2, s3, s4)}. n Binate covering problem (c 1 + c 2 ) (c 1 + c 3 ) (c 2 ) (c 3 ) (c 2 ’ + c 3 ) (c 3 ’ + c 2 ) =(c 1 + c 2 c 3 ) (c 2 ) (c 3 ) (c 2 ’ + c 3 ) (c 3 ’ + c 2 ) = (c 2 c 3 ) (c 2 ’ + c 3 ) (c 3 ’ + c 2 ) = (c 2 c 3 ) n Minimum cover: {c 2 c 3 }. n Minimum cover: {(s1, s5), (s2, s3, s4)}.

26 26 Finding Prime Compatible Classes … n All maximal compatible classes are prime. n Let C 1 and C 2 be two compatible classes such that C 1  C 2. One tempted to favor C 1 over C 2 as it covers more states. It might be better to choose C 2 in case that C 1 implies the selection of other compatible classes that would not be required if C 2 is selected. n The set of compatible classes implied by a compatible class is denoted as its class set (CS). n For each maximal compatible class p of size k with a non-empty class set, consider all its subsets S p of compatible classes of size k-1. n For each s  S p, and if there is a prime q of size > k-1, such that s  q and CS s  CS q then s is not prime. Otherwise, it is prime. n All maximal compatible classes are prime. n Let C 1 and C 2 be two compatible classes such that C 1  C 2. One tempted to favor C 1 over C 2 as it covers more states. It might be better to choose C 2 in case that C 1 implies the selection of other compatible classes that would not be required if C 2 is selected. n The set of compatible classes implied by a compatible class is denoted as its class set (CS). n For each maximal compatible class p of size k with a non-empty class set, consider all its subsets S p of compatible classes of size k-1. n For each s  S p, and if there is a prime q of size > k-1, such that s  q and CS s  CS q then s is not prime. Otherwise, it is prime.

27 27 … Finding Prime Compatible Classes n Maximal compatibles classes (s1, s2) (s1, s5)  (s3, s4) (s2, s3, s4)  (s1, s5) n Prime compatibles classes (s2, s3, s4) (s2, s3)  (s1, s5) Not prime (s2, s4)  (s3, s4) Prime (s3, s4)  (s2, s4) and (s1, s5) Not prime (s1, s5) (s1) Not prime (s5) Prime (s2, s4) (s2) Not prime (s4) Prime n Set of prime compatible classes (s1, s2), (s1, s5), (s2, s3, s4), (s2, s4), (s5), (s4) n Maximal compatibles classes (s1, s2) (s1, s5)  (s3, s4) (s2, s3, s4)  (s1, s5) n Prime compatibles classes (s2, s3, s4) (s2, s3)  (s1, s5) Not prime (s2, s4)  (s3, s4) Prime (s3, s4)  (s2, s4) and (s1, s5) Not prime (s1, s5) (s1) Not prime (s5) Prime (s2, s4) (s2) Not prime (s4) Prime n Set of prime compatible classes (s1, s2), (s1, s5), (s2, s3, s4), (s2, s4), (s5), (s4)

28 28 Additional State Minimization Example Flow Table Compatibility Table

29 29 Maximal Compatibility Classes Computation = = = = =

30 30 Prime Compatibility Classes Computation

31 31 Setting Up the Covering Problem n Covering clauses: One clause for each state For state a, the only two compatibles that cover it are 1 and 11. n Closure Constraints Prime 2 ({b, c, d}) requires {(a,b), (a, g), (d, e)}. n Covering problem formulation n Covering clauses: One clause for each state For state a, the only two compatibles that cover it are 1 and 11. n Closure Constraints Prime 2 ({b, c, d}) requires {(a,b), (a, g), (d, e)}. n Covering problem formulation

32 32 Reduced Table n Minimum cost solution: c 1 =c 4 =c 5 =c 9 =1. n Reduced table is not unique. It will lead to different implementations with different cost. n Minimum cost solution: c 1 =c 4 =c 5 =c 9 =1. n Reduced table is not unique. It will lead to different implementations with different cost.

33 33 State Encoding n Determine a binary encoding of the states (|S|=n s ) that optimize machine implementation Area Cycle-time Power dissipation Testability n Assume D-type registers. n Circuit complexity is related to Number of storage bits n b used for state representation Size of combinational component n There are possible encodings n Implementation Modeling Two-level circuits. Multiple-level circuits. n Determine a binary encoding of the states (|S|=n s ) that optimize machine implementation Area Cycle-time Power dissipation Testability n Assume D-type registers. n Circuit complexity is related to Number of storage bits n b used for state representation Size of combinational component n There are possible encodings n Implementation Modeling Two-level circuits. Multiple-level circuits.

34 34 Two-Level Circuit Models n Sum of product representation. PLA implementation. n Area # of products (rows)  # I/Os (columns). n Delay Twice # of products (2 column length) plus # I/Os (1 row length). n Note # products considered as the size of a minimum implementation. # I/Os depends on encoding length. n Sum of product representation. PLA implementation. n Area # of products (rows)  # I/Os (columns). n Delay Twice # of products (2 column length) plus # I/Os (1 row length). n Note # products considered as the size of a minimum implementation. # I/Os depends on encoding length.

35 35 State Encoding for Two-Level Models n Early work focused on use of minimum-length codes i.e. using n b =  log 2 n s . n Most classical heuristics are based on reduced dependency criterion Encode states so that state variables have least dependencies on those representing previous states. Correlates weakly with minimality of sum-of-products representation. n Symbolic minimization of state table. Equivalent to minimizing the size of sum-of-products form related to all codes that satisfy the corresponding constraints. n Constrained encoding problems. Exact and heuristic methods. n Early work focused on use of minimum-length codes i.e. using n b =  log 2 n s . n Most classical heuristics are based on reduced dependency criterion Encode states so that state variables have least dependencies on those representing previous states. Correlates weakly with minimality of sum-of-products representation. n Symbolic minimization of state table. Equivalent to minimizing the size of sum-of-products form related to all codes that satisfy the corresponding constraints. n Constrained encoding problems. Exact and heuristic methods.

36 36 Symbolic Minimization n Minimization of Boolean functions where codes of inputs and/or outputs are not specified. n Minimize tables of symbols rather than binary tables. n Extension to bvi and mvi function minimization. n Reduce the number of rows of a table, that can have symbolic fields. n Reduction exploits Combination of input symbols in the same field. Covering of output symbols. n Applications Encoding of op-codes. State encoding of finite-state machines. n Problems Input encoding. Output encoding. Mixed encoding. n Minimization of Boolean functions where codes of inputs and/or outputs are not specified. n Minimize tables of symbols rather than binary tables. n Extension to bvi and mvi function minimization. n Reduce the number of rows of a table, that can have symbolic fields. n Reduction exploits Combination of input symbols in the same field. Covering of output symbols. n Applications Encoding of op-codes. State encoding of finite-state machines. n Problems Input encoding. Output encoding. Mixed encoding.

37 37 Input Encoding Example Replace symbols by binary strings to minimize corresponding covers

38 38 DefinitionsDefinitions n Symbolic cover List of symbolic implicants. List of rows of a table. n Symbolic implicant Conjunction of symbolic literals. n Symbolic literals Simple: one symbol. Compound: the disjunction of some symbols. n Symbolic cover List of symbolic implicants. List of rows of a table. n Symbolic implicant Conjunction of symbolic literals. n Symbolic literals Simple: one symbol. Compound: the disjunction of some symbols.

39 39 Input Encoding Problem n Degrees of freedom in encoding the symbols. n Goal Reduce size of the representation. n Approach Encode to minimize number of rows. Encode to minimize number of bits. n Represent each string by 1-hot codes. n Minimize table with mvi minimizer. n Interpret minimized table Compound mvi-literals. Groups of symbols. n Degrees of freedom in encoding the symbols. n Goal Reduce size of the representation. n Approach Encode to minimize number of rows. Encode to minimize number of bits. n Represent each string by 1-hot codes. n Minimize table with mvi minimizer. n Interpret minimized table Compound mvi-literals. Groups of symbols.

40 40 Input Encoding Example … Encoded Cover Minimum Cover Input Encoding Problem 0 0 0 1

41 41 … Input Encoding Example n Examples of Simple literal: AND Compound literal: AND,OR n Examples of Simple literal: AND Compound literal: AND,OR Minimum Cover Minimum Symbolic Cover 0 0 0 1

42 42 Input Encoding Problem n Transform minimum symbolic cover into minimum bv- cover. n Map symbolic implicants into bv implicants (one to one). n Compound literals Encode corresponding symbols so that their supercube does not include other symbol codes. n Replace encoded literals into cover. n Transform minimum symbolic cover into minimum bv- cover. n Map symbolic implicants into bv implicants (one to one). n Compound literals Encode corresponding symbols so that their supercube does not include other symbol codes. n Replace encoded literals into cover.

43 43 ExampleExample n Compound literals AND,OR,JMP,ADD AND,OR JMP,ADD OR,JMP n Valid code {AND 00, OR 01, JMP 11, ADD 10} n Replacement in cover n Compound literals AND,OR,JMP,ADD AND,OR JMP,ADD OR,JMP n Valid code {AND 00, OR 01, JMP 11, ADD 10} n Replacement in cover Valid code Invalid code

44 44 Input Encoding Algorithms n Problem specification Constraint matrix A One row for each constraint (literal) and one column for each symbol a ij = 1 iff symbol j belongs to literal i. n Solution sought for Encoding matrix E As many rows as the symbols. Encoding length n b. n Constraint matrix n Encoding matrix n Problem specification Constraint matrix A One row for each constraint (literal) and one column for each symbol a ij = 1 iff symbol j belongs to literal i. n Solution sought for Encoding matrix E As many rows as the symbols. Encoding length n b. n Constraint matrix n Encoding matrix AND,OR JMP,ADD OR,JMP AND OR JMP ADD AND OR JMP ADD

45 45 Input Encoding Problem n Given constraint matrix A Find encoding matrix E satisfying all input encoding constraints (due to compound literals) With minimum number of columns (bits). n An encoding matrix E satisfies the encoding constraints by A if for each row a T of A The supercube of rows of E corresponding to 1’s in a T does not intersect any of the rows of E corresponding to 0’s in a T. n Identity matrix is always a valid encoding. 1-hot encoding n Theorem: Given a constraint matrix A, the encoding matrix E=A T satisfies the constrains of A. n Given constraint matrix A Find encoding matrix E satisfying all input encoding constraints (due to compound literals) With minimum number of columns (bits). n An encoding matrix E satisfies the encoding constraints by A if for each row a T of A The supercube of rows of E corresponding to 1’s in a T does not intersect any of the rows of E corresponding to 0’s in a T. n Identity matrix is always a valid encoding. 1-hot encoding n Theorem: Given a constraint matrix A, the encoding matrix E=A T satisfies the constrains of A.

46 46 Dichotomy Theory n Dichotomy Two sets (L, R). Bipartition of a subset of the symbol set. n Encoding Set of columns of E. Each column corresponds to a bipartition of symbol set. n Rationale Encoding matrix is equivalent to a set of bipartitions. Each row of the constraint matrix implies some choice on the codes i.e. induces a bipartition. n Dichotomy Two sets (L, R). Bipartition of a subset of the symbol set. n Encoding Set of columns of E. Each column corresponds to a bipartition of symbol set. n Rationale Encoding matrix is equivalent to a set of bipartitions. Each row of the constraint matrix implies some choice on the codes i.e. induces a bipartition.

47 47 DichotomiesDichotomies n Dichotomy associated with row a T of A A set pair (L, R) L has the symbols with the 1s in a T R has the symbols with the 0s in a T n Seed dichotomy associated with row a T of A A set pair (L, R) L has the symbols with the 1s in a T R has one symbol with a 0 in a T n Dichotomy associated with constraint a T = 1100 ({AND, OR}; {JMP, ADD}). n The corresponding seed dichotomies are ({AND, OR}; {JMP}) ({AND, OR}; {ADD}). n Dichotomy associated with row a T of A A set pair (L, R) L has the symbols with the 1s in a T R has the symbols with the 0s in a T n Seed dichotomy associated with row a T of A A set pair (L, R) L has the symbols with the 1s in a T R has one symbol with a 0 in a T n Dichotomy associated with constraint a T = 1100 ({AND, OR}; {JMP, ADD}). n The corresponding seed dichotomies are ({AND, OR}; {JMP}) ({AND, OR}; {ADD}).

48 48 DefinitionsDefinitions n Compatibility (L 1, R 1 ) and (L 2, R 2 ) are compatible if L 1  L 2 =  and R 1  R 2 =  or L 1  R 2 =  and R 1  L 2 = . n Covering Dichotomy (L 1, R 1 ) covers (L 2, R 2 ) if L 1  L 2 and R 1  R 2 or L 1  R 2 and R 1  L 2. n Prime dichotomy Dichotomy that is not covered by any compatible dichotomy of a given set. n Union of two compatible dichotomies is a dichotomy covering both with smallest left and right blocks. n Compatibility (L 1, R 1 ) and (L 2, R 2 ) are compatible if L 1  L 2 =  and R 1  R 2 =  or L 1  R 2 =  and R 1  L 2 = . n Covering Dichotomy (L 1, R 1 ) covers (L 2, R 2 ) if L 1  L 2 and R 1  R 2 or L 1  R 2 and R 1  L 2. n Prime dichotomy Dichotomy that is not covered by any compatible dichotomy of a given set. n Union of two compatible dichotomies is a dichotomy covering both with smallest left and right blocks.

49 49 Exact Input Encoding n Compute all prime dichotomies. n Form a prime/seed dichotomy table. n Find minimum cover of seeds by primes. n Prime dichotomies can be computed based on Compatibility graphs of seed dichotomies by Finding largest clique covering each edge n An encoding can be found based on Compatibility graphs of seed dichotomies by a clique covering Conflict graphs of seed dichotomies by a graph coloring n Compute all prime dichotomies. n Form a prime/seed dichotomy table. n Find minimum cover of seeds by primes. n Prime dichotomies can be computed based on Compatibility graphs of seed dichotomies by Finding largest clique covering each edge n An encoding can be found based on Compatibility graphs of seed dichotomies by a clique covering Conflict graphs of seed dichotomies by a graph coloring

50 50 Example … n Encoding matrix n Seed dichotomies n Encoding matrix n Seed dichotomies Prime Dichotomies

51 51 … Example n Table n Minimum cover: p 1 and p 2 n Encoding n Table n Minimum cover: p 1 and p 2 n Encoding AND OR JMP ADD

52 52 Heuristic Encoding n Determine dichotomies of rows of A. n Column-based encoding Construct E column by column. n Iterate Determine maximum compatible set. Find a compatible encoding. Use it as column of E. n Dichotomies n First two dichotomies are compatible. n Encoding column [1100] T satisfies d 1, d 2. n Need to satisfy d 3. Second encoding column [0110] T. n Determine dichotomies of rows of A. n Column-based encoding Construct E column by column. n Iterate Determine maximum compatible set. Find a compatible encoding. Use it as column of E. n Dichotomies n First two dichotomies are compatible. n Encoding column [1100] T satisfies d 1, d 2. n Need to satisfy d 3. Second encoding column [0110] T.

53 53 Output and Mixed Encoding n Output encoding Determine encoding of output symbols. n Mixed encoding Determine both input and output encoding Examples Interconnected circuits. Circuits with feedback. n Output encoding Determine encoding of output symbols. n Mixed encoding Determine both input and output encoding Examples Interconnected circuits. Circuits with feedback.

54 54 Symbolic Minimization n Extension to mvi-minimization. n Accounts for Covering relations. Disjunctive relations. n Exact and heuristic minimizers. n Minimum symbolic cover computed before n Can we use fewer implicants? n Can we merge implicants? n Extension to mvi-minimization. n Accounts for Covering relations. Disjunctive relations. n Exact and heuristic minimizers. n Minimum symbolic cover computed before n Can we use fewer implicants? n Can we merge implicants?

55 55 Covering Relations Example n Assume the code of CNTD covers the codes of CNTB and CNTC. n Possible codes CNTA = 00, CNTB = 01, CNTC =10 and CNTD = 11. n Assume the code of CNTD covers the codes of CNTB and CNTC. n Possible codes CNTA = 00, CNTB = 01, CNTC =10 and CNTD = 11.

56 56 Disjunctive Relations Example n Assume the code of CNTD is the OR of the codes of CNTB and CNTC. n Possible codes CNTA = 00, CNTB = 01, CNTC =10 and CNTD = 11. n Assume the code of CNTD is the OR of the codes of CNTB and CNTC. n Possible codes CNTA = 00, CNTB = 01, CNTC =10 and CNTD = 11.

57 57 Output Encoding Algorithms n Often solved in conjunction with input encoding. n Exact algorithms Prime dichotomies compatible with output constraints. Construct prime/seed table. Solve covering problem. n Heuristic algorithms Construct E column by column. n Compatibility (L 1, R 1 ) and (L 2, R 2 ) are compatible if L 1  R 2 =  and R 1  L 2 = . n Covering Dichotomy (L 1, R 1 ) covers (L 2, R 2 ) if L 1  L 2 and R 1  R 2. n Prime dichotomies need to cover at least one element of all seed pairs. n Often solved in conjunction with input encoding. n Exact algorithms Prime dichotomies compatible with output constraints. Construct prime/seed table. Solve covering problem. n Heuristic algorithms Construct E column by column. n Compatibility (L 1, R 1 ) and (L 2, R 2 ) are compatible if L 1  R 2 =  and R 1  L 2 = . n Covering Dichotomy (L 1, R 1 ) covers (L 2, R 2 ) if L 1  L 2 and R 1  R 2. n Prime dichotomies need to cover at least one element of all seed pairs.

58 58 Example … n Input constraint matrix of second stage n Output constraint matrix of first stage n Assume the code of CNTD covers the codes of CNTB and CNTC. n Input constraint matrix of second stage n Output constraint matrix of first stage n Assume the code of CNTD covers the codes of CNTB and CNTC.

59 59 … Example … n Seed dichotomies associated with A n Seed dichotomies s 2A and s 4B are not compatible with B. n Note that only one of the seed dichotomies S iA or S iB needs to be covered and not both. n Seed dichotomies associated with A n Seed dichotomies s 2A and s 4B are not compatible with B. n Note that only one of the seed dichotomies S iA or S iB needs to be covered and not both. S 1A : ( {CNTA, CNTB} ; {CNTC} ) S 1B : ( {CNTC} ; {CNTA, CNTB} ) S 2A : ( {CNTA, CNTB} ; {CNTD} ) S 2B : ( {CNTD} ; {CNTA, CNTB} ) S 3A : ( {CNTB, CNTD} ; {CNTA} ) S 3B : ( {CNTA} ; {CNTB, CNTD} ) S 4A : ( {CNTB, CNTD} ; {CNTC} ) S 4B : ( {CNTC} ; {CNTB, CNTD} )

60 60 S 1A : ( {CNTA, CNTB} ; {CNTC} ) S 1B : ( {CNTC} ; {CNTA, CNTB} ) S 2A : ( {CNTA, CNTB} ; {CNTD} ) S 2B : ( {CNTD} ; {CNTA, CNTB} ) S 3A : ( {CNTB, CNTD} ; {CNTA} ) S 3B : ( {CNTA} ; {CNTB, CNTD} ) S 4A : ( {CNTB, CNTD} ; {CNTC} ) S 4B : ( {CNTC} ; {CNTB, CNTD} ) … Example … n Prime dichotomies compatible with B n Cover: p 1 and p 2 n Encoding matrix n Prime dichotomies compatible with B n Cover: p 1 and p 2 n Encoding matrix S 1A S 4A S 1B S 2B S 3A p3 p2 p1 S 3B P1: ({CNTC, CNTD}; {CNTA, CNTB}) P2: ({CNTB, CNTD}; {CNTA, CNTC}) P3: ({CNTA, CNTB, CNTD}; {CNTC}) P4: ({CNTA}; {CNTB, CNTD})

61 61 … Example n Heuristic encoding considers the dichotomy pairs associated with each row n Dichotomies d 1B and d 2B do not satisfy output constraints. n Dichotomies d 1A and d 2A are not compatible and considered one at a time yielding two-column encoding. n Heuristic encoding considers the dichotomy pairs associated with each row n Dichotomies d 1B and d 2B do not satisfy output constraints. n Dichotomies d 1A and d 2A are not compatible and considered one at a time yielding two-column encoding. d 1A : ( {CNTC, CNTD} ; {CNTA, CNTB} ) d 1B : ( {CNTA, CNTB} ; {CNTC, CNTD} ) d 2A : ( {CNTB, CNTD} ; {CNTA, CNTC} ) d 2B : ( {CNTA, CNTC} ; {CNTB, CNTD} )

62 62 State Encoding of Finite-State Machines n Given a (minimum) state table of a finite-state machine Find a consistent encoding of the states that preserves the cover minimality with minimum number of bits. n The state set must be encoded while satisfying simultaneously both input and output constraints. n Given a (minimum) state table of a finite-state machine Find a consistent encoding of the states that preserves the cover minimality with minimum number of bits. n The state set must be encoded while satisfying simultaneously both input and output constraints.

63 63 Example … Minimum Symbolic Cover Covering Constraints s1 and s2 cover s3 s5 is covered by all other states. Encoding Constraint Matrices

64 64 … Example … After Implicant Merging: 0 s1, s2s30 1s2s11 1s3s41 0 s4, s5s21 1s1, s4s30 0s3s50 1s5s50 If s1  s3 and s2  s3: * s1, s2, s4s30 1s2s11 1s3s41 0 s4, s5s21 0s3s50 1s5s50 Last two rows, output is 0 => no impact on output equation. If s5 is covered by all other states, a minimal code will have s5 assigned the 0 code, i.e. no impact on next state equations => last two rows can be eliminated. * s1, s2, s4s30 1s2s11 1s3s41 0 s4, s5s21

65 65 … Example n Encoding matrix (one row per state) n Encoded cover of combinational component n Encoding matrix (one row per state) n Encoded cover of combinational component Covering Constraints s1 and s2 cover s3 s5 is covered by all other states.

66 66 Limitation of Symbolic Minimization and Constrained Encoding n The minimum-length solution compatible with a set of constraints may require bits larger than  log 2 n s . n Example: Consider an FSM whose minimal symbolic cover is: 00s1, s2s3 100 01s2, s3s1 010 10s1, s3s2 001 n Satisfaction of input constraints requires at least 3 bits. e.g. s1=100, s2=010, s3=001 PLA size is 3 rows and 11 columns (2 PI+3 PS+3 NS+3 PO) n Assume we do not satisfy first input constraint 2 bits are sufficient PLA size is 4 rows and 9 columns (2 PI+2 PS+2 NS+3 PO) n The minimum-length solution compatible with a set of constraints may require bits larger than  log 2 n s . n Example: Consider an FSM whose minimal symbolic cover is: 00s1, s2s3 100 01s2, s3s1 010 10s1, s3s2 001 n Satisfaction of input constraints requires at least 3 bits. e.g. s1=100, s2=010, s3=001 PLA size is 3 rows and 11 columns (2 PI+3 PS+3 NS+3 PO) n Assume we do not satisfy first input constraint 2 bits are sufficient PLA size is 4 rows and 9 columns (2 PI+2 PS+2 NS+3 PO)

67 67 State Encoding for Multiple-Level Models n Logic network representation. n Area: # of literals. n Delay: Critical path length. n Encoding based on cube-extraction heuristics [Mustang-Devadas]. n Rationale When two (or more) states have a transition to the same next-state Keep the distance of their encoding short. Extract a large common cube. n Exploit first stage of logic. n Works fine because most FSM logic is shallow. n Logic network representation. n Area: # of literals. n Delay: Critical path length. n Encoding based on cube-extraction heuristics [Mustang-Devadas]. n Rationale When two (or more) states have a transition to the same next-state Keep the distance of their encoding short. Extract a large common cube. n Exploit first stage of logic. n Works fine because most FSM logic is shallow.

68 68 ExampleExample n 5-state FSM (3-bits). s1  s3 with input i. s2  s3 with input i’. n Encoding s1  000 = a’b’c’. s2  001 = a’b’c. n Transition i a’b’c’ +i’ a’b’c = a’b’ (ic+i’c’) 6 literals instead of 8. n 5-state FSM (3-bits). s1  s3 with input i. s2  s3 with input i’. n Encoding s1  000 = a’b’c’. s2  001 = a’b’c. n Transition i a’b’c’ +i’ a’b’c = a’b’ (ic+i’c’) 6 literals instead of 8.

69 69 AlgorithmAlgorithm n Examine all state pairs Complete graph with |V| = |S|. n Add weight on edges Model desired code proximity. The higher the weight the lower the distance. n Embed graph in the Boolean space. Objective is to minimize the cost function n Difficulties The number of occurrences of common factors depends on the next-state encoding. The extraction of common cubes interact with each other. n Examine all state pairs Complete graph with |V| = |S|. n Add weight on edges Model desired code proximity. The higher the weight the lower the distance. n Embed graph in the Boolean space. Objective is to minimize the cost function n Difficulties The number of occurrences of common factors depends on the next-state encoding. The extraction of common cubes interact with each other.

70 70 Mustang Algorithm Implementation … n Fanout-oriented algorithm Consider state fanout i.e. next states and outputs. Assign closer codes to pair of states that have same next state transition or same output. Maximize the size of the most frequent common cubes. n Fanout-oriented algorithm Consider state fanout i.e. next states and outputs. Assign closer codes to pair of states that have same next state transition or same output. Maximize the size of the most frequent common cubes.

71 71 … Mustang Algorithm Implementation … n Fanin-oriented algorithm Consider state fan-in i.e. present states and inputs. Assign closer codes to pair of states that have transition from same present state or same input. Maximize the frequency of the largest common cubes. n Fanin-oriented algorithm Consider state fan-in i.e. present states and inputs. Assign closer codes to pair of states that have transition from same present state or same input. Maximize the frequency of the largest common cubes.

72 72 … Mustang Algorithm Implementation

73 73 Synchronous Logic Network … n Synchronous Logic Network Variables. Boolean equations. Synchronous delay annotation. n Synchronous network graph Vertices  equations  I/O, gates. Edges  dependencies  nets. Weights  synch. delays  registers. n Synchronous Logic Network Variables. Boolean equations. Synchronous delay annotation. n Synchronous network graph Vertices  equations  I/O, gates. Edges  dependencies  nets. Weights  synch. delays  registers.

74 74 … Synchronous Logic Network

75 75 Approaches to Synchronous Logic Optimization n Optimize combinational logic only. n Optimize register position only Retiming. n Optimize overall circuit Peripheral retiming. Synchronous transformations Algebraic. Boolean. n Optimize combinational logic only. n Optimize register position only Retiming. n Optimize overall circuit Peripheral retiming. Synchronous transformations Algebraic. Boolean.

76 76 Retiming … n Minimize cycle-time or area by changing register positions. n Do not modify combinational logic. n Preserve network structure Modify weights. Do not modify graph structure. n Minimize cycle-time or area by changing register positions. n Do not modify combinational logic. n Preserve network structure Modify weights. Do not modify graph structure.

77 77 … Retiming … n Global optimization technique [Leiserson]. n Changes register positions affects area changes register count. affects cycle-time changes path delays between register pairs. n Solvable in polynomial time. n Assumptions Vertex delay is constant: No fanout delay dependency. Graph topology is invariant: No logic transformations. Synchronous implementation Cycles have positive weights. Edges have non-negative weights. n Global optimization technique [Leiserson]. n Changes register positions affects area changes register count. affects cycle-time changes path delays between register pairs. n Solvable in polynomial time. n Assumptions Vertex delay is constant: No fanout delay dependency. Graph topology is invariant: No logic transformations. Synchronous implementation Cycles have positive weights. Edges have non-negative weights.

78 78 … Retiming …

79 79 … Retiming …

80 80 … Retiming

81 81 … Retiming … n Retiming of a vertex Moving registers from output to inputs or vice versa Integer Positive value: from outputs to inputs Negative value: from inputs to outputs n Retiming of a network Vector of vertex retiming. n Definitions Retiming of an edge (v i, v j ): n Retiming of a vertex Moving registers from output to inputs or vice versa Integer Positive value: from outputs to inputs Negative value: from inputs to outputs n Retiming of a network Vector of vertex retiming. n Definitions Retiming of an edge (v i, v j ):

82 82 ExampleExample n Node values indicate delay. n Retiming vector [a b c d e f g h]= [0 0 -1 -1 -1 0 1 1] [a b c d e f g h]= - [1 1 2 2 2 1 0 0]= [1 1 0 0 0 1 2 2] n Original critical path is (v d, v e, v f, v g, v h )= 24 units n Retimed critical path is (v b, v c, v e )= 13 units n Node values indicate delay. n Retiming vector [a b c d e f g h]= [0 0 -1 -1 -1 0 1 1] [a b c d e f g h]= - [1 1 2 2 2 1 0 0]= [1 1 0 0 0 1 2 2] n Original critical path is (v d, v e, v f, v g, v h )= 24 units n Retimed critical path is (v b, v c, v e )= 13 units

83 83 Behavior and Testability Preservation under Retiming … n A synchronizing sequence for a machine is an input sequence that brings the machine to a known and unique state determined without knowledge of output response or initial state of the machine. n An interesting class of synchronizing sequences allows the state reached after applying the synchronizing sequence to be either a single state or a set of equivalent states. n A synchronizing sequence (or a test) derived based on pessimistic 3-valued simulation is called structural; otherwise, it is called functional. functional synchronizing sequences (or tests) correspond to those derived based on the state transition graph of a circuit. n A synchronizing sequence for a machine is an input sequence that brings the machine to a known and unique state determined without knowledge of output response or initial state of the machine. n An interesting class of synchronizing sequences allows the state reached after applying the synchronizing sequence to be either a single state or a set of equivalent states. n A synchronizing sequence (or a test) derived based on pessimistic 3-valued simulation is called structural; otherwise, it is called functional. functional synchronizing sequences (or tests) correspond to those derived based on the state transition graph of a circuit.

84 84 … Behavior and Testability Preservation under Retiming … Vector 11 synchronizes C1 to a single state and C2 to an equivalent set of states. Any of the vectors (11, 00), (11, 01), (11, 10), (11, 11) synchronizes C2 to a single equivalent state.

85 85 … Behavior and Testability Preservation under Retiming … Vector 11 is a functional synchronizing sequence for L1 but not for L2. Any of the vectors (00, 11), (01, 11), (10, 11), (11, 11) is a synchronizing sequence for L2.

86 86 … Behavior and Testability Preservation under Retiming


Download ppt "COE 561 Digital System Design & Synthesis Sequential Logic Synthesis Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum."

Similar presentations


Ads by Google