python: Expose PlaceStrength enum and isValidBelForCell on ecp5

Signed-off-by: Erika <rrika9@yahoo.com>
This commit is contained in:
Erika 2020-01-26 19:59:18 +00:00
parent 3b5e64e8c6
commit 9185c85a54
3 changed files with 13 additions and 1 deletions

View File

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

View File

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

View File

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