Add BaseArchRanges for default ArchRanges types

Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
gatecat 2021-02-09 10:39:14 +00:00
parent bcf81f0e71
commit 11db5a2f1d
5 changed files with 25 additions and 49 deletions

View File

@ -1176,6 +1176,27 @@ template <typename R> struct ArchAPI : BaseCtx
virtual void assignArchInfo() = 0; virtual void assignArchInfo() = 0;
}; };
// This contains the relevant range types for the default implementations of Arch functions
struct BaseArchRanges
{
// Attributes
using BelAttrsRangeT = std::vector<std::pair<IdString, std::string>>;
using WireAttrsRangeT = std::vector<std::pair<IdString, std::string>>;
using PipAttrsRangeT = std::vector<std::pair<IdString, std::string>>;
// Groups
using AllGroupsRangeT = std::vector<GroupId>;
using GroupBelsRangeT = std::vector<BelId>;
using GroupWiresRangeT = std::vector<WireId>;
using GroupPipsRangeT = std::vector<PipId>;
using GroupGroupsRangeT = std::vector<GroupId>;
// Decals
using DecalGfxRangeT = std::vector<GraphicElement>;
// Placement validity
using CellTypeRangeT = const std::vector<IdString> &;
using BelBucketRangeT = const std::vector<BelBucketId> &;
using BucketBelRangeT = const std::vector<BelId> &;
};
template <typename R> struct BaseArch : ArchAPI<R> template <typename R> struct BaseArch : ArchAPI<R>
{ {
// -------------------------------------------------------------- // --------------------------------------------------------------

View File

@ -29,7 +29,7 @@ The contents of `ArchRanges` is as follows:
|`BelBucketRangeT` | `BelBucketRange` | |`BelBucketRangeT` | `BelBucketRange` |
|`BucketBelRangeT` | `BelId` | |`BucketBelRangeT` | `BelId` |
The functions that return a particular type are described below The functions that return a particular type are described below. Where a default function implementation is provided, `BaseArchRanges` (which `ArchRanges` can inherit from) will set the range type appropriately.
archdefs.h archdefs.h
========== ==========

View File

@ -435,35 +435,20 @@ template <> struct hash<NEXTPNR_NAMESPACE_PREFIX DelayKey>
} // namespace std } // namespace std
NEXTPNR_NAMESPACE_BEGIN NEXTPNR_NAMESPACE_BEGIN
struct ArchRanges struct ArchRanges : BaseArchRanges
{ {
using ArchArgsT = ArchArgs; using ArchArgsT = ArchArgs;
// Bels // Bels
using AllBelsRangeT = BelRange; using AllBelsRangeT = BelRange;
using TileBelsRangeT = BelRange; using TileBelsRangeT = BelRange;
using BelAttrsRangeT = std::vector<std::pair<IdString, std::string>>;
using BelPinsRangeT = std::vector<IdString>; using BelPinsRangeT = std::vector<IdString>;
// Wires // Wires
using AllWiresRangeT = WireRange; using AllWiresRangeT = WireRange;
using DownhillPipRangeT = PipRange; using DownhillPipRangeT = PipRange;
using UphillPipRangeT = PipRange; using UphillPipRangeT = PipRange;
using WireBelPinRangeT = BelPinRange; using WireBelPinRangeT = BelPinRange;
using WireAttrsRangeT = std::vector<std::pair<IdString, std::string>>;
// Pips // Pips
using AllPipsRangeT = AllPipRange; using AllPipsRangeT = AllPipRange;
using PipAttrsRangeT = std::vector<std::pair<IdString, std::string>>;
// Groups
using AllGroupsRangeT = std::vector<GroupId>;
using GroupBelsRangeT = std::vector<BelId>;
using GroupWiresRangeT = std::vector<WireId>;
using GroupPipsRangeT = std::vector<PipId>;
using GroupGroupsRangeT = std::vector<GroupId>;
// Decals
using DecalGfxRangeT = std::vector<GraphicElement>;
// Placement validity
using CellTypeRangeT = const std::vector<IdString> &;
using BelBucketRangeT = const std::vector<BelBucketId> &;
using BucketBelRangeT = const std::vector<BelId> &;
}; };
struct Arch : BaseArch<ArchRanges> struct Arch : BaseArch<ArchRanges>

View File

@ -374,35 +374,20 @@ struct ArchArgs
std::string package; std::string package;
}; };
struct ArchRanges struct ArchRanges : BaseArchRanges
{ {
using ArchArgsT = ArchArgs; using ArchArgsT = ArchArgs;
// Bels // Bels
using AllBelsRangeT = BelRange; using AllBelsRangeT = BelRange;
using TileBelsRangeT = BelRange; using TileBelsRangeT = BelRange;
using BelAttrsRangeT = std::vector<std::pair<IdString, std::string>>;
using BelPinsRangeT = std::vector<IdString>; using BelPinsRangeT = std::vector<IdString>;
// Wires // Wires
using AllWiresRangeT = WireRange; using AllWiresRangeT = WireRange;
using DownhillPipRangeT = PipRange; using DownhillPipRangeT = PipRange;
using UphillPipRangeT = PipRange; using UphillPipRangeT = PipRange;
using WireBelPinRangeT = BelPinRange; using WireBelPinRangeT = BelPinRange;
using WireAttrsRangeT = std::vector<std::pair<IdString, std::string>>;
// Pips // Pips
using AllPipsRangeT = AllPipRange; using AllPipsRangeT = AllPipRange;
using PipAttrsRangeT = std::vector<std::pair<IdString, std::string>>;
// Groups
using AllGroupsRangeT = std::vector<GroupId>;
using GroupBelsRangeT = std::vector<BelId>;
using GroupWiresRangeT = std::vector<WireId>;
using GroupPipsRangeT = std::vector<PipId>;
using GroupGroupsRangeT = std::vector<GroupId>;
// Decals
using DecalGfxRangeT = std::vector<GraphicElement>;
// Placement validity
using CellTypeRangeT = const std::vector<IdString> &;
using BelBucketRangeT = const std::vector<BelBucketId> &;
using BucketBelRangeT = const std::vector<BelId> &;
}; };
struct Arch : BaseArch<ArchRanges> struct Arch : BaseArch<ArchRanges>

View File

@ -855,35 +855,20 @@ struct ArchArgs
std::string device; std::string device;
}; };
struct ArchRanges struct ArchRanges : BaseArchRanges
{ {
using ArchArgsT = ArchArgs; using ArchArgsT = ArchArgs;
// Bels // Bels
using AllBelsRangeT = BelRange; using AllBelsRangeT = BelRange;
using TileBelsRangeT = std::vector<BelId>; using TileBelsRangeT = std::vector<BelId>;
using BelAttrsRangeT = std::vector<std::pair<IdString, std::string>>;
using BelPinsRangeT = std::vector<IdString>; using BelPinsRangeT = std::vector<IdString>;
// Wires // Wires
using AllWiresRangeT = WireRange; using AllWiresRangeT = WireRange;
using DownhillPipRangeT = UpDownhillPipRange; using DownhillPipRangeT = UpDownhillPipRange;
using UphillPipRangeT = UpDownhillPipRange; using UphillPipRangeT = UpDownhillPipRange;
using WireBelPinRangeT = BelPinRange; using WireBelPinRangeT = BelPinRange;
using WireAttrsRangeT = std::vector<std::pair<IdString, std::string>>;
// Pips // Pips
using AllPipsRangeT = AllPipRange; using AllPipsRangeT = AllPipRange;
using PipAttrsRangeT = std::vector<std::pair<IdString, std::string>>;
// Groups
using AllGroupsRangeT = std::vector<GroupId>;
using GroupBelsRangeT = std::vector<BelId>;
using GroupWiresRangeT = std::vector<WireId>;
using GroupPipsRangeT = std::vector<PipId>;
using GroupGroupsRangeT = std::vector<GroupId>;
// Decals
using DecalGfxRangeT = std::vector<GraphicElement>;
// Placement validity
using CellTypeRangeT = const std::vector<IdString> &;
using BelBucketRangeT = const std::vector<BelBucketId> &;
using BucketBelRangeT = const std::vector<BelId> &;
}; };
struct Arch : BaseArch<ArchRanges> struct Arch : BaseArch<ArchRanges>