diff options
Diffstat (limited to 'ice40/arch.h')
-rw-r--r-- | ice40/arch.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/ice40/arch.h b/ice40/arch.h index 60171a4c..18fc3aeb 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -826,6 +826,46 @@ struct Arch : BaseCtx return cell_type == getBelType(bel); } + const std::vector<IdString> &getCellTypes() const { + return cell_types; + } + + std::vector<PartitionId> getPartitions() const { + return partitions; + } + + IdString getPartitionName(PartitionId partition) const { + return partition.name; + } + + PartitionId getPartitionByName(IdString name) const { + PartitionId partition; + partition.name = name; + return partition; + } + + PartitionId getPartitionForBel(BelId bel) const { + PartitionId partition; + partition.name = getBelType(bel); + return partition; + } + + PartitionId getPartitionForCellType(IdString cell_type) const { + PartitionId partition; + partition.name = cell_type; + return partition; + } + + std::vector<BelId> getBelsForPartition(PartitionId partition) const { + std::vector<BelId> bels; + for(BelId bel : getBels()) { + if(getBelType(bel) == partition.name) { + bels.push_back(bel); + } + } + return bels; + } + // Whether or not a given cell can be placed at a given Bel // This is not intended for Bel type checks, but finer-grained constraints // such as conflicting set/reset signals, etc @@ -867,6 +907,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<PartitionId> partitions; }; void ice40DelayFuzzerMain(Context *ctx); |