From 9089ee2d1631fe2346143823c2896a2a85a27e8b Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Fri, 29 Jan 2021 15:35:00 -0800 Subject: Add pybindings for new APIs. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- ice40/arch_pybindings.cc | 2 ++ ice40/arch_pybindings.h | 12 ++++++++++++ 2 files changed, 14 insertions(+) (limited to 'ice40') diff --git a/ice40/arch_pybindings.cc b/ice40/arch_pybindings.cc index 921956e8..060cf0b1 100644 --- a/ice40/arch_pybindings.cc +++ b/ice40/arch_pybindings.cc @@ -75,6 +75,8 @@ void arch_wrap_python(py::module &m) typedef const PipRange UphillPipRange; typedef const PipRange DownhillPipRange; + typedef const std::vector & BelBucketRange; + typedef const std::vector & BelRangeForBelBucket; #include "arch_pybindings_shared.h" WRAP_RANGE(m, Bel, conv_to_str); diff --git a/ice40/arch_pybindings.h b/ice40/arch_pybindings.h index cf343976..dd3161ae 100644 --- a/ice40/arch_pybindings.h +++ b/ice40/arch_pybindings.h @@ -76,6 +76,18 @@ template <> struct string_converter } }; +template <> struct string_converter +{ + 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 from_str(Context *ctx, std::string name) -- cgit v1.2.3