diff options
author | gatecat <gatecat@ds0.me> | 2022-02-04 15:54:41 +0000 |
---|---|---|
committer | gatecat <gatecat@ds0.me> | 2022-02-04 15:54:41 +0000 |
commit | 5ef5c33e9e964a176040c829adc965ec46331d77 (patch) | |
tree | 1fb6dbc7721986d3e6431d2aed15f75b7dedde31 /generic | |
parent | 5007cd3603d71f10924bb97acfe42d50d2ebcbd4 (diff) | |
download | nextpnr-5ef5c33e9e964a176040c829adc965ec46331d77.tar.gz nextpnr-5ef5c33e9e964a176040c829adc965ec46331d77.tar.bz2 nextpnr-5ef5c33e9e964a176040c829adc965ec46331d77.zip |
generic: Add missing Pip vector binding
Signed-off-by: gatecat <gatecat@ds0.me>
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) |