7 auto py_netlist_serializer = m.def_submodule(
"NetlistSerializer", R
"(
8 HAL Netlist Serializer functions.
12 Serializes a netlist into a ``.hal`` file.
14 :param hal_py.Netlist netlist: The netlist to serialize.
15 :param pathlib.Path hal_file: The path to the ``.hal`` file.
16 :returns: ``True`` on success, ``False`` otherwise.
20 py_netlist_serializer.def(
21 "deserialize_from_file",
24 py::arg(
"gate_lib") =
nullptr,
26 Deserializes a netlist from a ``.hal`` file using the provided gate library.
27 If no gate library is provided, a gate library path must be specified within the ``.hal`` file.
29 :param pathlib.Path hal_file: The path to the ``.hal`` file.
30 :param hal_py.GateLibrary gate_lib: The gate library. Defaults to ``None``.
31 :returns: The deserialized netlist on success, ``None`` otherwise.
32 :rtype: hal_py.Netlist or None
35 py_netlist_serializer.def(
36 "deserialize_from_string",
38 py::arg(
"hal_string"),
39 py::arg(
"gate_lib") =
nullptr,
41 Deserializes a string which contains a netlist in HAL-(JSON)-format using the provided gate library.
42 If no gate library is provided, a gate library path must be specified within the ``.hal`` file.
44 :param pathlib.Path hal_file: The string containing the netlist in HAL-(JSON)-format.
45 :param hal_py.GateLibrary gate_lib: The gate library. Defaults to ``None``.
46 :returns: The deserialized netlist on success, ``None`` otherwise.
47 :rtype: hal_py.Netlist or None
void netlist_serializer_init(py::module &m)
const Module * module(const Gate *g, const NodeBoxes &boxes)
bool serialize_to_file(const Netlist *nl, const std::filesystem::path &hal_file)
std::unique_ptr< Netlist > deserialize_from_string(const std::string &hal_string, GateLibrary *gatelib)
std::unique_ptr< Netlist > deserialize_from_file(const std::filesystem::path &hal_file, GateLibrary *gatelib)