HAL
hal::netlist_serializer Namespace Reference

Functions

bool serialize_to_file (const Netlist *nl, const std::filesystem::path &hal_file)
 
std::unique_ptr< Netlistdeserialize_from_file (const std::filesystem::path &hal_file, GateLibrary *gatelib)
 
std::unique_ptr< Netlistdeserialize_from_string (const std::string &hal_string, GateLibrary *gatelib)
 

Function Documentation

◆ deserialize_from_file()

NETLIST_API std::unique_ptr< Netlist > hal::netlist_serializer::deserialize_from_file ( const std::filesystem::path &  hal_file,
GateLibrary gate_lib = nullptr 
)

Deserializes a netlist from a .hal file using the provided gate library. If no gate library is provided, a gate library path must be specified within the .hal file.

Parameters
[in]hal_file- The path to the .hal file.
[in]gate_lib- The gate library. Defaults to a nullptr.
Returns
The deserialized netlist on success, a nullptr otherwise.

Definition at line 1029 of file netlist_serializer.cpp.

References log_error.

Referenced by hal::netlist_factory::load_netlist(), and hal::netlist_serializer_init().

◆ deserialize_from_string()

NETLIST_API std::unique_ptr< Netlist > hal::netlist_serializer::deserialize_from_string ( const std::string &  hal_string,
GateLibrary gate_lib = nullptr 
)

Deserializes a string which contains a netlist in HAL-(JSON)-format using the provided gate library. If no gate library is provided, a gate library path must be specified within the string.

Parameters
[in]hal_string- The string containing the netlist in HAL-(JSON)-format.
[in]gate_lib- The gate library. Defaults to a nullptr.
Returns
The deserialized netlist on success, a nullptr otherwise.

Definition at line 1051 of file netlist_serializer.cpp.

Referenced by hal::netlist_factory::load_netlist_from_string(), and hal::netlist_serializer_init().

◆ serialize_to_file()

NETLIST_API bool hal::netlist_serializer::serialize_to_file ( const Netlist netlist,
const std::filesystem::path &  hal_file 
)

Serializes a netlist into a .hal file.

Parameters
[in]netlist- The netlist to serialize.
[in]hal_file- The path to the .hal file.
Returns
true on success, false otherwise.

Definition at line 970 of file netlist_serializer.cpp.

References DURATION, hal::ProjectManager::get_project_directory(), hal::ProjectManager::instance(), log_error, log_info, and SERIALIZATION_FORMAT_VERSION.

Referenced by hal::netlist_serializer_init(), and hal::ProjectManager::serialize_project().