aboutsummaryrefslogtreecommitdiffstats
path: root/gowin
diff options
context:
space:
mode:
Diffstat (limited to 'gowin')
-rw-r--r--gowin/arch.h37
-rw-r--r--gowin/cells.cc2
-rw-r--r--gowin/cells.h2
-rw-r--r--gowin/pack.cc9
4 files changed, 18 insertions, 32 deletions
diff --git a/gowin/arch.h b/gowin/arch.h
index 0f975f77..82fcb8c1 100644
--- a/gowin/arch.h
+++ b/gowin/arch.h
@@ -209,7 +209,7 @@ struct BelInfo
IdString name, type;
std::map<IdString, std::string> attrs;
CellInfo *bound_cell;
- std::unordered_map<IdString, PinInfo> pins;
+ dict<IdString, PinInfo> pins;
DecalXY decalxy;
int x, y, z;
bool gb;
@@ -229,27 +229,14 @@ struct CellDelayKey
{
IdString from, to;
inline bool operator==(const CellDelayKey &other) const { return from == other.from && to == other.to; }
+ unsigned int hash() const { return mkhash(from.hash(), to.hash()); }
};
-NEXTPNR_NAMESPACE_END
-namespace std {
-template <> struct hash<NEXTPNR_NAMESPACE_PREFIX CellDelayKey>
-{
- std::size_t operator()(const NEXTPNR_NAMESPACE_PREFIX CellDelayKey &dk) const noexcept
- {
- std::size_t seed = std::hash<NEXTPNR_NAMESPACE_PREFIX IdString>()(dk.from);
- seed ^= std::hash<NEXTPNR_NAMESPACE_PREFIX IdString>()(dk.to) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
- return seed;
- }
-};
-} // namespace std
-NEXTPNR_NAMESPACE_BEGIN
-
struct CellTiming
{
- std::unordered_map<IdString, TimingPortClass> portClasses;
- std::unordered_map<CellDelayKey, DelayQuad> combDelays;
- std::unordered_map<IdString, std::vector<TimingClockingInfo>> clockingInfo;
+ dict<IdString, TimingPortClass> portClasses;
+ dict<CellDelayKey, DelayQuad> combDelays;
+ dict<IdString, std::vector<TimingClockingInfo>> clockingInfo;
};
struct ArchRanges : BaseArchRanges
@@ -287,10 +274,10 @@ struct Arch : BaseArch<ArchRanges>
const PackagePOD *package;
const TimingGroupsPOD *speed;
- std::unordered_map<IdString, WireInfo> wires;
- std::unordered_map<IdString, PipInfo> pips;
- std::unordered_map<IdString, BelInfo> bels;
- std::unordered_map<GroupId, GroupInfo> groups;
+ dict<IdString, WireInfo> wires;
+ dict<IdString, PipInfo> pips;
+ dict<IdString, BelInfo> bels;
+ dict<GroupId, GroupInfo> groups;
// These functions include useful errors if not found
WireInfo &wire_info(IdString wire);
@@ -299,16 +286,16 @@ struct Arch : BaseArch<ArchRanges>
std::vector<IdString> bel_ids, wire_ids, pip_ids;
- std::unordered_map<Loc, BelId> bel_by_loc;
+ dict<Loc, BelId> bel_by_loc;
std::vector<std::vector<std::vector<BelId>>> bels_by_tile;
- std::unordered_map<DecalId, std::vector<GraphicElement>> decal_graphics;
+ dict<DecalId, std::vector<GraphicElement>> decal_graphics;
int gridDimX, gridDimY;
std::vector<std::vector<int>> tileBelDimZ;
std::vector<std::vector<int>> tilePipDimZ;
- std::unordered_map<IdString, CellTiming> cellTiming;
+ dict<IdString, CellTiming> cellTiming;
void addWire(IdString name, IdString type, int x, int y);
void addPip(IdString name, IdString type, IdString srcWire, IdString dstWire, DelayQuad delay, Loc loc);
diff --git a/gowin/cells.cc b/gowin/cells.cc
index e45cd482..93f1246f 100644
--- a/gowin/cells.cc
+++ b/gowin/cells.cc
@@ -114,7 +114,7 @@ void dff_to_lc(const Context *ctx, CellInfo *dff, CellInfo *lc, bool pass_thru_l
replace_port(dff, id_Q, lc, id_Q);
}
-void gwio_to_iob(Context *ctx, CellInfo *nxio, CellInfo *iob, std::unordered_set<IdString> &todelete_cells)
+void gwio_to_iob(Context *ctx, CellInfo *nxio, CellInfo *iob, pool<IdString> &todelete_cells)
{
if (nxio->type == id_IBUF) {
iob->params[id_INPUT_USED] = 1;
diff --git a/gowin/cells.h b/gowin/cells.h
index 30b29f5b..7bf1befd 100644
--- a/gowin/cells.h
+++ b/gowin/cells.h
@@ -87,7 +87,7 @@ void lut_to_lc(const Context *ctx, CellInfo *lut, CellInfo *lc, bool no_dff = tr
void dff_to_lc(const Context *ctx, CellInfo *dff, CellInfo *lc, bool pass_thru_lut = false);
// Convert a Gowin IO buffer to a IOB bel
-void gwio_to_iob(Context *ctx, CellInfo *nxio, CellInfo *sbio, std::unordered_set<IdString> &todelete_cells);
+void gwio_to_iob(Context *ctx, CellInfo *nxio, CellInfo *sbio, pool<IdString> &todelete_cells);
NEXTPNR_NAMESPACE_END
diff --git a/gowin/pack.cc b/gowin/pack.cc
index a2998c63..d3a749ea 100644
--- a/gowin/pack.cc
+++ b/gowin/pack.cc
@@ -21,7 +21,6 @@
#include <algorithm>
#include <iostream>
#include <iterator>
-#include <unordered_set>
#include "cells.h"
#include "design_utils.h"
#include "log.h"
@@ -34,7 +33,7 @@ static void pack_lut_lutffs(Context *ctx)
{
log_info("Packing LUT-FFs..\n");
- std::unordered_set<IdString> packed_cells;
+ pool<IdString> packed_cells;
std::vector<std::unique_ptr<CellInfo>> new_cells;
for (auto &cell : ctx->cells) {
CellInfo *ci = cell.second.get();
@@ -90,7 +89,7 @@ static void pack_nonlut_ffs(Context *ctx)
{
log_info("Packing non-LUT FFs..\n");
- std::unordered_set<IdString> packed_cells;
+ pool<IdString> packed_cells;
std::vector<std::unique_ptr<CellInfo>> new_cells;
for (auto &cell : ctx->cells) {
@@ -212,8 +211,8 @@ static bool is_gowin_iob(const Context *ctx, const CellInfo *cell)
// Pack IO buffers
static void pack_io(Context *ctx)
{
- std::unordered_set<IdString> packed_cells;
- std::unordered_set<IdString> delete_nets;
+ pool<IdString> packed_cells;
+ pool<IdString> delete_nets;
std::vector<std::unique_ptr<CellInfo>> new_cells;
log_info("Packing IOs..\n");