diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/arch_pybindings.cc | 1 | ||||
-rw-r--r-- | generic/arch_pybindings.h | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/generic/arch_pybindings.cc b/generic/arch_pybindings.cc index 92c78252..6d3d981c 100644 --- a/generic/arch_pybindings.cc +++ b/generic/arch_pybindings.cc @@ -266,6 +266,7 @@ void arch_wrap_python(py::module &m) WRAP_MAP_UPTR(m, NetMap, "IdNetMap"); WRAP_MAP(m, HierarchyMap, wrap_context<HierarchicalCell &>, "HierarchyMap"); WRAP_VECTOR(m, const std::vector<IdString>, conv_to_str<IdString>); + WRAP_VECTOR(m, const std::vector<PipId>, conv_to_str<PipId>); } NEXTPNR_NAMESPACE_END diff --git a/generic/arch_pybindings.h b/generic/arch_pybindings.h index 72d688dc..f0daccbc 100644 --- a/generic/arch_pybindings.h +++ b/generic/arch_pybindings.h @@ -76,6 +76,18 @@ template <> struct string_converter<PipId> } }; +template <> struct string_converter<const PipId &> +{ + PipId from_str(Context *ctx, std::string name) { return ctx->getPipByNameStr(name); } + + std::string to_str(Context *ctx, const PipId &id) + { + if (id == PipId()) + throw bad_wrap(); + return ctx->getPipName(id).str(ctx); + } +}; + template <> struct string_converter<BelPin> { BelPin from_str(Context *ctx, std::string name) |