aboutsummaryrefslogtreecommitdiffstats
path: root/fpga_interchange/arch.cc
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-05-13 11:02:15 +0100
committerGitHub <noreply@github.com>2021-05-13 11:02:15 +0100
commit21d594a150ba2bc6e595c62d107cfd84e734fa5a (patch)
treebd1b8dba70b86034fae4adb61f1cb2d10140fb49 /fpga_interchange/arch.cc
parentced31aa917d2b9da711f246815aae0d968b9365a (diff)
parent8c468acff8900f40e909882cfbf9381a59199b79 (diff)
downloadnextpnr-21d594a150ba2bc6e595c62d107cfd84e734fa5a.tar.gz
nextpnr-21d594a150ba2bc6e595c62d107cfd84e734fa5a.tar.bz2
nextpnr-21d594a150ba2bc6e595c62d107cfd84e734fa5a.zip
Merge pull request #700 from acomodi/fix-illegal-site-thru
interchange: arch: do not allow site pips within sites
Diffstat (limited to 'fpga_interchange/arch.cc')
-rw-r--r--fpga_interchange/arch.cc30
1 files changed, 14 insertions, 16 deletions
diff --git a/fpga_interchange/arch.cc b/fpga_interchange/arch.cc
index 602f3913..a05878f6 100644
--- a/fpga_interchange/arch.cc
+++ b/fpga_interchange/arch.cc
@@ -1776,15 +1776,15 @@ bool Arch::checkPipAvailForNet(PipId pip, NetInfo *net) const
}
}
+ auto tile_status_iter = tileStatus.find(pip.tile);
+
if (pip_data.pseudo_cell_wires.size() > 0) {
// FIXME: This pseudo pip check is incomplete, because constraint
// failures will not be detected. However the current FPGA
// interchange schema does not provide a cell type to place.
- auto iter = tileStatus.find(pip.tile);
- if (iter != tileStatus.end()) {
- if (!iter->second.pseudo_pip_model.checkPipAvail(getCtx(), pip)) {
- return false;
- }
+ if (tile_status_iter != tileStatus.end() &&
+ !tile_status_iter->second.pseudo_pip_model.checkPipAvail(getCtx(), pip)) {
+ return false;
}
}
@@ -1797,18 +1797,16 @@ bool Arch::checkPipAvailForNet(PipId pip, NetInfo *net) const
bool valid_pip = false;
if (pip.tile == net->driver.cell->bel.tile) {
- const BelInfoPOD &bel_data = tile_type.bel_data[net->driver.cell->bel.index];
- if (bel_data.site == pip_data.site) {
- // Only allow site pips or output site ports.
- if (dst_wire_data.site == -1) {
- // Allow output site port from this site.
- NPNR_ASSERT(src_wire_data.site == pip_data.site);
- valid_pip = true;
- }
+ if (tile_status_iter == tileStatus.end()) {
+ // there is no tile status and nothing blocks the validity of this PIP
+ valid_pip = true;
+ } else {
+ const BelInfoPOD &bel_data = tile_type.bel_data[net->driver.cell->bel.index];
+ const SiteRouter &site_router = get_site_status(tile_status_iter->second, bel_data);
- if (dst_wire_data.site == bel_data.site && src_wire_data.site == bel_data.site) {
- // This is site pip for the same site as the driver, allow
- // this site pip.
+ const auto& pips = site_router.valid_pips;
+ auto result = std::find(pips.begin(), pips.end(), pip);
+ if (result != pips.end()) {
valid_pip = true;
}
}