aboutsummaryrefslogtreecommitdiffstats
path: root/ice40
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-06-17 14:36:19 +0200
committerDavid Shah <davey1576@gmail.com>2018-06-17 14:36:19 +0200
commit681c9654d7c49d407a999b2b03c980d66bcefd8f (patch)
treea0a29eb9249aba6bdfc0c9f44a2b50531b412972 /ice40
parent153b800f6a5da9af277e64b4cd4aee1c10ca0a01 (diff)
downloadnextpnr-681c9654d7c49d407a999b2b03c980d66bcefd8f.tar.gz
nextpnr-681c9654d7c49d407a999b2b03c980d66bcefd8f.tar.bz2
nextpnr-681c9654d7c49d407a999b2b03c980d66bcefd8f.zip
place_sa: Add a rip-up feature when initial placement fails
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ice40')
-rw-r--r--ice40/arch_place.cc3
-rw-r--r--ice40/pack.cc14
2 files changed, 11 insertions, 6 deletions
diff --git a/ice40/arch_place.cc b/ice40/arch_place.cc
index 1c6361a1..276a9378 100644
--- a/ice40/arch_place.cc
+++ b/ice40/arch_place.cc
@@ -38,7 +38,8 @@ static bool logicCellsCompatible(const std::vector<const CellInfo *> &cells)
{
bool dffs_exist = false, dffs_neg = false;
const NetInfo *cen = nullptr, *clk = nullptr, *sr = nullptr;
- std::unordered_set<const NetInfo *> locals;
+ static std::unordered_set<const NetInfo *> locals;
+ locals.clear();
for (auto cell : cells) {
if (bool_or_default(cell->params, "DFF_ENABLE")) {
diff --git a/ice40/pack.cc b/ice40/pack.cc
index 0b76f3f3..6840d8d1 100644
--- a/ice40/pack.cc
+++ b/ice40/pack.cc
@@ -279,7 +279,9 @@ static void pack_io(Design *design)
static void insert_global(Design *design, NetInfo *net, bool is_reset,
bool is_cen)
{
- CellInfo *gb = create_ice_cell(design, "SB_GB");
+ std::string glb_name = net->name.str() + std::string("_$glb_") +
+ (is_reset ? "sr" : (is_cen ? "ce" : "clk"));
+ CellInfo *gb = create_ice_cell(design, "SB_GB", "$gbuf_" + glb_name);
gb->ports["USER_SIGNAL_TO_GLOBAL_BUFFER"].net = net;
PortRef pr;
pr.cell = gb;
@@ -289,8 +291,7 @@ static void insert_global(Design *design, NetInfo *net, bool is_reset,
pr.cell = gb;
pr.port = "GLOBAL_BUFFER_OUTPUT";
NetInfo *glbnet = new NetInfo();
- glbnet->name = net->name.str() + std::string("_glb_") +
- (is_reset ? "sr" : (is_cen ? "ce" : "clk"));
+ glbnet->name = glb_name;
glbnet->driver = pr;
design->nets[glbnet->name] = glbnet;
gb->ports["GLOBAL_BUFFER_OUTPUT"].net = glbnet;
@@ -363,19 +364,22 @@ static void promote_globals(Design *design)
++prom_resets;
clock_count.erase(rstnet->name);
reset_count.erase(rstnet->name);
-
+ cen_count.erase(rstnet->name);
} else if (global_cen->second > global_clock->second && prom_cens < 4) {
NetInfo *cennet = design->nets[global_cen->first];
insert_global(design, cennet, false, true);
++prom_globals;
++prom_cens;
- cen_count.erase(cennet->name);
clock_count.erase(cennet->name);
+ reset_count.erase(cennet->name);
+ cen_count.erase(cennet->name);
} else if (global_clock->second != 0) {
NetInfo *clknet = design->nets[global_clock->first];
insert_global(design, clknet, false, false);
++prom_globals;
clock_count.erase(clknet->name);
+ reset_count.erase(clknet->name);
+ cen_count.erase(clknet->name);
} else {
break;
}