|
HAL
v4.5.0-83-g30c8f0afc
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
|
#include <hal_core/netlist/net.h>


Public Member Functions | |
| bool | operator== (const Net &other) const |
| bool | operator!= (const Net &other) const |
| ssize_t | get_hash () const |
| u32 | get_id () const |
| Netlist * | get_netlist () const |
| const std::string & | get_name () const |
| void | set_name (const std::string &name) |
| Grouping * | get_grouping () const |
| Endpoint * | add_source (Gate *gate, const std::string &pin_name) |
| Endpoint * | add_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 |
| Endpoint * | add_destination (Gate *gate, const std::string &pin_name) |
| Endpoint * | add_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 |
Net class containing information about a net including its source and destination.
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.
| [in] | gate | - The gate. |
| [in] | pin_name | - The name of an input pin of the gate. |
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 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.
| [in] | gate | - The gate. |
| [in] | pin_name | - The name of an output pin of the gate. |
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().
| std::vector< Endpoint * > hal::Net::get_destinations | ( | const std::function< bool(Endpoint *ep)> & | filter = nullptr | ) | const |
Get a vector of destinations of the net. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
| [in] | filter | - An optional filter. |
Definition at line 450 of file net.cpp.
Referenced by hal::NetlistModificationDecorator::connect_nets(), hal::NetlistTraversalDecorator::get_next_combinational_gates(), hal::NetlistTraversalDecorator::get_next_matching_gates(), hal::NetlistTraversalDecorator::get_next_matching_gates_until(), hal::NetlistTraversalDecorator::get_next_matching_gates_until_depth(), hal::NetlistTraversalDecorator::get_next_sequential_gates(), hal::GraphContext::getNetDestination(), hal::Netlist::mark_global_input_net(), hal::Netlist::mark_global_output_net(), hal::SelectionRelay::navigateDown(), hal::SelectionRelay::navigateUp(), hal::net_init(), operator==(), hal::netlist_utils::remove_buffers(), hal::Netlist::unmark_global_input_net(), and hal::Netlist::unmark_global_output_net().
| 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.
Definition at line 117 of file net.cpp.
Referenced by hal::GroupingTableModel::colorForItem(), and hal::net_init().
| ssize_t hal::Net::get_hash | ( | ) | const |
Hash function for python binding
Definition at line 83 of file net.cpp.
Referenced by hal::net_init().
| u32 hal::Net::get_id | ( | ) | const |
Get the unique id of the net.
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().
| const std::string & hal::Net::get_name | ( | ) | const |
Get the name of the net.
Definition at line 98 of file net.cpp.
Referenced by hal::NetlistRelay::changeElementNameDialog(), hal::LogicEvaluatorDialog::compile(), hal::NetlistModificationDecorator::connect_nets(), hal::WavedataTableEditor::generateSimulationInput(), hal::SubgraphNetlistDecorator::get_subgraph_function(), hal::SubgraphNetlistDecorator::get_subgraph_function_inputs(), hal::ModulePinsTreeModel::handleModulePortsChanged(), hal::VerilogParser::instantiate(), hal::VHDLParser::instantiate(), hal::WavedataTableEditor::loadWaveData(), hal::Netlist::mark_global_input_net(), hal::Netlist::mark_global_output_net(), hal::ModuleItem::ModuleItem(), hal::net_init(), operator==(), hal::WaveWidget::refreshNetNames(), 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::ModuleModel::updateNetName().
| Netlist * hal::Net::get_netlist | ( | ) | const |
Get the netlist this net is associated with.
Definition at line 93 of file net.cpp.
Referenced by hal::module_identification::find_neighboring_registers(), and hal::net_init().
| 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.
| [in] | filter | - An optional filter. |
Definition at line 432 of file net.cpp.
Referenced by hal::VHDLParser::instantiate(), hal::net_init(), operator==(), and hal::xilinx_toolbox::split_shift_registers().
| 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.
| [in] | filter | - An optional filter. |
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==().
| std::vector< Endpoint * > hal::Net::get_sources | ( | const std::function< bool(Endpoint *ep)> & | filter = nullptr | ) | const |
Get a vector of sources of the net. The optional filter is evaluated on every candidate such that the result only contains those matching the specified condition.
| [in] | filter | - An optional filter. |
Definition at line 276 of file net.cpp.
Referenced by hal::NetlistModificationDecorator::connect_nets(), hal::NetlistTraversalDecorator::get_next_combinational_gates(), hal::NetlistTraversalDecorator::get_next_matching_gates(), hal::NetlistTraversalDecorator::get_next_matching_gates_until(), hal::NetlistTraversalDecorator::get_next_matching_gates_until_depth(), hal::NetlistTraversalDecorator::get_next_sequential_gates(), hal::SubgraphNetlistDecorator::get_subgraph_function(), hal::SubgraphNetlistDecorator::get_subgraph_function_inputs(), hal::GraphContext::getNetSource(), hal::Netlist::mark_global_input_net(), hal::Netlist::mark_global_output_net(), hal::net_init(), operator==(), hal::Netlist::unmark_global_input_net(), and hal::Netlist::unmark_global_output_net().
| bool hal::Net::is_a_destination | ( | const Endpoint * | ep | ) | const |
Check whether an endpoint is a destination of the net.
| [in] | ep | - The endpoint. |
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().
| bool hal::Net::is_a_destination | ( | const Gate * | gate | ) | const |
Check whether a gate is a destination of the net independent of the pin.
| [in] | gate | - The gate. |
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().
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.
| [in] | gate | - The gate. |
| [in] | pin | - The input pin of the gate. |
true if the endpoint is a destination of the net, false otherwise. Definition at line 384 of file net.cpp.
References log_warning.
| 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.
| [in] | gate | - The gate. |
| [in] | pin_name | - The name of an input pin of the gate. |
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.
| bool hal::Net::is_a_source | ( | const Endpoint * | ep | ) | const |
Check whether an endpoint is a source of the net.
| [in] | ep | - The endpoint. |
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().
| bool hal::Net::is_a_source | ( | const Gate * | gate | ) | const |
Check whether a gate is a source of the net independent of the pin.
| [in] | gate | - The gate. |
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().
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.
| [in] | gate | - The gate. |
| [in] | pin | - The output pin of the gate. |
true if the endpoint is a source of the net, false otherwise. Definition at line 210 of file net.cpp.
References log_warning.
| 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.
| [in] | gate | - The gate. |
| [in] | pin_name | - The name of an output pin of the gate. |
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.
| bool hal::Net::is_global_input_net | ( | ) | const |
Checks whether this net is a global input net.
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==().
| bool hal::Net::is_global_output_net | ( | ) | const |
Checks whether this net is a global output net.
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==().
| bool hal::Net::is_gnd_net | ( | ) | const |
Check whether the net is connected to GND.
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().
| bool hal::Net::is_unrouted | ( | ) | const |
Check whether the net is unrouted, i.e., it has no source or no destination.
true if the net is unrouted, false otherwise. Definition at line 469 of file net.cpp.
Referenced by hal::net_init().
| bool hal::Net::is_vcc_net | ( | ) | const |
Check whether the net is connected to VCC.
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().
| bool hal::Net::mark_global_input_net | ( | ) |
Mark this net as a global input net.
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().
| bool hal::Net::mark_global_output_net | ( | ) |
Mark this net as a global output net.
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().
| bool hal::Net::operator!= | ( | const Net & | other | ) | const |
Check whether two nets are unequal.
| [in] | other | - The net to compare against. |
true if both nets are unequal, false otherwise. Definition at line 78 of file net.cpp.
References operator==().
| bool hal::Net::operator== | ( | const Net & | other | ) | const |
Check whether two nets are equal.
| [in] | other | - The net to compare against. |
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!=().
| bool hal::Net::remove_destination | ( | Endpoint * | ep | ) |
Remove a destination endpoint from the net. The endpoint is specified by a tuple of a gate and an input pin of that gate.
| [in] | gate | - The gate. |
| [in] | pin | - The input pin of the gate. |
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.
| 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.
| [in] | gate | - The gate. |
| [in] | pin_name | - The name of an input pin of the gate. |
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().
| bool hal::Net::remove_source | ( | Endpoint * | ep | ) |
Remove a source endpoint from the net. The endpoint is specified by a tuple of a gate and an output pin of that gate.
| [in] | gate | - The gate. |
| [in] | pin | - The output pin of the gate. |
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.
| 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.
| [in] | gate | - The gate. |
| [in] | pin_name | - The name of an output pin of the gate. |
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().
| void hal::Net::set_name | ( | const std::string & | name | ) |
Set the name of the net.
| [in] | name | - The new name. |
Definition at line 103 of file net.cpp.
References log_error, name, hal::NetEvent::name_changed, hal::EventHandler::notify(), and hal::utils::trim().
Referenced by hal::netlist_preprocessing::create_nets_at_unconnected_pins(), hal::net_init(), and hal::resynthesis::replace_subgraph_with_netlist().
| bool hal::Net::unmark_global_input_net | ( | ) |
Unmark this net as a global input net.
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().
| bool hal::Net::unmark_global_output_net | ( | ) |
Unmark this net as a global output net.
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().
|
friend |