HAL  v4.5.0-124-g47ab54673
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::Netlist Class Reference

#include <hal_core/netlist/netlist.h>

Collaboration diagram for hal::Netlist:
Collaboration graph

Public Member Functions

 Netlist (const GateLibrary *gate_library)
 
 ~Netlist ()
 
bool operator== (const Netlist &other) const
 
bool operator!= (const Netlist &other) const
 
u32 get_id () const
 
void set_id (const u32 id)
 
std::filesystem::path get_input_filename () const
 
void set_input_filename (const std::filesystem::path &path)
 
const std::string & get_design_name () const
 
void set_design_name (const std::string &name)
 
const std::string & get_device_name () const
 
void set_device_name (const std::string &name)
 
const GateLibraryget_gate_library () const
 
Result< std::unique_ptr< Netlist > > copy () const
 
u32 get_unique_gate_id ()
 
Gatecreate_gate (const u32 gate_id, GateType *gate_type, const std::string &name="", i32 x=-1, i32 y=-1)
 
Gatecreate_gate (GateType *gate_type, const std::string &name="", i32 x=-1, i32 y=-1)
 
bool delete_gate (Gate *gate)
 
bool is_gate_in_netlist (const Gate *gate) const
 
Gateget_gate_by_id (const u32 gate_id) const
 
const std::vector< Gate * > & get_gates () const
 
std::vector< Gate * > get_gates (const std::function< bool(const Gate *)> &filter) const
 
bool mark_vcc_gate (Gate *gate)
 
bool mark_gnd_gate (Gate *gate)
 
bool unmark_vcc_gate (Gate *gate)
 
bool unmark_gnd_gate (Gate *gate)
 
bool is_vcc_gate (const Gate *gate) const
 
bool is_gnd_gate (const Gate *gate) const
 
const std::vector< Gate * > & get_vcc_gates () const
 
const std::vector< Gate * > & get_gnd_gates () const
 
u32 get_unique_net_id ()
 
Netcreate_net (const u32 net_id, const std::string &name)
 
Netcreate_net (const std::string &name)
 
bool delete_net (Net *net)
 
bool is_net_in_netlist (const Net *net) const
 
Netget_net_by_id (u32 net_id) const
 
const std::vector< Net * > & get_nets () const
 
std::vector< Net * > get_nets (const std::function< bool(const Net *)> &filter) const
 
bool mark_global_input_net (Net *net)
 
bool mark_global_output_net (Net *net)
 
bool unmark_global_input_net (Net *net)
 
bool unmark_global_output_net (Net *net)
 
bool is_global_input_net (const Net *net) const
 
bool is_global_output_net (const Net *net) const
 
const std::vector< Net * > & get_global_input_nets () const
 
const std::vector< Net * > & get_global_output_nets () const
 
std::vector< Net * > get_gnd_nets () const
 
std::vector< Net * > get_vcc_nets () const
 
void enable_automatic_net_checks (bool enable_checks=true)
 
u32 get_unique_module_id ()
 
Modulecreate_module (const u32 module_id, const std::string &name, Module *parent, const std::vector< Gate * > &gates={})
 
Modulecreate_module (const std::string &name, Module *parent, const std::vector< Gate * > &gates={})
 
bool delete_module (Module *module)
 
bool is_module_in_netlist (const Module *module) const
 
Moduleget_module_by_id (u32 module_id) const
 
const std::vector< Module * > & get_modules () const
 
std::vector< Module * > get_modules (const std::function< bool(const Module *)> &filter) const
 
Moduleget_top_module () const
 
u32 get_unique_grouping_id ()
 
Groupingcreate_grouping (const u32 grouping_id, const std::string &name="")
 
Groupingcreate_grouping (const std::string &name="")
 
bool delete_grouping (Grouping *grouping)
 
bool is_grouping_in_netlist (const Grouping *grouping) const
 
Groupingget_grouping_by_id (u32 grouping_id) const
 
const std::vector< Grouping * > & get_groupings () const
 
std::vector< Grouping * > get_groupings (const std::function< bool(const Grouping *)> &filter) const
 
u32 get_next_gate_id () const
 
void set_next_gate_id (const u32 id)
 
std::set< u32get_used_gate_ids () const
 
void set_used_gate_ids (const std::set< u32 > ids)
 
std::set< u32get_free_gate_ids () const
 
void set_free_gate_ids (const std::set< u32 > ids)
 
u32 get_next_net_id () const
 
void set_next_net_id (const u32 id)
 
std::set< u32get_used_net_ids () const
 
void set_used_net_ids (const std::set< u32 > ids)
 
std::set< u32get_free_net_ids () const
 
void set_free_net_ids (const std::set< u32 > ids)
 
u32 get_next_module_id () const
 
void set_next_module_id (const u32 id)
 
std::set< u32get_used_module_ids () const
 
void set_used_module_ids (const std::set< u32 > ids)
 
std::set< u32get_free_module_ids () const
 
void set_free_module_ids (const std::set< u32 > ids)
 
u32 get_next_grouping_id () const
 
void set_next_grouping_id (const u32 id)
 
std::set< u32get_used_grouping_ids () const
 
void set_used_grouping_ids (const std::set< u32 > ids)
 
std::set< u32get_free_grouping_ids () const
 
void set_free_grouping_ids (const std::set< u32 > ids)
 
EventHandlerget_event_handler () const
 
void clear_caches ()
 
bool load_gate_locations_from_data (const std::string &data_category="", const std::pair< std::string, std::string > &data_identifiers=std::pair< std::string, std::string >())
 

Friends

class NetlistInternalManager
 

Detailed Description

Netlist class containing information about the netlist including its gates, modules, nets, and groupings as well as the underlying gate library.

Definition at line 55 of file netlist.h.

Constructor & Destructor Documentation

◆ Netlist()

hal::Netlist::Netlist ( const GateLibrary gate_library)
explicit

Construct a new netlist for the specified gate library.
Warning: Use the netlist_factory to create instances!

Parameters
[in]gate_library- The gate library.

Definition at line 15 of file netlist.cpp.

References create_module(), and NetlistInternalManager.

◆ ~Netlist()

hal::Netlist::~Netlist ( )

Definition at line 28 of file netlist.cpp.

Member Function Documentation

◆ clear_caches()

void hal::Netlist::clear_caches ( )

Clear all internal caches of the netlist.
In a typical application, calling this function is not required.

Definition at line 859 of file netlist.cpp.

Referenced by hal::netlist_init().

◆ copy()

Result< std::unique_ptr< Netlist > > hal::Netlist::copy ( ) const

Create a deep copy of the netlist.

Returns
The copy of the netlist on success, an error otherwise.

Definition at line 144 of file netlist.cpp.

References ERR.

Referenced by hal::netlist_utils::copy_netlist(), and hal::netlist_init().

◆ create_gate() [1/2]

Gate * hal::Netlist::create_gate ( const u32  gate_id,
GateType gate_type,
const std::string &  name = "",
i32  x = -1,
i32  y = -1 
)

Create a new gate and add it to the netlist.

Parameters
[in]gate_id- The unique ID of the gate.
[in]gate_type- The gate type.
[in]name- The name of the gate.
[in]x- The x-coordinate of the gate.
[in]y- The y-coordinate of the gate.
Returns
The new gate on success, nullptr otherwise.

Definition at line 175 of file netlist.cpp.

References name, x, and y.

Referenced by create_gate(), hal::NetlistModificationDecorator::create_gnd_net(), hal::NetlistModificationDecorator::create_vcc_net(), hal::VHDLParser::instantiate(), hal::netlist_init(), hal::NetlistModificationDecorator::replace_gate(), hal::resynthesis::replace_subgraph_with_netlist(), hal::xilinx_toolbox::split_luts(), hal::xilinx_toolbox::split_shift_registers(), and hal::netlist_preprocessing::unify_ff_outputs().

◆ create_gate() [2/2]

Gate * hal::Netlist::create_gate ( GateType gate_type,
const std::string &  name = "",
i32  x = -1,
i32  y = -1 
)

Create a new gate and add it to the netlist.
The ID of the gate is set automatically.

Parameters
[in]gate_type- The gate type.
[in]name- The name of the gate.
[in]x- The x-coordinate of the gate.
[in]y- The y-coordinate of the gate.
Returns
The new gate on success, nullptr otherwise.

Definition at line 180 of file netlist.cpp.

References create_gate(), get_unique_gate_id(), name, x, and y.

◆ create_grouping() [1/2]

Grouping * hal::Netlist::create_grouping ( const std::string &  name = "")

Create a new grouping and add it to the netlist.
The ID of the grouping is set automatically.

Parameters
[in]name- The name of the grouping.
Returns
The new grouping on success, nullptr otherwise.

Definition at line 678 of file netlist.cpp.

References get_unique_grouping_id(), and name.

◆ create_grouping() [2/2]

Grouping * hal::Netlist::create_grouping ( const u32  grouping_id,
const std::string &  name = "" 
)

Create a new grouping and add it to the netlist.

Parameters
[in]grouping_id- The unique ID of the grouping.
[in]name- The name of the grouping.
Returns
The new grouping on success, nullptr otherwise.

Definition at line 673 of file netlist.cpp.

References name.

Referenced by hal::GroupingSerializer::deserialize(), hal::GroupingTableEntry::GroupingTableEntry(), hal::netlist_init(), and hal::WaveWidget::setVisualizeNetState().

◆ create_module() [1/2]

Module * hal::Netlist::create_module ( const std::string &  name,
Module parent,
const std::vector< Gate * > &  gates = {} 
)

Create a new module and add it to the netlist.
The ID of the module is set automatically.

Parameters
[in]name- The name of the module.
[in]parent- The parent module.
[in]gates- Gates to assign to the new module.
Returns
The new module on success, nullptr otherwise.

Definition at line 600 of file netlist.cpp.

References create_module(), get_unique_module_id(), and name.

◆ create_module() [2/2]

Module * hal::Netlist::create_module ( const u32  module_id,
const std::string &  name,
Module parent,
const std::vector< Gate * > &  gates = {} 
)

Create a new module and add it to the netlist.

Parameters
[in]module_id- The unique ID of the module.
[in]name- The name of the module.
[in]parent- The parent module.
[in]gates- Gates to assign to the new module.
Returns
The new module on success, nullptr otherwise.

Definition at line 589 of file netlist.cpp.

References hal::Module::assign_gates(), and name.

Referenced by create_module(), hal::hawkeye::CipherCandidate::create_modules(), hal::module_identification::Result::create_modules_in_netlist(), hal::netlist_preprocessing::create_multi_bit_gate_modules(), hal::ActionCreateObject::exec(), Netlist(), and hal::netlist_init().

◆ create_net() [1/2]

Net * hal::Netlist::create_net ( const std::string &  name)

Create a new net and add it to the netlist.
The ID of the net is set automatically.

Parameters
[in]name- The name of the net.
Returns
The new net on success, nullptr otherwise.

Definition at line 340 of file netlist.cpp.

References get_unique_net_id(), and name.

◆ create_net() [2/2]

Net * hal::Netlist::create_net ( const u32  net_id,
const std::string &  name 
)

◆ delete_gate()

◆ delete_grouping()

bool hal::Netlist::delete_grouping ( Grouping grouping)

Remove a grouping from the netlist.

Parameters
[in]grouping- The grouping.
Returns
true on success, false otherwise.

Definition at line 683 of file netlist.cpp.

Referenced by hal::netlist_init(), hal::GroupingTableModel::removeRows(), and hal::WaveWidget::setVisualizeNetState().

◆ delete_module()

bool hal::Netlist::delete_module ( Module module)

Remove a module from the netlist. Submodules, gates and nets under this module will be moved to the parent of this module.

Parameters
[in]module- The module.
Returns
true on success, false otherwise.

Definition at line 605 of file netlist.cpp.

References hal::ShortestPath::module().

Referenced by hal::NetlistModificationDecorator::delete_modules(), hal::ActionDeleteObject::exec(), and hal::netlist_init().

◆ delete_net()

◆ enable_automatic_net_checks()

void hal::Netlist::enable_automatic_net_checks ( bool  enable_checks = true)

Enables or disables automatic checks on nets that determine whether a net is an input or output of a module.

Warning
{WARNING: if disabled, the user is responsible to assign correct input and output nets and create respective module pins. Wrong usage may result in unknown behavior or crashes.}
Parameters
[in]enable_checks- Set true to enable automatic checks, false otherwise.

Definition at line 565 of file netlist.cpp.

Referenced by hal::netlist_init().

◆ get_design_name()

const std::string & hal::Netlist::get_design_name ( ) const

◆ get_device_name()

const std::string & hal::Netlist::get_device_name ( ) const

Get the name of the target device.

Returns
The name of the target device.

Definition at line 120 of file netlist.cpp.

Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), hal::module_identification::execute(), hal::event_log::handle_netlist_event(), hal::netlist_init(), and operator==().

◆ get_event_handler()

EventHandler * hal::Netlist::get_event_handler ( ) const

Get event handler. Should only be used to register callbacks

Returns
Pointer to netlist event handler

Definition at line 139 of file netlist.cpp.

Referenced by hal::NetlistRelay::registerNetlistCallbacks(), and hal::NetlistRelay::unregisterNetlistCallbacks().

◆ get_free_gate_ids()

std::set< u32 > hal::Netlist::get_free_gate_ids ( ) const

Get a set of all gate IDs that have previously been used but been freed ever since.

Returns
All freed gate IDs.

Definition at line 753 of file netlist.cpp.

Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and hal::netlist_init().

◆ get_free_grouping_ids()

std::set< u32 > hal::Netlist::get_free_grouping_ids ( ) const

Get a set of all grouping IDs that have previously been used but been freed ever since.

Returns
All freed grouping ids.

Definition at line 843 of file netlist.cpp.

Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and hal::netlist_init().

◆ get_free_module_ids()

std::set< u32 > hal::Netlist::get_free_module_ids ( ) const

Get a set of all module IDs that have previously been used but been freed ever since.

Returns
All freed module IDs.

Definition at line 813 of file netlist.cpp.

Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and hal::netlist_init().

◆ get_free_net_ids()

std::set< u32 > hal::Netlist::get_free_net_ids ( ) const

Get a set of all net IDs that have previously been used but been freed ever since.

Returns
All freed net IDs.

Definition at line 783 of file netlist.cpp.

Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and hal::netlist_init().

◆ get_gate_by_id()

Gate * hal::Netlist::get_gate_by_id ( const u32  gate_id) const

Get the gate specified by the given ID.

Parameters
[in]gate_id- The unique ID of the gate.
Returns
The gate on success, nullptr otherwise.

Definition at line 195 of file netlist.cpp.

References log_debug.

Referenced by hal::PhysicalGraphLayouter::add(), hal::NodeBoxes::addBox(), hal::ModuleModel::addGate(), hal::ModuleContextMenu::addGateSubmenu(), hal::NetlistRelay::addToModuleDialog(), hal::dataflow::Grouping::are_groups_allowed_to_merge(), hal::Grouping::assign_gate_by_id(), hal::NetlistRelay::changeElementNameDialog(), hal::GroupingTableModel::colorForItem(), hal::CommonSuccessorPredecessor::CommonSuccessorPredecessor(), hal::GuiApi::deselectGate(), hal::GroupingSerializer::deserialize(), hal::ActionAddBooleanFunction::exec(), hal::ActionAddItemsToObject::exec(), hal::ActionDeleteObject::exec(), hal::ActionRenameObject::exec(), hal::ActionSetObjectData::exec(), hal::GuiExtensionLogicEvaluator::execute_function(), hal::GuiExtensionModuleIdentification::execute_function(), hal::CoordinateFromData::fromNode(), hal::GateSelectModel::GateSelectModel(), hal::NetlistTraversalDecorator::get_shortest_path(), hal::NetlistTraversalDecorator::get_shortest_path_distance(), hal::GuiApiClasses::View::getGates(), hal::SelectionDetailsIconProvider::getIcon(), hal::GatePinsTreeModel::getNumberOfDisplayedPins(), hal::GuiApi::getSelectedGates(), hal::SelectionDetailsWidget::groupingUnassignActionFactory(), hal::event_log::handle_grouping_event(), hal::event_log::handle_module_event(), hal::event_log::handle_netlist_event(), hal::GatePinTree::handleContextMenuRequested(), hal::NetEndpointTable::handleContextMenuRequested(), hal::PythonGateSelectionReceiver::handleGatesPicked(), hal::GateSelectPicker::handleSelectionChanged(), hal::GraphGraphicsView::handleShortestPathToGrouping(), hal::ModuleModel::moduleAssignGate(), hal::ModuleModel::moduleAssignNets(), hal::ModuleItem::ModuleItem(), hal::SelectionRelay::navigateDown(), hal::SelectionRelay::navigateUp(), hal::netlist_init(), hal::NetlistSimulatorController::NetlistSimulatorController(), hal::NodeBox::NodeBox(), hal::GraphContext::nodeForGate(), hal::PyCodeProvider::pyCodeGateAsyncSetResetBehavior(), hal::GraphContext::readFromFile(), hal::ClockTreeExtractorInteraction::registerNode(), hal::Grouping::remove_gate_by_id(), hal::GroupingManagerWidget::removeElementsFromGrouping(), hal::dataflow::Result::Result(), hal::GateSelectionDialog::selectedGates(), hal::PageSelectGates::selectedGates(), hal::GuiApi::selectGate(), hal::ModuleSelectExclude::selectionToString(), hal::GatePinTree::setGate(), hal::GraphNavigationWidget::setup(), hal::ModuleShader::update(), hal::ModuleModel::updateGateName(), and hal::GraphContext::updateNets().

◆ get_gate_library()

◆ get_gates() [1/2]

const std::vector< Gate * > & hal::Netlist::get_gates ( ) const

Get all gates contained within the netlist.

Returns
A vector of gates.

Definition at line 206 of file netlist.cpp.

Referenced by hal::z3_utils::compare_netlists(), hal::z3_utils::compare_nets(), hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), hal::netlist_preprocessing::create_multi_bit_gate_modules(), hal::netlist_preprocessing::create_nets_at_unconnected_pins(), hal::resynthesis::decompose_gates_of_type(), hal::hawkeye::CipherCandidate::detect(), hal::cte::ClockTree::from_netlist(), hal::GateSelectModel::GateSelectModel(), hal::boolean_influence::get_ff_dependency_matrix(), hal::netlist_utils::get_ff_dependency_matrix(), hal::verilator::converter::get_gate_gate_types_from_netlist(), hal::NetlistTraversalDecorator::get_next_sequential_gates_map(), hal::CliExtensionsPerfTest::handle_cli_call(), hal::netlist_init(), operator==(), hal::netlist_preprocessing::parse_def_file(), hal::netlist_preprocessing::propagate_constants(), hal::netlist_preprocessing::reconstruct_indexed_ff_identifiers(), hal::netlist_utils::remove_buffers(), hal::netlist_preprocessing::remove_buffers(), hal::netlist_preprocessing::remove_consecutive_inverters(), hal::netlist_preprocessing::remove_unconnected_gates(), hal::netlist_utils::remove_unused_lut_endpoints(), hal::netlist_preprocessing::remove_unused_lut_inputs(), hal::verilator::remove_unwanted_parameters_from_netlist(), hal::resynthesis::replace_subgraph_with_netlist(), hal::resynthesis::resynthesize_gates_of_type(), hal::resynthesis::resynthesize_subgraph_of_type(), hal::netlist_preprocessing::simplify_lut_inits(), hal::xilinx_toolbox::split_luts(), hal::xilinx_toolbox::split_shift_registers(), hal::netlist_preprocessing::unify_ff_outputs(), and hal::dataflow::Configuration::with_known_structures().

◆ get_gates() [2/2]

std::vector< Gate * > hal::Netlist::get_gates ( const std::function< bool(const Gate *)> &  filter) const

Get all gates contained within the netlist.
The filter is evaluated on every gate such that the result only contains gates matching the specified condition.

Parameters
[in]filter- Filter function to be evaluated on each gate.
Returns
A vector of gates.

Definition at line 211 of file netlist.cpp.

◆ get_global_input_nets()

const std::vector< Net * > & hal::Netlist::get_global_input_nets ( ) const

Get all global input nets.

Returns
A vector of nets.

Definition at line 521 of file netlist.cpp.

Referenced by hal::netlist_init(), and hal::ClockTreeExtractorInteraction::registerNode().

◆ get_global_output_nets()

const std::vector< Net * > & hal::Netlist::get_global_output_nets ( ) const

Get all global output nets.

Returns
A vector of nets.

Definition at line 526 of file netlist.cpp.

Referenced by hal::netlist_init().

◆ get_gnd_gates()

◆ get_gnd_nets()

std::vector< Net * > hal::Netlist::get_gnd_nets ( ) const

Get all GND nets in the netlist.

Returns
A vector of nets.

Definition at line 531 of file netlist.cpp.

Referenced by hal::NetlistModificationDecorator::create_gnd_net(), and hal::netlist_init().

◆ get_grouping_by_id()

Grouping * hal::Netlist::get_grouping_by_id ( u32  grouping_id) const

Get the grouping specified by the given ID.

Parameters
[in]grouping_id- The unique ID of the grouping.
Returns
The grouping on success, nullptr otherwise.

Definition at line 693 of file netlist.cpp.

References log_debug.

Referenced by hal::ActionAddItemsToObject::exec(), hal::ActionRemoveItemsFromObject::exec(), hal::GroupingTableEntry::GroupingTableEntry(), hal::netlist_init(), and hal::SelectionTreeView::populate().

◆ get_groupings() [1/2]

const std::vector< Grouping * > & hal::Netlist::get_groupings ( ) const

Get all groupings contained within the netlist.

Returns
A vector of groupings.

Definition at line 704 of file netlist.cpp.

Referenced by hal::GroupingTableModel::GroupingTableModel(), hal::netlist_init(), and hal::GroupingSerializer::serialize().

◆ get_groupings() [2/2]

std::vector< Grouping * > hal::Netlist::get_groupings ( const std::function< bool(const Grouping *)> &  filter) const

Get all groupings contained within the netlist.
The filter is evaluated on every grouping such that the result only contains groupings matching the specified condition.

Parameters
[in]filter- Filter function to be evaluated on each grouping.
Returns
A vector of groupings.

Definition at line 709 of file netlist.cpp.

◆ get_id()

◆ get_input_filename()

std::filesystem::path hal::Netlist::get_input_filename ( ) const

Get the path to the input file.

Returns
The path to the input file.

Definition at line 92 of file netlist.cpp.

Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), hal::event_log::handle_netlist_event(), hal::netlist_init(), and operator==().

◆ get_module_by_id()

Module * hal::Netlist::get_module_by_id ( u32  module_id) const

Get the module specified by the given ID.

Parameters
[in]module_id- The unique ID of the module.
Returns
The module on success, nullptr otherwise.

Definition at line 615 of file netlist.cpp.

References log_debug.

Referenced by hal::WaitToBeSeatedList::add(), hal::NodeBoxes::addBox(), hal::NetlistRelay::addChildModuleDialog(), hal::ModuleModel::addGate(), hal::ModuleModel::addModule(), hal::ModuleContextMenu::addModuleSubmenu(), hal::ModuleModel::addNet(), hal::NetlistRelay::addToModuleDialog(), hal::ModuleSelectModel::appendEntries(), hal::ModuleItem::appendExistingChildIfAny(), hal::Grouping::assign_module_by_id(), hal::NetlistRelay::changeElementNameDialog(), hal::NetlistRelay::changeModuleColorDialog(), hal::NetlistRelay::changeModuleTypeDialog(), hal::GroupingTableModel::colorForItem(), hal::GuiApi::deselectModule(), hal::GroupingSerializer::deserialize(), hal::ActionAddItemsToObject::exec(), hal::ActionCreateObject::exec(), hal::ActionDeleteObject::exec(), hal::ActionFoldModule::exec(), hal::ActionPingroup::exec(), hal::ActionRenameObject::exec(), hal::ActionSetObjectColor::exec(), hal::ActionSetObjectData::exec(), hal::ActionSetObjectType::exec(), hal::ActionUnfoldModule::exec(), hal::GuiExtensionLogicEvaluator::execute_function(), hal::GuiExtensionModuleIdentification::execute_function(), hal::CoordinateFromData::fromNode(), hal::GraphContext::getModuleChildrenRecursively(), hal::GuiApiClasses::View::getModules(), hal::ModulePinsTreeModel::getNetFromItem(), hal::GuiApi::getSelectedModules(), hal::SelectionDetailsWidget::groupingUnassignActionFactory(), hal::event_log::handle_grouping_event(), hal::event_log::handle_module_event(), hal::ModulePinsTree::handleContextMenuRequested(), hal::PythonModuleSelectionReceiver::handleModulesPicked(), hal::AddToModuleReceiver::handleModulesPicked(), hal::ModuleSelectPicker::handleSelectionChanged(), hal::GraphGraphicsView::handleShortestPathToGrouping(), hal::GraphContext::isModuleUnfolded(), hal::GuiApiClasses::View::isolateModuleToModulePathInNewView(), hal::ModuleItem::ModuleItem(), hal::ModulePinsTreeModel::ModulePinsTreeModel(), hal::SelectionRelay::navigateDown(), hal::SelectionRelay::navigateUp(), hal::netlist_init(), hal::NodeBox::NodeBox(), hal::GraphContextManager::openModuleInView(), hal::ModuleModel::populateTree(), hal::bitorder_propagation::propagate_bitorder(), hal::GraphContext::readFromFile(), hal::GraphContext::refreshModule(), hal::Grouping::remove_module_by_id(), hal::GroupingManagerWidget::removeElementsFromGrouping(), hal::ModuleSelectExclude::selectionToString(), hal::GuiApi::selectModule(), hal::ModuleElementsTree::setModule(), hal::ModulePinsTree::setModule(), hal::ModuleItem::setModuleType(), hal::GraphNavigationWidget::setup(), hal::GraphContext::unfoldModule(), hal::ModuleModel::updateModuleName(), hal::ModuleModel::updateModuleType(), and hal::GraphContext::updateNets().

◆ get_modules() [1/2]

const std::vector< Module * > & hal::Netlist::get_modules ( ) const

◆ get_modules() [2/2]

std::vector< Module * > hal::Netlist::get_modules ( const std::function< bool(const Module *)> &  filter) const

Get all modules contained within the netlist, including the top module.
The filter is evaluated on every module such that the result only contains modules matching the specified condition.

Parameters
[in]filter- Filter function to be evaluated on each module.
Returns
A vector of modules.

Definition at line 631 of file netlist.cpp.

References hal::ShortestPath::module().

◆ get_net_by_id()

Net * hal::Netlist::get_net_by_id ( u32  net_id) const

Get the net specified by the given ID.

Parameters
[in]net_id- The unique ID of the net.
Returns
The net on success, nullptr otherwise.

Definition at line 355 of file netlist.cpp.

References log_debug.

Referenced by hal::ModuleModel::addNet(), hal::ModuleContextMenu::addNetSubmenu(), hal::Grouping::assign_net_by_id(), hal::NetlistRelay::changeElementNameDialog(), hal::GroupingTableModel::colorForItem(), hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), hal::GuiApi::deselectNet(), hal::GroupingSerializer::deserialize(), hal::ActionDeleteObject::exec(), hal::ActionRenameObject::exec(), hal::ActionSetObjectData::exec(), hal::BooleanFunctionNetDecorator::get_net_from(), hal::GuiApi::getSelectedNets(), hal::SelectionDetailsWidget::groupingUnassignActionFactory(), hal::event_log::handle_grouping_event(), hal::event_log::handle_netlist_event(), hal::GatePinTree::handleContextMenuRequested(), hal::ModuleTableModel::handleModulePortsChanged(), hal::ModuleTableModel::handleModuleRemoved(), hal::GraphContext::isShowingNetDestination(), hal::GraphContext::isShowingNetSource(), hal::ModuleItem::ModuleItem(), hal::GatePinTree::mouseDoubleClickEvent(), hal::SelectionRelay::navigateDown(), hal::SelectionRelay::navigateUp(), hal::netlist_init(), hal::NetlistSimulatorController::NetlistSimulatorController(), hal::GraphContextManager::openNetEndpointsInView(), hal::GraphContext::readFromFile(), hal::WaveWidget::refreshNetNames(), hal::SolveFsmInteraction::registerEdge(), hal::Grouping::remove_net_by_id(), hal::dataflow::Result::Result(), hal::DrawNetThread::run(), hal::GuiApi::selectNet(), hal::NetEndpointTable::setNet(), hal::NetModuleTable::setNet(), hal::GraphNavigationWidget::setup(), and hal::ModuleModel::updateNetName().

◆ get_nets() [1/2]

◆ get_nets() [2/2]

std::vector< Net * > hal::Netlist::get_nets ( const std::function< bool(const Net *)> &  filter) const

Get all nets contained within the netlist.
The filter is evaluated on every net such that the result only contains nets matching the specified condition.

Parameters
[in]filter- Filter function to be evaluated on each net.
Returns
A vector of nets.

Definition at line 371 of file netlist.cpp.

References net.

◆ get_next_gate_id()

u32 hal::Netlist::get_next_gate_id ( ) const

Get the gate ID following the highest currently used ID.

Returns
The next gate ID.

Definition at line 733 of file netlist.cpp.

Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and hal::netlist_init().

◆ get_next_grouping_id()

u32 hal::Netlist::get_next_grouping_id ( ) const

Get the grouping ID following the highest currently used ID.

Returns
The next grouping ID.

Definition at line 823 of file netlist.cpp.

Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and hal::netlist_init().

◆ get_next_module_id()

u32 hal::Netlist::get_next_module_id ( ) const

Get the module ID following the highest currently used ID.

Returns
The next module ID.

Definition at line 793 of file netlist.cpp.

Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and hal::netlist_init().

◆ get_next_net_id()

u32 hal::Netlist::get_next_net_id ( ) const

Get the net ID following the highest currently used ID.

Returns
The next net ID.

Definition at line 763 of file netlist.cpp.

Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and hal::netlist_init().

◆ get_top_module()

◆ get_unique_gate_id()

u32 hal::Netlist::get_unique_gate_id ( )

Get a spare gate ID.
The value of 0 is reserved and represents an invalid ID.

Returns
The gate ID.

Definition at line 162 of file netlist.cpp.

Referenced by create_gate(), hal::VHDLParser::instantiate(), and hal::netlist_init().

◆ get_unique_grouping_id()

u32 hal::Netlist::get_unique_grouping_id ( )

Gets a spare grouping ID.
The value of 0 is reserved and represents an invalid ID.

Returns
The grouping ID.

Definition at line 660 of file netlist.cpp.

Referenced by create_grouping(), and hal::netlist_init().

◆ get_unique_module_id()

u32 hal::Netlist::get_unique_module_id ( )

Get a spare module ID.
The value of 0 is reserved and represents an invalid ID.

Returns
The module ID.

Definition at line 576 of file netlist.cpp.

Referenced by create_module(), hal::ActionCreateObject::exec(), and hal::netlist_init().

◆ get_unique_net_id()

u32 hal::Netlist::get_unique_net_id ( )

Get a spare net ID.
The value of 0 is reserved and represents an invalid ID.

Returns
The net ID.

Definition at line 322 of file netlist.cpp.

Referenced by create_net(), and hal::netlist_init().

◆ get_used_gate_ids()

std::set< u32 > hal::Netlist::get_used_gate_ids ( ) const

Get a set of all currently used gate IDs.

Returns
All used gate IDs.

Definition at line 743 of file netlist.cpp.

Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), hal::netlist_init(), and hal::PluginParameterNodeDialog::PluginParameterNodeDialog().

◆ get_used_grouping_ids()

std::set< u32 > hal::Netlist::get_used_grouping_ids ( ) const

Get a set of all currently used grouping IDs.

Returns
All used grouping IDs.

Definition at line 833 of file netlist.cpp.

Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and hal::netlist_init().

◆ get_used_module_ids()

std::set< u32 > hal::Netlist::get_used_module_ids ( ) const

Get a set of all currently used module IDs.

Returns
All used module IDs.

Definition at line 803 of file netlist.cpp.

Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), hal::netlist_init(), and hal::PluginParameterNodeDialog::PluginParameterNodeDialog().

◆ get_used_net_ids()

std::set< u32 > hal::Netlist::get_used_net_ids ( ) const

Get a set of all currently used net IDs.

Returns
All used net IDs.

Definition at line 773 of file netlist.cpp.

Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and hal::netlist_init().

◆ get_vcc_gates()

const std::vector< Gate * > & hal::Netlist::get_vcc_gates ( ) const

◆ get_vcc_nets()

std::vector< Net * > hal::Netlist::get_vcc_nets ( ) const

Get all VCC nets in the netlist.

Returns
A vector of nets.

Definition at line 548 of file netlist.cpp.

Referenced by hal::NetlistModificationDecorator::create_vcc_net(), and hal::netlist_init().

◆ is_gate_in_netlist()

◆ is_global_input_net()

bool hal::Netlist::is_global_input_net ( const Net net) const

Checks whether a net is a global input net.

Parameters
[in]net- The net to check.
Returns
true if the net is a global input net, false otherwise.

Definition at line 511 of file netlist.cpp.

Referenced by hal::Net::is_global_input_net(), mark_global_input_net(), and hal::netlist_init().

◆ is_global_output_net()

bool hal::Netlist::is_global_output_net ( const Net net) const

Checks whether a net is a global output net.

Parameters
[in]net- The net to check.
Returns
true if the net is a global output net, false otherwise.

Definition at line 516 of file netlist.cpp.

Referenced by hal::Net::is_global_output_net(), mark_global_output_net(), and hal::netlist_init().

◆ is_gnd_gate()

bool hal::Netlist::is_gnd_gate ( const Gate gate) const

Check whether a gate is a global GND gate.

Parameters
[in]gate- The gate to check.
Returns
true if the gate is a global GND gate, false otherwise.

Definition at line 301 of file netlist.cpp.

Referenced by mark_gnd_gate(), and hal::netlist_init().

◆ is_grouping_in_netlist()

bool hal::Netlist::is_grouping_in_netlist ( const Grouping grouping) const

Check whether the grouping is registered in the netlist.

Parameters
[in]grouping- The grouping to check.
Returns
true if the grouping is in the netlist, false otherwise.

Definition at line 688 of file netlist.cpp.

Referenced by hal::netlist_init().

◆ is_module_in_netlist()

bool hal::Netlist::is_module_in_netlist ( const Module module) const

Check whether the module is registered in the netlist.

Parameters
[in]module- The module to check.
Returns
true if the module is in the netlist, false otherwise.

Definition at line 649 of file netlist.cpp.

References hal::ShortestPath::module().

Referenced by hal::GuiApi::deselectModule(), hal::netlist_init(), hal::GuiApi::selectModule(), and hal::ModuleInfoTable::setModule().

◆ is_net_in_netlist()

◆ is_vcc_gate()

bool hal::Netlist::is_vcc_gate ( const Gate gate) const

Check whether a gate is a global VCC gate.

Parameters
[in]gate- The gate to check.
Returns
true if the gate is a global VCC gate, false otherwise.

Definition at line 296 of file netlist.cpp.

Referenced by mark_vcc_gate(), and hal::netlist_init().

◆ load_gate_locations_from_data()

bool hal::Netlist::load_gate_locations_from_data ( const std::string &  data_category = "",
const std::pair< std::string, std::string > &  data_identifiers = std::pair<std::string, std::string>() 
)

Load the locations of the gates in the netlist from their associated data using the specified category and identifier. If no parameter is given, the data is querried using the default category and identifier stored with the gate library.

Parameters
[in]data_category- The data category.
[in]data_identifiers- The data identifiers for the x- and y-coordinates.
Returns
true on success, false otherwise.

Definition at line 864 of file netlist.cpp.

References log_error, and log_warning.

Referenced by hal::VerilogParser::instantiate(), hal::VHDLParser::instantiate(), and hal::netlist_init().

◆ mark_global_input_net()

bool hal::Netlist::mark_global_input_net ( Net net)

◆ mark_global_output_net()

bool hal::Netlist::mark_global_output_net ( Net net)

◆ mark_gnd_gate()

bool hal::Netlist::mark_gnd_gate ( Gate gate)

Mark a gate as a global GND gate.

Parameters
[in]gate- The gate.
Returns
true on success, false otherwise.

Definition at line 246 of file netlist.cpp.

References hal::Gate::get_id(), hal::Gate::get_name(), is_gate_in_netlist(), is_gnd_gate(), log_debug, and hal::NetlistEvent::marked_global_gnd.

Referenced by hal::VHDLParser::instantiate(), and hal::netlist_init().

◆ mark_vcc_gate()

bool hal::Netlist::mark_vcc_gate ( Gate gate)

Mark a gate as a global VCC gate.

Parameters
[in]gate- The gate.
Returns
true on success, false otherwise.

Definition at line 230 of file netlist.cpp.

References hal::Gate::get_id(), hal::Gate::get_name(), is_gate_in_netlist(), is_vcc_gate(), log_debug, and hal::NetlistEvent::marked_global_vcc.

Referenced by hal::VHDLParser::instantiate(), and hal::netlist_init().

◆ operator!=()

bool hal::Netlist::operator!= ( const Netlist other) const

Check whether two netlists are unequal. Does not check netlist IDs.

Parameters
[in]other- The netlist to compare against.
Returns
true if both netlists are unequal, false otherwise.

Definition at line 72 of file netlist.cpp.

References operator==().

◆ operator==()

bool hal::Netlist::operator== ( const Netlist other) const

Check whether two netlists are equal. Does not check netlist IDs.

Parameters
[in]other- The netlist to compare against.
Returns
true if both netlists are equal, false otherwise.

Definition at line 33 of file netlist.cpp.

References get_design_name(), get_device_name(), get_gate_library(), get_gates(), get_id(), get_input_filename(), get_modules(), get_nets(), get_top_module(), log_info, and net.

Referenced by operator!=().

◆ set_design_name()

void hal::Netlist::set_design_name ( const std::string &  name)

Set the name of the design.

Parameters
[in]name- The new name of the design.

Definition at line 111 of file netlist.cpp.

References hal::NetlistEvent::design_name_changed.

Referenced by hal::netlist_init().

◆ set_device_name()

void hal::Netlist::set_device_name ( const std::string &  name)

Set the name of the target device.

Parameters
[in]name- The name of the target device.

Definition at line 125 of file netlist.cpp.

References hal::NetlistEvent::device_name_changed.

Referenced by hal::netlist_init().

◆ set_free_gate_ids()

void hal::Netlist::set_free_gate_ids ( const std::set< u32 ids)

Set a set of all gate IDs that have previously been used but been freed ever since.

Parameters
[in]ids- All freed gate IDs.

Definition at line 758 of file netlist.cpp.

Referenced by hal::netlist_init().

◆ set_free_grouping_ids()

void hal::Netlist::set_free_grouping_ids ( const std::set< u32 ids)

Set the set of all grouping IDs that have previously been used but been freed ever since.

Parameters
[in]ids- All freed grouping ids.

Definition at line 848 of file netlist.cpp.

Referenced by hal::netlist_init().

◆ set_free_module_ids()

void hal::Netlist::set_free_module_ids ( const std::set< u32 ids)

Set a set of all module IDs that have previously been used but been freed ever since.

Parameters
[in]ids- All freed module IDs.

Definition at line 818 of file netlist.cpp.

Referenced by hal::netlist_init().

◆ set_free_net_ids()

void hal::Netlist::set_free_net_ids ( const std::set< u32 ids)

Set a set of all net IDs that have previously been used but been freed ever since.

Parameters
[in]ids- All freed net IDs.

Definition at line 788 of file netlist.cpp.

Referenced by hal::netlist_init().

◆ set_id()

void hal::Netlist::set_id ( const u32  id)

Set the ID of the netlist to the specified value.

Parameters
[in]id- The new ID of the netlist.

Definition at line 82 of file netlist.cpp.

References id, and hal::NetlistEvent::id_changed.

Referenced by hal::netlist_init().

◆ set_input_filename()

void hal::Netlist::set_input_filename ( const std::filesystem::path &  path)

Set the path to the input file.

Parameters
[in]path- The path to the input file.

Definition at line 97 of file netlist.cpp.

References hal::NetlistEvent::input_filename_changed.

Referenced by hal::netlist_init().

◆ set_next_gate_id()

void hal::Netlist::set_next_gate_id ( const u32  id)

Set the gate ID following the highest currently used ID.

Parameters
[in]id- The next gate ID.

Definition at line 738 of file netlist.cpp.

References id.

Referenced by hal::netlist_init().

◆ set_next_grouping_id()

void hal::Netlist::set_next_grouping_id ( const u32  id)

Set the grouping ID following the highest currently used ID.

Parameters
[in]id- The next grouping ID.

Definition at line 828 of file netlist.cpp.

References id.

Referenced by hal::netlist_init().

◆ set_next_module_id()

void hal::Netlist::set_next_module_id ( const u32  id)

Set the module ID following the highest currently used ID.

Parameters
[in]id- The next module id.

Definition at line 798 of file netlist.cpp.

References id.

Referenced by hal::netlist_init().

◆ set_next_net_id()

void hal::Netlist::set_next_net_id ( const u32  id)

Set the net ID following the highest currently used ID.

Parameters
[in]id- The next net ID.

Definition at line 768 of file netlist.cpp.

References id.

Referenced by hal::netlist_init().

◆ set_used_gate_ids()

void hal::Netlist::set_used_gate_ids ( const std::set< u32 ids)

Set a set of all currently used gate IDs.

Parameters
[in]ids- All used gate IDs.

Definition at line 748 of file netlist.cpp.

Referenced by hal::netlist_init().

◆ set_used_grouping_ids()

void hal::Netlist::set_used_grouping_ids ( const std::set< u32 ids)

Set a set of all currently used grouping IDs.

Parameters
[in]ids- All used grouping IDs.

Definition at line 838 of file netlist.cpp.

Referenced by hal::netlist_init().

◆ set_used_module_ids()

void hal::Netlist::set_used_module_ids ( const std::set< u32 ids)

Set a set of all currently used module IDs.

Parameters
[in]ids- All used module IDs.

Definition at line 808 of file netlist.cpp.

Referenced by hal::netlist_init().

◆ set_used_net_ids()

void hal::Netlist::set_used_net_ids ( const std::set< u32 ids)

Set a set of all currently used net IDs.

Parameters
[in]ids- All used net IDs.

Definition at line 778 of file netlist.cpp.

Referenced by hal::netlist_init().

◆ unmark_global_input_net()

bool hal::Netlist::unmark_global_input_net ( Net net)

Unmark a global input net.

Parameters
[in]net- The net.
Returns
true on success, false otherwise.

Definition at line 449 of file netlist.cpp.

References hal::Net::get_destinations(), hal::Net::get_id(), hal::Net::get_name(), hal::Net::get_sources(), is_net_in_netlist(), log_debug, and hal::NetlistEvent::unmarked_global_input.

Referenced by hal::netlist_init(), and hal::Net::unmark_global_input_net().

◆ unmark_global_output_net()

bool hal::Netlist::unmark_global_output_net ( Net net)

Unmark a global output net.

Parameters
[in]net- The net.
Returns
true on success, false otherwise.

Definition at line 480 of file netlist.cpp.

References hal::Net::get_destinations(), hal::Net::get_id(), hal::Net::get_name(), hal::Net::get_sources(), is_net_in_netlist(), log_debug, and hal::NetlistEvent::unmarked_global_output.

Referenced by hal::netlist_init(), and hal::Net::unmark_global_output_net().

◆ unmark_gnd_gate()

bool hal::Netlist::unmark_gnd_gate ( Gate gate)

Unmark a global GND gate.

Parameters
[in]gate- The gate.
Returns
true on success, false otherwise.

Definition at line 279 of file netlist.cpp.

References hal::Gate::get_id(), hal::Gate::get_name(), is_gate_in_netlist(), log_debug, and hal::NetlistEvent::unmarked_global_gnd.

Referenced by hal::netlist_init().

◆ unmark_vcc_gate()

bool hal::Netlist::unmark_vcc_gate ( Gate gate)

Unmark a global VCC gate.

Parameters
[in]gate- The gate.
Returns
true on success, false otherwise.

Definition at line 262 of file netlist.cpp.

References hal::Gate::get_id(), hal::Gate::get_name(), is_gate_in_netlist(), log_debug, and hal::NetlistEvent::unmarked_global_vcc.

Referenced by hal::netlist_init().

Friends And Related Function Documentation

◆ NetlistInternalManager

friend class NetlistInternalManager
friend

Definition at line 57 of file netlist.h.

Referenced by Netlist().


The documentation for this class was generated from the following files: