diff options
author | gatecat <gatecat@ds0.me> | 2021-12-30 13:18:34 +0000 |
---|---|---|
committer | gatecat <gatecat@ds0.me> | 2022-01-04 20:19:29 +0000 |
commit | e88bd34c02272ecdad6295123941d9040fa4f043 (patch) | |
tree | 2ff879a3a856d19f61cc0c0875e7a3aa7fba7ac1 /generic/arch.h | |
parent | 089ca8258e6f4dc93f8d39594c1109a8578cdc98 (diff) | |
download | nextpnr-e88bd34c02272ecdad6295123941d9040fa4f043.tar.gz nextpnr-e88bd34c02272ecdad6295123941d9040fa4f043.tar.bz2 nextpnr-e88bd34c02272ecdad6295123941d9040fa4f043.zip |
Viaduct API for a hybrid between generic and full-custom arch
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'generic/arch.h')
-rw-r--r-- | generic/arch.h | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/generic/arch.h b/generic/arch.h index 885089ca..e96853f1 100644 --- a/generic/arch.h +++ b/generic/arch.h @@ -23,10 +23,12 @@ #include <map> #include "arch_api.h" +#include "base_arch.h" #include "idstring.h" #include "idstringlist.h" #include "nextpnr_namespaces.h" #include "nextpnr_types.h" +#include "viaduct_api.h" NEXTPNR_NAMESPACE_BEGIN @@ -126,7 +128,7 @@ template <typename TId> struct linear_range iterator end() const { return iterator(size); } }; -struct ArchRanges +struct ArchRanges : BaseArchRanges { using ArchArgsT = ArchArgs; // Bels @@ -158,9 +160,10 @@ struct ArchRanges using BucketBelRangeT = std::vector<BelId>; }; -struct Arch : ArchAPI<ArchRanges> +struct Arch : BaseArch<ArchRanges> { std::string chipName; + std::unique_ptr<ViaductAPI> uarch{}; std::vector<WireInfo> wires; std::vector<PipInfo> pips; @@ -325,6 +328,8 @@ struct Arch : ArchAPI<ArchRanges> std::vector<IdString> getCellTypes() const override { + if (uarch) + return uarch->getCellTypes(); pool<IdString> cell_types; for (auto bel : bels) { cell_types.insert(bel.type); @@ -339,9 +344,15 @@ struct Arch : ArchAPI<ArchRanges> BelBucketId getBelBucketByName(IdString bucket) const override { return bucket; } - BelBucketId getBelBucketForBel(BelId bel) const override { return getBelType(bel); } + BelBucketId getBelBucketForBel(BelId bel) const override + { + return uarch ? uarch->getBelBucketForBel(bel) : getBelType(bel); + } - BelBucketId getBelBucketForCellType(IdString cell_type) const override { return cell_type; } + BelBucketId getBelBucketForCellType(IdString cell_type) const override + { + return uarch ? uarch->getBelBucketForCellType(cell_type) : cell_type; + } std::vector<BelId> getBelsInBucket(BelBucketId bucket) const override { @@ -366,19 +377,11 @@ struct Arch : ArchAPI<ArchRanges> // Get the TimingClockingInfo of a port TimingClockingInfo getPortClockingInfo(const CellInfo *cell, IdString port, int index) const override; - bool isValidBelForCellType(IdString cell_type, BelId bel) const override { return cell_type == getBelType(bel); } - bool isBelLocationValid(BelId bel) const override; - - // TODO - CellInfo *getClusterRootCell(ClusterId cluster) const override { NPNR_ASSERT_FALSE("unimplemented"); } - ArcBounds getClusterBounds(ClusterId cluster) const override { NPNR_ASSERT_FALSE("unimplemented"); } - Loc getClusterOffset(const CellInfo *cell) const override { NPNR_ASSERT_FALSE("unimplemented"); } - bool isClusterStrict(const CellInfo *cell) const override { NPNR_ASSERT_FALSE("unimplemented"); } - bool getClusterPlacement(ClusterId cluster, BelId root_bel, - std::vector<std::pair<CellInfo *, BelId>> &placement) const override + bool isValidBelForCellType(IdString cell_type, BelId bel) const override { - NPNR_ASSERT_FALSE("unimplemented"); + return uarch ? uarch->isValidBelForCellType(cell_type, bel) : cell_type == getBelType(bel); } + bool isBelLocationValid(BelId bel) const override; static const std::string defaultPlacer; static const std::vector<std::string> availablePlacers; |