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,8 +729,9 @@ 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);
|
||||||
for (size_t i = 0; i < ni->users.size(); i++)
|
if (ctx->timing_driven)
|
||||||
net_arc_tcost[ni->udata][i] = get_timing_cost(ni, i);
|
for (size_t i = 0; i < ni->users.size(); i++)
|
||||||
|
net_arc_tcost[ni->udata][i] = get_timing_cost(ni, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -804,21 +806,23 @@ 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;
|
||||||
}
|
}
|
||||||
// Output ports - all arcs change timing
|
if (ctx->timing_driven) {
|
||||||
if (port.second.type == PORT_OUT) {
|
// Output ports - all arcs change timing
|
||||||
int cc;
|
if (port.second.type == PORT_OUT) {
|
||||||
TimingPortClass cls = ctx->getPortTimingClass(cell, port.first, cc);
|
int cc;
|
||||||
if (cls != TMG_IGNORE)
|
TimingPortClass cls = ctx->getPortTimingClass(cell, port.first, cc);
|
||||||
for (size_t i = 0; i < pn->users.size(); i++)
|
if (cls != TMG_IGNORE)
|
||||||
if (!mc.already_changed_arcs[pn->udata][i]) {
|
for (size_t i = 0; i < pn->users.size(); i++)
|
||||||
mc.changed_arcs.emplace_back(std::make_pair(pn->udata, i));
|
if (!mc.already_changed_arcs[pn->udata][i]) {
|
||||||
mc.already_changed_arcs[pn->udata][i] = true;
|
mc.changed_arcs.emplace_back(std::make_pair(pn->udata, i));
|
||||||
}
|
mc.already_changed_arcs[pn->udata][i] = true;
|
||||||
} else if (port.second.type == PORT_IN) {
|
}
|
||||||
auto usr = fast_port_to_user.at(&port.second);
|
} else if (port.second.type == PORT_IN) {
|
||||||
if (!mc.already_changed_arcs[pn->udata][usr]) {
|
auto usr = fast_port_to_user.at(&port.second);
|
||||||
mc.changed_arcs.emplace_back(std::make_pair(pn->udata, usr));
|
if (!mc.already_changed_arcs[pn->udata][usr]) {
|
||||||
mc.already_changed_arcs[pn->udata][usr] = true;
|
mc.changed_arcs.emplace_back(std::make_pair(pn->udata, usr));
|
||||||
|
mc.already_changed_arcs[pn->udata][usr] = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -833,13 +837,14 @@ 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);
|
||||||
md.new_arc_costs.emplace_back(std::make_pair(tc, new_cost));
|
md.new_arc_costs.emplace_back(std::make_pair(tc, new_cost));
|
||||||
md.timing_delta += (new_cost - old_cost);
|
md.timing_delta += (new_cost - old_cost);
|
||||||
md.already_changed_arcs[tc.first][tc.second] = false;
|
md.already_changed_arcs[tc.first][tc.second] = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user