From 59874188a6800fbaa03ec21e3578160e963c2eb5 Mon Sep 17 00:00:00 2001 From: gatecat Date: Thu, 30 Dec 2021 09:08:02 +0000 Subject: generic: Refactor for faster performance This won't affect Python-built arches significantly; but will be useful for the future 'viaduct' functionality where generic routing graphs can be built on the C++ side; too. Signed-off-by: gatecat --- generic/arch_pybindings.cc | 64 ++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 28 deletions(-) (limited to 'generic/arch_pybindings.cc') diff --git a/generic/arch_pybindings.cc b/generic/arch_pybindings.cc index df59b4fe..92c78252 100644 --- a/generic/arch_pybindings.cc +++ b/generic/arch_pybindings.cc @@ -42,6 +42,10 @@ void arch_wrap_python(py::module &m) { using namespace PythonConversion; + typedef linear_range BelRange; + typedef linear_range WireRange; + typedef linear_range AllPipRange; + auto arch_cls = py::class_(m, "Arch").def(py::init()); auto dxy_cls = py::class_>(m, "DecalXY_"); @@ -74,8 +78,8 @@ void arch_wrap_python(py::module &m) conv_from_str>::def_wrap(ctx_cls, "getBoundBelCell"); fn_wrapper_1a, conv_from_str>::def_wrap(ctx_cls, "getConflictingBelCell"); - fn_wrapper_0a &>>::def_wrap(ctx_cls, "getBels"); + fn_wrapper_0a>::def_wrap(ctx_cls, + "getBels"); fn_wrapper_2a, conv_from_str, conv_from_str>::def_wrap(ctx_cls, "getBelPinWire"); @@ -96,11 +100,11 @@ void arch_wrap_python(py::module &m) fn_wrapper_1a, conv_from_str>::def_wrap(ctx_cls, "getConflictingWireNet"); - fn_wrapper_0a &>>::def_wrap(ctx_cls, "getWires"); + fn_wrapper_0a>::def_wrap( + ctx_cls, "getWires"); - fn_wrapper_0a &>>::def_wrap(ctx_cls, "getPips"); + fn_wrapper_0a>::def_wrap( + ctx_cls, "getPips"); fn_wrapper_1a, conv_from_str>::def_wrap(ctx_cls, "getPipChecksum"); fn_wrapper_3a_v, @@ -156,50 +160,50 @@ void arch_wrap_python(py::module &m) "name"_a, "type"_a, "x"_a, "y"_a); fn_wrapper_6a_v, - conv_from_str, conv_from_str, conv_from_str, - pass_through, pass_through>::def_wrap(ctx_cls, "addPip", "name"_a, "type"_a, - "srcWire"_a, "dstWire"_a, "delay"_a, "loc"_a); + conv_from_str, conv_from_str, conv_from_str, pass_through, + pass_through>::def_wrap(ctx_cls, "addPip", "name"_a, "type"_a, "srcWire"_a, "dstWire"_a, + "delay"_a, "loc"_a); fn_wrapper_5a_v, conv_from_str, pass_through, pass_through, pass_through>::def_wrap(ctx_cls, "addBel", "name"_a, "type"_a, "loc"_a, "gb"_a, "hidden"_a); - fn_wrapper_3a_v, - conv_from_str, conv_from_str>::def_wrap(ctx_cls, "addBelInput", "bel"_a, - "name"_a, "wire"_a); - fn_wrapper_3a_v, - conv_from_str, conv_from_str>::def_wrap(ctx_cls, "addBelOutput", "bel"_a, - "name"_a, "wire"_a); - fn_wrapper_3a_v, - conv_from_str, conv_from_str>::def_wrap(ctx_cls, "addBelInout", "bel"_a, - "name"_a, "wire"_a); + fn_wrapper_3a_v, + conv_from_str, conv_from_str>::def_wrap(ctx_cls, "addBelInput", "bel"_a, "name"_a, + "wire"_a); + fn_wrapper_3a_v, + conv_from_str, conv_from_str>::def_wrap(ctx_cls, "addBelOutput", "bel"_a, + "name"_a, "wire"_a); + fn_wrapper_3a_v, + conv_from_str, conv_from_str>::def_wrap(ctx_cls, "addBelInout", "bel"_a, "name"_a, + "wire"_a); fn_wrapper_2a_v, - conv_from_str>::def_wrap(ctx_cls, "addGroupBel", "group"_a, "bel"_a); + conv_from_str>::def_wrap(ctx_cls, "addGroupBel", "group"_a, "bel"_a); fn_wrapper_2a_v, - conv_from_str>::def_wrap(ctx_cls, "addGroupWire", "group"_a, "wire"_a); + conv_from_str>::def_wrap(ctx_cls, "addGroupWire", "group"_a, "wire"_a); fn_wrapper_2a_v, - conv_from_str>::def_wrap(ctx_cls, "addGroupPip", "group"_a, "pip"_a); - fn_wrapper_2a_v, + conv_from_str>::def_wrap(ctx_cls, "addGroupPip", "group"_a, "pip"_a); + fn_wrapper_2a_v, conv_from_str>::def_wrap(ctx_cls, "addGroupGroup", "group"_a, "grp"_a); fn_wrapper_2a_v, pass_through>::def_wrap(ctx_cls, "addDecalGraphic", (py::arg("decal"), "graphic")); - fn_wrapper_2a_v, + fn_wrapper_2a_v, unwrap_context>::def_wrap(ctx_cls, "setWireDecal", "wire"_a, "decalxy"_a); - fn_wrapper_2a_v, + fn_wrapper_2a_v, unwrap_context>::def_wrap(ctx_cls, "setPipDecal", "pip"_a, "decalxy"_a); - fn_wrapper_2a_v, + fn_wrapper_2a_v, unwrap_context>::def_wrap(ctx_cls, "setBelDecal", "bel"_a, "decalxy"_a); fn_wrapper_2a_v, unwrap_context>::def_wrap(ctx_cls, "setGroupDecal", "group"_a, "decalxy"_a); - fn_wrapper_3a_v, + fn_wrapper_3a_v, conv_from_str, pass_through>::def_wrap(ctx_cls, "setWireAttr", "wire"_a, "key"_a, "value"_a); - fn_wrapper_3a_v, + fn_wrapper_3a_v, conv_from_str, pass_through>::def_wrap(ctx_cls, "setBelAttr", "bel"_a, "key"_a, "value"_a); - fn_wrapper_3a_v, + fn_wrapper_3a_v, conv_from_str, pass_through>::def_wrap(ctx_cls, "setPipAttr", "pip"_a, "key"_a, "value"_a); @@ -254,6 +258,10 @@ void arch_wrap_python(py::module &m) pass_through, conv_from_str, conv_from_str>::def_wrap(ctx_cls, "isValidBelForCellType"); + WRAP_RANGE(m, Bel, conv_to_str); + WRAP_RANGE(m, Wire, conv_to_str); + WRAP_RANGE(m, AllPip, conv_to_str); + WRAP_MAP_UPTR(m, CellMap, "IdCellMap"); WRAP_MAP_UPTR(m, NetMap, "IdNetMap"); WRAP_MAP(m, HierarchyMap, wrap_context, "HierarchyMap"); -- cgit v1.2.3