Professional Documents
Culture Documents
05 High Level Synthesis
05 High Level Synthesis
05 High Level Synthesis
Design Representation
• Intermediate representation essential for efficient
processing.
– Input HDL behavioral descriptions translated into some
canonical intermediate representation.
• Language independent
• Uniform view across CAD tools and users
– Synthesis tools carry out transformations of the
intermediate representation.
1
Scope of High Level Synthesis
Verilog / VHDL Description
Transformation
Scheduling
Allocation
FSM DataPath
Controller Structure
Simple Transformation
A = B + C;
D = A * E;
X = D – A;
+ * –
2
Read B Read C
+
Read E
*
Data Flow
Graph
Write X
CAD for VLSI 5
case (C)
1: begin
X = X + 3;
A = X + 1;
end
2: A = X + 5;
default: A = X + Y;
endcase
3
Data flow graph
can be drawn
X = X + 3; similarly, consisting
A = X + 5; A = X + Y;
A = X + 1; of “Read” and
“Write” boxes,
operation nodes,
and muliplexers.
Another Example
if (X == 0)
A = B + C;
D = B – C;
else
D = D – 1;
4
Read B Read C Read D 1
+ − −
Read A
Read X 0
= 1 0 1 0
MUX
Write A Write D
Compiler Transformations
• Set of operations carried out on the intermediate
representation.
– Constant folding
– Redundant operator elimination
– Tree height transformation
– Control flattening
– Logic level transformation
– Register-Transfer level transformation
5
Constant Folding
Write X Write X
* * *
6
Tree Height Transformation
a=b–c+d–e+f+g
a a
− −
b + b −
c − +
d + + e +
e + c f g
d
f g
Control Flattening
7
Logic Level Transformation
NOT OR
AND
Write C
OR
Write C
C = A + A′′B = A + B
PARTITIONING
8
Why Required?
• Used in various steps of high level synthesis:
– Scheduling
– Allocation
– Unit selection
• The same techniques for partitioning are also used
in physical design automation tools.
– To be discussed later.
Component Partitioning
• Given a netlist, create a partition which satisfies
some objective function.
– Clusters almost of equal sizes.
– Minimum interconnection strength between clusters.
• An example to illustrate the concept.
9
Cut 1 = 4
Cut 2 = 4
Size 1 = 15
Size 2 = 16
Size 3 = 17
Behavioral Partitioning
• With respect to Verilog, can be used when:
– Multiple modules are instantiated in a top-level module
description.
• Each module becomes a partition.
– Several concurrent “always” blocks are used.
• Each “always” block becomes a partition.
10
Partitioning Techniques
Random Selection
• Randomly select nodes one at a time and place
them into clusters of fixed size, until the proper size
is reached.
• Repeat above procedure until all the nodes have
been placed.
• Quality/Performance:
– Fast and easy to implement.
– Generally produces poor results.
– Usually used to generate the initial partitions for iterative
placement algorithms.
11
Cluster Growth
m : size of each cluster, V : set of nodes
n = |V| / m ;
for (i=1; i<=n; i++)
{
seed = vertex in V with maximum degree;
Vi = {seed};
V = V – {seed};
for (j=1; j<m; j++)
{
t = vertex in V maximally connected to Vi;
Vi = Vi U {t};
V = V – {t};
}
}
Hierarchical Clustering
• Consider a set of objects and group them
depending on some measure of closeness.
– The two closest objects are clustered first, and considered
to be a single object for further partitioning.
– The process continues by grouping two individual objects,
or an object or cluster with another cluster.
– We stop when a single cluster is generated and a
hierarchical cluster tree has been formed.
• The tree can be cut in any way to get clusters.
12
Example
v1
v1
7 5 v241 v2413
7 5 6 v3
v2
1 v3 v24 4 4
1 v3
9
4
4 v5 v5
v4 v5
v5
v24135
v24135
v2413
v241
v24
v2 v4 v1 v3 v5
13
Min-Cut Algorithm (Kernighan-Lin)
• Basically a bisection algorithm.
– The input graph is partitioned into two subsets of equal
sizes.
• Till the cutsets keep improving:
– Vertex pairs which give the largest decrease in cutsize are
exchanged.
– These vertices are then locked.
– If no improvement is possible and some vertices are still
unlocked, the vertices which give the smallest increase are
exchanged.
Example
1 1 8
5
2 3
6 2
6 7
3 7
4 8
5 4
14
Steps of Execution
1 3
2 6
Choose 5 and 3
for exchange
5 7
4 8
15
Goldberg-Burstein Algorithm
• Performance of K-L algorithm depends on the ratio
R of edges to vertices.
• K-L algorithm yields good bisections if R > 5.
• For typical VLSI problems, 1.8 < R < 2.5.
• The basic improvement attempted is to increase R.
– Find a matching M in graph G.
– Each edge in the matching is contracted to increase the
density of the graph.
– Any bisection algorithm is applied to the modified graph.
– Edges are uncontracted within each partition.
After Contracting
Matching of Graph
16
Simulated Annealing
• Iterative improvement algorithm.
– Simulates the annealing process in metals.
– Parameters:
• Solution representation
• Cost function
• Moves
• Termination condition
• Randomized algorithm
– To be discussed later.
SCHEDULING
17
What is Scheduling?
• Task of assigning behavioral operators to control
steps.
– Input:
• Control and Data Flow Graph (CDFG)
– Output:
• Temporal ordering of individual operations (FSM states)
• Basic Objective:
– Obtain the fastest design within constraints (exploit
parallelism).
Example
• Solving 2nd order differential equations (HAL)
18
CAD for VLSI 37
Scheduling Algorithms
• Three popular algorithms:
– As Soon As Possible (ASAP)
– As Late As Possible (ALAP)
– Resource Constrained (List scheduling)
19
As Soon As Possible (ASAP)
• Generated from the DFG by a breadth-first search
from the data sources to the sinks.
– Starts with the highest nodes (that have no parents) in the
DFG, and assigns time steps in increasing order as it
proceeds downwards.
– Follows the simple rule that a successor node can execute
only after its parent has executed.
• Fastest schedule possible
– Requires least number of control steps.
– Does not consider resource constraints.
v1 v2 v3 v4 v10
* * * * +
v5 v6 v9
* * + < v11
v7
-
v8
-
20
As Late As Possible (ALAP)
• Works very similar to the ALAP algorithm, except
that it starts at the bottom of the DFG and proceeds
upwards.
• Usually gives a bad solution:
– Slowest possible schedule (takes the maximum number of
control steps).
– Also does not necessarily reduce the number of functional
units needed.
v1 v2
* *
v5 v3
* *
v7 v6 v4 v10
- * * +
v8 v9 + < v11
-
21
Resource Constrained Scheduling
• There is a constraint on the number of resources
that can be used.
– List-Based Scheduling
• One of the most popular methods.
• Generalization of ASAP scheduling, since it produces
the same result in absence of resource constraints.
– Basic idea of List-Based Scheduling:
• Maintains a priority list of “ready” nodes.
• During each iteration, we try to use up all resources in that
state by scheduling operations in the head of the list.
• For conflicts, the operator with higher priority will be
scheduled first.
v5 v3
<2> v9
<0>
* *
<1> + < v11
<2>
v7 v6
<0> - *
<1>
For operator node i,
v8
- Mobility of i
<0> <i> = Time for ALAP – Time for ASAP
22
• Priority List:
*: 1 <0>
2 <0>
3 <1>
4 <2>
+: 10 <2>
• Resources:
*: 2
+: 1
-: 1
<: 1
v1 v2 v10
* * +
v5 v3
* * < v11
v7 v6 v4
- * *
v8 v9
- +
23
Time Constrained Scheduling
• Given the number of time steps, try to minimize the
resources required.
1. Force Directed Scheduling (FDS)
2. Integer Linear Programming (ILP)
3. Iterative Refinement
24
The Force Directed Scheduling
Algorithm
Step 1
* * * * + * *
* * + < * *
- - * * +
- - + <
ASAP ALAP
25
Step 2
• Determine Time Frame of each op
– Length of box ~ Possible execution cycles
– Width of box ~ Probability of assignment
– Uniform distribution, Area assigned = 1
Step 3
• Create Distribution Graphs
– Sum of probabilities of each Op type for each c-step of the CDFG
– Indicates concurrency of similar Ops
DG(i) = Σ Prob(Op, i)
26
Conditional Statements
- + - +
+ +
+ - + -
Join DG for Add
Self Forces
• Scheduling an operation will effect overall concurrency
• Every operation has 'self force' for every C-step of its time
frame
• Analogous to the effect of a spring: F = Kx (Hooke’s law)
Force(i) = DG(i) * x(i)
DG(i) ~ Current Distribution Graph value
x(i) ~ Change in operation’s probability
b
Total self force associated with the
assignment of an operation to
Self Force(j) = ∑
i=t
[Force(i)]
C-step j (t ≤ j ≤ b)
27
Example
28
Predecessor & Successor Forces
29
Final Time Frame and Schedule
30
Lookahead
• Temporarily modify the constant DG(i) to include the
effect of the iteration being considered
31
Minimization of Register Costs
• Minimum registers required is given by the largest number of
data arcs crossing a C-step boundary
• Create Storage Operations, at output of any operation that
transfers a value to a destination in a later C-step
• Generate Storage DG for these “operations”
• Length of storage operation depends on final schedule
s s
d d
Storage distribution for S
32
Pipelining
Functional Pipelining
1 * * * +
2 <
• Functional Pipelining 3, 1’
*
-
-
* *
* * * +
4, 2’ + * * * <
– Pipelining across multiple 3’
Instance -
operations 4’ - +
Instance’
– Must balance distribution across
groups of concurrent C-steps
– Cut DG horizontally and
superimpose
– Finally perform regular Force
Directed Scheduling DG for Multiply
Other Optimizations
• Local timing constraints
– Insert dummy timing operations -> Restricted time frames
• Multiclass FU’s
– Create multiclass DG by summing probabilities of relevant
ops
• Multistep/Chained operations.
– Carry propagation delay information with operation
– Extend time frames into other C-steps as required
• Hardware constraints
– Use Force as priority function in list scheduling algorithms
33
Scheduling Under Realistic Constraints
+ +
*
+ * +
34
+
*
+ *
Chaining *
Pipelining
35
Basic Idea
Example
a b c d
R1 R2 R3 R4
o1 o2 a b,e,g c,f,h d
+ +
e f
o3 o4 Adder 1 Adder 2
+ +
o1,o3 o2,o4
g h
e = a + b;
g = a + e;
f = c + d;
h = f + d;
CAD for VLSI 72
36
An Integrated Approach
• From the paper by “C-J. Tseng and D.P. Sieworek”
37