From 5ef5c33e9e964a176040c829adc965ec46331d77 Mon Sep 17 00:00:00 2001 From: gatecat Date: Fri, 4 Feb 2022 15:54:41 +0000 Subject: generic: Add missing Pip vector binding Signed-off-by: gatecat --- generic/arch_pybindings.cc | 1 + generic/arch_pybindings.h | 12 ++++++++++++ 2 files changed, 13 insertions(+) (limited to 'generic') 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, "HierarchyMap"); WRAP_VECTOR(m, const std::vector, conv_to_str); + WRAP_VECTOR(m, const std::vector, conv_to_str); } 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 } }; +template <> struct string_converter +{ + 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 from_str(Context *ctx, std::string name) -- cgit v1.2.3