Minor performance tweaks and fixes
Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
parent
f723aaa373
commit
f66999a883
@ -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)
|
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
|
// Initial random placement
|
||||||
|
@ -440,8 +440,8 @@ void route_design(Design *design, bool verbose)
|
|||||||
"routing.\n",
|
"routing.\n",
|
||||||
int(netsQueue.size()));
|
int(netsQueue.size()));
|
||||||
|
|
||||||
ripup_pip_penalty += 5;
|
ripup_pip_penalty *= 1.5;
|
||||||
ripup_wire_penalty += 5;
|
ripup_wire_penalty *= 1.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
|
|
||||||
NEXTPNR_NAMESPACE_BEGIN
|
NEXTPNR_NAMESPACE_BEGIN
|
||||||
|
|
||||||
static const NetInfo *get_net_or_nullptr(const CellInfo *cell,
|
static const NetInfo *get_net_or_empty(const CellInfo *cell,
|
||||||
const IdString port)
|
const IdString port)
|
||||||
{
|
{
|
||||||
auto found = cell->ports.find(port);
|
auto found = cell->ports.find(port);
|
||||||
if (found != cell->ports.end())
|
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;
|
bool dffs_exist = false, dffs_neg = false;
|
||||||
const NetInfo *cen = nullptr, *clk = nullptr, *sr = nullptr;
|
const NetInfo *cen = nullptr, *clk = nullptr, *sr = nullptr;
|
||||||
static std::unordered_set<const NetInfo *> locals;
|
static std::unordered_set<IdString> locals;
|
||||||
locals.clear();
|
locals.clear();
|
||||||
|
|
||||||
for (auto cell : cells) {
|
for (auto cell : cells) {
|
||||||
if (bool_or_default(cell->params, "DFF_ENABLE")) {
|
if (bool_or_default(cell->params, "DFF_ENABLE")) {
|
||||||
if (!dffs_exist) {
|
if (!dffs_exist) {
|
||||||
dffs_exist = true;
|
dffs_exist = true;
|
||||||
cen = get_net_or_nullptr(cell, "CEN");
|
cen = get_net_or_empty(cell, "CEN");
|
||||||
clk = get_net_or_nullptr(cell, "CLK");
|
clk = get_net_or_empty(cell, "CLK");
|
||||||
sr = get_net_or_nullptr(cell, "SR");
|
sr = get_net_or_empty(cell, "SR");
|
||||||
|
|
||||||
if (!is_global_net(cen))
|
if (!is_global_net(cen) && cen != nullptr)
|
||||||
locals.insert(cen);
|
locals.insert(cen->name);
|
||||||
if (!is_global_net(clk))
|
if (!is_global_net(clk) && clk != nullptr)
|
||||||
locals.insert(clk);
|
locals.insert(clk->name);
|
||||||
if (!is_global_net(sr))
|
if (!is_global_net(sr) && sr != nullptr)
|
||||||
locals.insert(sr);
|
locals.insert(sr->name);
|
||||||
|
|
||||||
if (bool_or_default(cell->params, "NEG_CLK")) {
|
if (bool_or_default(cell->params, "NEG_CLK")) {
|
||||||
dffs_neg = true;
|
dffs_neg = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (cen != get_net_or_nullptr(cell, "CEN"))
|
if (cen != get_net_or_empty(cell, "CEN"))
|
||||||
return false;
|
return false;
|
||||||
if (clk != get_net_or_nullptr(cell, "CLK"))
|
if (clk != get_net_or_empty(cell, "CLK"))
|
||||||
return false;
|
return false;
|
||||||
if (sr != get_net_or_nullptr(cell, "SR"))
|
if (sr != get_net_or_empty(cell, "SR"))
|
||||||
return false;
|
return false;
|
||||||
if (dffs_neg != bool_or_default(cell->params, "NEG_CLK"))
|
if (dffs_neg != bool_or_default(cell->params, "NEG_CLK"))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
locals.insert(get_net_or_nullptr(cell, "I0"));
|
const NetInfo *i0 = get_net_or_empty(cell, "I0"),
|
||||||
locals.insert(get_net_or_nullptr(cell, "I1"));
|
*i1 = get_net_or_empty(cell, "I1"),
|
||||||
locals.insert(get_net_or_nullptr(cell, "I2"));
|
*i2 = get_net_or_empty(cell, "I2"),
|
||||||
locals.insert(get_net_or_nullptr(cell, "I3"));
|
*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;
|
return locals.size() <= 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user