Ch7 Sequential Logic Optimiztn
Ch7 Sequential Logic Optimiztn
By
24ECM1R20
24ECM1R21
24ECM1R22
24ECM1R24
24ECM1R25
• Objective
• Motivation and assumptions for sequential synthesis
• Finite-state machine design and optimization
Synchronous logic circuits
• Interconnection of
• Combinational logic gates
• Synchronous delay elements
• Edge-triggered, master/slave
• Assumptions
• No direct combinational feedback
• Single-phase clocking
• Extensions to
• Multiple-phase clocking
• Gated latches
Modeling synchronous circuits
• State-based model:
• Model circuits as finite-state machines (FSMs)
• Represent by state tables/diagrams
• Apply exact/heuristic algorithms for:
• State minimization
• State encoding
• Structural model
• Represent circuit by synchronous logic network
• Apply
• Retiming
• Logic transformations
State-based optimization
Modeling synchronous circuits
• Advantages and disadvantages of models
• State-based model
• Explicit notion of state
• Implicit notion of area and delay
• Structural model
• Implicit notion of state
• Explicit notion of area and delay
• Transition from a model to another is possible
• State encoding
• State extraction
Sequential logic optimization
• Typical flow
• Optimize FSM state model first
• Reduce complexity of the model
• E.g., apply state minimization
• Correlates to area reduction
• Encode states and obtain a structural model
• Apply retiming and transformations
• Achieve performance enhancement
• Use state extraction for verification purposes
Formal finite-state machine model
• A set of states S
• An output function:
• λ: X × S → Y for Mealy models
• λ: S → Y for Moore models
State minimization
• Classic problem
• Exact and heuristic algorithms are available
• Objective is to reduce the number of states and hence the area
• Completely-specified finite-state machines
• No don’t care conditions
• Polynomial-time solutions
• Incompletely-specified finite-state machines
• Unspecified transitions and/or outputs
• Usual case in synthesis
• Intractable problem:
• Requires binate covering
State minimization
for completely-specified FSMs
• Equivalent states:
• Given any input sequence, the corresponding output sequence match
• Theorem:
• Two states are equivalent if and only if:
• They lead to identical outputs and their next-states are equivalent
• Equivalence is transitive
• Partition states into equivalence classes
• Minimum finite-state machine is unique
State minimization
for completely-specified FSMs
• Initial partition:
• Π1 : States belong to the same block when outputs are
the same for any input
• Iteration:
• Π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
• Convergence:
• Πk+1 = Πk
Example
Example
Example
• Example:
• Replace * by 1
• Π1 = { { s1, s2} , { s3}, {s4 }, { s5 } }
• Replace * by 0
• Π1 = { { s1, s5} , { s2,s3 , s4 } }
Compatibility and implications
Example
• Incompatible pairs
• {s2, s5}
• {s3, s5}
• {s1, s4}
• {s4, s5}
• {s1, s3}
Compatibility and implications
• Example:
• {s1, s2}
• {s1, s5} ← {s3, s4}
• {s2, s3, s4} ← {s1, s5}
• Example:
• {s1, s2}
• {s1, s5} ← {s3, s4}
• {s2, s3, s4} ← {s1, s5}
• Minimum cover:
• {s1, s5} , {s2, s3, s4}
• Minimum cover has cardinality 2
State encoding
• Multiple-level model
• Some heuristic methods that look for encoding which privilege
cube and/or kernel extraction
• Weak correlation with area minimality
Example
INPUT P-STATE N-STATE OUTPUT
0 s1 s3 0
1 s1 s3 0
0 s2 s3 0
1 s2 s1 1
0 s3 s5 0
1 s3 s4 1
0 s4 s2 1
1 s4 s3 0
0 s5 s2 1
1 s5 s5 0
Example
• Minimum symbolic cover:
* s1s2s4 s3 0
1 s2 s1 1
0 s4s5 s2 1
1 s3 s4 1
• Encoded cover :
* 1** 001 0
1 101 111 1
0 *00 101 1
1 001 100 1
Summary
finite-state machine optimization
• Objective
• Structural representation of sequential circuits
• Retiming
• Extensions
Structural model for sequential circuits
• Retiming
• Move register positions. Change weights on graph
• Preserve network topology
• Synchronous transformations
• Blend combinational transformations and retiming
• Powerful, but complex to use
Example of local retiming
Retiming
• Retiming of a vertex v
• Integer rv
• Registers moved from output to input: rv positive
• Registers moved from input to output: rv negative
• Retiming of a network
• Vector whose entries are the retiming at various vertices
• A family of I/O equivalent networks are specified by:
• The original network
• A set of vectors satisfying specific constraints
• Legal retiming
Example
7 7 7
Original graph 0 0 Delay: 24
vg vf ve 0
0
3
0 0 0 0
vh vd
3 3 3
1 vb 1
va vc
1 1
7 7 7
1 1
Retimed graph vg vf ve 0
Delay: 13
0
3
0
vh 1 0 0 vd
3 3 3
0 vb 1
va vc
1 0
Definitions and properties
• Definitions:
• w( vi, v j) weight on edge ( vi, vj )
• ( vi, …, vj ) path from vi to vj
• w( vi, …, vj ) weight on path from vi to vj
• d( vi, …, vj ) combinational delay on path from vi to vj
• Properties:
wij
• Retiming of an edge ( vi, vj ) vi vj
• ŵij = wij + rj – ri
• Retiming of a path ( vi, …, vj )
• ŵ ( vi, …, vj) = w (vi, …, vj) + rj – ri
• Cycle weights are invariant
Legal retiming
• Least-register path
• W (vi, vj) = min w (vi, …, vj) over all paths between vi and vj
• Critical delay:
• D (vi, vj) = max d (vi, …, vj) over all paths between vi and vj
with weight W (vi, vj)
• There exist a vertex pair (vi, vj) whose delay D (vi, vj) bounds
the cycle time
Example
7 7 7
0 0
vg vf ve 0
0
3
0
vh 0 0 0 vd
3 3 3
1 vb 1
va vc
1 1
•Vertices: va, ve
•Paths: (va, vb, vc , ve) and (va, vb, vc, vd, ve)
•W(va, ve) = 2
•D(va, ve) = 16
Minimum cycle-time retiming problem
• Find the minimum value of the clock period φ
such that there exist a retiming vector where:
• ri – rj ≤ wij for all ( vi, vj )
• All registers are implementable
• ri – rj ≤ W (vi, vj) – 1 for all ( vi, vj ) such that D (vi, vj) > φ
• All timing path constraints are satisfied
• Solution
• Given a value of φ
• Solve linear constraints A r ≤ b
• Mixed integer-linear program
• A set of inequalities has a solution if the constraint graph has no positive cycles
• Bellman-Ford algorithm – compute longest path
• Iterative algorithm
• Relaxation
Minimum cycle-time retiming algorithm
• Compute all pair path weights W (vi, vj) and delays D (vi, vj)
• Warshall-Floyd algorithm with complexity O( |V|3 )
• Remarks
• Result is a global optimum
• Overall complexity is O( |V|3 log |V| )
Example: original graph
7 7 7
0 0
vg vf ve 0
0
3
0
vh 0 0 0 vd
3 3 3
1 vb 1
va vc
1 1
• rc - rb ≤ 1 or equivalently rc ≥ rb – 1
•…
Example
• Sort elements of D:
• 33,30,27,26,24,23,21,20,19,17,16,14,13,12,10,9,7,6,3
• Select φ = 19
• 33,30,27,26,24,23,21,20,19,17,16,14,13,12,10,9,7,6,3
• Pass: legal retiming found
• Select φ = 13
• 33,30,27,26,24,23,21,20,19,17,16,14,13,12,10,9,7,6,3
• Pass: legal retiming found
• Select φ < 13
• 33,30,27,26,24,23,21,20,19,17,16,14,13,12,10,9,7,6,3
• Fail: no legal retiming found
1 1
0 0
rg rf re 0
0 -1
-1
rh 0 0
-2
0 rd
-1 -1
ra rb rc
-1 -1
Example φ = 13
1 1
• Constraint graph:
0 0
rg rf re 0
0 -1
-1
• Longest path from source rh 0 0
-2
0 rd
-[12232100] -1 -1
•
ra rb rc
-1 -1
7 7 7
1 1
• Retimed graph
vg vf ve 1
0
3
0
vh 1 1 0 vd
3 3 3
0 vb 0
va vc
0 1
Example φ = 13
7 7 7
• The solution is not unique 1 1
vg vf ve 1
0
3
0
vh 1 1 0 vd
3 3 3
0 vb 0
va vc
0 1
7 7 7
1 1
vg vf ve 0
0
3
0
vh 1 0 0 vd
3 3 3
0 vb 1
va vc
1 0
Relaxation-based retiming
• Rationale
• Search for decreasing φ in fixed step
• Look for values of φ compatible with peripheral circuits
• Use efficient method to determine legality
• Network graph is often very sparse
• Can be coupled with topological timing analysis
Relaxation-based retiming
7 7 7 7 7 7
0 0
vg vf ve 0 vg vf ve
0
3 3
0 0
vh 0 0 0 vd vh vd
3 3 3 3 3 3
1 vb 1
va vc va vb vc
1 1
Example φ = 13 iteration = 2
7 7 7 7 7
0 1 7
vg vf ve 0 vg vf ve
0
3 3
0
vh 1 1 0 vd vh 0
vd
3 3 3 3 3
3
0 vb 1
va vc va vb vc
1 1
Example φ = 13 iteration = 3
7 7 7 7 7
1 1 7
vg vf ve 0 vg vf ve
0
3 3
0
vh 1 1 0 vd vh 0
vd
3 3 3 3 3
3
0 vb 1
va vc va vb vc
0 1
Retiming for minimum area
• Objective
• Relating state-based and structural models
• State extraction
Relating the sequential models
• State encoding
• Maps a state-based representation into a structural one
• State extraction
• Recovers the state information from a structural model
• Remark
• A circuit with n registers may have 2n states
• Unreachable states
State extraction
• State variables: p, q
• Reachability analysis
• Given a state, determine which states are reachable for some
inputs
• Given a state subset, determine the reachable state subset
• Start from an initial state
• Stop when convergence is reached
• Notation:
• A state (or a state subset) is represented by an expression over
the state variables
• Implicit representation
Reachability analysis
• State transition function: f
• Initial state: r0
• And so on … 0
s2
Remarks