aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5/arch.h
diff options
context:
space:
mode:
authorD. Shah <dave@ds0.me>2021-01-27 20:43:01 +0000
committerD. Shah <dave@ds0.me>2021-01-27 20:43:01 +0000
commit75ee2fc4e6ede1ad731b9451fd606c61f5892801 (patch)
tree42900c8ff1012a62f2ff4a23af2616d47e76f234 /ecp5/arch.h
parent3fc5455ec5fdaef0df0b01115e1ee0f9c9af8892 (diff)
downloadnextpnr-75ee2fc4e6ede1ad731b9451fd606c61f5892801.tar.gz
nextpnr-75ee2fc4e6ede1ad731b9451fd606c61f5892801.tar.bz2
nextpnr-75ee2fc4e6ede1ad731b9451fd606c61f5892801.zip
Move RelPtr/RelSlice out of arches into common
The bba approach seems widely used enough that it's reasonable for this to become part of common code. Signed-off-by: D. Shah <dave@ds0.me>
Diffstat (limited to 'ecp5/arch.h')
-rw-r--r--ecp5/arch.h38
1 files changed, 1 insertions, 37 deletions
diff --git a/ecp5/arch.h b/ecp5/arch.h
index 458ff935..58373157 100644
--- a/ecp5/arch.h
+++ b/ecp5/arch.h
@@ -29,43 +29,7 @@ NEXTPNR_NAMESPACE_BEGIN
/**** Everything in this section must be kept in sync with chipdb.py ****/
-template <typename T> struct RelPtr
-{
- int32_t offset;
-
- const T *get() const { return reinterpret_cast<const T *>(reinterpret_cast<const char *>(this) + offset); }
-
- const T &operator[](size_t index) const { return get()[index]; }
-
- const T &operator*() const { return *(get()); }
-
- const T *operator->() const { return get(); }
-
- RelPtr(const RelPtr &) = delete;
- RelPtr &operator=(const RelPtr &) = delete;
-};
-
-NPNR_PACKED_STRUCT(template <typename T> struct RelSlice {
- int32_t offset;
- uint32_t length;
-
- const T *get() const { return reinterpret_cast<const T *>(reinterpret_cast<const char *>(this) + offset); }
-
- const T &operator[](size_t index) const
- {
- NPNR_ASSERT(index < length);
- return get()[index];
- }
-
- const T *begin() const { return get(); }
- const T *end() const { return get() + length; }
-
- const size_t size() const { return length; }
-
- const T &operator*() const { return *(get()); }
-
- const T *operator->() const { return get(); }
-});
+#include "relptr.h"
NPNR_PACKED_STRUCT(struct BelWirePOD {
LocationPOD rel_wire_loc;