HAL  v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::Net Class Reference

#include <hal_core/netlist/net.h>

Inheritance diagram for hal::Net:
Inheritance graph
Collaboration diagram for hal::Net:
Collaboration graph

Public Member Functions

bool operator== (const Net &other) const
 
bool operator!= (const Net &other) const
 
ssize_t get_hash () const
 
u32 get_id () const
 
Netlistget_netlist () const
 
const std::string & get_name () const
 
void set_name (const std::string &name)
 
Groupingget_grouping () const
 
Endpointadd_source (Gate *gate, const std::string &pin_name)
 
Endpointadd_source (Gate *gate, GatePin *pin)
 
bool remove_source (Gate *gate, const std::string &pin_name)
 
bool remove_source (Gate *gate, const GatePin *pin)
 
bool remove_source (Endpoint *ep)
 
bool is_a_source (const Gate *gate) const
 
bool is_a_source (const Gate *gate, const std::string &pin_name) const
 
bool is_a_source (const Gate *gate, const GatePin *pin) const
 
bool is_a_source (const Endpoint *ep) const
 
u32 get_num_of_sources (const std::function< bool(Endpoint *ep)> &filter=nullptr) const
 
std::vector< Endpoint * > get_sources (const std::function< bool(Endpoint *ep)> &filter=nullptr) const
 
Endpointadd_destination (Gate *gate, const std::string &pin_name)
 
Endpointadd_destination (Gate *gate, GatePin *pin)
 
bool remove_destination (Gate *gate, const std::string &pin_name)
 
bool remove_destination (Gate *gate, const GatePin *pin)
 
bool remove_destination (Endpoint *ep)
 
bool is_a_destination (const Gate *gate) const
 
bool is_a_destination (const Gate *gate, const std::string &pin_name) const
 
bool is_a_destination (const Gate *gate, const GatePin *pin) const
 
bool is_a_destination (const Endpoint *ep) const
 
u32 get_num_of_destinations (const std::function< bool(Endpoint *ep)> &filter=nullptr) const
 
std::vector< Endpoint * > get_destinations (const std::function< bool(Endpoint *ep)> &filter=nullptr) const
 
bool is_unrouted () const
 
bool is_gnd_net () const
 
bool is_vcc_net () const
 
bool mark_global_input_net ()
 
bool mark_global_output_net ()
 
bool unmark_global_input_net ()
 
bool unmark_global_output_net ()
 
bool is_global_input_net () const
 
bool is_global_output_net () const
 
- Public Member Functions inherited from hal::DataContainer
 DataContainer ()=default
 
virtual ~DataContainer ()=default
 
bool operator== (const DataContainer &other) const
 
bool operator!= (const DataContainer &other) const
 
bool set_data (const std::string &category, const std::string &key, const std::string &data_type, const std::string &value, const bool log_with_info_level=false)
 
bool has_data (const std::string &category, const std::string &key) const
 
std::tuple< std::string, std::string > get_data (const std::string &category, const std::string &key) const
 
bool delete_data (const std::string &category, const std::string &key, const bool log_with_info_level=false)
 
const std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string > > & get_data_map () const
 
void set_data_map (const std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string >> &map)
 

Friends

class NetlistInternalManager
 

Additional Inherited Members

- Protected Attributes inherited from hal::DataContainer
std::map< std::tuple< std::string, std::string >, std::tuple< std::string, std::string > > m_data
 

Detailed Description

Net class containing information about a net including its source and destination.

Definition at line 57 of file net.h.

Member Function Documentation

◆ add_destination() [1/2]

Endpoint * hal::Net::add_destination ( Gate gate,
const std::string &  pin_name 
)

Add a destination endpoint to the net. The endpoint is specified by a tuple of a gate and the name of an input pin of that gate.

Parameters
[in]gate- The gate.
[in]pin_name- The name of an input pin of the gate.
Returns
The endpoint on success, a nullptr otherwise.

Definition at line 300 of file net.cpp.

References hal::Gate::get_id(), hal::Gate::get_name(), hal::GateType::get_pin_by_name(), hal::Gate::get_type(), and log_warning.

Referenced by hal::NetlistModificationDecorator::connect_nets(), hal::net_init(), hal::netlist_preprocessing::propagate_constants(), hal::netlist_utils::remove_buffers(), hal::netlist_utils::remove_unused_lut_endpoints(), hal::netlist_preprocessing::remove_unused_lut_inputs(), hal::resynthesis::replace_subgraph_with_netlist(), and hal::xilinx_toolbox::split_shift_registers().

◆ add_destination() [2/2]

Endpoint * hal::Net::add_destination ( Gate gate,
GatePin pin 
)

Add a destination endpoint to the net. The endpoint is specified by a tuple of a gate and an input pin of that gate.

Parameters
[in]gate- The gate.
[in]pin- The input pin of the gate.
Returns
The endpoint on success, a nullptr otherwise.

Definition at line 295 of file net.cpp.

◆ add_source() [1/2]

Endpoint * hal::Net::add_source ( Gate gate,
const std::string &  pin_name 
)

Add a source endpoint to the net. The endpoint is specified by a tuple of a gate and the name of an output pin of that gate.

Parameters
[in]gate- The gate.
[in]pin_name- The name of an output pin of the gate.
Returns
The endpoint on success, a nullptr otherwise.

Definition at line 127 of file net.cpp.

References hal::Gate::get_id(), hal::Gate::get_name(), hal::GateType::get_pin_by_name(), hal::Gate::get_type(), and log_warning.

Referenced by hal::NetlistModificationDecorator::connect_nets(), hal::VHDLParser::instantiate(), hal::net_init(), hal::resynthesis::replace_subgraph_with_netlist(), hal::xilinx_toolbox::split_shift_registers(), and hal::netlist_preprocessing::unify_ff_outputs().

◆ add_source() [2/2]

Endpoint * hal::Net::add_source ( Gate gate,
GatePin pin 
)

Add a source endpoint to the net. The endpoint is specified by a tuple of a gate and an output pin of that gate.

Parameters
[in]gate- The gate.
[in]pin- The output pin of the gate.
Returns
The endpoint on success, a nullptr otherwise.

Definition at line 122 of file net.cpp.

◆ get_destinations()

◆ get_grouping()

Grouping * hal::Net::get_grouping ( ) const

Get the grouping in which this net is contained.
If no grouping contains this gate, a nullptr is returned.

Returns
The grouping.

Definition at line 117 of file net.cpp.

Referenced by hal::GroupingTableModel::colorForItem(), and hal::net_init().

◆ get_hash()

ssize_t hal::Net::get_hash ( ) const

Hash function for python binding

Returns
Pybind11 compatible hash

Definition at line 83 of file net.cpp.

Referenced by hal::net_init().

◆ get_id()

u32 hal::Net::get_id ( ) const

Get the unique id of the net.

Returns
The unique id.

Definition at line 88 of file net.cpp.

Referenced by hal::WaveDataGroup::addNet(), hal::LogicEvaluatorDialog::compile(), hal::NetlistModificationDecorator::connect_nets(), hal::ActionCreateObject::exec(), hal::WavedataTableEditor::generateSimulationInput(), hal::BooleanFunctionNetDecorator::get_boolean_variable_name(), hal::SubgraphNetlistDecorator::get_subgraph_function(), hal::SubgraphNetlistDecorator::get_subgraph_function_inputs(), hal::NetlistSimulatorController::get_waveform_by_net(), hal::GraphicsGate::GraphicsGate(), hal::ModulePinsTree::handleContextMenuRequested(), hal::GraphContextManager::handleNetDestinationAdded(), hal::GraphContextManager::handleNetDestinationRemoved(), hal::GraphContextManager::handleNetNameChanged(), hal::GraphContextManager::handleNetRemoved(), hal::GraphContextManager::handleNetSourceAdded(), hal::GraphContextManager::handleNetSourceRemoved(), hal::GraphGraphicsView::handleShortestPathToGrouping(), hal::WavedataTableEditor::loadWaveData(), hal::Netlist::mark_global_input_net(), hal::Netlist::mark_global_output_net(), hal::net_init(), hal::ModulePin::operator==(), operator==(), hal::bitorder_propagation::propagate_module_pingroup_bitorder(), hal::netlist_utils::remove_buffers(), hal::netlist_preprocessing::remove_buffers(), hal::resynthesis::replace_subgraph_with_netlist(), hal::GatePinsTreeModel::setGate(), hal::Netlist::unmark_global_input_net(), hal::Netlist::unmark_global_output_net(), and hal::WaveDataList::waveDataByNet().

◆ get_name()

◆ get_netlist()

Netlist * hal::Net::get_netlist ( ) const

Get the netlist this net is associated with.

Returns
The netlist.

Definition at line 93 of file net.cpp.

Referenced by hal::module_identification::find_neighboring_registers(), and hal::net_init().

◆ get_num_of_destinations()

u32 hal::Net::get_num_of_destinations ( const std::function< bool(Endpoint *ep)> &  filter = nullptr) const

Get the number of destinations of the net. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.

Parameters
[in]filter- An optional filter.
Returns
The number of destinations.

Definition at line 432 of file net.cpp.

Referenced by hal::VHDLParser::instantiate(), hal::net_init(), operator==(), and hal::xilinx_toolbox::split_shift_registers().

◆ get_num_of_sources()

u32 hal::Net::get_num_of_sources ( const std::function< bool(Endpoint *ep)> &  filter = nullptr) const

Get the number of sources of the net. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.

Parameters
[in]filter- An optional filter.
Returns
The number of sources.

Definition at line 258 of file net.cpp.

Referenced by hal::SubgraphNetlistDecorator::get_subgraph_function(), hal::SubgraphNetlistDecorator::get_subgraph_function_inputs(), hal::net_init(), and operator==().

◆ get_sources()

◆ is_a_destination() [1/4]

bool hal::Net::is_a_destination ( const Endpoint ep) const

Check whether an endpoint is a destination of the net.

Parameters
[in]ep- The endpoint.
Returns
true if the endpoint is a destination of the net, false otherwise.

Definition at line 418 of file net.cpp.

References hal::Endpoint::is_destination_pin().

◆ is_a_destination() [2/4]

bool hal::Net::is_a_destination ( const Gate gate) const

Check whether a gate is a destination of the net independent of the pin.

Parameters
[in]gate- The gate.
Returns
true if the gate is a destination of the net, false otherwise.

Definition at line 373 of file net.cpp.

References log_warning.

Referenced by is_a_destination(), and hal::net_init().

◆ is_a_destination() [3/4]

bool hal::Net::is_a_destination ( const Gate gate,
const GatePin pin 
) const

Check whether an endpoint is a destination of the net. The endpoint is specified by a tuple of a gate and an input pin of that gate.

Parameters
[in]gate- The gate.
[in]pin- The input pin of the gate.
Returns
true if the endpoint is a destination of the net, false otherwise.

Definition at line 384 of file net.cpp.

References log_warning.

◆ is_a_destination() [4/4]

bool hal::Net::is_a_destination ( const Gate gate,
const std::string &  pin_name 
) const

Check whether an endpoint is a destination of the net. The endpoint is specified by a tuple of a gate and the name of an input pin of that gate.

Parameters
[in]gate- The gate.
[in]pin_name- The name of an input pin of the gate.
Returns
true if the endpoint is a destination of the net, false otherwise.

Definition at line 401 of file net.cpp.

References hal::Gate::get_id(), hal::Gate::get_name(), hal::GateType::get_pin_by_name(), hal::Gate::get_type(), is_a_destination(), and log_warning.

◆ is_a_source() [1/4]

bool hal::Net::is_a_source ( const Endpoint ep) const

Check whether an endpoint is a source of the net.

Parameters
[in]ep- The endpoint.
Returns
true if the endpoint is a source of the net, false otherwise.

Definition at line 244 of file net.cpp.

References hal::Endpoint::is_source_pin().

◆ is_a_source() [2/4]

bool hal::Net::is_a_source ( const Gate gate) const

Check whether a gate is a source of the net independent of the pin.

Parameters
[in]gate- The gate.
Returns
true if the gate is a source of the net, false otherwise.

Definition at line 199 of file net.cpp.

References log_warning.

Referenced by is_a_source(), and hal::net_init().

◆ is_a_source() [3/4]

bool hal::Net::is_a_source ( const Gate gate,
const GatePin pin 
) const

Check whether an endpoint is a source of the net. The endpoint is specified by a tuple of a gate and an output pin of that gate.

Parameters
[in]gate- The gate.
[in]pin- The output pin of the gate.
Returns
true if the endpoint is a source of the net, false otherwise.

Definition at line 210 of file net.cpp.

References log_warning.

◆ is_a_source() [4/4]

bool hal::Net::is_a_source ( const Gate gate,
const std::string &  pin_name 
) const

Check whether an endpoint is a source of the net. The endpoint is specified by a tuple of a gate and the name of an output pin of that gate.

Parameters
[in]gate- The gate.
[in]pin_name- The name of an output pin of the gate.
Returns
true if the endpoint is a source of the net, false otherwise.

Definition at line 227 of file net.cpp.

References hal::Gate::get_id(), hal::Gate::get_name(), hal::GateType::get_pin_by_name(), hal::Gate::get_type(), is_a_source(), and log_warning.

◆ is_global_input_net()

bool hal::Net::is_global_input_net ( ) const

Checks whether this net is a global input net.

Returns
true if the net is a global input net, false otherwise.

Definition at line 504 of file net.cpp.

References hal::Netlist::is_global_input_net().

Referenced by hal::NetlistModificationDecorator::connect_nets(), hal::SubgraphNetlistDecorator::get_subgraph_function(), hal::SubgraphNetlistDecorator::get_subgraph_function_inputs(), hal::net_init(), and operator==().

◆ is_global_output_net()

bool hal::Net::is_global_output_net ( ) const

Checks whether this net is a global output net.

Returns
true if the net is a global output net, false otherwise.

Definition at line 509 of file net.cpp.

References hal::Netlist::is_global_output_net().

Referenced by hal::NetlistModificationDecorator::connect_nets(), hal::net_init(), and operator==().

◆ is_gnd_net()

bool hal::Net::is_gnd_net ( ) const

Check whether the net is connected to GND.

Returns
true if the net is connected to GND, false otherwise.

Definition at line 474 of file net.cpp.

Referenced by hal::net_init(), and hal::xilinx_toolbox::split_shift_registers().

◆ is_unrouted()

bool hal::Net::is_unrouted ( ) const

Check whether the net is unrouted, i.e., it has no source or no destination.

Returns
true if the net is unrouted, false otherwise.

Definition at line 469 of file net.cpp.

Referenced by hal::net_init().

◆ is_vcc_net()

bool hal::Net::is_vcc_net ( ) const

Check whether the net is connected to VCC.

Returns
true if the net is connected to VCC, false otherwise.

Definition at line 479 of file net.cpp.

Referenced by hal::net_init(), and hal::xilinx_toolbox::split_shift_registers().

◆ mark_global_input_net()

bool hal::Net::mark_global_input_net ( )

Mark this net as a global input net.

Returns
true on success, false otherwise.

Definition at line 484 of file net.cpp.

References hal::Netlist::mark_global_input_net().

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

◆ mark_global_output_net()

bool hal::Net::mark_global_output_net ( )

Mark this net as a global output net.

Returns
true on success, false otherwise.

Definition at line 489 of file net.cpp.

References hal::Netlist::mark_global_output_net().

Referenced by hal::net_init().

◆ operator!=()

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

Check whether two nets are unequal.

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

Definition at line 78 of file net.cpp.

References operator==().

◆ operator==()

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

Check whether two nets are equal.

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

Definition at line 26 of file net.cpp.

References get_destinations(), get_id(), get_name(), get_num_of_destinations(), get_num_of_sources(), get_sources(), is_global_input_net(), is_global_output_net(), and log_debug.

Referenced by operator!=().

◆ remove_destination() [1/3]

bool hal::Net::remove_destination ( Endpoint ep)

Remove a destination endpoint from the net.

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

Definition at line 364 of file net.cpp.

◆ remove_destination() [2/3]

bool hal::Net::remove_destination ( Gate gate,
const GatePin pin 
)

Remove a destination endpoint from the net. The endpoint is specified by a tuple of a gate and an input pin of that gate.

Parameters
[in]gate- The gate.
[in]pin- The input pin of the gate.
Returns
true on success, false otherwise.

Definition at line 321 of file net.cpp.

References hal::Gate::get_id(), hal::Gate::get_name(), and log_warning.

◆ remove_destination() [3/3]

bool hal::Net::remove_destination ( Gate gate,
const std::string &  pin_name 
)

Remove a destination endpoint from the net. The endpoint is specified by a tuple of a gate and the name of an input pin of that gate.

Parameters
[in]gate- The gate.
[in]pin_name- The name of an input pin of the gate.
Returns
true on success, false otherwise.

Definition at line 343 of file net.cpp.

References hal::Gate::get_id(), hal::Gate::get_name(), hal::GateType::get_pin_by_name(), hal::Gate::get_type(), and log_warning.

Referenced by hal::NetlistModificationDecorator::connect_nets(), hal::net_init(), hal::netlist_utils::remove_buffers(), and hal::netlist_preprocessing::remove_buffers().

◆ remove_source() [1/3]

bool hal::Net::remove_source ( Endpoint ep)

Remove a source endpoint from the net.

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

Definition at line 190 of file net.cpp.

◆ remove_source() [2/3]

bool hal::Net::remove_source ( Gate gate,
const GatePin pin 
)

Remove a source endpoint from the net. The endpoint is specified by a tuple of a gate and an output pin of that gate.

Parameters
[in]gate- The gate.
[in]pin- The output pin of the gate.
Returns
true on success, false otherwise.

Definition at line 148 of file net.cpp.

References hal::Gate::get_id(), hal::Gate::get_name(), and log_warning.

◆ remove_source() [3/3]

bool hal::Net::remove_source ( Gate gate,
const std::string &  pin_name 
)

Remove a source endpoint from the net. The endpoint is specified by a tuple of a gate and the name of an output pin of that gate.

Parameters
[in]gate- The gate.
[in]pin_name- The name of an output pin of the gate.
Returns
true on success, false otherwise.

Definition at line 169 of file net.cpp.

References hal::Gate::get_id(), hal::Gate::get_name(), hal::GateType::get_pin_by_name(), hal::Gate::get_type(), and log_warning.

Referenced by hal::NetlistModificationDecorator::connect_nets(), and hal::net_init().

◆ set_name()

void hal::Net::set_name ( const std::string &  name)

◆ unmark_global_input_net()

bool hal::Net::unmark_global_input_net ( )

Unmark this net as a global input net.

Returns
true on success, false otherwise.

Definition at line 494 of file net.cpp.

References hal::Netlist::unmark_global_input_net().

Referenced by hal::net_init().

◆ unmark_global_output_net()

bool hal::Net::unmark_global_output_net ( )

Unmark this net as a global output net.

Returns
true on success, false otherwise.

Definition at line 499 of file net.cpp.

References hal::Netlist::unmark_global_output_net().

Referenced by hal::net_init().

Friends And Related Function Documentation

◆ NetlistInternalManager

friend class NetlistInternalManager
friend

Definition at line 403 of file net.h.


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