Retiming: Reduce Clock Period by Shortening Critical Path Reduce The Number of Registers
Retiming: Reduce Clock Period by Shortening Critical Path Reduce The Number of Registers
1
NO CHANGE IN FUNCTIONAL
BEHAVIOR AFETER RETIMING
w(n)=ay(n-1)+by(n-2) 𝑤! = 𝑎𝑦 𝑛 − 1
y(n)=w(n-1)+x(n) 𝑤" = 𝑏𝑦 𝑛 − 2
=ay(n-2)+by(n-3)+x(n) 𝑦 𝑛 = 𝑤! 𝑛 − 1 + 𝑤" 𝑛 − 1 + 𝑥 𝑛
= ay(n-2)+by(n-3)+x(n)
2
RETIMING FORMULATION
• Retiming value, r
3D r(N) = 2 D
3D 5D
N N
2D
5
APPLICATION OF A RETIMING SOLUTION
𝑟 1 − 𝑟(3) ≤ 1
𝑟 1 − 𝑟(4) ≤ 2
𝑟 3 − 𝑟(2) ≤ 0
𝑟 4 − 𝑟(2) ≤ 0
𝑟 2 − 𝑟(1) ≤ 1
A retiming solution:
𝑟 1 =0
𝑟 2 =1
𝑟 3 =0
𝑟 4 =0
6
SOLVING SYSTEM OF INEQUALITIES BY
SHORTEST PATH ALGORITHM
• Given M inequalities in N variables where inequality is
of the form 𝑟! − 𝑟" ≤ 𝑘 for integer values of k
• Draw a constraint graph
• Draw the node i for each of the N variables ri, i=1,2,…,N
• Draw the node N+1
• For each inequality 𝑟! −𝑟" ≤ 𝑘, draw the edge jài of length k
• For each node i, i=1,2,…, n, draw the edge N+1ài from the node N+1
to node i with length 0
• Solve using a shortest path algorithm
• The system of inequalities have a solution iff the constraint graph
contains no negative cycles
• If a solution exists, one solution is where ri is the minimum length
path from the node N+1 to node i
7
EXAMPLE
𝑟 1 − 𝑟(2) ≤ 0
𝑟 3 − 𝑟(1) ≤ 5
𝑟 4 − 𝑟(1) ≤ 4
𝑟 4 − 𝑟 3 ≤ −1
𝑟 3 − 𝑟(2) ≤ 2
• A feasible cutset
𝑤# 𝑒!," ≥ 0 ⇒ 𝑤 𝑒!," + 𝑘 ≥ 0 − min
"
𝑤(𝑒) ≤ 𝑘 ≤ min
"
𝑤(𝑒)
%! →%# %# →%!
𝑤# 𝑒",! ≥ 0 ⇒ 𝑤 𝑒",! − 𝑘 ≥ 0
9
PIPELING IS A SPECIAL CASE OF RETIMING
Feed-forward Cutset:
k=2
10
RETIMING TOGETHER WITH SLOW-DOWN
11
RETIMING TO REDUCE CLOCK PERIOD
• Retiming can be performed to achieve a particular clock
period i.e. to ensure the critical path is not longer than c
• To find a retiming solution, we need to compute two tables
• W[U,V] = number of registers on the minimum weight path from
UàV
• D[U,V] = maximum delay over all paths with W[U,V] registers
• Knowing W[U,V], the system of inequalities meeting the
path constraint 𝑟 𝑈 − 𝑟 𝑉 ≤ 𝑊 𝑈, 𝑉 can be derived
• Knowing D[U,V], more inequalities can be added by
considering the critical path constraint
• Change 𝑤! (𝑈, 𝑉) ≥ 0 to 𝑤! (𝑈, 𝑉) ≥ 1 to ensure there is at least on
register is added to reduce those paths with D[U,V]>c
• 𝑤 𝑈, 𝑉 + 𝑟 𝑉 − 𝑟 𝑈 ≥ 1
• 𝑟 𝑈 − 𝑟 𝑉 ≤ 𝑤 𝑈, 𝑉 − 1
12
EXAMPLE
𝑟 1 − 𝑟(2) ≤ 0
𝑟 1 − 𝑟(3) ≤ 1
𝑟 2 − 𝑟(3) ≤ 1
𝑟 1 − 𝑟(4) ≤ 2 𝑟 2 − 𝑟(4) ≤ 2
𝑟 2 − 𝑟(1) ≤ 1
𝑟 3 − 𝑟(1) ≤ 0
𝑟 3 − 𝑟(2) ≤ 0
𝑟 3 − 𝑟(4) ≤ 2
𝑟 4 − 𝑟(2) ≤ 0 𝑟 4 − 𝑟(1) ≤ 0
𝑟 4 − 𝑟(3) ≤ 1
13
SOLVING THE SYSTEM OF INEQUALITIES
• Solution is
r(1)=r(2)=r(3)=r(4)=0
15
RETIMING FOR REGISTER MINIMIZATION
D
D
N N
D
16
17