aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/place_sa.cc2
-rw-r--r--common/route.cc4
-rw-r--r--ice40/arch_place.cc48
3 files changed, 30 insertions, 24 deletions
diff --git a/common/place_sa.cc b/common/place_sa.cc
index e8b3725c..12ca30d8 100644
--- a/common/place_sa.cc
+++ b/common/place_sa.cc
@@ -66,7 +66,7 @@ static float random_float_upto(rnd_state &rnd, float limit)
static int random_int_between(rnd_state &rnd, int a, int b)
{
- return a + int(random_float_upto(rnd, b - a));
+ return a + int(random_float_upto(rnd, b - a) - 0.00001);
}
// Initial random placement
diff --git a/common/route.cc b/common/route.cc
index 32212c7d..247c8840 100644
--- a/common/route.cc
+++ b/common/route.cc
@@ -440,8 +440,8 @@ void route_design(Design *design, bool verbose)
"routing.\n",
int(netsQueue.size()));
- ripup_pip_penalty += 5;
- ripup_wire_penalty += 5;
+ ripup_pip_penalty *= 1.5;
+ ripup_wire_penalty *= 1.5;
}
}
diff --git a/ice40/arch_place.cc b/ice40/arch_place.cc
index 276a9378..3205fb6e 100644
--- a/ice40/arch_place.cc
+++ b/ice40/arch_place.cc
@@ -24,8 +24,8 @@
NEXTPNR_NAMESPACE_BEGIN
-static const NetInfo *get_net_or_nullptr(const CellInfo *cell,
- const IdString port)
+static const NetInfo *get_net_or_empty(const CellInfo *cell,
+ const IdString port)
{
auto found = cell->ports.find(port);
if (found != cell->ports.end())
@@ -38,47 +38,53 @@ static bool logicCellsCompatible(const std::vector<const CellInfo *> &cells)
{
bool dffs_exist = false, dffs_neg = false;
const NetInfo *cen = nullptr, *clk = nullptr, *sr = nullptr;
- static std::unordered_set<const NetInfo *> locals;
+ static std::unordered_set<IdString> locals;
locals.clear();
for (auto cell : cells) {
if (bool_or_default(cell->params, "DFF_ENABLE")) {
if (!dffs_exist) {
dffs_exist = true;
- cen = get_net_or_nullptr(cell, "CEN");
- clk = get_net_or_nullptr(cell, "CLK");
- sr = get_net_or_nullptr(cell, "SR");
+ cen = get_net_or_empty(cell, "CEN");
+ clk = get_net_or_empty(cell, "CLK");
+ sr = get_net_or_empty(cell, "SR");
- if (!is_global_net(cen))
- locals.insert(cen);
- if (!is_global_net(clk))
- locals.insert(clk);
- if (!is_global_net(sr))
- locals.insert(sr);
+ if (!is_global_net(cen) && cen != nullptr)
+ locals.insert(cen->name);
+ if (!is_global_net(clk) && clk != nullptr)
+ locals.insert(clk->name);
+ if (!is_global_net(sr) && sr != nullptr)
+ locals.insert(sr->name);
if (bool_or_default(cell->params, "NEG_CLK")) {
dffs_neg = true;
}
} else {
- if (cen != get_net_or_nullptr(cell, "CEN"))
+ if (cen != get_net_or_empty(cell, "CEN"))
return false;
- if (clk != get_net_or_nullptr(cell, "CLK"))
+ if (clk != get_net_or_empty(cell, "CLK"))
return false;
- if (sr != get_net_or_nullptr(cell, "SR"))
+ if (sr != get_net_or_empty(cell, "SR"))
return false;
if (dffs_neg != bool_or_default(cell->params, "NEG_CLK"))
return false;
}
}
- locals.insert(get_net_or_nullptr(cell, "I0"));
- locals.insert(get_net_or_nullptr(cell, "I1"));
- locals.insert(get_net_or_nullptr(cell, "I2"));
- locals.insert(get_net_or_nullptr(cell, "I3"));
+ const NetInfo *i0 = get_net_or_empty(cell, "I0"),
+ *i1 = get_net_or_empty(cell, "I1"),
+ *i2 = get_net_or_empty(cell, "I2"),
+ *i3 = get_net_or_empty(cell, "I3");
+ if (i0 != nullptr)
+ locals.insert(i0->name);
+ if (i1 != nullptr)
+ locals.insert(i1->name);
+ if (i2 != nullptr)
+ locals.insert(i2->name);
+ if (i3 != nullptr)
+ locals.insert(i3->name);
}
- locals.erase(nullptr); // disconnected signals don't use local tracks
-
return locals.size() <= 32;
}