diff options
author | Keith Rothman <537074+litghost@users.noreply.github.com> | 2021-01-29 15:35:00 -0800 |
---|---|---|
committer | Keith Rothman <537074+litghost@users.noreply.github.com> | 2021-02-02 07:43:36 -0800 |
commit | 9089ee2d1631fe2346143823c2896a2a85a27e8b (patch) | |
tree | 7fb694eec79c542fa4658392b058b56a45f7013f /nexus | |
parent | 9fe546f279cd643a308322ffa6af622630892315 (diff) | |
download | nextpnr-9089ee2d1631fe2346143823c2896a2a85a27e8b.tar.gz nextpnr-9089ee2d1631fe2346143823c2896a2a85a27e8b.tar.bz2 nextpnr-9089ee2d1631fe2346143823c2896a2a85a27e8b.zip |
Add pybindings for new APIs.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
Diffstat (limited to 'nexus')
-rw-r--r-- | nexus/arch_pybindings.cc | 3 | ||||
-rw-r--r-- | nexus/arch_pybindings.h | 12 |
2 files changed, 15 insertions, 0 deletions
diff --git a/nexus/arch_pybindings.cc b/nexus/arch_pybindings.cc index 1a3890ff..cf0badae 100644 --- a/nexus/arch_pybindings.cc +++ b/nexus/arch_pybindings.cc @@ -55,6 +55,9 @@ void arch_wrap_python(py::module &m) typedef UpDownhillPipRange DownhillPipRange; typedef WireBelPinRange BelPinRange; + typedef const std::vector<BelBucketId> & BelBucketRange; + typedef const std::vector<BelId> & BelRangeForBelBucket; + #include "arch_pybindings_shared.h" WRAP_RANGE(m, Bel, conv_to_str<BelId>); diff --git a/nexus/arch_pybindings.h b/nexus/arch_pybindings.h index 326af306..7694090b 100644 --- a/nexus/arch_pybindings.h +++ b/nexus/arch_pybindings.h @@ -76,6 +76,18 @@ template <> struct string_converter<PipId> } }; +template <> struct string_converter<BelBucketId> +{ + BelBucketId from_str(Context *ctx, std::string name) { return ctx->getBelBucketByName(ctx->id(name)); } + + std::string to_str(Context *ctx, BelBucketId id) + { + if (id == BelBucketId()) + throw bad_wrap(); + return ctx->getBelBucketName(id).str(ctx); + } +}; + template <> struct string_converter<BelPin> { BelPin from_str(Context *ctx, std::string name) |