Merge pull request #907 from YosysHQ/gatecat/generic-pips-py-fix

generic: Add missing Pip vector binding
This commit is contained in:
gatecat 2022-02-04 20:48:41 +00:00 committed by GitHub
commit 4b72f02255
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -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

View File

@ -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)