Vishwani D. Agrawal James J. Danaher Professor

Slides:



Advertisements
Similar presentations
Introduction to Algorithms 6.046J/18.401J/SMA5503
Advertisements

ECE 667 Synthesis and Verification of Digital Circuits
ECE Longest Path dual 1 ECE 665 Spring 2005 ECE 665 Spring 2005 Computer Algorithms with Applications to VLSI CAD Linear Programming Duality – Longest.
Courtesy RK Brayton (UCB) and A Kuehlmann (Cadence) 1 Logic Synthesis Sequential Synthesis.
Chapter 4 Retiming.
Sequential Timing Optimization. Long path timing constraints Data must not reach destination FF too late s i + d(i,j) + T setup  s j + P s i s j d(i,j)
FUNDAMENTAL PROBLEMS AND ALGORITHMS Graph Theory and Combinational © Giovanni De Micheli Stanford University.
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
Spring 07, Apr 10, 12 ELEC 7770: Advanced VLSI Design (Agrawal) 1 ELEC 7770 Advanced VLSI Design Spring 2007 Constraint Graph and Performance Optimization.
Spring 07, Feb 13 ELEC 7770: Advanced VLSI Design (Agrawal) 1 ELEC 7770 Advanced VLSI Design Spring 2007 Binary Decision Diagrams Vishwani D. Agrawal James.
Spring 08, Feb 28 ELEC 7770: Advanced VLSI Design (Agrawal) 1 ELEC 7770 Advanced VLSI Design Spring 2008 Retiming Vishwani D. Agrawal James J. Danaher.
Spring 07, Mar 8 ELEC 7770: Advanced VLSI Design (Agrawal) 1 ELEC 7770 Advanced VLSI Design Spring 2007 Timing Verification and Optimization Vishwani D.
Retiming. Consider the Following Circuit Suppose T XOR = 3 ns, T pcq = 1 ns, T setup = 1 ns, then this circuit can be clocked at 1 ns + (3 x 3 ns) + 1.
Spring 08, Mar 4, 6 ELEC 7770: Advanced VLSI Design (Agrawal) 1 ELEC 7770 Advanced VLSI Design Spring 2008 Constraint Graph and Performance Optimization.
Spring 07, Apr 5 ELEC 7770: Advanced VLSI Design (Agrawal) 1 ELEC 7770 Advanced VLSI Design Spring 2007 Retiming Vishwani D. Agrawal James J. Danaher Professor.
Tirgul 13. Unweighted Graphs Wishful Thinking – you decide to go to work on your sun-tan in ‘ Hatzuk ’ beach in Tel-Aviv. Therefore, you take your swimming.
More Graph Algorithms Weiss ch Exercise: MST idea from yesterday Alternative minimum spanning tree algorithm idea Idea: Look at smallest edge not.
Spring 08, Feb 26 ELEC 7770: Advanced VLSI Design (Agrawal) 1 ELEC 7770 Advanced VLSI Design Spring 2008 Clock Skew Problem Vishwani D. Agrawal James J.
Spring 08, Feb 6 ELEC 7770: Advanced VLSI Design (Agrawal) 1 ELEC 7770 Advanced VLSI Design Spring 2008 Timing Verification and Optimization Vishwani D.
Spring 2010, Feb 10...ELEC 7770: Advanced VLSI Design (Agrawal)1 ELEC 7770 Advanced VLSI Design Spring 2010 Constraint Graph and Retiming Solution Vishwani.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
1 ELEC692 Fall 2004 Lecture 1b ELEC692 Lecture 1a Introduction to graph theory and algorithm.
Spring 2014, Feb 14...ELEC 7770: Advanced VLSI Design (Agrawal)1 ELEC 7770 Advanced VLSI Design Spring 2014 Constraint Graph and Retiming Solution Vishwani.
1 Network Models Transportation Problem (TP) Distributing any commodity from any group of supply centers, called sources, to any group of receiving.
Pipelining and Retiming
Shortest Path Problems
Greedy Technique.
CSC317 Shortest path algorithms
CS137: Electronic Design Automation
Single-Source Shortest Paths
James D. Z. Ma Department of Electrical and Computer Engineering
Algorithms and Data Structures Lecture XIII
Introduction to Graphs
Shortest Path Problems
ADVANCED ALGORITHMS GRAPH ALGORITHMS (UNIT-2).
Shortest Path Problems
Topological Sort (topological order)
ELEC 7770 Advanced VLSI Design Spring 2016 Clock Skew Problem
ELEC 7770 Advanced VLSI Design Spring 2012 Clock Skew Problem
ELEC 7770 Advanced VLSI Design Spring 2014 Clock Skew Problem
ELEC 7770 Advanced VLSI Design Spring 2012 Retiming
Vishwani D. Agrawal James J. Danaher Professor
ICS 353: Design and Analysis of Algorithms
ESE535: Electronic Design Automation
Vishwani D. Agrawal James J. Danaher Professor
ELEC 7770 Advanced VLSI Design Spring 2014 Technology Mapping
Algorithms and Data Structures Lecture XIII
Shortest Path Problems
ELEC 7770 Advanced VLSI Design Spring 2016 Technology Mapping
Vishwani D. Agrawal James J. Danaher Professor
CS184a: Computer Architecture (Structures and Organization)
Vishwani D. Agrawal James J. Danaher Professor
Haitao Wang Utah State University WADS 2017, St. John’s, Canada
Honors Track: Competitive Programming & Problem Solving Avoiding negative edges Steven Ge.
Fundamental Data Structures and Algorithms
ESE535: Electronic Design Automation
Algorithms (2IL15) – Lecture 7
Lecture 14 Shortest Path (cont’d) Minimum Spanning Tree
The Bellman-Ford Shortest Path Algorithm Neil Tang 03/27/2008
ELEC 7770 Advanced VLSI Design Spring 2016 Retiming
Shortest Path Problems
Advanced Algorithms Analysis and Design
Shortest Path Problems
Timing Analysis and Optimization of Sequential Circuits
CSE 417: Algorithms and Computational Complexity
ELEC 7770 Advanced VLSI Design Spring 2012 Timing Simulation and STA
Chapter 24: Single-Source Shortest-Path
Lecture 13 Shortest Path (cont’d) Minimum Spanning Tree
INTRODUCTION A graph G=(V,E) consists of a finite non empty set of vertices V , and a finite set of edges E which connect pairs of vertices .
Presentation transcript:

ELEC 7770 Advanced VLSI Design Spring 2012 Constraint Graph and Retiming Solution Vishwani D. Agrawal James J. Danaher Professor ECE Department, Auburn University Auburn, AL 36849 vagrawal@eng.auburn.edu http://www.eng.auburn.edu/~vagrawal/COURSE/E7770_Spr10/course.html Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

ELEC 7770: Advanced VLSI Design (Agrawal) Retiming Theorem Given a network G(V, E, W) and a cycle time T, (r1, . . . ) is a feasible retiming if and only if: ri – rj ≤ wij for all edges (vi,vj) ε E ri – rj ≤ W(vi,vj) – 1 for all node-pairs vi, vj such that D(vi,vj) > T Where, W(vi,vj) is the minimum weight path between vi and vj D(vi,vj) is the maximum delay among all minimum weight paths between vi and vj Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Retiming Theorem Explained Condition 1, ri – rj ≤ wij is related to edge weight: Original circuit is feasible => original weight wij is positive Originally, ri = rj = 0 Retiming, rj flip-flops added to eij, ri flip-flops removed from eij, net reduction ri – rj must be less than wij to leave the retimed weight of eij positive. Condition 2, ri – rj ≤ W(vi,vj) – 1 is related to path delays between node pairs being less than clock period T whenever path weight is 0. Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

ELEC 7770: Advanced VLSI Design (Agrawal) Examine Condition 2 W1, D1 rj ri vj vi W2, D2 W3, D3 W1 = W2 < W3, W(vi, vj) = W1 = W2, minimum weight among paths D1 > D2, therefore D(vi, vj) = D1, maximum delay of a minimum weigh path If D1 ≤ T, there is no requirement on ri, rj If D1 > T, Retimed weight W1’ = W1 – ri + rj ≥ 1 (at least 1 FF on path) or ri – rj ≤ W1 – 1 Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

ELEC 7770: Advanced VLSI Design (Agrawal) Timing Optimization Find the clock period (T) by path analysis. Set clock period to T/2 and find a feasible retiming. If feasible, further reduce the clock period to half. If not feasible, increase clock period. Do a binary search for optimum clock period. Retime the circuit. Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Representing a Constraint ri – rj ≤ wij or rj ≥ ri – wij rj – wij ri Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

ELEC 7770: Advanced VLSI Design (Agrawal) Constraint Graph -6 r1 ≥ r0 + 3 r1 ≥ r2 + 1 r2 ≥ r0 + 1 r2 ≥ r1 – 1 r3 ≥ r1 + 1 r3 ≥ r2 + 4 r0 ≥ r3 – 6 r1 3 1 r0 -1 1 r3 1 4 r2 Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Feasibility Condition A set of values for variables can be found if and only if the constraint graph has no positive cycles. This is also the condition for the solvability of the longest path problem, which provides a solution to the set of constraints. Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Example: Infeasible Constraints x1 ≥ x2 + 6 x2 ≥ x1 – 3 6 x2 ≥ x1 – 3 x1 x2 3 -3 Positive cycle mean no longest path can be found. x1 ≥ x2 + 6 x1 3 6 Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Solving a Constraint Set -6 r1 ≥ r0 + 3 r1 ≥ r2 + 1 r2 ≥ r0 + 1 r2 ≥ r1 – 1 r3 ≥ r1 + 1 r3 ≥ r2 + 4 r0 ≥ r3 – 6 r1 3 1 r0 -1 1 r3 Longest paths from source r0 to r0, r1, r2, r3 Path lengths: s0=0, s1=3, s2=2, s3=6 Solution: r0=0, r1=3, r2=2, r3=6 1 4 r2 Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

The General Path Problem Find the shortest (or longest) path in a graph from a source vertex to all other vertices. Graph has vertices and directed edges: Edge weights can be positive or negative Graph can be cyclic Single source vertex – a vertex with 0 in-degree (not a necessary condition) Inconsistent problems Negative weight cycles for shortest path Positive weight cycles for longest path Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Dijkstra’s Shortest Path Algorithm Greedy algorithm. Applies to directed acyclic graphs (DAG) with positive edge weights. Computational complexity O(|E| + |V| log |V|) ≤ O(n2) References: A. Aho, J. Hopcroft and J. Ullman, Data Structures and Algorithms, Reading, Massachusetts: Addison-Wesley, 1983. T. Cormen, C. Leiserson and R. Rivest, Introduction to Algorithms, New York: McGraw-Hill, 1990. Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Dijkstra’s Shortest Path Algorithm Example 1 v1 Alg. steps s0 s1 s2 s3 Initially: mark v0 15 2  Step 1: mark v2 12 8 Step 2: mark v3 11 Step 3: mark v1 w01=15 3 v0 v3 10 source 2 6 v2 si = path weight (v0, vi) Each step marks the path with smallest weight and updates the unmarked path weights. Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Dijkstra’s Shortest Path Algorithm Example 2 v1 Alg. steps s0 s1 s2 s3 Initially: mark v0 15 2  Step 1: mark v2 8 12 Step 2: mark v1 Step 3: mark v3 w01=15 3 v0 v3 6 source 2 10 v2 si = path weight (v0, vi) Each step marks the path with smallest weight and updates the unmarked path weights. Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Dijkstra’s Algorithm, G(V, E, W) s0(1) = 0 initialize source for ( i = 1 to n ) initialize path weights, n=|V| –1 si(1) = w0i repeat { Select an unmarked vertex vq such that sq is minimal Mark vq foreach ( unmarked vertex vi ) si = min { si, sq + wqi } } until (all vertices are marked) Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Try Dijkstra’s Algorithm for Your Graph http://www.dgp.toronto.edu/people/JamesStewart/270/9798s/Laffra/DijkstraApplet.html Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Dijkstra’s Longest Path Algorithm v1 Either change min to max Or change all positive weights to negatives w01=15 3 v0 v3 10 Alg. steps s0 s1 s2 s3 Initially -15 -2  Step 1: mark v1 Step 2: mark v2 -8 Step 3: mark v3 source 2 6 v2 v1 w01= -15 -3 v0 v3 -10 source -2 -6 v2 si = path length (v0, vi) Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Dijkstra’s Alg. Does Not Work for Cycles, Mixed Weights Alg. steps s0 s1 s2 s3 Initially: mark v0 15 2  Step 1: mark v2 7 6 Step 2: mark v3 Step 3: mark v1 6? -2 v1 w01=15 3 v0 v3 5 source 2 4 v2 si = path weight (v0, vi) Algorithm stops because all vertices are marked. But, there exists a v0 to v3 path of length 5 Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Bellman’s Equations – Shortest Path vj vk wki wji For all vertices: si = min (sq + wqi) vq ε pred(vi) vi vm wmi wni vn sq = minimum path weight between source and vq Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Bellman-Ford Algorithm, G(V, E, W) s0(1) = 0 initialize source for ( i = 1 to n ) initialize path weights, n = |V| – 1 si(1) = w0i for ( j = 1 to n ) n iterations for ( i = 1 to n ) n nodes si(j+1) = min { si(j), sk(j) + wki } vk ε pred(vi) } if ( si(j+1) == si(j) i ) return (true) return (false) Complexity = O(|V||E|) ≤ O(n3) Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Bellman-Ford Shortest Path v1 w01=15 Alg. steps s0 s1 s2 s3 Initially 15 2  Iteration 1 12 8 Iteration 2 11 Iteration 3 3 v0 v3 10 source 2 6 v2 si = path weight (v0, vi) Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Bellman-Ford Longest Path Reverse the sign of weights and solve shortest path problem. (Alternative: keep original weights and change min operator in algorithm to max.) n = 3 (shortest path) Weights reversed Alg. steps s0 s1 s2 s3 Initially -15 -2  Iteration 1 -8 Iteration 2 v1 w01= -15 -3 v0 v3 -10 source -2 -6 v2 si = path weight (v0, vi) Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Bellman’s Equations – Longest Path vj vk wki wji For all vertices: si = max (sq + wqi) vq ε pred(vi) vi vm wmi wni vn sq = maximum path weight between source and vq Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Bellman-Ford for Cycles, Neg. Weights -2 n = 3 (shortest path) v1 Alg. steps s0 s1 s2 s3 Initially 15 2  Iteration 1 7 6 Iteration 2 5 Iteration 3 w01=15 3 v0 v3 5 source 2 4 v2 si = path weight (v0, vi) This was incorrect with Dijkstra’s shortest path algorithm Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Bellman-Ford for Negative Cycle 2 n = 3 (shortest path) v1 Alg. steps s0 s1 s2 s3 Initially 15 2  Iteration 1 7 6 Iteration 2 3 Iteration 3 5 w01=15 -3 v0 v3 5 source 2 4 v2 si = path weight (v0, vi) Values not stabilized after n iterations. Inconsistent problem: negative cycle. Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

ELEC 7770: Advanced VLSI Design (Agrawal) Retiming Example FF a b c 10 5 5 Delay Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Retiming Graph FF a b c 10 5 5 1 h a 10 b 5 1 c 5 Critical path = 15 a 10 b 5 1 c 5 Critical path = 15 It is the longest path consisting only of zero weight edges. Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Feasibility Constraints (Condition 1) FF a b c 10 5 5 1 h a 10 b 5 1 c 5 rh – ra ≤ 0 ra – rb ≤ 0 rb – rc ≤ 1 rc – rh ≤ 1 ri – rj ≤ wij  edges i → j Retiming should not cause negative edge weights. Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

ELEC 7770: Advanced VLSI Design (Agrawal) Constraint Graph FF a b c 10 5 5 -1 rh ra 10 rb 5 -1 rc 5 rh – ra ≤ 0 ra – rb ≤ 0 Constraints for rb – rc ≤ 1 Condition 1 rc – rh ≤ 1 ri – rj ≤ wij  edges i → j Retiming should not cause negative edge weights. Observation: Constraint graph has the same structure as the original retiming graph, with signs of weights reversed. Vertex labels are the retiming integer variables. Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Max Delay for Min Weight Paths 1 h a 10 b 5 1 c 5 T = 15 W(h,a) = 0 D(h,a) = 10 W(h,b) = 0 D(h,b) = 15 W(h,c) = 1 D(h,c) = 20 W(a,b) = 0 D(a,b) = 15 W(a,c) = 1 D(a,c) = 20 W(a,h) = 2 D(a,h) = 20 W(b,c) = 1 D(b,c) = 10 W(b,h) = 2 D(b,h) = 10 W(b,a) = 2 D(b,a) = 20 W(c,h) = 1 D(c,h) = 5 W(c,a) = 1 D(c,a) = 15 W(c,b) = 1 D(c,b) = 20 Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Timing Optimization, T = 7.5? -1 Constraint graph (feasibility) rh ra 10 rb 5 -1 rc 5 Add constraints for Condition 2: ri – rj ≤ W(I,j) – 1  paths (i,j) such that D(i,j) > 7.5 W(h,a) = 0 D(h,a) = 10 W(h,b) = 0 D(h,b) = 15 W(h,c) = 1 D(h,c) = 20 W(a,b) = 0 D(a,b) = 15 W(a,c) = 1 D(a,c) = 20 W(a,h) = 2 D(a,h) = 20 W(b,c) = 1 D(b,c) = 10 W(b,h) = 2 D(b,h) = 10 W(b,a) = 2 D(b,a) = 20 W(c,h) = 1 D(c,h) = 5 W(c,a) = 1 D(c,a) = 15 W(c,b) = 1 D(c,b) = 20 Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Timing Optimization, T = 7.5? Positive cycle; no solution for longest path -1 1 1 1 rh ra 10 rb 5 -1 rc 5 -1 -1 -1 W(h,a) = 0 D(h,a) = 10 W(h,b) = 0 D(h,b) = 15 W(h,c) = 1 D(h,c) = 20 W(a,b) = 0 D(a,b) = 15 W(a,c) = 1 D(a,c) = 20 W(a,h) = 2 D(a,h) = 20 W(b,c) = 1 D(b,c) = 10 W(b,h) = 2 D(b,h) = 10 W(b,a) = 2 D(b,a) = 20 W(c,h) = 1 D(c,h) = 5 W(c,a) = 1 D(c,a) = 15 W(c,b) = 1 D(c,b) = 20 Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

Timing Optimization, T = 11.25? -1 rh = 0 rb = 1 rc = 0 ra = 0 1 1 rh ra 10 rb 5 -1 rc 5 -1 -1 W(h,a) = 0 D(h,a) = 10 W(h,b) = 0 D(h,b) = 15 W(h,c) = 1 D(h,c) = 20 W(a,b) = 0 D(a,b) = 15 W(a,c) = 1 D(a,c) = 20 W(a,h) = 2 D(a,h) = 20 W(b,c) = 1 D(b,c) = 10 W(b,h) = 2 D(b,h) = 10 W(b,a) = 2 D(b,a) = 20 W(c,h) = 1 D(c,h) = 5 W(c,a) = 1 D(c,a) = 15 W(c,b) = 1 D(c,b) = 20 Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

ELEC 7770: Advanced VLSI Design (Agrawal) Retiming Graph FF a b c 10 5 5 1 h a 10 b 5 1 c 5 1 rh = 0 ra = 0 rb = 1 rc = 0 wij_retimed = wij + rj – ri Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

ELEC 7770: Advanced VLSI Design (Agrawal) Retimed Circuit FF a b c 10 5 5 Logic optimization will remove these. 1 h a 10 1 b 5 c 5 rh = 0 ra = 0 rb = 1 rc = 0 Critical Path = 10 Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)

ELEC 7770: Advanced VLSI Design (Agrawal) Reference G. De Micheli, Synthesis and Optimization of Digital Circuits, New York: McGraw-Hill, 1994. Spring 2015, Feb 15 . . . ELEC 7770: Advanced VLSI Design (Agrawal)