aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorD. Shah <dave@ds0.me>2021-02-05 11:23:07 +0000
committerD. Shah <dave@ds0.me>2021-02-05 19:19:17 +0000
commita8a27299ae46143c9fadb1d9153a964492525f4a (patch)
tree92132aa0983c0adf3425248ad5e964c93efbb797
parentb4227f586c59ca959d1bfe0d01c4c04b601fa30f (diff)
downloadnextpnr-a8a27299ae46143c9fadb1d9153a964492525f4a.tar.gz
nextpnr-a8a27299ae46143c9fadb1d9153a964492525f4a.tar.bz2
nextpnr-a8a27299ae46143c9fadb1d9153a964492525f4a.zip
Add pure-virtual ArchAPI interface
This splits out the pure-virtual definition of the architecture API into ArchAPI; leaving BaseArch to only provide default implementations (which can now be completely opted out of by deriving from ArchAPI instead of BaseArch). Signed-off-by: D. Shah <dave@ds0.me>
-rw-r--r--common/nextpnr.h302
1 files changed, 198 insertions, 104 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h
index cb3f6e9f..7de5233b 100644
--- a/common/nextpnr.h
+++ b/common/nextpnr.h
@@ -1064,26 +1064,128 @@ typename std::enable_if<!std::is_same<Tret, Tc>::value, Tret>::type return_if_ma
} // namespace
-template <typename R> struct BaseArch : BaseCtx
+// The specification of the Arch API (pure virtual)
+template <typename R> struct ArchAPI : BaseCtx
{
- // --------------------------------------------------------------
- // Arch API base
-
// Basic config
+ virtual IdString archId() const = 0;
virtual std::string getChipName() const = 0;
- virtual IdString archId() const { return id(STRINGIFY(ARCHNAME)); }
virtual int getGridDimX() const = 0;
virtual int getGridDimY() const = 0;
virtual int getTileBelDimZ(int x, int y) const = 0;
- virtual int getTilePipDimZ(int x, int y) const { return 1; }
- virtual char getNameDelimiter() const { return ' '; }
-
+ virtual int getTilePipDimZ(int x, int y) const = 0;
+ virtual char getNameDelimiter() const = 0;
// Bel methods
virtual typename R::AllBelsRange getBels() const = 0;
- virtual BelId getBelByName(IdStringList name) const = 0;
virtual IdStringList getBelName(BelId bel) const = 0;
- virtual uint32_t getBelChecksum(BelId bel) const { return uint32_t(std::hash<BelId>()(bel)); }
- virtual void bindBel(BelId bel, CellInfo *cell, PlaceStrength strength)
+ virtual BelId getBelByName(IdStringList name) const = 0;
+ virtual uint32_t getBelChecksum(BelId bel) const = 0;
+ virtual void bindBel(BelId bel, CellInfo *cell, PlaceStrength strength) = 0;
+ virtual void unbindBel(BelId bel) = 0;
+ virtual Loc getBelLocation(BelId bel) const = 0;
+ virtual BelId getBelByLocation(Loc loc) const = 0;
+ virtual typename R::TileBelsRange getBelsByTile(int x, int y) const = 0;
+ virtual bool getBelGlobalBuf(BelId bel) const = 0;
+ virtual bool checkBelAvail(BelId bel) const = 0;
+ virtual CellInfo *getBoundBelCell(BelId bel) const = 0;
+ virtual CellInfo *getConflictingBelCell(BelId bel) const = 0;
+ virtual IdString getBelType(BelId bel) const = 0;
+ virtual typename R::BelAttrsRange getBelAttrs(BelId bel) const = 0;
+ virtual WireId getBelPinWire(BelId bel, IdString pin) const = 0;
+ virtual PortType getBelPinType(BelId bel, IdString pin) const = 0;
+ // Wire methods
+ virtual typename R::AllWiresRange getWires() const = 0;
+ virtual WireId getWireByName(IdStringList name) const = 0;
+ virtual IdStringList getWireName(WireId wire) const = 0;
+ virtual IdString getWireType(WireId wire) const = 0;
+ virtual typename R::WireAttrsRange getWireAttrs(WireId) const = 0;
+ virtual typename R::DownhillPipRange getPipsDownhill(WireId wire) const = 0;
+ virtual typename R::UphillPipRange getPipsUphill(WireId wire) const = 0;
+ virtual typename R::WireBelPinRange getWireBelPins(WireId wire) const = 0;
+ virtual uint32_t getWireChecksum(WireId wire) const = 0;
+ virtual void bindWire(WireId wire, NetInfo *net, PlaceStrength strength) = 0;
+ virtual void unbindWire(WireId wire) = 0;
+ virtual bool checkWireAvail(WireId wire) const = 0;
+ virtual NetInfo *getBoundWireNet(WireId wire) const = 0;
+ virtual WireId getConflictingWireWire(WireId wire) const = 0;
+ virtual NetInfo *getConflictingWireNet(WireId wire) const = 0;
+ virtual DelayInfo getWireDelay(WireId wire) const = 0;
+ // Pip methods
+ virtual typename R::AllPipsRange getPips() const = 0;
+ virtual PipId getPipByName(IdStringList name) const = 0;
+ virtual IdStringList getPipName(PipId pip) const = 0;
+ virtual IdString getPipType(PipId pip) const = 0;
+ virtual typename R::PipAttrsRange getPipAttrs(PipId) const = 0;
+ virtual uint32_t getPipChecksum(PipId pip) const = 0;
+ virtual void bindPip(PipId pip, NetInfo *net, PlaceStrength strength) = 0;
+ virtual void unbindPip(PipId pip) = 0;
+ virtual bool checkPipAvail(PipId pip) const = 0;
+ virtual NetInfo *getBoundPipNet(PipId pip) const = 0;
+ virtual WireId getConflictingPipWire(PipId pip) const = 0;
+ virtual NetInfo *getConflictingPipNet(PipId pip) const = 0;
+ virtual WireId getPipSrcWire(PipId pip) const = 0;
+ virtual WireId getPipDstWire(PipId pip) const = 0;
+ virtual DelayInfo getPipDelay(PipId pip) const = 0;
+ virtual Loc getPipLocation(PipId pip) const = 0;
+ // Group methods
+ virtual GroupId getGroupByName(IdStringList name) const = 0;
+ virtual IdStringList getGroupName(GroupId group) const = 0;
+ virtual typename R::AllGroupsRange getGroups() const = 0;
+ virtual typename R::GroupBelsRange getGroupBels(GroupId group) const = 0;
+ virtual typename R::GroupWiresRange getGroupWires(GroupId group) const = 0;
+ virtual typename R::GroupPipsRange getGroupPips(GroupId group) const = 0;
+ virtual typename R::GroupGroupsRange getGroupGroups(GroupId group) const = 0;
+ // Delay Methods
+ virtual delay_t predictDelay(const NetInfo *net_info, const PortRef &sink) const = 0;
+ virtual delay_t getDelayEpsilon() const = 0;
+ virtual delay_t getRipupDelayPenalty() const = 0;
+ virtual float getDelayNS(delay_t v) const = 0;
+ virtual DelayInfo getDelayFromNS(float ns) const = 0;
+ virtual uint32_t getDelayChecksum(delay_t v) const = 0;
+ virtual bool getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const = 0;
+ virtual delay_t estimateDelay(WireId src, WireId dst) const = 0;
+ virtual ArcBounds getRouteBoundingBox(WireId src, WireId dst) const = 0;
+ // Decal methods
+ virtual typename R::DecalGfxRange getDecalGraphics(DecalId decal) const = 0;
+ virtual DecalXY getBelDecal(BelId bel) const = 0;
+ virtual DecalXY getWireDecal(WireId wire) const = 0;
+ virtual DecalXY getPipDecal(PipId pip) const = 0;
+ virtual DecalXY getGroupDecal(GroupId group) const = 0;
+ // Cell timing methods
+ virtual bool getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, DelayInfo &delay) const = 0;
+ virtual TimingPortClass getPortTimingClass(const CellInfo *cell, IdString port, int &clockInfoCount) const = 0;
+ virtual TimingClockingInfo getPortClockingInfo(const CellInfo *cell, IdString port, int index) const = 0;
+ // Placement validity checks
+ virtual bool isValidBelForCellType(IdString cell_type, BelId bel) const = 0;
+ virtual IdString getBelBucketName(BelBucketId bucket) const = 0;
+ virtual BelBucketId getBelBucketByName(IdString name) const = 0;
+ virtual BelBucketId getBelBucketForBel(BelId bel) const = 0;
+ virtual BelBucketId getBelBucketForCellType(IdString cell_type) const = 0;
+ virtual bool isValidBelForCell(CellInfo *cell, BelId bel) const = 0;
+ virtual bool isBelLocationValid(BelId bel) const = 0;
+ virtual typename R::CellTypeRange getCellTypes() const = 0;
+ virtual typename R::BelBucketRange getBelBuckets() const = 0;
+ virtual typename R::BucketBelRange getBelsInBucket(BelBucketId bucket) const = 0;
+ // Flow methods
+ virtual bool pack() = 0;
+ virtual bool place() = 0;
+ virtual bool route() = 0;
+ virtual void assignArchInfo() = 0;
+};
+
+template <typename R> struct BaseArch : ArchAPI<R>
+{
+ // --------------------------------------------------------------
+ // Default, trivial, implementations of Arch API functions for arches that don't need complex behaviours
+
+ // Basic config
+ virtual IdString archId() const override { return this->id(STRINGIFY(ARCHNAME)); }
+ virtual int getTilePipDimZ(int x, int y) const override { return 1; }
+ virtual char getNameDelimiter() const override { return ' '; }
+
+ // Bel methods
+ virtual uint32_t getBelChecksum(BelId bel) const override { return uint32_t(std::hash<BelId>()(bel)); }
+ virtual void bindBel(BelId bel, CellInfo *cell, PlaceStrength strength) override
{
NPNR_ASSERT(bel != BelId());
auto &entry = base_bel2cell[bel];
@@ -1091,9 +1193,9 @@ template <typename R> struct BaseArch : BaseCtx
cell->bel = bel;
cell->belStrength = strength;
entry = cell;
- refreshUiBel(bel);
+ this->refreshUiBel(bel);
}
- virtual void unbindBel(BelId bel)
+ virtual void unbindBel(BelId bel) override
{
NPNR_ASSERT(bel != BelId());
auto &entry = base_bel2cell[bel];
@@ -1101,41 +1203,31 @@ template <typename R> struct BaseArch : BaseCtx
entry->bel = BelId();
entry->belStrength = STRENGTH_NONE;
entry = nullptr;
- refreshUiBel(bel);
+ this->refreshUiBel(bel);
}
- virtual Loc getBelLocation(BelId bel) const = 0;
- virtual BelId getBelByLocation(Loc loc) const = 0;
- virtual typename R::TileBelsRange getBelsByTile(int x, int y) const = 0;
- virtual bool getBelGlobalBuf(BelId bel) const { return false; }
- virtual bool checkBelAvail(BelId bel) const { return getBoundBelCell(bel) == nullptr; };
- virtual CellInfo *getBoundBelCell(BelId bel) const
+
+ virtual bool getBelGlobalBuf(BelId bel) const override { return false; }
+ virtual bool checkBelAvail(BelId bel) const override { return getBoundBelCell(bel) == nullptr; };
+ virtual CellInfo *getBoundBelCell(BelId bel) const override
{
auto fnd = base_bel2cell.find(bel);
return fnd == base_bel2cell.end() ? nullptr : fnd->second;
}
- virtual CellInfo *getConflictingBelCell(BelId bel) const { return getBoundBelCell(bel); }
- virtual IdString getBelType(BelId bel) const = 0;
- virtual typename R::BelAttrsRange getBelAttrs(BelId bel) const
+ virtual CellInfo *getConflictingBelCell(BelId bel) const override { return getBoundBelCell(bel); }
+ virtual typename R::BelAttrsRange getBelAttrs(BelId bel) const override
{
return empty_if_possible<typename R::BelAttrsRange>();
}
- virtual WireId getBelPinWire(BelId bel, IdString pin) const = 0;
- virtual PortType getBelPinType(BelId bel, IdString pin) const = 0;
// Wire methods
- virtual typename R::AllWiresRange getWires() const = 0;
- virtual WireId getWireByName(IdStringList name) const = 0;
- virtual IdStringList getWireName(WireId wire) const = 0;
- virtual IdString getWireType(WireId wire) const { return IdString(); }
- virtual typename R::WireAttrsRange getWireAttrs(WireId) const
+ virtual IdString getWireType(WireId wire) const override { return IdString(); }
+ virtual typename R::WireAttrsRange getWireAttrs(WireId) const override
{
return empty_if_possible<typename R::WireAttrsRange>();
}
- virtual uint32_t getWireChecksum(WireId wire) const { return uint32_t(std::hash<WireId>()(wire)); }
- virtual typename R::DownhillPipRange getPipsDownhill(WireId wire) const = 0;
- virtual typename R::UphillPipRange getPipsUphill(WireId wire) const = 0;
- virtual typename R::WireBelPinRange getWireBelPins(WireId wire) const = 0;
- virtual void bindWire(WireId wire, NetInfo *net, PlaceStrength strength)
+ virtual uint32_t getWireChecksum(WireId wire) const override { return uint32_t(std::hash<WireId>()(wire)); }
+
+ virtual void bindWire(WireId wire, NetInfo *net, PlaceStrength strength) override
{
NPNR_ASSERT(wire != WireId());
auto &w2n_entry = base_wire2net[wire];
@@ -1143,9 +1235,9 @@ template <typename R> struct BaseArch : BaseCtx
net->wires[wire].pip = PipId();
net->wires[wire].strength = strength;
w2n_entry = net;
- refreshUiWire(wire);
+ this->refreshUiWire(wire);
}
- virtual void unbindWire(WireId wire)
+ virtual void unbindWire(WireId wire) override
{
NPNR_ASSERT(wire != WireId());
auto &w2n_entry = base_wire2net[wire];
@@ -1164,48 +1256,44 @@ template <typename R> struct BaseArch : BaseCtx
base_wire2net[wire] = nullptr;
w2n_entry = nullptr;
- refreshUiWire(wire);
+ this->refreshUiWire(wire);
}
- virtual bool checkWireAvail(WireId wire) const { return getBoundWireNet(wire) == nullptr; }
- virtual NetInfo *getBoundWireNet(WireId wire) const
+ virtual bool checkWireAvail(WireId wire) const override { return getBoundWireNet(wire) == nullptr; }
+ virtual NetInfo *getBoundWireNet(WireId wire) const override
{
auto fnd = base_wire2net.find(wire);
return fnd == base_wire2net.end() ? nullptr : fnd->second;
}
- virtual WireId getConflictingWireWire(WireId wire) const { return wire; };
- virtual NetInfo *getConflictingWireNet(WireId wire) const { return getBoundWireNet(wire); }
- virtual DelayInfo getWireDelay(WireId wire) const = 0;
+ virtual WireId getConflictingWireWire(WireId wire) const override { return wire; };
+ virtual NetInfo *getConflictingWireNet(WireId wire) const override { return getBoundWireNet(wire); }
// Pip methods
- virtual typename R::AllPipsRange getPips() const = 0;
- virtual PipId getPipByName(IdStringList name) const = 0;
- virtual IdStringList getPipName(PipId pip) const = 0;
virtual IdString getPipType(PipId pip) const { return IdString(); }
- virtual typename R::PipAttrsRange getPipAttrs(PipId) const
+ virtual typename R::PipAttrsRange getPipAttrs(PipId) const override
{
return empty_if_possible<typename R::PipAttrsRange>();
}
- virtual uint32_t getPipChecksum(PipId pip) const { return uint32_t(std::hash<PipId>()(pip)); }
- virtual void bindPip(PipId pip, NetInfo *net, PlaceStrength strength)
+ virtual uint32_t getPipChecksum(PipId pip) const override { return uint32_t(std::hash<PipId>()(pip)); }
+ virtual void bindPip(PipId pip, NetInfo *net, PlaceStrength strength) override
{
NPNR_ASSERT(pip != PipId());
auto &p2n_entry = base_pip2net[pip];
NPNR_ASSERT(p2n_entry == nullptr);
p2n_entry = net;
- WireId dst = getPipDstWire(pip);
+ WireId dst = this->getPipDstWire(pip);
auto &w2n_entry = base_wire2net[dst];
NPNR_ASSERT(w2n_entry == nullptr);
w2n_entry = net;
net->wires[dst].pip = pip;
net->wires[dst].strength = strength;
}
- virtual void unbindPip(PipId pip)
+ virtual void unbindPip(PipId pip) override
{
NPNR_ASSERT(pip != PipId());
auto &p2n_entry = base_pip2net[pip];
NPNR_ASSERT(p2n_entry != nullptr);
- WireId dst = getPipDstWire(pip);
+ WireId dst = this->getPipDstWire(pip);
auto &w2n_entry = base_wire2net[dst];
NPNR_ASSERT(w2n_entry != nullptr);
@@ -1214,93 +1302,99 @@ template <typename R> struct BaseArch : BaseCtx
p2n_entry->wires.erase(dst);
p2n_entry = nullptr;
}
- virtual bool checkPipAvail(PipId pip) const { return getBoundPipNet(pip) == nullptr; }
- virtual NetInfo *getBoundPipNet(PipId pip) const
+ virtual bool checkPipAvail(PipId pip) const override { return getBoundPipNet(pip) == nullptr; }
+ virtual NetInfo *getBoundPipNet(PipId pip) const override
{
auto fnd = base_pip2net.find(pip);
return fnd == base_pip2net.end() ? nullptr : fnd->second;
}
- virtual WireId getConflictingPipWire(PipId pip) const { return WireId(); }
- virtual NetInfo *getConflictingPipNet(PipId pip) const { return getBoundPipNet(pip); }
- virtual WireId getPipSrcWire(PipId pip) const = 0;
- virtual WireId getPipDstWire(PipId pip) const = 0;
- virtual DelayInfo getPipDelay(PipId pip) const = 0;
- virtual Loc getPipLocation(PipId pip) const = 0;
+ virtual WireId getConflictingPipWire(PipId pip) const override { return WireId(); }
+ virtual NetInfo *getConflictingPipNet(PipId pip) const override { return getBoundPipNet(pip); }
// Group methods
- virtual GroupId getGroupByName(IdStringList name) const { return GroupId(); };
- virtual IdStringList getGroupName(GroupId group) const { return IdStringList(); };
- virtual delay_t estimateDelay(WireId src, WireId dst) const = 0;
- virtual ArcBounds getRouteBoundingBox(WireId src, WireId dst) const = 0;
- virtual typename R::AllGroupsRange getGroups() const { return empty_if_possible<typename R::AllGroupsRange>(); }
+ virtual GroupId getGroupByName(IdStringList name) const override { return GroupId(); };
+ virtual IdStringList getGroupName(GroupId group) const override { return IdStringList(); };
+ virtual typename R::AllGroupsRange getGroups() const override
+ {
+ return empty_if_possible<typename R::AllGroupsRange>();
+ }
// Default implementation of these assumes no groups so never called
- virtual typename R::GroupBelsRange getGroupBels(GroupId group) const { NPNR_ASSERT_FALSE("unreachable"); };
- virtual typename R::GroupWiresRange getGroupWires(GroupId group) const { NPNR_ASSERT_FALSE("unreachable"); };
- virtual typename R::GroupPipsRange getGroupPips(GroupId group) const { NPNR_ASSERT_FALSE("unreachable"); };
- virtual typename R::GroupGroupsRange getGroupGroups(GroupId group) const { NPNR_ASSERT_FALSE("unreachable"); };
+ virtual typename R::GroupBelsRange getGroupBels(GroupId group) const override { NPNR_ASSERT_FALSE("unreachable"); };
+ virtual typename R::GroupWiresRange getGroupWires(GroupId group) const override
+ {
+ NPNR_ASSERT_FALSE("unreachable");
+ };
+ virtual typename R::GroupPipsRange getGroupPips(GroupId group) const override { NPNR_ASSERT_FALSE("unreachable"); };
+ virtual typename R::GroupGroupsRange getGroupGroups(GroupId group) const override
+ {
+ NPNR_ASSERT_FALSE("unreachable");
+ };
// Delay methods
- virtual delay_t predictDelay(const NetInfo *net_info, const PortRef &sink) const = 0;
- virtual delay_t getDelayEpsilon() const = 0;
- virtual delay_t getRipupDelayPenalty() const = 0;
- virtual float getDelayNS(delay_t v) const = 0;
- virtual DelayInfo getDelayFromNS(float ns) const = 0;
- virtual uint32_t getDelayChecksum(delay_t v) const = 0;
- virtual bool getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const
+ virtual bool getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const override
{
return false;
}
// Decal methods
- virtual typename R::DecalGfxRange getDecalGraphics(DecalId decal) const { NPNR_ASSERT_FALSE("unreachable"); };
- virtual DecalXY getBelDecal(BelId bel) const { return DecalXY(); }
- virtual DecalXY getWireDecal(WireId wire) const { return DecalXY(); }
- virtual DecalXY getPipDecal(PipId pip) const { return DecalXY(); }
- virtual DecalXY getGroupDecal(GroupId group) const { return DecalXY(); }
+ virtual typename R::DecalGfxRange getDecalGraphics(DecalId decal) const override
+ {
+ NPNR_ASSERT_FALSE("unreachable");
+ };
+ virtual DecalXY getBelDecal(BelId bel) const override { return DecalXY(); }
+ virtual DecalXY getWireDecal(WireId wire) const override { return DecalXY(); }
+ virtual DecalXY getPipDecal(PipId pip) const override { return DecalXY(); }
+ virtual DecalXY getGroupDecal(GroupId group) const override { return DecalXY(); }
// Cell timing methods
- virtual bool getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, DelayInfo &delay) const
+ virtual bool getCellDelay(const CellInfo *cell, IdString fromPort, IdString toPort, DelayInfo &delay) const override
{
return false;
}
- virtual TimingPortClass getPortTimingClass(const CellInfo *cell, IdString port, int &clockInfoCount) const
+ virtual TimingPortClass getPortTimingClass(const CellInfo *cell, IdString port, int &clockInfoCount) const override
{
return TMG_IGNORE;
}
- virtual TimingClockingInfo getPortClockingInfo(const CellInfo *cell, IdString port, int index) const
+ virtual TimingClockingInfo getPortClockingInfo(const CellInfo *cell, IdString port, int index) const override
{
NPNR_ASSERT_FALSE("unreachable");
}
// Placement validity checks
- virtual bool isValidBelForCellType(IdString cell_type, BelId bel) const { return cell_type == getBelType(bel); }
- virtual IdString getBelBucketName(BelBucketId bucket) const { return bbid_to_name<BelBucketId>(bucket); }
- virtual BelBucketId getBelBucketByName(IdString name) const { return bbid_from_name<BelBucketId>(name); }
- virtual BelBucketId getBelBucketForBel(BelId bel) const { return getBelBucketForCellType(getBelType(bel)); };
- virtual BelBucketId getBelBucketForCellType(IdString cell_type) const { return getBelBucketByName(cell_type); };
- virtual bool isValidBelForCell(CellInfo *cell, BelId bel) const { return true; }
- virtual bool isBelLocationValid(BelId bel) const { return true; }
- virtual typename R::CellTypeRange getCellTypes() const
+ virtual bool isValidBelForCellType(IdString cell_type, BelId bel) const override
+ {
+ return cell_type == this->getBelType(bel);
+ }
+ virtual IdString getBelBucketName(BelBucketId bucket) const override { return bbid_to_name<BelBucketId>(bucket); }
+ virtual BelBucketId getBelBucketByName(IdString name) const override { return bbid_from_name<BelBucketId>(name); }
+ virtual BelBucketId getBelBucketForBel(BelId bel) const override
+ {
+ return getBelBucketForCellType(this->getBelType(bel));
+ };
+ virtual BelBucketId getBelBucketForCellType(IdString cell_type) const override
+ {
+ return getBelBucketByName(cell_type);
+ };
+ virtual bool isValidBelForCell(CellInfo *cell, BelId bel) const override { return true; }
+ virtual bool isBelLocationValid(BelId bel) const override { return true; }
+ virtual typename R::CellTypeRange getCellTypes() const override
{
NPNR_ASSERT(cell_types_initialised);
return return_if_match<const std::vector<IdString> &, typename R::CellTypeRange>(cell_types);
}
- virtual typename R::BelBucketRange getBelBuckets() const
+ virtual typename R::BelBucketRange getBelBuckets() const override
{
NPNR_ASSERT(bel_buckets_initialised);
return return_if_match<const std::vector<BelBucketId> &, typename R::BelBucketRange>(bel_buckets);
}
- virtual typename R::BucketBelRange getBelsInBucket(BelBucketId bucket) const
+ virtual typename R::BucketBelRange getBelsInBucket(BelBucketId bucket) const override
{
NPNR_ASSERT(bel_buckets_initialised);
return return_if_match<const std::vector<BelId> &, typename R::BucketBelRange>(bucket_bels.at(bucket));
}
// Flow methods
- virtual bool pack() = 0;
- virtual bool place() = 0;
- virtual bool route() = 0;
- virtual void assignArchInfo(){};
+ virtual void assignArchInfo() override{};
// --------------------------------------------------------------
// These structures are used to provide default implementations of bel/wire/pip binding. Arches might want to
@@ -1321,20 +1415,20 @@ template <typename R> struct BaseArch : BaseCtx
void init_cell_types()
{
std::unordered_set<IdString> bel_types;
- for (auto bel : getBels())
- bel_types.insert(getBelType(bel));
+ for (auto bel : this->getBels())
+ bel_types.insert(this->getBelType(bel));
std::copy(bel_types.begin(), bel_types.end(), std::back_inserter(cell_types));
std::sort(cell_types.begin(), cell_types.end());
cell_types_initialised = true;
}
void init_bel_buckets()
{
- for (auto cell_type : getCellTypes()) {
- auto bucket = getBelBucketForCellType(cell_type);
+ for (auto cell_type : this->getCellTypes()) {
+ auto bucket = this->getBelBucketForCellType(cell_type);
bucket_bels[bucket]; // create empty bucket
}
- for (auto bel : getBels()) {
- auto bucket = getBelBucketForBel(bel);
+ for (auto bel : this->getBels()) {
+ auto bucket = this->getBelBucketForBel(bel);
bucket_bels[bucket].push_back(bel);
}
for (auto &b : bucket_bels)