diff options
author | gatecat <gatecat@ds0.me> | 2022-03-01 16:38:48 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-01 16:38:48 +0000 |
commit | 0a70b9c992c06a7553725b3742052eb95abd5f20 (patch) | |
tree | d1d8436576bad3424031c5ce435d76717fef196e /common/placer_heap.cc | |
parent | d8bea3ccfc7b6e925a9fd63c9172748ea0420e88 (diff) | |
parent | 86699b42f619960bfefd4d0b479dd44a90527ea4 (diff) | |
download | nextpnr-0a70b9c992c06a7553725b3742052eb95abd5f20.tar.gz nextpnr-0a70b9c992c06a7553725b3742052eb95abd5f20.tar.bz2 nextpnr-0a70b9c992c06a7553725b3742052eb95abd5f20.zip |
Merge pull request #925 from YosysHQ/gatecat/netlist-iv
Switch to potentially-sparse net users array
Diffstat (limited to 'common/placer_heap.cc')
-rw-r--r-- | common/placer_heap.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/common/placer_heap.cc b/common/placer_heap.cc index f8385cef..5b43dc72 100644 --- a/common/placer_heap.cc +++ b/common/placer_heap.cc @@ -655,9 +655,9 @@ class HeAPPlacer template <typename Tf> void foreach_port(NetInfo *net, Tf func) { if (net->driver.cell != nullptr) - func(net->driver, -1); - for (size_t i = 0; i < net->users.size(); i++) - func(net->users.at(i), i); + func(net->driver, store_index<PortRef>()); + for (auto usr : net->users.enumerate()) + func(usr.value, usr.index); } // Build the system of equations for either X or Y @@ -682,7 +682,7 @@ class HeAPPlacer // Find the bounds of the net in this axis, and the ports that correspond to these bounds PortRef *lbport = nullptr, *ubport = nullptr; int lbpos = std::numeric_limits<int>::max(), ubpos = std::numeric_limits<int>::min(); - foreach_port(ni, [&](PortRef &port, int user_idx) { + foreach_port(ni, [&](PortRef &port, store_index<PortRef> user_idx) { int pos = cell_pos(port.cell); if (pos < lbpos) { lbpos = pos; @@ -713,17 +713,17 @@ class HeAPPlacer }; // Add all relevant connections to the matrix - foreach_port(ni, [&](PortRef &port, int user_idx) { + foreach_port(ni, [&](PortRef &port, store_index<PortRef> user_idx) { int this_pos = cell_pos(port.cell); auto process_arc = [&](PortRef *other) { if (other == &port) return; int o_pos = cell_pos(other->cell); - double weight = 1.0 / (ni->users.size() * + double weight = 1.0 / (ni->users.entries() * std::max<double>(1, (yaxis ? cfg.hpwl_scale_y : cfg.hpwl_scale_x) * std::abs(o_pos - this_pos))); - if (user_idx != -1) { + if (user_idx) { weight *= (1.0 + cfg.timingWeight * std::pow(tmg.get_criticality(CellPortKey(port)), cfg.criticalityExponent)); } |