aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5/arch_pybindings.h
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-07-06 14:02:37 +0200
committerDavid Shah <davey1576@gmail.com>2018-07-11 10:41:36 +0200
commit83303bae5aec42ef411478dc2841b28aeecfd5e0 (patch)
tree3ffd8600738a30821cf75f6421aed85d56e59ad4 /ecp5/arch_pybindings.h
parent074df03c593f03ba93ac19804c551e22a404d8d6 (diff)
downloadnextpnr-83303bae5aec42ef411478dc2841b28aeecfd5e0.tar.gz
nextpnr-83303bae5aec42ef411478dc2841b28aeecfd5e0.tar.bz2
nextpnr-83303bae5aec42ef411478dc2841b28aeecfd5e0.zip
ecp5: Implementing (at least stubs) most of arch.cc
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ecp5/arch_pybindings.h')
-rw-r--r--ecp5/arch_pybindings.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/ecp5/arch_pybindings.h b/ecp5/arch_pybindings.h
index f7f07529..a5044f29 100644
--- a/ecp5/arch_pybindings.h
+++ b/ecp5/arch_pybindings.h
@@ -26,6 +26,50 @@
NEXTPNR_NAMESPACE_BEGIN
+namespace PythonConversion {
+
+template <> struct string_converter<BelId>
+{
+ BelId from_str(Context *ctx, std::string name) { return ctx->getBelByName(ctx->id(name)); }
+
+ std::string to_str(Context *ctx, BelId id)
+ {
+ if (id == BelId())
+ throw bad_wrap();
+ return ctx->getBelName(id).str(ctx);
+ }
+};
+
+template <> struct string_converter<BelType>
+{
+ BelType from_str(Context *ctx, std::string name) { return ctx->belTypeFromId(ctx->id(name)); }
+
+ std::string to_str(Context *ctx, BelType typ) { return ctx->belTypeToId(typ).str(ctx); }
+};
+
+template <> struct string_converter<WireId>
+{
+ WireId from_str(Context *ctx, std::string name) { return ctx->getWireByName(ctx->id(name)); }
+
+ std::string to_str(Context *ctx, WireId id) { return ctx->getWireName(id).str(ctx); }
+};
+
+template <> struct string_converter<PipId>
+{
+ PipId from_str(Context *ctx, std::string name) { return ctx->getPipByName(ctx->id(name)); }
+
+ std::string to_str(Context *ctx, PipId id) { return ctx->getPipName(id).str(ctx); }
+};
+
+template <> struct string_converter<PortPin>
+{
+ PortPin from_str(Context *ctx, std::string name) { return ctx->portPinFromId(ctx->id(name)); }
+
+ std::string to_str(Context *ctx, PortPin id) { return ctx->portPinToId(id).str(ctx); }
+};
+
+} // namespace PythonConversion
+
NEXTPNR_NAMESPACE_END
#endif
#endif