7 m.def_submodule(
"NetlistFactory", R
"(
8 Functions to create a netlist, either empty or by parsing a netlist file.
12 Create a new empty netlist using the specified gate library.
14 :param hal_py.GateLibrary gate_library: The gate library.
15 :returns: The netlist on success, ``None`` otherwise.
16 :rtype: hal_py.Netlist or None
21 [](
const std::filesystem::path& netlist_file,
const std::filesystem::path& gate_library_file) {
24 py::arg(
"netlist_file"),
26 py::arg(
"gate_library_file") =
"",
28 Create a netlist from the given file using the specified gate library file.
29 Will either deserialize ``.hal`` file or call parser plugin for other formats.
30 In the latter case the specified gate library file is mandatory.
32 :param pathlib.Path netlist_file: Path to the file.
33 :param pathlib.Path gate_library_file: Path to the gate library file. Optional for a ``.hal`` file, which then uses the gate library it names.
34 :returns: The netlist on success, ``None`` otherwise.
35 :rtype: hal_py.Netlist or None
41 py::arg(
"netlist_file"),
42 py::arg(
"gate_library"),
44 Create a netlist from the given file trying to parse it with the specified gate library.
45 Will either deserialize ``.hal`` file or call parser plugin for other formats.
47 :param pathlib.Path netlist_file: Path to the file.
48 :param hal_py.GateLibrary gate_library: The gate library.
49 :returns: The netlist on success, ``None`` otherwise.
50 :rtype: hal_py.Netlist or None
54 "load_netlist_from_string",
55 [](
const std::string& netlist_string,
const std::filesystem::path& gate_library_file) {
58 py::arg(
"netlist_string"),
59 py::arg(
"gate_library_file") =
"",
61 Create a netlist from the given string.
62 The string must contain a netlist in HAL-(JSON)-format.
64 :param str netlist_string: The string containing the netlist.
65 :param pathlib.Path gate_library_file: Path to the gate library file.
66 :returns: The netlist on success, ``None`` otherwise.
67 :rtype: hal_py.Netlist or None
71 "load_hal_project", [](
const std::filesystem::path& project_dir) {
return std::shared_ptr<Netlist>(
netlist_factory::load_hal_project(project_dir)); }, py::arg(
"project_dir"), R
"(
72 Create a netlist using information specified in command line arguments on startup.
73 Will either deserialize ``.hal`` file or call parser plugin for other formats.
75 :param pathlib.Path project_dir: Path to the hal project directory.
76 :returns: The netlist on success, ``None`` otherwise.
77 :rtype: hal_py.Netlist or None
82 [](
const std::filesystem::path& hal_file) {
83 std::vector<std::shared_ptr<Netlist>> result;
86 result.emplace_back(std::move(ptr));
90 py::arg(
"netlist_file"),
92 Create a netlist from a given file for each matching pre-loaded gate library.
94 :param pathlib.Path netlist_file: Path to the netlist file.
95 :returns: A list of netlists, one for each suitable gate library.
96 :rtype: list[hal_py.Netlist]
void netlist_factory_init(py::module &m)
const Module * module(const Gate *g, const NodeBoxes &boxes)
std::unique_ptr< Netlist > load_hal_project(const std::filesystem::path &project_dir)
Create a netlist from the given hal project.
std::vector< std::unique_ptr< Netlist > > load_netlists(const std::filesystem::path &netlist_file)
Create a netlist from a given file for each matching pre-loaded gate library.
std::unique_ptr< Netlist > load_netlist_from_string(const std::string &netlist_string, const std::filesystem::path &gate_library_file=std::filesystem::path())
Create a netlist from the given string.
std::unique_ptr< Netlist > create_netlist(const GateLibrary *gate_library)
Create a new empty netlist using the specified gate library.
std::unique_ptr< Netlist > load_netlist(const std::filesystem::path &netlist_file, const std::filesystem::path &gate_library_file=std::filesystem::path())
Create a netlist from the given file.