7 py::class_<BooleanFunctionDecorator> py_boolean_function_decorator(m,
"BooleanFunctionDecorator", R
"()");
9 py_boolean_function_decorator.def(py::init<const BooleanFunction&>(), py::arg("bf"), R
"(
10 Construct new BooleanFunctionDecorator object.
12 :param hal_py.BooleanFunction bf: The Booelan function to operate on.
15 py_boolean_function_decorator.def(
16 "substitute_power_ground_nets",
18 auto res =
self.substitute_power_ground_nets(nl);
25 log_error(
"python_context",
"error encountered while substituting power and ground nets:\n{}", res.get_error().get());
31 Substitute all Boolean function variables fed by power or ground gates by constant ``0`` and ``1``.
33 :param hal_py.Netlist nl: The netlist to operate on.
34 :returns: The resulting Boolean function on success, ``None`` otherwise.
35 :rtype: hal_py.BooleanFunction or None
38 py_boolean_function_decorator.def(
39 "substitute_power_ground_pins",
41 auto res =
self.substitute_power_ground_pins(
g);
48 log_error(
"python_context",
"error encountered while substituting power and ground pins:\n{}", res.get_error().get());
54 Substitute all Boolean function variables that belong to a pin connected to a power or ground gate by constant ``0`` and ``1``.
56 :param hal_py.Gate g: The gate which is connected to the pins and belongs to the Boolean function under inspection.
57 :returns: The resulting Boolean function on success, ``None`` otherwise.
58 :rtype: hal_py.BooleanFunction or None
61 py_boolean_function_decorator.def_static(
62 "get_boolean_function_from",
63 [](
const std::vector<BooleanFunction>& functions,
u32 extend_to_size = 0,
bool sign_extend =
false) -> std::optional<BooleanFunction> {
71 log_error(
"python_context",
"error encountered while getting Boolean function from Boolean function vector:\n{}", res.get_error().get());
76 py::arg(
"extend_to_size") = 0,
77 py::arg(
"sign_extend") =
false,
79 Get the Boolean function that is the concatenation of Boolean functions.
80 The Boolean function can optionally be extended to any desired size greater the size of the given net vector.
82 :param list[hal_py.BooleanFunction] functions: The Boolean functions to concatenate.
83 :param int extend_to_size: The size to which to extend the Boolean function. Set to ``0`` to prevent extension. Defaults to ``0``.
84 :param bool sign_extend: Set ``True`` to sign extend, ``False`` to zero extend. Defaults to ``False``.
85 :returns: The resulting Boolean function on success, ``None`` otherwise.
86 :rtype: hal_py.BooleanFunction or None
89 py_boolean_function_decorator.def_static(
90 "get_boolean_function_from",
91 [](
const std::vector<Net*>& nets,
u32 extend_to_size = 0,
bool sign_extend =
false) -> std::optional<BooleanFunction> {
99 log_error(
"python_context",
"error encountered while getting Boolean function from net vector:\n{}", res.get_error().get());
104 py::arg(
"extend_to_size") = 0,
105 py::arg(
"sign_extend") =
false,
107 Get the Boolean function that is the concatenation of variable names corresponding to nets of a netlist.
108 The Boolean function can optionally be extended to any desired size greater the size of the given net vector.
110 :param list[hal_py.Net] nets: The nets to concatenate.
111 :param int extend_to_size: The size to which to extend the Boolean function. Set to ``0`` to prevent extension. Defaults to ``0``.
112 :param bool sign_extend: Set ``True`` to sign extend, ``False`` to zero extend. Defaults to ``False``.
113 :returns: The resulting Boolean function on success, ``None`` otherwise.
114 :rtype: hal_py.BooleanFunction or None
117 py_boolean_function_decorator.def_static(
118 "get_boolean_function_from",
119 [](
const PinGroup<ModulePin>* pin_group,
u32 extend_to_size = 0,
bool sign_extend =
false) -> std::optional<BooleanFunction> {
127 log_error(
"python_context",
"error encountered while getting Boolean function from net vector:\n{}", res.get_error().get());
131 py::arg(
"pin_group"),
132 py::arg(
"extend_to_size") = 0,
133 py::arg(
"sign_extend") =
false,
135 Get the Boolean function that is the concatenation of variable names corresponding to the nets connected to the pins of the given pin group.
136 The Boolean function can optionally be extended to any desired size greater the size of the given net vector.
138 :param hal_py.ModulePinGroup pin_group: The module pin group.
139 :param int extend_to_size: The size to which to extend the Boolean function. Set to ``0`` to prevent extension. Defaults to ``0``.
140 :param bool sign_extend: Set ``True`` to sign extend, ``False`` to zero extend. Defaults to ``False``.
141 :returns: The resulting Boolean function on success, ``None`` otherwise.
142 :rtype: hal_py.BooleanFunction or None
static Result< BooleanFunction > get_boolean_function_from(const std::vector< BooleanFunction > &functions, u32 extend_to_size=0, bool sign_extend=false)
void boolean_function_decorator_init(py::module &m)
#define log_error(channel,...)
const Module * module(const Gate *g, const NodeBoxes &boxes)