HAL
netlist_serializer.cpp File Reference
#include "hal_core/netlist/persistent/netlist_serializer.h"
#include "hal_core/netlist/boolean_function.h"
#include "hal_core/netlist/gate.h"
#include "hal_core/netlist/gate_library/gate_library_manager.h"
#include "hal_core/netlist/module.h"
#include "hal_core/netlist/net.h"
#include "hal_core/netlist/netlist.h"
#include "hal_core/netlist/project_manager.h"
#include "hal_core/utilities/log.h"
#include "rapidjson/filereadstream.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/writer.h"
#include <chrono>
#include <fstream>
#include <queue>
#include <sstream>
Include dependency graph for netlist_serializer.cpp:

Go to the source code of this file.

Namespaces

 hal
 
 hal::netlist_serializer
 

Macros

#define PRETTY_JSON_OUTPUT   false
 
#define DURATION(begin_time)   ((double)std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - begin_time).count() / 1000)
 
#define JSON_STR_HELPER(x)   rapidjson::Value{}.SetString(x.c_str(), x.length(), allocator)
 
#define assert_availablility(MEMBER)
 

Functions

bool hal::netlist_serializer::serialize_to_file (const Netlist *nl, const std::filesystem::path &hal_file)
 
std::unique_ptr< Netlist > hal::netlist_serializer::deserialize_from_file (const std::filesystem::path &hal_file, GateLibrary *gatelib)
 
std::unique_ptr< Netlist > hal::netlist_serializer::deserialize_from_string (const std::string &hal_string, GateLibrary *gatelib)
 

Macro Definition Documentation

◆ assert_availablility

#define assert_availablility (   MEMBER)
Value:
if (!root.HasMember(MEMBER)) \
{ \
log_critical("netlist_persistent", "'netlist' node does not include a '{}' node", MEMBER); \
return nullptr; \
}

Definition at line 43 of file netlist_serializer.cpp.

◆ DURATION

#define DURATION (   begin_time)    ((double)std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - begin_time).count() / 1000)

Definition at line 27 of file netlist_serializer.cpp.

◆ JSON_STR_HELPER

#define JSON_STR_HELPER (   x)    rapidjson::Value{}.SetString(x.c_str(), x.length(), allocator)

Definition at line 41 of file netlist_serializer.cpp.

◆ PRETTY_JSON_OUTPUT

#define PRETTY_JSON_OUTPUT   false

Definition at line 14 of file netlist_serializer.cpp.

Variable Documentation

◆ ascending

◆ direction

PinDirection direction = PinDirection::none

Definition at line 64 of file netlist_serializer.cpp.

Referenced by hal::NetlistModificationDecorator::create_gnd_net(), hal::Module::create_pin(), hal::GateType::create_pin(), hal::GateType::create_pin_group(), hal::Module::create_pin_group(), hal::NetlistModificationDecorator::create_vcc_net(), hal::gate_type_init(), hal::graph_algorithm::get_all_shortest_paths(), hal::graph_algorithm::get_all_shortest_paths_igraph(), hal::Gate::get_fan_in_endpoint(), hal::Gate::get_fan_out_endpoint(), hal::GateType::get_input_pin_names(), hal::Module::get_input_pin_names(), hal::GateType::get_input_pins(), hal::Module::get_input_pins(), hal::graph_algorithm::get_neighborhood(), hal::graph_algorithm::get_neighborhood_igraph(), hal::netlist_utils::get_nets_at_pins(), hal::GateType::get_output_pin_names(), hal::Module::get_output_pin_names(), hal::GateType::get_output_pins(), hal::Module::get_output_pins(), hal::Gate::get_predecessor(), hal::NetlistTraversalDecorator::get_shortest_path(), hal::NetlistTraversalDecorator::get_shortest_path_distance(), hal::graph_algorithm::get_shortest_paths(), hal::graph_algorithm::get_shortest_paths_igraph(), hal::Gate::get_successor(), hal::module_init(), hal::GatePinTree::mouseDoubleClickEvent(), hal::PinGroup< T >::move_pin(), hal::netlist_traversal_decorator_init(), hal::PYBIND11_PLUGIN(), hal::BasePin< T >::set_direction(), hal::PinGroup< T >::set_direction(), hal::PinItem::setDirection(), hal::PinItem::setFields(), and hal::GatePinsTreeModel::setGate().

◆ id

◆ name

std::string name

Definition at line 58 of file netlist_serializer.cpp.

Referenced by hal::ActionPingroup::ActionPingroup(), hal::Gate::add_boolean_function(), hal::GateType::add_boolean_functions(), hal::CallbackHook< R(ArgTypes...)>::add_callback(), hal::JsonWriteObject::add_member(), hal::JsonWriteDocument::add_member(), hal::ChannelModel::addChannel(), hal::NetlistRelay::addChildModuleDialog(), hal::ContextTreeModel::addDirectory(), hal::GateLibrarySelectionTable::addGateLibrary(), hal::ActionPingroup::addPinsToNewGroup(), hal::ActionPingroup::addPinToNewGroup(), hal::NetlistRelay::addToModuleDialog(), hal::GateLibrary::contains_gate_type_by_name(), hal::GraphContextManager::contextWithNameExists(), hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), hal::Netlist::create_gate(), hal::GateLibrary::create_gate_type(), hal::Netlist::create_grouping(), hal::Netlist::create_module(), hal::Netlist::create_net(), hal::Module::create_pin(), hal::GateType::create_pin(), hal::GateType::create_pin_group(), hal::Module::create_pin_group(), hal::GraphContextManager::createNewContext(), hal::GraphContextManager::createNewDirectory(), hal::GuiApiClasses::View::createNewDirectory(), hal::BooleanFunction::evaluate(), hal::ActionPingroup::exec(), hal::gate_type_init(), hal::GateDetailsTabWidget::GateDetailsTabWidget(), hal::GateLibrarySelectionTable::GateLibrarySelectionTable(), hal::Gate::get_boolean_function(), hal::GateType::get_boolean_function(), hal::ProjectDirectory::get_default_filename(), hal::GateLibrary::get_gate_type_by_name(), hal::GateType::get_pin_by_name(), hal::Module::get_pin_by_name(), hal::GateType::get_pin_group_by_name(), hal::Module::get_pin_group_by_name(), hal::plugin_manager::get_plugin_features(), hal::ProjectDirectory::get_shadow_filename(), hal::GraphContextManager::getCleanContext(), hal::GuiApiClasses::View::getId(), hal::GateLibrarySelectionTable::getIndexByPath(), hal::GraphicsNode::GraphicsNode(), hal::GroupingTableModel::groupingByName(), hal::ModulePinsTree::handleContextMenuRequested(), hal::ContentFrame::handleNameChanged(), hal::dataflow::pre_processing::identify_register_stages(), hal::BoolWizardPage::initializePage(), hal::VerilogParser::instantiate(), hal::VHDLParser::instantiate(), hal::CallbackHook< R(ArgTypes...)>::is_callback_registered(), hal::GuiApiClasses::View::isolateInNew(), hal::module_init(), hal::GraphContextManager::nextViewName(), hal::GraphContextManager::openGateInView(), hal::GraphContextManager::openModuleInView(), hal::GraphContextManager::openNetEndpointsInView(), hal::BooleanFunctionParser::parse_with_liberty_grammar(), hal::BooleanFunctionParser::parse_with_standard_grammar(), hal::PluginRelay::pluginManagerCallback(), hal::ProgramOptions::ProgramOptions(), hal::ActionPingroup::readFromXml(), hal::gate_library_parser_manager::register_parser(), hal::netlist_parser_manager::register_parser(), hal::gate_library_writer_manager::register_writer(), hal::netlist_writer_manager::register_writer(), hal::SelectionRelay::registerSender(), hal::GateLibrary::remove_gate_type(), hal::ActionPingroup::removePinsFromGroup(), hal::GateLibrary::replace_gate_type(), hal::LogManager::set_file_name(), hal::GraphicsNode::set_name(), hal::Gate::set_name(), hal::Module::set_name(), hal::Net::set_name(), hal::BasePin< T >::set_name(), hal::PinGroup< T >::set_name(), hal::Grouping::set_name(), hal::GeneralInfoWizardPage::setData(), hal::PinItem::setFields(), hal::PythonCodeEditor::setFilename(), hal::PinItem::setName(), hal::GuiApiClasses::View::setName(), hal::SearchOptionsDialog::setOptions(), hal::BooleanFunction::substitute(), hal::plugin_manager::unload(), hal::plugin_manager::unload_all_plugins(), hal::EventHandler::unregister_callback(), hal::gate_library_parser_manager::unregister_parser(), hal::netlist_parser_manager::unregister_parser(), hal::gate_library_writer_manager::unregister_writer(), hal::netlist_writer_manager::unregister_writer(), hal::PythonConsoleQssAdapter::updateStyle(), hal::BooleanFunction::Var(), hal::BooleanFunctionParser::Token::Variable(), hal::utils::which(), and hal::dataflow::Result::write_txt().

◆ net

Net* net

Definition at line 57 of file netlist_serializer.cpp.

Referenced by hal::ModuleContextMenu::addNetSubmenu(), hal::Grouping::assign_net(), hal::Grouping::assign_net_by_id(), hal::NetlistModificationDecorator::connect_gates(), hal::Grouping::contains_net(), hal::Module::contains_net(), hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), hal::Module::create_pin(), hal::GuiApi::deselect(), hal::GuiApi::deselectNet(), hal::ActionDeleteObject::exec(), hal::ActionRenameObject::exec(), hal::GraphWidget::focusNet(), hal::graph_algorithm::NetlistGraph::from_netlist(), hal::Gate::get_fan_in_endpoint(), hal::Gate::get_fan_out_endpoint(), hal::Grouping::get_net_ids(), hal::Netlist::get_nets(), hal::Grouping::get_nets(), hal::netlist_utils::get_nets_at_pins(), hal::NetlistTraversalDecorator::get_next_combinational_gates(), hal::netlist_utils::get_next_gates(), hal::NetlistTraversalDecorator::get_next_matching_gates_until_depth(), hal::netlist_utils::get_next_sequential_gates(), hal::NetlistTraversalDecorator::get_next_sequential_gates(), hal::netlist_utils::get_path(), hal::Module::get_pin_by_net(), hal::netlist_utils::get_subgraph_function(), hal::SelectionDetailsWidget::groupingUnassignActionFactory(), hal::event_log::handle_grouping_event(), hal::event_log::handle_net_event(), hal::event_log::handle_netlist_event(), hal::ModuleTableModel::handleModulePortsChanged(), hal::ModuleTableModel::handleModuleRemoved(), hal::VerilogParser::instantiate(), hal::VHDLParser::instantiate(), hal::Gate::is_fan_in_net(), hal::Gate::is_fan_out_net(), hal::Module::is_input_net(), hal::Module::is_internal_net(), hal::Module::is_output_net(), hal::GraphContext::isShowingNetDestination(), hal::GraphContext::isShowingNetSource(), hal::module_init(), hal::net_init(), hal::netlist_traversal_decorator_init(), hal::netlist_utils_init(), hal::EventHandler::notify(), hal::GraphContextManager::openNetEndpointsInView(), hal::Netlist::operator==(), hal::Grouping::remove_net(), hal::Grouping::remove_net_by_id(), hal::GuiApi::select(), hal::GuiApi::selectNet(), hal::Module::set_parent_module(), hal::DataTableWidget::setNet(), hal::GroupingsOfItemModel::setNet(), hal::GroupingsOfItemWidget::setNet(), hal::NetDetailsTabWidget::setNet(), hal::EndpointTableModel::setNet(), hal::ModuleTableModel::setNet(), hal::NetInfoTable::setNet(), hal::BooleanFunctionDecorator::substitute_power_ground_nets(), hal::BooleanFunctionDecorator::substitute_power_ground_pins(), hal::TEST_F(), hal::Module::update_nets(), hal::ModuleModel::updateNetParent(), and hal::GraphContext::updateNets().

◆ ordered

bool ordered = false

Definition at line 69 of file netlist_serializer.cpp.

Referenced by hal::PinGroup< T >::set_ordered().

◆ pins

◆ start_index

◆ type

PinType type = PinType::none

Definition at line 59 of file netlist_serializer.cpp.

Referenced by hal::ActionCreateObject::ActionCreateObject(), hal::ModulePinsTreeModel::canDropMimeData(), hal::NetlistRelay::changeElementNameDialog(), hal::BooleanFunction::Node::clone(), hal::NetlistModificationDecorator::create_gnd_net(), hal::dataflow::Result::create_modules(), hal::Module::create_pin(), hal::GateType::create_pin(), hal::GateType::create_pin_group(), hal::Module::create_pin_group(), hal::NetlistModificationDecorator::create_vcc_net(), hal::GraphicsFactory::createGraphicsGate(), hal::GraphicsFactory::createGraphicsModule(), hal::ModulePinsTreeModel::dropMimeData(), hal::FFComponentEntry::FFComponentEntry(), hal::gate_type_init(), hal::BooleanFunction::Node::get_arity(), hal::BooleanFunction::Node::get_arity_of_type(), hal::dataflow::Result::get_gate_control_nets(), hal::GateLibrary::get_gate_types(), hal::dataflow::Result::get_group_control_nets(), hal::PythonThread::getInput(), hal::ModuleModel::getItem(), hal::ModuleModel::getItems(), hal::ModuleElementsTree::handleContextMenuRequested(), hal::PinModel::handleDeleteItem(), hal::NetlistRelay::handleThreadEvent(), hal::ModuleWidget::handleTreeViewContextMenuRequested(), hal::GateType::has_component_of_type(), hal::SMT::Solver::has_local_solver_for(), hal::RAMPortWizardPage::initializePage(), hal::BooleanFunction::Node::is(), hal::BooleanFunction::Node::is_commutative(), hal::LatchComponentEntry::LatchComponentEntry(), hal::ModulePinsTreeModel::mimeData(), hal::module_init(), hal::ModuleItem::ModuleItem(), hal::myMessageOutput(), hal::BooleanFunction::Node::operator<(), hal::BooleanFunction::Node::operator==(), hal::SMT::Model::parse(), hal::PYBIND11_PLUGIN(), hal::dataflow::Result::Result(), hal::Module::set_type(), hal::BasePin< T >::set_type(), hal::PinGroup< T >::set_type(), hal::PinItem::setFields(), hal::PinItem::setItemType(), hal::PinItem::setType(), hal::dataflow::Result::split_group(), hal::StateComponentEntry::StateComponentEntry(), hal::BooleanFunction::Node::to_string(), and hal::dataflow::Result::write_txt().