aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ice40/arch.cc10
-rw-r--r--ice40/arch_place.cc14
-rw-r--r--ice40/archdefs.h1
3 files changed, 14 insertions, 11 deletions
diff --git a/ice40/arch.cc b/ice40/arch.cc
index 1aa02294..786d8ba1 100644
--- a/ice40/arch.cc
+++ b/ice40/arch.cc
@@ -25,7 +25,7 @@
#include "placer1.h"
#include "router1.h"
#include "util.h"
-
+#include "cells.h"
NEXTPNR_NAMESPACE_BEGIN
// -----------------------------------------------------------------------
@@ -704,6 +704,14 @@ void Arch::assignArchInfo()
NetInfo *ni = net.second.get();
if (isGlobalNet(ni))
ni->is_global = true;
+ ni->is_enable = false;
+ ni->is_reset = false;
+ for (auto usr : ni->users) {
+ if (is_enable_port(this, usr))
+ ni->is_enable = true;
+ if (is_reset_port(this, usr))
+ ni->is_reset = true;
+ }
}
for (auto &cell : getCtx()->cells) {
CellInfo *ci = cell.second.get();
diff --git a/ice40/arch_place.cc b/ice40/arch_place.cc
index 1f2943a0..116ab7d3 100644
--- a/ice40/arch_place.cc
+++ b/ice40/arch_place.cc
@@ -108,21 +108,15 @@ bool Arch::isValidBelForCell(CellInfo *cell, BelId bel) const
} else if (cell->type == id_sb_io) {
return getBelPackagePin(bel) != "";
} else if (cell->type == id_sb_gb) {
- bool is_reset = false, is_cen = false;
NPNR_ASSERT(cell->ports.at(id_glb_buf_out).net != nullptr);
- for (auto user : cell->ports.at(id_glb_buf_out).net->users) {
- if (is_reset_port(this, user))
- is_reset = true;
- if (is_enable_port(this, user))
- is_cen = true;
- }
+ const NetInfo *net = cell->ports.at(id_glb_buf_out).net;
IdString glb_net = getWireName(getWireBelPin(bel, PIN_GLOBAL_BUFFER_OUTPUT));
int glb_id = std::stoi(std::string("") + glb_net.str(this).back());
- if (is_reset && is_cen)
+ if (net->is_reset && net->is_enable)
return false;
- else if (is_reset)
+ else if (net->is_reset)
return (glb_id % 2) == 0;
- else if (is_cen)
+ else if (net->is_enable)
return (glb_id % 2) == 1;
else
return true;
diff --git a/ice40/archdefs.h b/ice40/archdefs.h
index 55e2c2fb..14b0d2be 100644
--- a/ice40/archdefs.h
+++ b/ice40/archdefs.h
@@ -153,6 +153,7 @@ struct DecalId
struct ArchNetInfo
{
bool is_global = false;
+ bool is_reset = false, is_enable = false;
};
struct NetInfo;