aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5/arch.h
diff options
context:
space:
mode:
Diffstat (limited to 'ecp5/arch.h')
-rw-r--r--ecp5/arch.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/ecp5/arch.h b/ecp5/arch.h
index 58373157..18a70fe8 100644
--- a/ecp5/arch.h
+++ b/ecp5/arch.h
@@ -950,6 +950,46 @@ struct Arch : BaseCtx
// -------------------------------------------------
// Placement validity checks
+ bool isValidBelForCellType(IdString cell_type, BelId bel) const { return cell_type == getBelType(bel); }
+
+ const std::vector<IdString> &getCellTypes() const { return cell_types; }
+
+ std::vector<BelBucketId> getBelBuckets() const { return buckets; }
+
+ IdString getBelBucketName(BelBucketId bucket) const { return bucket.name; }
+
+ BelBucketId getBelBucketByName(IdString name) const
+ {
+ BelBucketId bucket;
+ bucket.name = name;
+ return bucket;
+ }
+
+ BelBucketId getBelBucketForBel(BelId bel) const
+ {
+ BelBucketId bucket;
+ bucket.name = getBelType(bel);
+ return bucket;
+ }
+
+ BelBucketId getBelBucketForCellType(IdString cell_type) const
+ {
+ BelBucketId bucket;
+ bucket.name = cell_type;
+ return bucket;
+ }
+
+ std::vector<BelId> getBelsInBucket(BelBucketId bucket) const
+ {
+ std::vector<BelId> bels;
+ for (BelId bel : getBels()) {
+ if (getBelType(bel) == bucket.name) {
+ bels.push_back(bel);
+ }
+ }
+ return bels;
+ }
+
bool isValidBelForCell(CellInfo *cell, BelId bel) const;
bool isBelLocationValid(BelId bel) const;
@@ -1022,6 +1062,9 @@ struct Arch : BaseCtx
static const std::vector<std::string> availablePlacers;
static const std::string defaultRouter;
static const std::vector<std::string> availableRouters;
+
+ std::vector<IdString> cell_types;
+ std::vector<BelBucketId> buckets;
};
NEXTPNR_NAMESPACE_END