HAL  v4.5.0-259-g577210b12
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
hal::Gate Class Reference

#include <hal_core/netlist/gate.h>

Inheritance diagram for hal::Gate:
Inheritance graph
Collaboration diagram for hal::Gate:
Collaboration graph

Public Member Functions

bool operator== (const Gate &other) const
 
bool operator!= (const Gate &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)
 
GateType * get_type () const
 
bool has_location () const
 
void set_location_x (i32 x)
 
i32 get_location_x () const
 
void set_location_y (i32 y)
 
i32 get_location_y () const
 
void set_location (const std::pair< i32, i32 > &location)
 
std::pair< i32, i32 > get_location () const
 
Module * get_module () const
 
std::vector< Module * > get_modules (const std::function< bool(Module *)> &filter=nullptr, bool recursive=true) const
 
Grouping * get_grouping () const
 
BooleanFunction get_boolean_function (const std::string &name) const
 
Result< BooleanFunction > get_boolean_function (const std::string &name, bool inlined, bool substitute_nets) const
 
BooleanFunction get_boolean_function (const GatePin *pin=nullptr) const
 
Result< BooleanFunction > get_boolean_function (const GatePin *pin, bool inlined, bool substitute_nets) const
 
bool has_boolean_function (const std::string &name) const
 
bool has_boolean_function (const GatePin *pin) const
 
std::unordered_map< std::string, BooleanFunction > get_boolean_functions (bool only_custom_functions=false) const
 
Result< std::unordered_map< std::string, BooleanFunction > > get_boolean_functions (bool only_custom_functions, bool inlined, bool substitute_nets) const
 
bool add_boolean_function (const std::string &name, const BooleanFunction &func)
 
bool mark_vcc_gate ()
 
bool mark_gnd_gate ()
 
bool unmark_vcc_gate ()
 
bool unmark_gnd_gate ()
 
bool is_vcc_gate () const
 
bool is_gnd_gate () const
 
const std::vector< Net * > & get_fan_in_nets () const
 
std::vector< Net * > get_fan_in_nets (const std::function< bool(Net *)> &filter) const
 
Net * get_fan_in_net (const std::string &pin_name) const
 
Net * get_fan_in_net (const GatePin *pin) const
 
bool is_fan_in_net (const Net *net) const
 
const std::vector< Endpoint * > & get_fan_in_endpoints () const
 
std::vector< Endpoint * > get_fan_in_endpoints (const std::function< bool(Endpoint *)> &filter) const
 
Endpoint * get_fan_in_endpoint (const std::string &pin_name) const
 
Endpoint * get_fan_in_endpoint (const GatePin *pin) const
 
Endpoint * get_fan_in_endpoint (const Net *net) const
 
const std::vector< Net * > & get_fan_out_nets () const
 
std::vector< Net * > get_fan_out_nets (const std::function< bool(Net *)> &filter) const
 
Net * get_fan_out_net (const std::string &pin_name) const
 
Net * get_fan_out_net (const GatePin *pin) const
 
bool is_fan_out_net (const Net *net) const
 
const std::vector< Endpoint * > & get_fan_out_endpoints () const
 
std::vector< Endpoint * > get_fan_out_endpoints (const std::function< bool(Endpoint *)> &filter) const
 
Endpoint * get_fan_out_endpoint (const std::string &pin_name) const
 
Endpoint * get_fan_out_endpoint (const GatePin *pin) const
 
Endpoint * get_fan_out_endpoint (const Net *net) const
 
std::vector< Gate * > get_unique_predecessors (const std::function< bool(const GatePin *pin, Endpoint *ep)> &filter=nullptr) const
 
std::vector< Endpoint * > get_predecessors (const std::function< bool(const GatePin *pin, Endpoint *ep)> &filter=nullptr) const
 
Endpoint * get_predecessor (const std::string &pin_name) const
 
Endpoint * get_predecessor (const GatePin *pin) const
 
std::vector< Gate * > get_unique_successors (const std::function< bool(const GatePin *pin, Endpoint *ep)> &filter=nullptr) const
 
std::vector< Endpoint * > get_successors (const std::function< bool(const GatePin *pin, Endpoint *ep)> &filter=nullptr) const
 
Endpoint * get_successor (const std::string &pin_name) const
 
Endpoint * get_successor (const GatePin *pin) 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)
 
Result< std::monostate > set_parameter (const Parameter &param, const std::string &value)
 
Result< std::string > get_parameter_value (const std::string &name) const
 
Result< std::string > get_parameter_value (const Parameter &name) const
 
Result< Parameter > get_parameter_declaration (const std::string &name) const
 
bool has_parameter (const Parameter &param) const
 
bool has_parameter (const std::string &name) const
 
bool delete_parameter (const std::string &name)
 
const std::unordered_map< std::string, std::pair< Parameter, std::string > > & get_parameters () const
 

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
 
std::unordered_map< std::string, std::pair< Parameter, std::string > > m_parameters
 

Detailed Description

Gate class containing information about a gate including its location, functions, and module.

Definition at line 58 of file gate.h.

Member Function Documentation

◆ add_boolean_function()

◆ get_boolean_function() [1/4]

Result< BooleanFunction > hal::Gate::get_boolean_function ( const GatePin *  pin,
bool  inlined,
bool  substitute_nets 
) const

Get the Boolean function corresponding to the given output pin, with full error reporting. When inlined is true, internal and output pin variables are recursively substituted with their definitions, and any gate-instance parameter values are reduced. When substitute_nets is true, the remaining input pin variables are additionally substituted with variable names derived from the fan-in nets using BooleanFunctionNetDecorator. substitute_nets requires inlined to be true; passing substitute_nets=true with inlined=false returns an error. Returns an error if pin is nullptr.

Parameters
[in]pin- The output pin.
[in]inlined- Set true to inline internal and output pins and reduce parameter-conditional expressions.
[in]substitute_nets- Set true to substitute input pin variables with fan-in net variables. Requires every input pin to have a connected net.
Returns
The Boolean function on success, an error otherwise.

Definition at line 400 of file gate.cpp.

References ERR, and hal::BasePin< T >::get_name().

◆ get_boolean_function() [2/4]

BooleanFunction hal::Gate::get_boolean_function ( const GatePin *  pin = nullptr) const

Get the raw Boolean function corresponding to the given output pin without inlining or net substitution. If pin is a nullptr, the Boolean function of the first output pin is returned. For full control over inlining and net substitution use the Result-returning overload.

Parameters
[in]pin- The pin.
Returns
The Boolean function on success, an empty Boolean function otherwise.

Definition at line 385 of file gate.cpp.

References hal::BasePin< T >::get_name(), and log_warning.

◆ get_boolean_function() [3/4]

BooleanFunction hal::Gate::get_boolean_function ( const std::string &  name) const

Get the raw Boolean function specified by the given name without inlining or net substitution. This name can for example be an output pin of the gate or any other user-defined function name. For full control over inlining and net substitution use the Result-returning overload.

Parameters
[in]name- The name. If empty, the first output pin is used.
Returns
The Boolean function on success, an empty Boolean function otherwise.

Definition at line 246 of file gate.cpp.

References log_warning, and name.

Referenced by hal::resynthesis::decompose_gate(), hal::resynthesis::decompose_gates_of_type(), hal::ActionAddBooleanFunction::exec(), and hal::gate_init().

◆ get_boolean_function() [4/4]

Result< BooleanFunction > hal::Gate::get_boolean_function ( const std::string &  name,
bool  inlined,
bool  substitute_nets 
) const

Get the Boolean function specified by the given name, with full error reporting. When inlined is true, internal and output pin variables are recursively substituted with their definitions, and any gate-instance parameter values are reduced. When substitute_nets is true, the remaining input pin variables are additionally substituted with variable names derived from the fan-in nets using BooleanFunctionNetDecorator. substitute_nets requires inlined to be true; passing substitute_nets=true with inlined=false returns an error.

Parameters
[in]name- The name. Must not be empty.
[in]inlined- Set true to inline internal and output pins and reduce parameter-conditional expressions.
[in]substitute_nets- Set true to substitute input pin variables with fan-in net variables. Requires inlined=true and every input pin to have a connected net.
Returns
The Boolean function on success, an error otherwise.

Definition at line 268 of file gate.cpp.

References ERR, ERR_APPEND, hal::BooleanFunctionNetDecorator::get_boolean_variable(), hal::BasePin< T >::get_direction(), hal::BasePin< T >::get_name(), hal::BooleanFunction::get_parameters(), hal::BasePin< T >::get_type(), hal::BooleanFunction::get_variable_names(), name, OK, and hal::BooleanFunction::substitute().

◆ get_boolean_functions() [1/2]

Result< std::unordered_map< std::string, BooleanFunction > > hal::Gate::get_boolean_functions ( bool  only_custom_functions,
bool  inlined,
bool  substitute_nets 
) const

Get a map from function name to Boolean function for all boolean functions associated with this gate, with full error reporting. When inlined is true, internal and output pin variables are recursively substituted with their definitions and gate-instance parameter values are reduced. When substitute_nets is true, the remaining input pin variables are additionally substituted with variable names derived from the fan-in nets using BooleanFunctionNetDecorator. substitute_nets requires inlined to be true. Aborts and returns an error on the first failure.

Parameters
[in]only_custom_functions- Set true to get only Boolean functions that are local to the gate, false otherwise.
[in]inlined- Set true to inline internal and output pins and reduce parameter-conditional expressions.
[in]substitute_nets- Set true to substitute input pin variables with fan-in net variables. Requires inlined=true and every input pin to have a connected net.
Returns
A map from function name to function on success, an error otherwise.

Definition at line 475 of file gate.cpp.

References ERR_APPEND, hal::BasePin< T >::get_name(), and OK.

◆ get_boolean_functions() [2/2]

std::unordered_map< std::string, BooleanFunction > hal::Gate::get_boolean_functions ( bool  only_custom_functions = false) const

Get a map from function name to raw Boolean function for all boolean functions associated with this gate. For full control over inlining and net substitution use the Result-returning overload.

Parameters
[in]only_custom_functions- Set true to get only Boolean functions that are local to the gate, false otherwise.
Returns
A map from function name to function on success, an empty map otherwise.

Definition at line 451 of file gate.cpp.

References hal::BasePin< T >::get_name().

Referenced by hal::gate_init(), operator==(), hal::netlist_utils::remove_buffers(), and hal::netlist_utils::remove_unused_lut_endpoints().

◆ get_fan_in_endpoint() [1/3]

Endpoint * hal::Gate::get_fan_in_endpoint ( const GatePin *  pin) const

Get the fan-in endpoint corresponding to the specified input pin.

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

Definition at line 930 of file gate.cpp.

References direction, hal::BasePin< T >::get_direction(), hal::BasePin< T >::get_name(), log_debug, and log_warning.

◆ get_fan_in_endpoint() [2/3]

Endpoint * hal::Gate::get_fan_in_endpoint ( const Net *  net) const

Get the fan-in endpoint connected to the specified input net.

Parameters
[in]net- The input net.
Returns
The endpoint on success, a nullptr otherwise.

Definition at line 952 of file gate.cpp.

References log_warning, and net.

◆ get_fan_in_endpoint() [3/3]

Endpoint * hal::Gate::get_fan_in_endpoint ( const std::string &  pin_name) const

Get the fan-in endpoint corresponding to the input pin specified by name.

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

Definition at line 914 of file gate.cpp.

References log_warning.

Referenced by hal::gate_init().

◆ get_fan_in_endpoints() [1/2]

◆ get_fan_in_endpoints() [2/2]

std::vector< Endpoint * > hal::Gate::get_fan_in_endpoints ( const std::function< bool(Endpoint *)> &  filter) const

Get a vector of all fan-in endpoints of the gate, i.e., all endpoints associated with an input pin of the gate. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.

Parameters
[in]filter- Filter function to be evaluated on each endpoint.
Returns
A vector of all fan-in endpoints.

Definition at line 893 of file gate.cpp.

◆ get_fan_in_net() [1/2]

Net * hal::Gate::get_fan_in_net ( const GatePin *  pin) const

Get the fan-in net corresponding to the specified input pin.

Parameters
[in]pin- The input pin.
Returns
The fan-in net on success, a nullptr otherwise.

Definition at line 862 of file gate.cpp.

◆ get_fan_in_net() [2/2]

Net * hal::Gate::get_fan_in_net ( const std::string &  pin_name) const

◆ get_fan_in_nets() [1/2]

const std::vector< Net * > & hal::Gate::get_fan_in_nets ( ) const

Get a vector of all fan-in nets of the gate, i.e., all nets that are connected to one of the input pins.

Returns
A vector of all fan-in nets.

Definition at line 826 of file gate.cpp.

Referenced by hal::gate_init(), hal::netlist_utils::get_next_sequential_gates(), hal::netlist_utils::get_path(), hal::ModuleModel::moduleAssignNets(), and hal::ShortestPath::net().

◆ get_fan_in_nets() [2/2]

std::vector< Net * > hal::Gate::get_fan_in_nets ( const std::function< bool(Net *)> &  filter) const

Get a vector of all fan-in nets of the gate, i.e., all nets that are connected to one of the input pins. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.

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

Definition at line 831 of file gate.cpp.

◆ get_fan_out_endpoint() [1/3]

Endpoint * hal::Gate::get_fan_out_endpoint ( const GatePin *  pin) const

Get the fan-out endpoint corresponding to the specified output pin.

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

Definition at line 1069 of file gate.cpp.

References direction, hal::BasePin< T >::get_direction(), hal::BasePin< T >::get_name(), log_debug, and log_warning.

◆ get_fan_out_endpoint() [2/3]

Endpoint * hal::Gate::get_fan_out_endpoint ( const Net *  net) const

Get the fan-out endpoint connected to the specified output net.

Parameters
[in]net- The output net.
Returns
The endpoint on success, a nullptr otherwise.

Definition at line 1091 of file gate.cpp.

References log_warning, and net.

◆ get_fan_out_endpoint() [3/3]

Endpoint * hal::Gate::get_fan_out_endpoint ( const std::string &  pin_name) const

Get the fan-out endpoint corresponding to the output pin specified by name.

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

Definition at line 1058 of file gate.cpp.

References log_warning.

Referenced by hal::gate_init().

◆ get_fan_out_endpoints() [1/2]

◆ get_fan_out_endpoints() [2/2]

std::vector< Endpoint * > hal::Gate::get_fan_out_endpoints ( const std::function< bool(Endpoint *)> &  filter) const

Get a vector of all fan-out endpoints of the gate, i.e., all endpoints associated with an output pin of the gate. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.

Parameters
[in]filter- Filter function to be evaluated on each endpoint.
Returns
A vector of all fan-out endpoints.

Definition at line 1037 of file gate.cpp.

◆ get_fan_out_net() [1/2]

Net * hal::Gate::get_fan_out_net ( const GatePin *  pin) const

Get the fan-out net corresponding to the specified output pin.

Parameters
[in]pin- The output pin.
Returns
The fan-out net on success, a nullptr otherwise.

Definition at line 1006 of file gate.cpp.

◆ get_fan_out_net() [2/2]

Net * hal::Gate::get_fan_out_net ( const std::string &  pin_name) const

Get the fan-out net corresponding to the output pin specified by name.

Parameters
[in]pin_name- The output pin name.
Returns
The fan-out net on success, a nullptr otherwise.

Definition at line 996 of file gate.cpp.

Referenced by hal::NetlistSimulatorController::add_waveform_group(), hal::NetlistModificationDecorator::connect_gates(), hal::gate_init(), hal::SimulationInput::NetGroup::get_nets(), hal::netlist_utils::get_nets_at_pins(), hal::GraphicsGate::GraphicsGate(), hal::GatePinsTreeModel::setGate(), hal::xilinx_toolbox::split_lut(), and hal::xilinx_toolbox::split_shift_register().

◆ get_fan_out_nets() [1/2]

const std::vector< Net * > & hal::Gate::get_fan_out_nets ( ) const

Get a vector of all fan-out nets of the gate, i.e., all nets that are connected to one of the output pins.

Returns
A vector of all fan-out nets.

Definition at line 970 of file gate.cpp.

Referenced by hal::gate_init(), hal::boolean_influence::get_ff_dependency_matrix(), hal::netlist_utils::get_next_sequential_gates(), hal::netlist_utils::get_path(), hal::ModuleModel::moduleAssignNets(), and hal::ShortestPath::net().

◆ get_fan_out_nets() [2/2]

std::vector< Net * > hal::Gate::get_fan_out_nets ( const std::function< bool(Net *)> &  filter) const

Get a vector of all fan-out nets of the gate, i.e., all nets that are connected to one of the output pins. The filter is evaluated on every candidate such that the result only contains those matching the specified condition.

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

Definition at line 975 of file gate.cpp.

◆ get_grouping()

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

◆ get_hash()

ssize_t hal::Gate::get_hash ( ) const

Hash function for python binding.

Returns
Pybind11 compatible hash.

Definition at line 127 of file gate.cpp.

Referenced by hal::gate_init().

◆ get_id()

u32 hal::Gate::get_id ( ) const

Get the unique id of the gate.

Returns
The unique id.

Definition at line 132 of file gate.cpp.

Referenced by hal::Net::add_destination(), hal::Net::add_source(), hal::z3_utils::compare_netlists(), hal::NetlistModificationDecorator::connect_gates(), hal::Grouping::contains_gate(), hal::resynthesis::decompose_gate(), hal::resynthesis::decompose_gates_of_type(), hal::GuiApi::deselectGate(), hal::hawkeye::CipherCandidate::detect(), hal::cte::export_dot(), hal::gate_init(), hal::GateSelectEntry::GateSelectEntry(), hal::GateSelectModel::GateSelectModel(), hal::graph_algorithm::NetlistGraph::get_all_vertices_from_gate(), hal::NetlistTraversalDecorator::get_combinational_cone(), hal::NetlistTraversalDecorator::get_common_inputs(), hal::NetlistTraversalDecorator::get_complex_gate_chain(), hal::NetlistTraversalDecorator::get_gate_chain(), hal::NetlistTraversalDecorator::get_gates(), hal::netlist_utils::get_nets_at_pins(), hal::NetlistTraversalDecorator::get_next_sequential_gates(), hal::NetlistTraversalDecorator::get_shortest_path(), hal::NetlistTraversalDecorator::get_shortest_path_distance(), hal::SelectionDetailsWidget::groupingUnassignActionFactory(), hal::event_log::handle_gate_event(), hal::event_log::handle_grouping_event(), hal::GraphContextManager::handleGateNameChanged(), hal::GraphContextManager::handleGateRemoved(), hal::GateSelectPicker::handleSelectionChanged(), hal::GraphGraphicsView::handleShortestPathToGrouping(), hal::Net::is_a_destination(), hal::Net::is_a_source(), hal::Netlist::mark_gnd_gate(), hal::Netlist::mark_vcc_gate(), operator==(), hal::netlist_utils::remove_buffers(), hal::netlist_preprocessing::remove_buffers(), hal::Net::remove_destination(), hal::Net::remove_source(), hal::netlist_utils::remove_unused_lut_endpoints(), hal::NetlistModificationDecorator::replace_gate(), hal::resynthesis::resynthesize_gate(), hal::GuiApi::selectGate(), hal::ModuleSelectExclude::selectionToString(), hal::ParameterTableModel::setData(), hal::GatePinTree::setGate(), hal::GatePinsTreeModel::setGate(), hal::DataTableWidget::setGate(), hal::GateDetailsTabWidget::setGate(), hal::GroupingsOfItemModel::setGate(), hal::GroupingsOfItemWidget::setGate(), hal::BooleanFunctionTable::setGateInformation(), hal::GraphNavigationWidget::setup(), hal::solve_fsm::solve_fsm(), hal::xilinx_toolbox::split_lut(), hal::xilinx_toolbox::split_shift_register(), hal::BooleanFunctionDecorator::substitute_power_ground_pins(), hal::Netlist::unmark_gnd_gate(), and hal::Netlist::unmark_vcc_gate().

◆ get_location()

std::pair< i32, i32 > hal::Gate::get_location ( ) const

Get the physical location of the gate in the layout.
If no valid physical location coordinate is assigned, a negative value is returned for the respective coordinate.

Returns
A pair <x-coordinate, y-coordinate>.

Definition at line 177 of file gate.cpp.

Referenced by hal::gate_init(), and hal::NetlistModificationDecorator::replace_gate().

◆ get_location_x()

i32 hal::Gate::get_location_x ( ) const

Get the physical location x-coordinate of the gate in the layout.
If no valid physical location x-coordinate is assigned, a negative value is returned.

Returns
The gate's x-coordinate.

Definition at line 167 of file gate.cpp.

Referenced by hal::PhysicalGraphLayouter::add(), hal::cte::export_dot(), hal::CoordinateFromData::fromNode(), hal::gate_init(), and operator==().

◆ get_location_y()

i32 hal::Gate::get_location_y ( ) const

Get the physical location y-coordinate of the gate in the layout.
If no valid physical location y-coordinate is assigned, a negative value is returned.

Returns
The gate's y-coordinate.

Definition at line 172 of file gate.cpp.

Referenced by hal::PhysicalGraphLayouter::add(), hal::cte::export_dot(), hal::CoordinateFromData::fromNode(), hal::gate_init(), and operator==().

◆ get_module()

◆ get_modules()

std::vector< Module * > hal::Gate::get_modules ( const std::function< bool(Module *)> &  filter = nullptr,
bool  recursive = true 
) const

Get all modules that contain this gate, either directly or as parent of another module. If recursive is set to true, indirect parent modules are also included. Otherwise, only the module containing the gate directly is returned.
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.
[in]recursive- Set true to include indirect parents as well, false otherwise.
Returns
A vector of modules.

Definition at line 216 of file gate.cpp.

References hal::Module::get_parent_modules().

Referenced by hal::gate_init().

◆ get_name()

const std::string & hal::Gate::get_name ( ) const

Get the name of the gate.

Returns
The name.

Definition at line 142 of file gate.cpp.

Referenced by hal::Net::add_destination(), hal::Net::add_source(), hal::ModuleContextMenu::addGateSubmenu(), hal::NetlistRelay::changeElementNameDialog(), hal::z3_utils::compare_netlists(), hal::NetlistModificationDecorator::connect_gates(), hal::resynthesis::decompose_gate(), hal::resynthesis::decompose_gates_of_type(), hal::ActionRenameObject::exec(), hal::cte::export_dot(), hal::gate_init(), hal::GateSelectEntry::GateSelectEntry(), hal::graph_algorithm::NetlistGraph::get_all_vertices_from_gate(), hal::NetlistTraversalDecorator::get_combinational_cone(), hal::NetlistTraversalDecorator::get_common_inputs(), hal::NetlistTraversalDecorator::get_complex_gate_chain(), hal::NetlistTraversalDecorator::get_gate_chain(), hal::NetlistTraversalDecorator::get_gates(), hal::LUTComponent::get_init_string(), hal::netlist_utils::get_nets_at_pins(), hal::NetlistTraversalDecorator::get_next_sequential_gates(), hal::NetlistTraversalDecorator::get_shortest_path(), hal::NetlistTraversalDecorator::get_shortest_path_distance(), hal::GraphicsGate::GraphicsGate(), hal::event_log::handle_gate_event(), hal::event_log::handle_grouping_event(), hal::GateSelectPicker::handleSelectionChanged(), hal::GraphGraphicsView::handleShortestPathToGrouping(), hal::Net::is_a_destination(), hal::Net::is_a_source(), hal::Netlist::mark_gnd_gate(), hal::Netlist::mark_vcc_gate(), hal::ModuleItem::ModuleItem(), hal::NetlistSimulatorController::NetlistSimulatorController(), operator==(), hal::netlist_utils::remove_buffers(), hal::netlist_preprocessing::remove_buffers(), hal::Net::remove_destination(), hal::Net::remove_source(), hal::netlist_utils::remove_unused_lut_endpoints(), hal::NetlistModificationDecorator::replace_gate(), hal::resynthesis::resynthesize_gate(), hal::ModuleSelectExclude::selectionToString(), hal::LUTComponent::set_init_string(), hal::solve_fsm::solve_fsm(), hal::xilinx_toolbox::split_lut(), hal::xilinx_toolbox::split_shift_register(), hal::BooleanFunctionDecorator::substitute_power_ground_pins(), hal::Netlist::unmark_gnd_gate(), hal::Netlist::unmark_vcc_gate(), and hal::ModuleModel::updateGateName().

◆ get_netlist()

◆ get_predecessor() [1/2]

Endpoint * hal::Gate::get_predecessor ( const GatePin *  pin) const

Get a single direct predecessor endpoint that is connected to the specified input pin. Fails if there are no or more than one predecessors.

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

Definition at line 1147 of file gate.cpp.

References direction, hal::BasePin< T >::get_direction(), hal::BasePin< T >::get_name(), and log_warning.

◆ get_predecessor() [2/2]

Endpoint * hal::Gate::get_predecessor ( const std::string &  pin_name) const

Get a single direct predecessor endpoint that is connected to the input pin specified by name. Fails if there are no or more than one predecessors.

Parameters
[in]pin_name- The input pin name.
Returns
The predecessor endpoint on success, a nullptr otherwise.

Definition at line 1173 of file gate.cpp.

References log_warning.

Referenced by hal::gate_init().

◆ get_predecessors()

std::vector< Endpoint * > hal::Gate::get_predecessors ( const std::function< bool(const GatePin *pin, Endpoint *ep)> &  filter = nullptr) const

Get a vector of all direct predecessor endpoints of the gate, i.e., all predecessor endpoints that are connected to an input pin of the gate. 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 being evaluated on the gate's input pin as well as the predecessor endpoint.
Returns
A vector of predecessor endpoints.

Definition at line 1121 of file gate.cpp.

Referenced by hal::gate_init(), hal::NetlistTraversalDecorator::get_common_inputs(), and hal::NetlistTraversalDecorator::get_complex_gate_chain().

◆ get_successor() [1/2]

Endpoint * hal::Gate::get_successor ( const GatePin *  pin) const

Get a single direct successor endpoint that is connected to the specified output pin. Fails if there are no or more than one successors.

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

Definition at line 1227 of file gate.cpp.

References direction, hal::BasePin< T >::get_direction(), hal::BasePin< T >::get_name(), and log_warning.

◆ get_successor() [2/2]

Endpoint * hal::Gate::get_successor ( const std::string &  pin_name) const

Get a single direct successor endpoint that is connected to the output pin specified by name. Fails if there are no or more than one successors.

Parameters
[in]pin_name- The output pin name.
Returns
The successor endpoint on success, a nullptr otherwise.

Definition at line 1253 of file gate.cpp.

References log_warning.

Referenced by hal::gate_init().

◆ get_successors()

std::vector< Endpoint * > hal::Gate::get_successors ( const std::function< bool(const GatePin *pin, Endpoint *ep)> &  filter = nullptr) const

Get a vector of all direct successor endpoints of the gate, i.e., all successor endpoints that are connected to an output pin of the gate. 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 being evaluated on the gate's output pin as well as the successor endpoint.
Returns
A vector of successor endpoints.

Definition at line 1201 of file gate.cpp.

Referenced by hal::gate_init(), hal::NetlistTraversalDecorator::get_complex_gate_chain(), and hal::NetlistTraversalDecorator::get_gate_chain().

◆ get_type()

GateType * hal::Gate::get_type ( ) const

Get the type of the gate.

Returns
The type.

Definition at line 162 of file gate.cpp.

Referenced by hal::GuiExtensionLogicEvaluator::acceptGate(), hal::Net::add_destination(), hal::Net::add_source(), hal::ModuleContextMenu::addGateSubmenu(), hal::dataflow::Grouping::are_groups_allowed_to_merge(), hal::z3_utils::compare_netlists(), hal::z3_utils::compare_nets(), hal::resynthesis::decompose_gate(), hal::resynthesis::decompose_gates_of_type(), hal::hawkeye::CipherCandidate::detect(), hal::ActionSetParameterValue::exec(), hal::cte::export_dot(), hal::gate_init(), hal::GateSelectEntry::GateSelectEntry(), hal::NetlistTraversalDecorator::get_complex_gate_chain(), hal::boolean_influence::get_ff_dependency_matrix(), hal::NetlistTraversalDecorator::get_gate_chain(), hal::LUTComponent::get_init_string(), hal::SelectionDetailsIconProvider::getIcon(), hal::GatePinsTreeModel::getNumberOfDisplayedPins(), hal::GraphicsGate::GraphicsGate(), hal::event_log::handle_gate_event(), hal::GatePinTree::handleContextMenuRequested(), hal::Net::is_a_destination(), hal::Net::is_a_source(), hal::cte::is_buffer(), hal::cte::is_delay(), hal::cte::is_ff(), hal::cte::is_inverter(), hal::cte::is_latch(), hal::cte::is_mux(), hal::cte::is_oscillator(), hal::cte::is_pll(), hal::ModuleItem::ModuleItem(), hal::SelectionRelay::navigateDown(), hal::SelectionRelay::navigateUp(), operator==(), hal::PyCodeProvider::pyCodeGateAsyncSetResetBehavior(), hal::netlist_utils::remove_buffers(), hal::Net::remove_destination(), hal::Net::remove_source(), hal::NetlistModificationDecorator::replace_gate(), hal::LUTComponent::set_init_string(), hal::GatePinsTreeModel::setGate(), hal::xilinx_toolbox::split_lut(), hal::xilinx_toolbox::split_luts(), hal::xilinx_toolbox::split_shift_register(), and hal::xilinx_toolbox::split_shift_registers().

◆ get_unique_predecessors()

std::vector< Gate * > hal::Gate::get_unique_predecessors ( const std::function< bool(const GatePin *pin, Endpoint *ep)> &  filter = nullptr) const

Get a vector of all unique predecessor gates of the gate. 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 being evaluated on the gate's input pin as well as the predecessor endpoint.
Returns
A vector of unique predecessor gates.

Definition at line 1109 of file gate.cpp.

Referenced by hal::gate_init().

◆ get_unique_successors()

std::vector< Gate * > hal::Gate::get_unique_successors ( const std::function< bool(const GatePin *pin, Endpoint *ep)> &  filter = nullptr) const

Get a vector of all unique successor gates of the gate. 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 being evaluated on the gate's output pin as well as the successor endpoint.
Returns
A vector of unique successor gates.

Definition at line 1189 of file gate.cpp.

Referenced by hal::gate_init().

◆ has_boolean_function() [1/2]

bool hal::Gate::has_boolean_function ( const GatePin *  pin) const

Check whether the gate has a Boolean function for the given output pin, i.e., whether get_boolean_function finds one. If pin is a nullptr, the first output pin is checked. Every LUT output pin has a Boolean function, even if the LUT is not configured.

Parameters
[in]pin- The pin.
Returns
true if the gate has a Boolean function for the pin, false otherwise.

Definition at line 440 of file gate.cpp.

References hal::BasePin< T >::get_name().

◆ has_boolean_function() [2/2]

bool hal::Gate::has_boolean_function ( const std::string &  name) const

Check whether the gate has a Boolean function with the given name, i.e., whether get_boolean_function finds one. This name can for example be an output pin of the gate or any other user-defined function name. Every LUT output pin has a Boolean function, even if the LUT is not configured.

Parameters
[in]name- The name.
Returns
true if the gate has a Boolean function with that name, false otherwise.

Definition at line 409 of file gate.cpp.

References hal::BasePin< T >::get_type(), and name.

Referenced by hal::gate_init().

◆ has_location()

bool hal::Gate::has_location ( ) const

Check whether the gate's location in the layout is available.

Returns
true if valid location data is available, false otherwise.

Definition at line 182 of file gate.cpp.

Referenced by hal::PhysicalGraphLayouter::add(), hal::cte::export_dot(), hal::CoordinateFromData::fromNode(), and hal::gate_init().

◆ is_fan_in_net()

bool hal::Gate::is_fan_in_net ( const Net *  net) const

Check whether the given net is a fan-in of the gate.

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

Definition at line 872 of file gate.cpp.

References log_warning, and net.

Referenced by hal::gate_init().

◆ is_fan_out_net()

bool hal::Gate::is_fan_out_net ( const Net *  net) const

Check whether the given net is a fan-out of the gate.

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

Definition at line 1016 of file gate.cpp.

References log_warning, and net.

Referenced by hal::gate_init().

◆ is_gnd_gate()

bool hal::Gate::is_gnd_gate ( ) const

Checks whether this gate is a global gnd gate.

Returns
true if the gate is a global gnd gate, false otherwise.

Definition at line 821 of file gate.cpp.

Referenced by hal::gate_init(), and operator==().

◆ is_vcc_gate()

bool hal::Gate::is_vcc_gate ( ) const

Checks whether this gate is a global vcc gate.

Returns
true if the gate is a global vcc gate, false otherwise.

Definition at line 816 of file gate.cpp.

Referenced by hal::gate_init(), and operator==().

◆ mark_gnd_gate()

bool hal::Gate::mark_gnd_gate ( )

Mark this gate as a global gnd gate.

Returns
true on success, false otherwise.

Definition at line 801 of file gate.cpp.

Referenced by hal::gate_init().

◆ mark_vcc_gate()

bool hal::Gate::mark_vcc_gate ( )

Mark this gate as a global vcc gate.

Returns
true on success, false otherwise.

Definition at line 796 of file gate.cpp.

Referenced by hal::gate_init().

◆ operator!=()

bool hal::Gate::operator!= ( const Gate &  other) const

Check whether two gates are unequal. Does not check for connected nets or containing module.

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

Definition at line 122 of file gate.cpp.

◆ operator==()

bool hal::Gate::operator== ( const Gate &  other) const

Check whether two gates are equal. Does not check for connected nets or containing module.

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

Definition at line 87 of file gate.cpp.

References get_boolean_functions(), get_id(), get_location_x(), get_location_y(), get_name(), get_type(), is_gnd_gate(), is_vcc_gate(), and log_debug.

◆ set_location()

void hal::Gate::set_location ( const std::pair< i32, i32 > &  location)

Set the physical location of the gate in the layout.
Only positive coordinates are valid, negative values will be regarded as no location assigned.

Parameters
[in]location- A pair <x-coordinate, y-coordinate>.

Definition at line 205 of file gate.cpp.

Referenced by hal::gate_init().

◆ set_location_x()

void hal::Gate::set_location_x ( i32  x)

Set the physical location x-coordinate of the gate in the layout.
Only positive values are valid, negative values will be regarded as no location assigned.

Parameters
[in]x- The gate's x-coordinate.

Definition at line 187 of file gate.cpp.

References x.

Referenced by hal::gate_init().

◆ set_location_y()

void hal::Gate::set_location_y ( i32  y)

Set the physical location y-coordinate of the gate in the layout.
Only positive values are valid, negative values will be regarded as no location assigned.

Parameters
[in]y- The gate's y-coordinate.

Definition at line 196 of file gate.cpp.

References y.

Referenced by hal::gate_init().

◆ set_name()

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

Set the name of the gate.

Parameters
[in]name- The new name.

Definition at line 147 of file gate.cpp.

References log_error, name, and hal::utils::trim().

Referenced by hal::ActionRenameObject::exec(), and hal::gate_init().

◆ unmark_gnd_gate()

bool hal::Gate::unmark_gnd_gate ( )

Unmark this gate as a global gnd gate.

Returns
true on success, false otherwise.

Definition at line 811 of file gate.cpp.

Referenced by hal::gate_init().

◆ unmark_vcc_gate()

bool hal::Gate::unmark_vcc_gate ( )

Unmark this gate as a global vcc gate.

Returns
true on success, false otherwise.

Definition at line 806 of file gate.cpp.

Referenced by hal::gate_init().

Friends And Related Function Documentation

◆ NetlistInternalManager

friend class NetlistInternalManager
friend

Definition at line 584 of file gate.h.


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