|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--org.opencores.placement.Annealing
This is main class, consisting of simulated annealing routine. Nodes must be are already placed correctly (using preplacement) and their pos (.x, .y) and index .idx are set. All work here is done using indexes, but coordinates are also maintaned to speed up placement.
Alpha functions and some other dinamic parameters are adopted from VPR.
| Field Summary | |
private double[][] |
alpha
Discrete temperature update - alpha function. |
private float[] |
costs
|
private int[][] |
distance
Precalculated distance based on (x,y) coordinates. |
private static double |
DONE_CONSTANT
Stoping treshold. |
private Graph |
g
graph we are working on |
private static int |
INITIAL_TEMP_K
Initial temperature coefficient. |
private int |
INNER_NUM
Number of inner loop execution times. |
private static int |
INNER_NUM_K
Coefficient, which linearly changes number of inner loop executions. |
private NodeGPC[] |
posGPC
table of all possible GPC positions (and current assignments) |
private NodeIOC[] |
posIOC
table of all possible Port positions (and current assignments) |
private double |
temp
current temperature, @see setTemp |
private int |
tempAccepted
number of (accepted) moves performed per current temperature |
private int |
tempMoves
number of (possible) moves performed per current temperature |
private int |
tempWiringChange
total wiring change per current temperature |
private int |
wiringCost
current total wiring cost, @see calcTotalWiringCost, getWiringCost |
| Constructor Summary | |
Annealing(Graph g)
Construct and resets new SA object on graph g. |
|
| Method Summary | |
private boolean |
allowMove(float dCost)
Decides whether move with delta cost dCost should be taken. |
void |
anneal()
simulates anneal at current temperature temp. |
private void |
buildDist()
Build estimated #hops for each vector (dx, dy). |
private int |
calcTotalWiringCost()
Wiring length is sum of sizes of all minimum spanning trees. |
private float |
checkWiringCost()
Checks MST trees currently built with stored number in nets.cost |
private int |
dist(int dx,
int dy)
Returns estimated distance of vector (dx, dy). |
boolean |
doneCriteria()
Decides whether annealing has good solution and it is unlikely that we will find it, so we should stop. |
double |
getTemp()
Returns current temperature. |
int |
getWiringCost()
Returns current total wiring cost. |
private static int |
manhattan(int dx,
int dy)
Returns manhattan distance of vector (dx, dy). |
private boolean |
move(IndexedNode a,
IndexedNode b,
int bx,
int by,
int bidx)
Returns true if node has been moved from a to b |
private void |
move(NodeGPC a)
Tries to move node n, using current Conf. |
private void |
move(NodeIOC a)
Tries to move node n, using current configuration |
private float |
moveCost(Node n,
int x,
int y)
Estimates cost (wiring cost change) of move, after n is moved to (x,y). |
private int |
MST(Net nt)
Calculates minimum spanning tree size. |
void |
reset()
Resets SA. |
void |
setTemp(double temp)
Changes temperature and resets temperature specific data. |
private double |
stdDev()
Calculates standard deviation of one random move for each graph node. |
private boolean |
stopCriteria()
Decides whether we should stop annealing at current temperature. |
private void |
takeBackMove(Node n)
This function is called when move is not accepted, and updates net MST costs, to previous moveCost costs |
void |
updateTemperature()
Changes temperature - function alpha(T) |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private static final int INNER_NUM_K
private static final int INITIAL_TEMP_K
private int INNER_NUM
private static final double DONE_CONSTANT
private Graph g
private NodeGPC[] posGPC
private NodeIOC[] posIOC
private double temp
private int wiringCost
private int tempMoves
private int tempAccepted
private int tempWiringChange
private final double[][] alpha
First number is acceptance ratio, second coefficient K, and T = K * T
private float[] costs
private int[][] distance
| Constructor Detail |
public Annealing(Graph g)
g - mapped, preplaced graph to work on| Method Detail |
public void reset()
public void setTemp(double temp)
Should be called after each temp change.
temp - new temperaturepublic void updateTemperature()
public void anneal()
private final boolean stopCriteria()
public final boolean doneCriteria()
NOTE: call this before updateTemperature, since it destroys temperature dependent data, needed here
private void move(NodeGPC a)
temp - current temperaturea - GPC node to moveprivate void move(NodeIOC a)
an - IOC node to moveprivate final boolean allowMove(float dCost)
dCost - movement delta cost
private final float moveCost(Node n,
int x,
int y)
NOTE: no replacement is made. Does not calculate replacement cost of node at (x,y).
This function stores computed costs in costs, which can be used later if move is not accepted.
Proceed as following:
1. find closest pin on each a's port net, and calculate cost to move it to next neighbour or if no other to new position
2. find closest pin for each a's port net, based on new position
n - node to calculate movement cost ondest - node, we will exchange n withx - destination x positiony - destination y positionprivate void takeBackMove(Node n)
moveCost
private boolean move(IndexedNode a,
IndexedNode b,
int bx,
int by,
int bidx)
private final void buildDist()
distance
private final int dist(int dx,
int dy)
dx - vector x componentdy - vector y component
private static final int manhattan(int dx,
int dy)
dx - vector x componentdy - vector y componentprivate int MST(Net nt)
net - to compute MST onprivate int calcTotalWiringCost()
private float checkWiringCost()
private double stdDev()
public int getWiringCost()
public double getTemp()
temp
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||