aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2020-01-27 09:35:23 +0000
committerGitHub <noreply@github.com>2020-01-27 09:35:23 +0000
commitab7078d574713280e11af7d6f0e7b7ecf7a492c0 (patch)
treef1b99f5804b2310fa22005a1b8e14222a53779cd
parent3b5e64e8c60d01f9aa3b2463b1bb73776072abf8 (diff)
parent9185c85a5434d7fded49397ecd9eee646140e942 (diff)
downloadnextpnr-ab7078d574713280e11af7d6f0e7b7ecf7a492c0.tar.gz
nextpnr-ab7078d574713280e11af7d6f0e7b7ecf7a492c0.tar.bz2
nextpnr-ab7078d574713280e11af7d6f0e7b7ecf7a492c0.zip
Merge pull request #386 from rrika/master
python: Expose PlaceStrength enum and isValidBelForCell on ecp5
-rw-r--r--common/pybindings.cc9
-rw-r--r--common/pywrappers.h2
-rw-r--r--ecp5/arch_pybindings.cc3
3 files changed, 13 insertions, 1 deletions
diff --git a/common/pybindings.cc b/common/pybindings.cc
index 3b2a3744..51da00e9 100644
--- a/common/pybindings.cc
+++ b/common/pybindings.cc
@@ -129,6 +129,15 @@ BOOST_PYTHON_MODULE(MODULE_NAME)
.value("PORT_INOUT", PORT_INOUT)
.export_values();
+ enum_<PlaceStrength>("PlaceStrength")
+ .value("STRENGTH_NONE", STRENGTH_NONE)
+ .value("STRENGTH_WEAK", STRENGTH_WEAK)
+ .value("STRENGTH_STRONG", STRENGTH_STRONG)
+ .value("STRENGTH_FIXED", STRENGTH_FIXED)
+ .value("STRENGTH_LOCKED", STRENGTH_LOCKED)
+ .value("STRENGTH_USER", STRENGTH_USER)
+ .export_values();
+
typedef std::unordered_map<IdString, Property> AttrMap;
typedef std::unordered_map<IdString, PortInfo> PortMap;
typedef std::unordered_map<IdString, IdString> IdIdMap;
diff --git a/common/pywrappers.h b/common/pywrappers.h
index 1d970985..d50af4c3 100644
--- a/common/pywrappers.h
+++ b/common/pywrappers.h
@@ -274,7 +274,7 @@ template <typename Class, typename FuncT, FuncT fn, typename arg1_conv> struct f
}
};
-// Two parameters, one return
+// Two parameters, no return
template <typename Class, typename FuncT, FuncT fn, typename arg1_conv, typename arg2_conv> struct fn_wrapper_2a_v
{
using class_type = typename WrapIfNotContext<Class>::maybe_wrapped_t;
diff --git a/ecp5/arch_pybindings.cc b/ecp5/arch_pybindings.cc
index cd5e31c3..951745af 100644
--- a/ecp5/arch_pybindings.cc
+++ b/ecp5/arch_pybindings.cc
@@ -46,6 +46,9 @@ void arch_wrap_python()
.def("place", &Context::place)
.def("route", &Context::route);
+ fn_wrapper_2a<Context, decltype(&Context::isValidBelForCell), &Context::isValidBelForCell, pass_through<bool>,
+ addr_and_unwrap<CellInfo>, conv_from_str<BelId>>::def_wrap(ctx_cls, "isValidBelForCell");
+
typedef std::unordered_map<IdString, std::unique_ptr<CellInfo>> CellMap;
typedef std::unordered_map<IdString, std::unique_ptr<NetInfo>> NetMap;
typedef std::unordered_map<IdString, IdString> AliasMap;