aboutsummaryrefslogtreecommitdiffstats
path: root/ice40
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-06-15 21:29:02 +0200
committerDavid Shah <davey1576@gmail.com>2018-06-16 14:44:10 +0200
commitcabdfe361655a9eb8132ff5c7afe8c1fa7a3847b (patch)
tree630d7dc7b739b4efa80b62304a85690c955b256f /ice40
parent2479b4ecbf629192db18e3873dd9b4716f8b4752 (diff)
downloadnextpnr-cabdfe361655a9eb8132ff5c7afe8c1fa7a3847b.tar.gz
nextpnr-cabdfe361655a9eb8132ff5c7afe8c1fa7a3847b.tar.bz2
nextpnr-cabdfe361655a9eb8132ff5c7afe8c1fa7a3847b.zip
ice40: Only place IO at valid pins
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ice40')
-rw-r--r--ice40/arch_place.cc7
-rw-r--r--ice40/chip.cc9
-rw-r--r--ice40/chip.h1
3 files changed, 14 insertions, 3 deletions
diff --git a/ice40/arch_place.cc b/ice40/arch_place.cc
index e4a6c5d7..492ed846 100644
--- a/ice40/arch_place.cc
+++ b/ice40/arch_place.cc
@@ -22,8 +22,8 @@
NEXTPNR_NAMESPACE_BEGIN
-static const NetInfo *
-get_net_or_nullptr(const CellInfo *cell, const IdString port)
+static const NetInfo *get_net_or_nullptr(const CellInfo *cell,
+ const IdString port)
{
auto found = cell->ports.find(port);
if (found != cell->ports.end())
@@ -97,7 +97,8 @@ bool isValidBelForCell(Design *design, CellInfo *cell, BelId bel)
cells.push_back(cell);
return logicCellsCompatible(cells);
-
+ } else if (cell->type == "SB_IO") {
+ return design->chip.getBelPackagePin(bel) != "";
} else {
// TODO: IO cell clock checks
return true;
diff --git a/ice40/chip.cc b/ice40/chip.cc
index b40963bf..e24fb9ac 100644
--- a/ice40/chip.cc
+++ b/ice40/chip.cc
@@ -273,6 +273,15 @@ BelId Chip::getPackagePinBel(const std::string &pin) const
return BelId();
}
+std::string Chip::getBelPackagePin(BelId bel) const
+{
+ for (int i = 0; i < package_info->num_pins; i++) {
+ if (package_info->pins[i].bel_index == bel.index) {
+ return std::string(package_info->pins[i].name);
+ }
+ }
+ return "";
+}
// -----------------------------------------------------------------------
bool Chip::estimatePosition(BelId bel, float &x, float &y) const
diff --git a/ice40/chip.h b/ice40/chip.h
index e2b54cdf..c0b0ec72 100644
--- a/ice40/chip.h
+++ b/ice40/chip.h
@@ -691,6 +691,7 @@ struct Chip
}
BelId getPackagePinBel(const std::string &pin) const;
+ std::string getBelPackagePin(BelId bel) const;
// -------------------------------------------------