placer1: Implement non-timing-driven mode
Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
parent
1780f42b9a
commit
bd0a33022b
@ -455,6 +455,7 @@ class SAPlacer
|
|||||||
// Attempt a SA position swap, return true on success or false on failure
|
// Attempt a SA position swap, return true on success or false on failure
|
||||||
bool try_swap_position(CellInfo *cell, BelId newBel)
|
bool try_swap_position(CellInfo *cell, BelId newBel)
|
||||||
{
|
{
|
||||||
|
static const double epsilon = 1e-20;
|
||||||
moveChange.reset();
|
moveChange.reset();
|
||||||
BelId oldBel = cell->bel;
|
BelId oldBel = cell->bel;
|
||||||
CellInfo *other_cell = ctx->getBoundBelCell(newBel);
|
CellInfo *other_cell = ctx->getBoundBelCell(newBel);
|
||||||
@ -496,8 +497,8 @@ class SAPlacer
|
|||||||
new_dist = get_constraints_distance(ctx, cell);
|
new_dist = get_constraints_distance(ctx, cell);
|
||||||
if (other_cell != nullptr)
|
if (other_cell != nullptr)
|
||||||
new_dist += get_constraints_distance(ctx, other_cell);
|
new_dist += get_constraints_distance(ctx, other_cell);
|
||||||
delta = lambda * (moveChange.timing_delta / last_timing_cost) +
|
delta = lambda * (moveChange.timing_delta / std::max<double>(last_timing_cost, epsilon)) +
|
||||||
(1 - lambda) * (double(moveChange.wirelen_delta) / last_wirelen_cost);
|
(1 - lambda) * (double(moveChange.wirelen_delta) / std::max<double>(last_wirelen_cost, epsilon));
|
||||||
delta += (cfg.constraintWeight / temp) * (new_dist - old_dist) / last_wirelen_cost;
|
delta += (cfg.constraintWeight / temp) * (new_dist - old_dist) / last_wirelen_cost;
|
||||||
n_move++;
|
n_move++;
|
||||||
// SA acceptance criterea
|
// SA acceptance criterea
|
||||||
@ -728,6 +729,7 @@ class SAPlacer
|
|||||||
if (ignore_net(ni))
|
if (ignore_net(ni))
|
||||||
continue;
|
continue;
|
||||||
net_bounds[ni->udata] = get_net_bounds(ni);
|
net_bounds[ni->udata] = get_net_bounds(ni);
|
||||||
|
if (ctx->timing_driven)
|
||||||
for (size_t i = 0; i < ni->users.size(); i++)
|
for (size_t i = 0; i < ni->users.size(); i++)
|
||||||
net_arc_tcost[ni->udata][i] = get_timing_cost(ni, i);
|
net_arc_tcost[ni->udata][i] = get_timing_cost(ni, i);
|
||||||
}
|
}
|
||||||
@ -804,6 +806,7 @@ class SAPlacer
|
|||||||
mc.bounds_changed_nets.push_back(pn->udata);
|
mc.bounds_changed_nets.push_back(pn->udata);
|
||||||
mc.already_bounds_changed[pn->udata] = true;
|
mc.already_bounds_changed[pn->udata] = true;
|
||||||
}
|
}
|
||||||
|
if (ctx->timing_driven) {
|
||||||
// Output ports - all arcs change timing
|
// Output ports - all arcs change timing
|
||||||
if (port.second.type == PORT_OUT) {
|
if (port.second.type == PORT_OUT) {
|
||||||
int cc;
|
int cc;
|
||||||
@ -823,6 +826,7 @@ class SAPlacer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void compute_cost_changes(MoveChangeData &md)
|
void compute_cost_changes(MoveChangeData &md)
|
||||||
{
|
{
|
||||||
@ -833,7 +837,7 @@ class SAPlacer
|
|||||||
md.wirelen_delta += (bounds.hpwl() - old_hpwl);
|
md.wirelen_delta += (bounds.hpwl() - old_hpwl);
|
||||||
md.already_bounds_changed[bc] = false;
|
md.already_bounds_changed[bc] = false;
|
||||||
}
|
}
|
||||||
|
if (ctx->timing_driven) {
|
||||||
for (const auto &tc : md.changed_arcs) {
|
for (const auto &tc : md.changed_arcs) {
|
||||||
double old_cost = net_arc_tcost.at(tc.first).at(tc.second);
|
double old_cost = net_arc_tcost.at(tc.first).at(tc.second);
|
||||||
double new_cost = get_timing_cost(net_by_udata.at(tc.first), tc.second);
|
double new_cost = get_timing_cost(net_by_udata.at(tc.first), tc.second);
|
||||||
@ -842,6 +846,7 @@ class SAPlacer
|
|||||||
md.already_changed_arcs[tc.first][tc.second] = false;
|
md.already_changed_arcs[tc.first][tc.second] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void commit_cost_changes(MoveChangeData &md)
|
void commit_cost_changes(MoveChangeData &md)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user