aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-08-18 18:36:13 +0100
committerDavid Shah <davey1576@gmail.com>2018-08-18 18:36:13 +0100
commit72a9a475fad693dd6e96c5fa55d02a8869e97120 (patch)
tree77e4bbf92663b65255f5ad7581ddcffe7623a39c /ecp5
parentb8206d71ca281f00b1c681d3f7bb532eb01e030c (diff)
downloadnextpnr-72a9a475fad693dd6e96c5fa55d02a8869e97120.tar.gz
nextpnr-72a9a475fad693dd6e96c5fa55d02a8869e97120.tar.bz2
nextpnr-72a9a475fad693dd6e96c5fa55d02a8869e97120.zip
ecp5: Speed up Bel availability/binding checks
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ecp5')
-rw-r--r--ecp5/arch.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/ecp5/arch.h b/ecp5/arch.h
index 98aa6941..5b2738b5 100644
--- a/ecp5/arch.h
+++ b/ecp5/arch.h
@@ -480,25 +480,31 @@ struct Arch : BaseCtx
bool checkBelAvail(BelId bel) const
{
NPNR_ASSERT(bel != BelId());
- return bel_to_cell.find(bel) == bel_to_cell.end() || bel_to_cell.at(bel) == nullptr;
+ auto found = bel_to_cell.find(bel);
+ if (found == bel_to_cell.end())
+ return true;
+ else
+ return found->second == nullptr;
}
CellInfo *getBoundBelCell(BelId bel) const
{
NPNR_ASSERT(bel != BelId());
- if (bel_to_cell.find(bel) == bel_to_cell.end())
+ auto found = bel_to_cell.find(bel);
+ if (found == bel_to_cell.end())
return nullptr;
else
- return bel_to_cell.at(bel);
+ return found->second;
}
CellInfo *getConflictingBelCell(BelId bel) const
{
NPNR_ASSERT(bel != BelId());
- if (bel_to_cell.find(bel) == bel_to_cell.end())
+ auto found = bel_to_cell.find(bel);
+ if (found == bel_to_cell.end())
return nullptr;
else
- return bel_to_cell.at(bel);
+ return found->second;
}
BelRange getBels() const