DSP-FPGA - Ch02 - Iteration Bound - HK202
DSP-FPGA - Ch02 - Iteration Bound - HK202
TLTK:
1. Các slide từ sách của Prof. Parhi
2. Slide của Prof. Viktor Öwall
3. Slide bài giảng của Thầy Hồ Trung Mỹ
4. KTGHK cũ
1
Outline
Introduction
Loop Bound (giới hạn vòng)
Important Definitions and Examples
Iteration Bound (giới hạn lặp)
Important Definitions and Examples
Techniques to Compute Iteration Bound
Algorithms to compute iteration bound
Longest Path Matrix (LPM)
Minimum Cycle Mean (MCM)
2
Some Definitions For DSP Algorithms
Non-terminating programs
Execute repetitively
Iteration
Execution of all the computations in the algorithm once
Iteration period
The time required for execution of an iteration
Iteration rate
Number iterations executed per second
3
Some Definitions For DSP Algorithms
Sampling period
The time difference between two consecutive samples
Sampling rate (throughput)
Number of samples processed per second
Critical path for combinational logic circuit
Longest path between inputs and outputs
Critical path for sequential circuits
Longest path between any two storage (delay)
elements
In general, critical path is defined to be the path with
the longest computation time among all paths that
contain zero delays.
4
Some Definitions For DSP Algorithms
Critical path computation time determines
Minimum feasible clock period of DSP systems
Clock period = Clock cycle time = 1/clock rate =
1/Critical path period
Latency
Difference between the time an output generated and
the time at which its corresponding input was received
by the system
Latency representations
• Absolute time units, or the number of gate delays, for
combinational logic circuit systems.
• Number of clock cycle for the sequential systems.
5
Various Representations of DSP Systems
6
DSP algorithm descriptions
Mathematical formulations
Specify functionality of DSP algorithm
Does not specify the order & structure of the
internal operations
7
Behavioral Descriptions
Applicative languages
A set of equations
Silage language
Prescriptive languages
Specify the order of the assignment statements
Pascal, C, SystemC,..
Descriptive languages
Represents the structure of DSP system
Verilog HDL or VHDL
8
Graphical Representations
Efficient for investigating and analyzing data
flow properties
Efficient for exploiting the inherent parallelism
among different subtasks
Easy mapping DSP algorithm descriptions to
hardware structural implementations
Provide technology-independent architecture
9
Various graphical representations
10
Graphical representations
functional
blocks
11
Ex: Direct Form 4-tap FIR filter
Note:
Clock speed limited by Critical Path!
TCritical = TM + (N-1)TA
N = Nr. of Taps 12
Graphical Representation Method 2:
Signal-Flow Graph (SFG)
Note:
Source = no entering edge
Sink = only entering edges 13
14
15
Block diagram with data broadcast
16
Graphical Representation Method 3:
Data-Flow Graph (DFG)
17
18
Loop Bound
Loop: a directed path that begins and ends at the
same node.
Loop Bound of the loop
Lower bound on the loop computation time or the time
requires to execute one iteration of the loop.
Defined as t𝑙/w𝑙, where t𝑙 is the loop computation time
and w𝑙 is the number of delays in the loop
E.g. 𝑦(𝑛)
(2) A→B→A is a loop
𝑥(𝑛) (4)
A B a t𝑙 = 2+ 4=6, w𝑙 = 1
D ⟹loop bound = t𝑙/w𝑙 =6
𝑦 𝑛 = ay 𝑛 − 1 + 𝑥 𝑛
Loop Bound (cont’d)
Another example
A→B→A is a loop
y(n) t𝑙 = 2+ 4=6, w𝑙 = 2 (since 2D)
x(n) (2) ⟹ loop bound = t𝑙/w𝑙 = 3
A (4)
B a
It means one iteration of loop can be
executed in 3 time unit.
2D
Another example
D
(2) (4) (5) Two loops
A→B→A : T = 6, W = 2, loop bound = 3
A B C
A→B→C→A, T = 11, W = 1, loop bound = 11
2D
Loop Bound (cont’d)
22
Iteration Bound
= 12ns
24
Iteration Bound (cont’d)
25
Critical Path
Critical Path: the path with longest computation time
among all paths that contain zero delays.
Critical Path: the lower bound on clock period. 𝑇clock ≥ 𝑇𝑐𝑟𝑖𝑡𝑖𝑐𝑎𝑙
27
Algorithms to compute iteration bound
28
Longest Path Matrix (LPM)
𝒎 𝟏 𝒎−𝟏
𝒍𝒊,𝒋 = max −𝟏, 𝒍𝒊,𝒌 + 𝒍𝒌,𝒋 𝐟𝐨𝐫 𝒌 ∈ 𝟏, 𝟐, ⋯ , 𝒅 ; 𝐦 = 𝟐, 𝟑, ⋯ , 𝒅
𝒌
𝑚
and 𝑙𝑖,𝑖 ≠ −1 29
Examples for LPM
-1 0 -1 -1
(1)
L = 4 -1 0 -1
5 -1 -1 0
5 -1 -1 -1
d i → dj
max
q q
t if at least one path exists
𝑙 (1)i,j =
-1 if no such path exists
30
𝒎 𝟏 𝒎−𝟏
𝒍𝒊,𝒋 = max −𝟏, 𝒍𝒊,𝒌 + 𝒍𝒌,𝒋 𝑙 (1)i,k ≠ −1 ; 𝑙 (m-1)k,j ≠ −1
𝒌∈ 𝟏,𝒅
𝑙 (1)1,2
• Ex. i = 1; m = 2; L(2)
(2) (1) (1) i=1
𝑙 1,1 = max( -1, 𝑙 1,k + 𝑙 k,1)
k{2}
= max( -1,0+4) = 4
(2) (1) (1)
𝑙 1,2 = max( -1, 𝑙 1,k + 𝑙 k,2)
= max( -1) = -1
j=1
𝑙 (1)2,1
𝑙 1,3(2) = max( -1, 𝑙 (1)1,k + 𝑙 (1)k,3) i=1
k{2} 4 - - -
= max(-1, 0+0) = 0 - - - -
(2)
𝑙 1,4(2) = max ( -1, 𝑙 (1)1,k + 𝑙 (1)k,4) L = - - - -
- - - -
= max(-1) = -1
31
𝒎 𝟏 𝒎−𝟏
𝒍𝒊,𝒋 = max −𝟏, 𝒍𝒊,𝒌 + 𝒍𝒌,𝒋 𝑙 (1)i,k ≠ −1 ; 𝑙 (m-1)k,j ≠ −1
𝒌∈ 𝟏,𝒅
𝑙 (1)1,2
• Ex. i = 1; m = 2; L(2)
(2) (1) (1) i=1
𝑙 1,1 = max( -1, 𝑙 1,k + 𝑙 k,1)
k{2}
= max( -1,0+4) = 4
(2) (1) (1)
𝑙 1,2 = max( -1, 𝑙 1,k + 𝑙 k,2)
= max( -1) = -1
j=2
𝑙 1,3(2) = max( -1, 𝑙 (1)1,k + 𝑙 (1)k,3) i=1
k{2} 4 -1 - -
= max(-1, 0+0) = 0 - - - -
(2)
𝑙 1,4(2) = max ( -1, 𝑙 (1)1,k + 𝑙 (1)k,4) L = - - - -
- - - -
= max(-1) = -1
32
𝒎 𝟏 𝒎−𝟏
𝒍𝒊,𝒋 = max −𝟏, 𝒍𝒊,𝒌 + 𝒍𝒌,𝒋 𝑙 (1)i,k ≠ −1 ; 𝑙 (m-1)k,j ≠ −1
𝒌∈ 𝟏,𝒅
𝑙 (1)1,2
• Ex. i = 1; m = 2; L(2)
(2) (1) (1) i=1
𝑙 1,1 = max( -1, 𝑙 1,k + 𝑙 k,1)
k{2}
= max( -1,0+4) = 4
(2) (1) (1)
𝑙 1,2 = max( -1, 𝑙 1,k + 𝑙 k,2)
𝑙 (1)2,3
= max( -1) = -1
j=3
𝑙 1,3(2) = max( -1, 𝑙 (1)1,k + 𝑙 (1)k,3) i=1
k{2} 4 -1 0 -
= max(-1, 0+0) = 0 - - - -
(2)
𝑙 1,4(2) = max ( -1, 𝑙 (1)1,k + 𝑙 (1)k,4) L = - - - -
- - - -
= max(-1) = -1
33
𝒎 𝟏 𝒎−𝟏
𝒍𝒊,𝒋 = max −𝟏, 𝒍𝒊,𝒌 + 𝒍𝒌,𝒋 𝑙 (1)i,k ≠ −1 ; 𝑙 (m-1)k,j ≠ −1
𝒌∈ 𝟏,𝒅
𝑙 (1)1,2
• Ex. i = 1; m = 2; L(2)
(2) (1) (1) i=1
𝑙 1,1 = max( -1, 𝑙 1,k + 𝑙 k,1)
k{2}
= max( -1,0+4) = 4
(2) (1) (1)
𝑙 1,2 = max( -1, 𝑙 1,k + 𝑙 k,2)
= max( -1) = -1
j=4
𝑙 1,3(2) = max( -1, 𝑙 (1)1,k + 𝑙 (1)k,3) i=1
k{2} 4 -1 0 -1
= max(-1, 0+0) = 0 - - - -
(2)
𝑙 1,4(2) = max ( -1, 𝑙 (1)1,k + 𝑙 (1)k,4) L = - - - -
- - - -
= max(-1) = -1
34
𝒎 𝒎 𝟏 + 𝒍 𝒎−𝟏 𝟏 𝒎−𝟏
𝒍𝒊,𝒋
𝒍𝒊,𝒋 ==𝒌∈
max
max −𝟏,𝒍𝒍𝒊,𝒌
−𝟏, 𝒊,𝒌 + 𝒍 𝒌,𝒋
𝒌,𝒋
𝑙 (1)i,k ≠ −1 ; 𝑙 (m-1)k,j ≠ −1
𝟏,𝒅𝒌
𝑙 (1)2,3
• Ex. i = 2; m = 2; L(2)
(2) (1) (1)
𝑙 2,1 = max( -1, 𝑙 2,k +𝑙 k,1)
k{3} i=2
= max( -1,0+5) = 5
(2) (1) (1)
𝑙 2,2 = max( -1, 𝑙 2,k + 𝑙 k,2)
k{1}
• Ex. i = 3; m = 2; L(2)
𝑙
(2) (1)
𝑙 3,k
(1)
+ 𝑙 k,1) 𝑙 (1)3,4
3,1 = max( -1,
k{4}
• Ex. i = 4; m = 2; L(2)
(2) (1) (1)
𝑙 4,1 = max( -1, 𝑙 4,k +𝑙 k,1)
= max( -1) = -1
(2) (1) (1)
𝑙 4,2 = max( -1, 𝑙 4,k + 𝑙 k,2)
k{1} i=4
(m=2)
(m=3) (m=4)
38
Examples for LPM (other solution)
𝒎 𝟏 𝒎−𝟏
𝒍𝒊,𝒋 = max −𝟏, 𝒍𝒊,𝒌 + 𝒍𝒌,𝒋
𝒌∈ 𝟏,𝒅
𝑙 (1)i,k ≠ −1 ; 𝑙 (m-1)k,j ≠ −1
𝟏
𝑳 𝑳 𝟏
+
𝑳 𝟐 = +
𝑳 𝟐 =
39
Examples for LPM (other solution)
𝒎 𝟏 𝒎−𝟏
𝒍𝒊,𝒋 = max −𝟏, 𝒍𝒊,𝒌 + 𝒍𝒌,𝒋
𝒌∈ 𝟏,𝒅
𝑙 (1)i,k ≠ −1 ; 𝑙 (m-1)k,j ≠ −1
𝟏
𝑳 𝑳 𝟏
+
𝑳 𝟐 = +
𝑳 𝟐 =
40
Examples for LPM (other solution)
𝒎 𝟏 𝒎−𝟏
𝒍𝒊,𝒋 = max −𝟏, 𝒍𝒊,𝒌 + 𝒍𝒌,𝒋
𝒌∈ 𝟏,𝒅
𝑙 (1)i,k ≠ −1 ; 𝑙 (m-1)k,j ≠ −1
𝟏
𝑳 𝑳 𝟏
+
𝑳 𝟐 = +
𝑳 𝟐 =
41
Examples for LPM (other solution)
𝒎 𝟏 𝒎−𝟏
𝒍𝒊,𝒋 = max −𝟏, 𝒍𝒊,𝒌 + 𝒍𝒌,𝒋
𝒌∈ 𝟏,𝒅
𝑙 (1)i,k ≠ −1 ; 𝑙 (m-1)k,j ≠ −1
𝟏
𝑳 𝑳 𝟏
+
𝑳 𝟐 = +
𝑳 𝟐 =
42
Examples for LPM (other solution)
𝒎 𝟏 𝒎−𝟏
𝒍𝒊,𝒋 = max −𝟏, 𝒍𝒊,𝒌 + 𝒍𝒌,𝒋
𝒌∈ 𝟏,𝒅
𝑙 (1)i,k ≠ −1 ; 𝑙 (m-1)k,j ≠ −1
𝟏
𝑳 𝑳 𝟏
+
𝑳 𝟐 = +
𝑳 𝟐 =
43
Examples for LPM (other solution)
𝒎 𝟏 𝒎−𝟏
𝒍𝒊,𝒋 = max −𝟏, 𝒍𝒊,𝒌 + 𝒍𝒌,𝒋
𝒌∈ 𝟏,𝒅
𝑙 (1)i,k ≠ −1 ; 𝑙 (m-1)k,j ≠ −1
𝟏
𝑳 𝑳 𝟐
+
𝑳 𝟑 = +
𝑳 𝟑 =
44
Examples for LPM (other solution)
𝒎 𝟏 𝒎−𝟏
𝒍𝒊,𝒋 = max −𝟏, 𝒍𝒊,𝒌 + 𝒍𝒌,𝒋
𝒌∈ 𝟏,𝒅
𝑙 (1)i,k ≠ −1 ; 𝑙 (m-1)k,j ≠ −1
𝟏
𝑳 𝑳 𝟑
+
𝑳 𝟒 = +
𝑳 𝟒 =
45
Examples for LPM
= max −𝟏, 𝟒 + 𝟒, 𝟒 + 𝟖
𝟏 𝟏
𝑳 𝑳
= 8 u.t.
46
TD: Đề KTGHK-HK112
47
48
49
Minimum Cycle Mean Method (MCM)
50
51
Minimum Cycle Mean Method (MCM)-Summary
52
Examples for MCM (1/4)
Graph Gd
DFG 53
Examples for MCM (2/4)
𝑤 2,1 𝑤 ′ 2,1
𝒘′ 𝒊, 𝒋 = −𝒘 𝒊, 𝒋
Graph Gd Graph 𝑮′𝒅
DFG 54
Examples for MCM (3/4)
reference
node
𝒇𝟒 𝟏
treated
as zero
Note that:
56
Examples for MCM (cont’d)
57
Conclusion
When the DFG is recursive, the iteration bound
is the fundamental limit on the minimum sample
period of a hardware implementation of the DSP
program.
58