aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/placer1.cc8
-rw-r--r--common/placer_heap.cc27
-rw-r--r--common/router2.cc5
-rw-r--r--common/rulecheck.cc69
-rw-r--r--common/timing.cc33
5 files changed, 17 insertions, 125 deletions
diff --git a/common/placer1.cc b/common/placer1.cc
index 92f42ba7..49f556f7 100644
--- a/common/placer1.cc
+++ b/common/placer1.cc
@@ -406,7 +406,7 @@ class SAPlacer
auto saplace_end = std::chrono::high_resolution_clock::now();
log_info("SA placement time %.02fs\n", std::chrono::duration<float>(saplace_end - saplace_start).count());
- // Final post-pacement validitiy check
+ // Final post-placement validity check
ctx->yield();
for (auto bel : ctx->getBels()) {
CellInfo *cell = ctx->getBoundBelCell(bel);
@@ -548,7 +548,7 @@ class SAPlacer
goto swap_fail;
}
- // Recalculate metrics for all nets touched by the peturbation
+ // Recalculate metrics for all nets touched by the perturbation
compute_cost_changes(moveChange);
new_dist = get_constraints_distance(ctx, cell);
@@ -560,7 +560,7 @@ class SAPlacer
if (cfg.netShareWeight > 0)
delta += -cfg.netShareWeight * (net_delta_score / std::max<double>(total_net_share, epsilon));
n_move++;
- // SA acceptance criterea
+ // SA acceptance criteria
if (delta < 0 || (temp > 1e-8 && (ctx->rng() / float(0x3fffffff)) <= std::exp(-delta / temp))) {
n_accept++;
} else {
@@ -691,7 +691,7 @@ class SAPlacer
cfg.netShareWeight * (orig_share_cost - total_net_share) / std::max<double>(total_net_share, 1e-20);
}
n_move++;
- // SA acceptance criterea
+ // SA acceptance criteria
if (delta < 0 || (temp > 1e-9 && (ctx->rng() / float(0x3fffffff)) <= std::exp(-delta / temp))) {
n_accept++;
#if 0
diff --git a/common/placer_heap.cc b/common/placer_heap.cc
index 908be49e..f10d4139 100644
--- a/common/placer_heap.cc
+++ b/common/placer_heap.cc
@@ -195,8 +195,8 @@ class HeAPPlacer
}
if (cfg.placeAllAtOnce) {
- // Never want to deal with LUTs, FFs, MUXFxs seperately,
- // for now disable all single-cell-type runs and only have heteregenous
+ // Never want to deal with LUTs, FFs, MUXFxs separately,
+ // for now disable all single-cell-type runs and only have heterogeneous
// runs
heap_runs.clear();
}
@@ -205,7 +205,7 @@ class HeAPPlacer
// The main HeAP placer loop
log_info("Running main analytical placer.\n");
while (stalled < 5 && (solved_hpwl <= legal_hpwl * 0.8)) {
- // Alternate between particular Bel types and all bels
+ // Alternate between particular bel types and all bels
for (auto &run : heap_runs) {
auto run_startt = std::chrono::high_resolution_clock::now();
@@ -321,7 +321,7 @@ class HeAPPlacer
std::vector<std::vector<std::vector<std::vector<BelId>>>> fast_bels;
std::unordered_map<IdString, std::tuple<int, int>> bel_types;
- // For fast handling of heterogeneosity during initial placement without full legalisation,
+ // For fast handling of heterogeneity during initial placement without full legalisation,
// for each Bel type this goes from x or y to the nearest x or y where a Bel of a given type exists
// This is particularly important for the iCE40 architecture, where multipliers and BRAM only exist at the
// edges and corners respectively
@@ -1123,7 +1123,6 @@ class HeAPPlacer
#endif
workqueue.emplace(r.id, false);
- // cut_region(r, false);
}
while (!workqueue.empty()) {
auto front = workqueue.front();
@@ -1139,7 +1138,6 @@ class HeAPPlacer
// Try the other dir, in case stuck in one direction only
auto res2 = cut_region(r, !front.second);
if (res2) {
- // log_info("RETRY SUCCESS\n");
workqueue.emplace(res2->first, front.second);
workqueue.emplace(res2->second, front.second);
}
@@ -1356,8 +1354,6 @@ class HeAPPlacer
for (int y1 = reg.y0; y1 <= reg.y1; y1++) {
for (size_t t = 0; t < beltype.size(); t++) {
if (occ_at(reg.x1 + 1, y1, t) > bels_at(reg.x1 + 1, y1, t)) {
- // log_info("(%d, %d) occ %d bels %d\n", reg.x1+ 1, y1, occ_at(reg.x1 + 1, y1),
- // bels_at(reg.x1 + 1, y1));
over_occ_x = true;
break;
}
@@ -1374,8 +1370,6 @@ class HeAPPlacer
for (int x1 = reg.x0; x1 <= reg.x1; x1++) {
for (size_t t = 0; t < beltype.size(); t++) {
if (occ_at(x1, reg.y1 + 1, t) > bels_at(x1, reg.y1 + 1, t)) {
- // log_info("(%d, %d) occ %d bels %d\n", x1, reg.y1 + 1, occ_at(x1, reg.y1 + 1),
- // bels_at(x1, reg.y1 + 1));
over_occ_y = true;
break;
}
@@ -1600,13 +1594,8 @@ class HeAPPlacer
if (std::accumulate(left_bels_v.begin(), left_bels_v.end(), 0) == 0 ||
std::accumulate(right_bels_v.begin(), right_bels_v.end(), 0) == 0)
return {};
- // log_info("pivot %d target cut %d lc %d lb %d rc %d rb %d\n", pivot, best_tgt_cut,
- // std::accumulate(left_cells_v.begin(), left_cells_v.end(), 0), std::accumulate(left_bels_v.begin(),
- // left_bels_v.end(), 0),
- // std::accumulate(right_cells_v.begin(), right_cells_v.end(), 0),
- // std::accumulate(right_bels_v.begin(), right_bels_v.end(), 0));
- // Peturb the source cut to eliminate overutilisation
+ // Perturb the source cut to eliminate overutilisation
auto is_part_overutil = [&](bool r) {
double delta = 0;
for (size_t t = 0; t < left_cells_v.size(); t++) {
@@ -1629,8 +1618,7 @@ class HeAPPlacer
right_cells_v.at(type_index.at(cut_cells.at(pivot)->type)) -= size;
pivot++;
}
- // log_info("peturbed pivot %d lc %d lb %d rc %d rb %d\n", pivot, left_cells, left_bels, right_cells,
- // right_bels);
+
// Split regions into bins, and then spread cells by linear interpolation within those bins
auto spread_binlerp = [&](int cells_start, int cells_end, double area_l, double area_r) {
int N = cells_end - cells_start;
@@ -1673,8 +1661,6 @@ class HeAPPlacer
NPNR_ASSERT(pos >= orig_left && pos <= orig_right);
pos = bl.second + m * (pos - orig_left);
}
- // log("[%f, %f] -> [%f, %f]: %f -> %f\n", orig_left, orig_right, bl.second, br.second,
- // orig_pos, pos);
}
}
};
@@ -1690,7 +1676,6 @@ class HeAPPlacer
cl.x = std::min(r.x1, std::max(r.x0, int(cl.rawx)));
cl.y = std::min(r.y1, std::max(r.y0, int(cl.rawy)));
cells_at_location.at(cl.x).at(cl.y).push_back(cell);
- // log_info("spread pos %d %d\n", cl.x, cl.y);
}
SpreaderRegion rl, rr;
rl.id = int(regions.size());
diff --git a/common/router2.cc b/common/router2.cc
index d19b8291..49d5fdec 100644
--- a/common/router2.cc
+++ b/common/router2.cc
@@ -396,7 +396,8 @@ struct Router2
if (ctx->getBelPinType(bp.bel, bp.pin) != PORT_IN)
return false;
for (auto p : ctx->getPipsUphill(wire))
- return false;
+ if (ctx->checkPipAvail(p))
+ return false;
return true;
}
@@ -411,7 +412,7 @@ struct Router2
WireId cursor = sink;
bool done = false;
if (ctx->debug)
- log("resevering wires for arc %d of net %s\n", int(i), ctx->nameOf(net));
+ log("reserving wires for arc %d of net %s\n", int(i), ctx->nameOf(net));
while (!done) {
auto &wd = wire_data(cursor);
if (ctx->debug)
diff --git a/common/rulecheck.cc b/common/rulecheck.cc
deleted file mode 100644
index 1db9ae00..00000000
--- a/common/rulecheck.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-#include <assert.h>
-#include <string>
-#include "log.h"
-#include "nextpnr.h"
-
-NEXTPNR_NAMESPACE_BEGIN
-
-bool check_all_nets_driven(Context *ctx)
-{
- const bool debug = false;
-
- log_info("Rule checker, verifying imported design\n");
-
- for (auto &cell_entry : ctx->cells) {
- CellInfo *cell = cell_entry.second.get();
-
- if (debug)
- log_info(" Examining cell \'%s\', of type \'%s\'\n", cell->name.c_str(ctx), cell->type.c_str(ctx));
- for (auto port_entry : cell->ports) {
- PortInfo &port = port_entry.second;
-
- if (debug)
- log_info(" Checking name of port \'%s\' "
- "against \'%s\'\n",
- port_entry.first.c_str(ctx), port.name.c_str(ctx));
- NPNR_ASSERT(port.name == port_entry.first);
- NPNR_ASSERT(!port.name.empty());
-
- if (port.net == NULL) {
- if (debug)
- log_warning(" Port \'%s\' in cell \'%s\' is unconnected\n", port.name.c_str(ctx),
- cell->name.c_str(ctx));
- } else {
- NPNR_ASSERT(port.net);
- if (debug)
- log_info(" Checking for a net named \'%s\'\n", port.net->name.c_str(ctx));
- NPNR_ASSERT(ctx->nets.count(port.net->name) > 0);
- }
- }
- }
-
- for (auto &net_entry : ctx->nets) {
- NetInfo *net = net_entry.second.get();
-
- NPNR_ASSERT(net->name == net_entry.first);
- if ((net->driver.cell != NULL) && (net->driver.cell->type != ctx->id("GND")) &&
- (net->driver.cell->type != ctx->id("VCC"))) {
-
- if (debug)
- log_info(" Checking for a driver cell named \'%s\'\n", net->driver.cell->name.c_str(ctx));
- NPNR_ASSERT(ctx->cells.count(net->driver.cell->name) > 0);
- }
-
- for (auto user : net->users) {
- if ((user.cell != NULL) && (user.cell->type != ctx->id("GND")) && (user.cell->type != ctx->id("VCC"))) {
-
- if (debug)
- log_info(" Checking for a user cell named \'%s\'\n", user.cell->name.c_str(ctx));
- NPNR_ASSERT(ctx->cells.count(user.cell->name) > 0);
- }
- }
- }
-
- if (debug)
- log_info(" Verified!\n");
- return true;
-}
-
-NEXTPNR_NAMESPACE_END
diff --git a/common/timing.cc b/common/timing.cc
index 8b35e41c..d8445989 100644
--- a/common/timing.cc
+++ b/common/timing.cc
@@ -317,7 +317,8 @@ struct Timing
auto &data = net_data[port.second.net][start_clk];
auto &arrival = data.max_arrival;
arrival = std::max(arrival, usr_arrival + comb_delay.maxDelay());
- if (!budget_override) { // Do not increment path length if budget overriden since it doesn't
+ if (!budget_override) { // Do not increment path length if budget overridden since it
+ // doesn't
// require a share of the slack
auto &path_length = data.max_path_length;
path_length = std::max(path_length, net_length_plus_one);
@@ -602,20 +603,11 @@ struct Timing
auto &nc = (*net_crit)[net->name];
if (nc.slack.empty())
nc.slack.resize(net->users.size(), std::numeric_limits<delay_t>::max());
-#if 0
- if (ctx->debug)
- log_info("Net %s cd %s\n", net->name.c_str(ctx), startdomain.first.clock.c_str(ctx));
-#endif
+
for (size_t i = 0; i < net->users.size(); i++) {
delay_t slack = nd.min_required.at(i) -
(nd.max_arrival + ctx->getNetinfoRouteDelay(net, net->users.at(i)));
-#if 0
- if (ctx->debug)
- log_info(" user %s.%s required %.02fns arrival %.02f route %.02f slack %.02f\n",
- net->users.at(i).cell->name.c_str(ctx), net->users.at(i).port.c_str(ctx),
- ctx->getDelayNS(nd.min_required.at(i)), ctx->getDelayNS(nd.max_arrival),
- ctx->getDelayNS(ctx->getNetinfoRouteDelay(net, net->users.at(i))), ctx->getDelayNS(slack));
-#endif
+
if (worst_slack.count(startdomain.first))
worst_slack.at(startdomain.first) = std::min(worst_slack.at(startdomain.first), slack);
else
@@ -653,23 +645,6 @@ struct Timing
nc.cd_worst_slack = worst_slack.at(startdomain.first);
}
}
-#if 0
- if (ctx->debug) {
- for (auto &nc : *net_crit) {
- NetInfo *net = ctx->nets.at(nc.first).get();
- log_info("Net %s maxlen %d worst_slack %.02fns: \n", nc.first.c_str(ctx), nc.second.max_path_length,
- ctx->getDelayNS(nc.second.cd_worst_slack));
- if (!nc.second.criticality.empty() && !nc.second.slack.empty()) {
- for (size_t i = 0; i < net->users.size(); i++) {
- log_info(" user %s.%s slack %.02fns crit %.03f\n", net->users.at(i).cell->name.c_str(ctx),
- net->users.at(i).port.c_str(ctx), ctx->getDelayNS(nc.second.slack.at(i)),
- nc.second.criticality.at(i));
- }
- }
- log_break();
- }
- }
-#endif
}
return min_slack;
}