diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/nextpnr.h | 46 | ||||
-rw-r--r-- | common/placer1.cc (renamed from common/place_sa.cc) | 4 | ||||
-rw-r--r-- | common/placer1.h (renamed from common/place_sa.h) | 2 | ||||
-rw-r--r-- | common/pybindings.cc | 10 | ||||
-rw-r--r-- | common/router1.cc (renamed from common/route.cc) | 8 | ||||
-rw-r--r-- | common/router1.h (renamed from common/route.h) | 9 | ||||
-rw-r--r-- | common/util.h | 13 |
7 files changed, 75 insertions, 17 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h index 37e193b9..50465869 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -136,7 +136,7 @@ NEXTPNR_NAMESPACE_BEGIN struct GraphicElement { - enum + enum type_t { G_NONE, G_LINE, @@ -145,6 +145,14 @@ struct GraphicElement G_LABEL } type = G_NONE; + enum style_t + { + G_FRAME, + G_HIDDEN, + G_INACTIVE, + G_ACTIVE, + } style = G_FRAME; + float x1 = 0, y1 = 0, x2 = 0, y2 = 0, z = 0; std::string text; }; @@ -155,6 +163,12 @@ NEXTPNR_NAMESPACE_END NEXTPNR_NAMESPACE_BEGIN +struct DecalXY +{ + DecalId decal; + float x = 0, y = 0; +}; + struct BelPin { BelId bel; @@ -253,6 +267,31 @@ struct BaseCtx delete idstring_str_to_idx; delete idstring_idx_to_str; } + + Context *getCtx() { return reinterpret_cast<Context *>(this); } + + const Context *getCtx() const { return reinterpret_cast<const Context *>(this); } + + // -------------------------------------------------------------- + + bool allUiReload = false; + bool frameUiReload = false; + std::unordered_set<BelId> belUiReload; + std::unordered_set<WireId> wireUiReload; + std::unordered_set<PipId> pipUiReload; + std::unordered_set<GroupId> groupUiReload; + + void refreshUi() { allUiReload = true; } + + void refreshUiFrame() { frameUiReload = true; } + + void refreshUiBel(BelId bel) { belUiReload.insert(bel); } + + void refreshUiWire(WireId wire) { wireUiReload.insert(wire); } + + void refreshUiPip(PipId pip) { pipUiReload.insert(pip); } + + void refreshUiGroup(GroupId group) { groupUiReload.insert(group); } }; NEXTPNR_NAMESPACE_END @@ -273,6 +312,11 @@ struct Context : Arch // -------------------------------------------------------------- + // provided by router1.cc + bool getActualRouteDelay(WireId src_wire, WireId dst_wire, delay_t &delay); + + // -------------------------------------------------------------- + uint64_t rngstate = 0x3141592653589793; uint64_t rng64() diff --git a/common/place_sa.cc b/common/placer1.cc index ab161c57..53295a91 100644 --- a/common/place_sa.cc +++ b/common/placer1.cc @@ -21,7 +21,7 @@ * */ -#include "place_sa.h" +#include "placer1.h" #include <algorithm> #include <cmath> #include <iostream> @@ -429,7 +429,7 @@ class SAPlacer const float post_legalise_dia_scale = 2; }; -bool place_design_sa(Context *ctx) +bool placer1(Context *ctx) { try { SAPlacer placer(ctx); diff --git a/common/place_sa.h b/common/placer1.h index 1fd8c712..477fae56 100644 --- a/common/place_sa.h +++ b/common/placer1.h @@ -23,7 +23,7 @@ NEXTPNR_NAMESPACE_BEGIN -extern bool place_design_sa(Context *ctx); +extern bool placer1(Context *ctx); NEXTPNR_NAMESPACE_END diff --git a/common/pybindings.cc b/common/pybindings.cc index 64055755..061dfc47 100644 --- a/common/pybindings.cc +++ b/common/pybindings.cc @@ -110,13 +110,13 @@ BOOST_PYTHON_MODULE(MODULE_NAME) readwrite_wrapper<CellInfo &, decltype(&CellInfo::belStrength), &CellInfo::belStrength, pass_through<PlaceStrength>, pass_through<PlaceStrength>>::def_wrap(ci_cls, "belStrength"); readonly_wrapper<CellInfo &, decltype(&CellInfo::pins), &CellInfo::pins, wrap_context<PinMap &>>::def_wrap(ci_cls, - "pins"); + "pins"); auto pi_cls = class_<ContextualWrapper<PortInfo &>>("PortInfo", no_init); readwrite_wrapper<PortInfo &, decltype(&PortInfo::name), &PortInfo::name, conv_to_str<IdString>, conv_from_str<IdString>>::def_wrap(pi_cls, "name"); readonly_wrapper<PortInfo &, decltype(&PortInfo::net), &PortInfo::net, deref_and_wrap<NetInfo>>::def_wrap(pi_cls, - "net"); + "net"); readwrite_wrapper<PortInfo &, decltype(&PortInfo::type), &PortInfo::type, pass_through<PortType>, pass_through<PortType>>::def_wrap(pi_cls, "type"); @@ -131,11 +131,11 @@ BOOST_PYTHON_MODULE(MODULE_NAME) readonly_wrapper<NetInfo &, decltype(&NetInfo::users), &NetInfo::users, wrap_context<PortVector &>>::def_wrap( ni_cls, "users"); readonly_wrapper<NetInfo &, decltype(&NetInfo::wires), &NetInfo::wires, wrap_context<WireMap &>>::def_wrap(ni_cls, - "wires"); + "wires"); auto pr_cls = class_<ContextualWrapper<PortRef &>>("PortRef", no_init); readonly_wrapper<PortRef &, decltype(&PortRef::cell), &PortRef::cell, deref_and_wrap<CellInfo>>::def_wrap(pr_cls, - "cell"); + "cell"); readwrite_wrapper<PortRef &, decltype(&PortRef::port), &PortRef::port, conv_to_str<IdString>, conv_from_str<IdString>>::def_wrap(pr_cls, "port"); readwrite_wrapper<PortRef &, decltype(&PortRef::budget), &PortRef::budget, pass_through<delay_t>, @@ -151,7 +151,9 @@ BOOST_PYTHON_MODULE(MODULE_NAME) arch_wrap_python(); } +#ifdef MAIN_EXECUTABLE static wchar_t *program; +#endif void init_python(const char *executable, bool first) { diff --git a/common/route.cc b/common/router1.cc index 82525fcc..94c7070e 100644 --- a/common/route.cc +++ b/common/router1.cc @@ -21,7 +21,7 @@ #include <queue> #include "log.h" -#include "route.h" +#include "router1.h" namespace { @@ -402,7 +402,7 @@ struct Router NEXTPNR_NAMESPACE_BEGIN -bool route_design(Context *ctx) +bool router1(Context *ctx) { try { int totalVisitCnt = 0, totalRevisitCnt = 0, totalOvertimeRevisitCnt = 0; @@ -643,10 +643,10 @@ bool route_design(Context *ctx) } } -bool get_actual_route_delay(Context *ctx, WireId src_wire, WireId dst_wire, delay_t &delay) +bool Context::getActualRouteDelay(WireId src_wire, WireId dst_wire, delay_t &delay) { RipupScoreboard scores; - Router router(ctx, scores, src_wire, dst_wire); + Router router(this, scores, src_wire, dst_wire); if (router.routedOkay) delay = router.visited.at(dst_wire).delay; return router.routedOkay; diff --git a/common/route.h b/common/router1.h index 1da9edc2..38552c58 100644 --- a/common/route.h +++ b/common/router1.h @@ -17,16 +17,15 @@ * */ -#ifndef ROUTE_H -#define ROUTE_H +#ifndef ROUTER1_H +#define ROUTER1_H #include "nextpnr.h" NEXTPNR_NAMESPACE_BEGIN -extern bool route_design(Context *ctx); -extern bool get_actual_route_delay(Context *ctx, WireId src_wire, WireId dst_wire, delay_t &delay); +extern bool router1(Context *ctx); NEXTPNR_NAMESPACE_END -#endif // ROUTE_H +#endif // ROUTER1_H diff --git a/common/util.h b/common/util.h index 60eb35af..8f361dc8 100644 --- a/common/util.h +++ b/common/util.h @@ -39,6 +39,18 @@ ValueType get_or_default(const Container &ct, const KeyType &key, ValueType def return found->second; }; +// Get a value from a map-style container, returning default if value is not +// found (forces string) +template <typename Container, typename KeyType> +std::string str_or_default(const Container &ct, const KeyType &key, std::string def = "") +{ + auto found = ct.find(key); + if (found == ct.end()) + return def; + else + return found->second; +}; + // Get a value from a map-style container, converting to int, and returning // default if value is not found template <typename Container, typename KeyType> int int_or_default(const Container &ct, const KeyType &key, int def = 0) @@ -84,6 +96,7 @@ inline const NetInfo *get_net_or_empty(const CellInfo *cell, const IdString port else return nullptr; }; + NEXTPNR_NAMESPACE_END #endif |