19
Retiming – 3 Solving System of in-equalities by Floyd-Warshall algorithm Arunachalam V AP SG, SENSE

WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Embed Size (px)

DESCRIPTION

retiming

Citation preview

Page 1: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Retiming – 3Solving System of in-equalities by

Floyd-Warshall algorithm

Arunachalam VAP SG, SENSE

Page 2: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Definition• Re-timing is a architectural transformation technique used to change the

locations of delay elements in a circuit without affecting the input – outputcharacteristics of the circuit.

Page 3: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Solving system of in-equalities• There are “M” in-equalities and “n” variables.

each inequality is represented as where “k” is an integer value.• Step 1: Draw a constraint graph.

a) Draw the node ‘i’ for each of the n variables, ri, i=1,2,3,…,nb) Draw the (n+1)th node.c) For each draw an edge with length k.

d) For each node i, i=1,2,3,…,n , draw the edge with length 0.

;krr ji

;krr ji

ij

e

in

e1

Page 4: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

An ExampleSystem of in-equalities Constraint graph “Gc”

21

450

23

34

14

13

21

rrrrrrrrrr

Page 5: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Step 2: Solve the constraint graph “Gc”

• Solving the constraint graph using shortest path algorithm (Bellman-Ford algorithm / Floyd-Warshall algorithm).a) A system of in-equalities has a solution if and only if the “Gc” contains no

negative cycles.b) If a solution exists, one solution is where “ri” is the maximum length path

from (n+1) to the node “i” .

Page 6: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

FLOYD-WARSHALL ALGORITHMDETERMINING SHORTEST PATH IN A GIVEN GRAPHALL-POINTS SHORTEST PATH ALGORITHM

Page 7: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Part – I Initialize (steps 1 to 3)

1;1.1 nNNtoVFor

Gc

NtoUFor 1.2

VUrelse

exsistspathifVUwVUre

,

,.3

1

1

0000

120

45

1R

Page 8: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Part – II Updating the r(k)(U,V)(steps 4 to 9)

NtokFor 1.4 NtoVFor 1.5

VUrVUr kk ,,.7 1

VkrkUrVUrIf kkk ,,,.8 1

NtoUFor 1.6

VkrkUrVUrthen kkk ,,,.9 1

0000

120

45

1R

Page 9: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Application of the algorithm• k = 1,

1,11,1 111 rr 1,11,1 12 rr 1,11,11,1 112 rrr

0

01,1 UR

false 1,12r

1,21,2 111 rr 01,21,2 12 rr 1,11,21,2 112 rrr false 00 01,22 r

1,31,3 111 rr 1,31,3 12 rr 1,11,31,3 112 rrr false 1,32r 1,41,4 111 rr 1,41,4 12 rr 1,11,41,4 112 rrr false 1,42r 1,51,5 111 rr 01,51,5 12 rr 1,11,51,5 112 rrr false 00 01,52 r

0

01,2 UR

V= 1, 2, 3, 4, 5 and U = 1, 2, 3, 4, 5

Page 10: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Application of the algorithm• k = 1, V=2 and U = 1, 2, 3, 4, 5

2,12,1 111 rr 2,12,1 12 rr 2,11,12,1 112 rrr false 2,12r

2,22,2 111 rr 2,22,2 12 rr 2,11,22,2 112 rrr false 0 2,22r

2,32,3 111 rr 2,32,3 12 rr 2,11,32,3 112 rrr false 2,32r 2,42,4 111 rr 2,42,4 12 rr 2,11,42,4 112 rrr false 2,42r 2,52,5 111 rr 02,52,5 12 rr 2,11,52,5 112 rrr false 00 02,52 r

0

2,2 UR

00

01R

Page 11: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Step 1

0000

120

45

1R

0000

142045

2R

k – select kth row and kth columnV – select Vth columnU – Uth row in Vth column

211

,1RR

kfor

Page 12: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Step 2

0000

142045

2R

k – select kth row and kth columnV – select Vth columnU – Uth row in Vth column

312

,2RR

kfor

0000

142045

3R

Page 13: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Step 3

0000

142045

3R

k – select kth row and kth columnV – select Vth columnU – Uth row in Vth column

413

,3RR

kfor

1000

112045

4R

Page 14: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Step 4

k – select kth row and kth columnV – select Vth columnU – Uth row in Vth column

514

,4RR

kfor

1000

112045

5R

1000

112045

4R

Page 15: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Step 5k – select kth row and kth column

615

,5RR

kfor

1000

112045

6R

1000

112045

5RV – select Vth column

U – Uth row in Vth column

Page 16: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Part – III Check for the negative cycles(steps 10 to 14)

10. For k =1 to N11. For U = 1 to N12. If13. Return false and exit14. Return true and exit

0, UUr k

Page 17: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Check for negative cycle and solution

k = 4

4

1

-1

-1

U = 1

U = 2

U = 3

U = 4

U = 5

k = 1

0

0

k = 2

0

k = 3

5

2

0

k = 5

• If “true” is returned because all diagonal entries are non negative.

• The solution is : r(1) = 0; r(2) = 0; r(3) = 0;r(4) = -1

Page 18: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

Try these problems

121 rr

313 rr214 rr115 rr

123 rr134 rr

254 rr153 rr

313 rr214 rr215 rr

123 rr134 rr

754 rr653 rr

121 rr

Problem 1 Problem 2

Page 19: WINSEM2014-15_CP0791_10-Feb-2015_RM01_06_Retiming

SPECIAL CASES OF RETIMINGNext Class