diff options
author | gatecat <gatecat@ds0.me> | 2022-02-04 20:48:41 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-04 20:48:41 +0000 |
commit | 4b72f02255df435f4ed1c5eaaab03434aa8168fe (patch) | |
tree | 09853ccc550aa0d641b8f19de5a7824631674de6 | |
parent | 69625564ca2659ca0fbbd3d85e75b70182febf6f (diff) | |
parent | 5ef5c33e9e964a176040c829adc965ec46331d77 (diff) | |
download | nextpnr-4b72f02255df435f4ed1c5eaaab03434aa8168fe.tar.gz nextpnr-4b72f02255df435f4ed1c5eaaab03434aa8168fe.tar.bz2 nextpnr-4b72f02255df435f4ed1c5eaaab03434aa8168fe.zip |
Merge pull request #907 from YosysHQ/gatecat/generic-pips-py-fix
generic: Add missing Pip vector binding
-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) |