|
HAL
v4.5.0-258-gf372a0264
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
|
Functions | |
| Result< BooleanFunction > | get_subgraph_function (const Net *net, const std::vector< const Gate * > &subgraph_gates, std::map< std::pair< u32, const GatePin * >, BooleanFunction > &cache) |
| Result< BooleanFunction > | get_subgraph_function (const Net *net, const std::vector< const Gate * > &subgraph_gates) |
| std::unique_ptr< Netlist > | copy_netlist (const Netlist *nl) |
| std::pair< std::map< u32, Gate * >, std::vector< std::vector< int > > > | get_ff_dependency_matrix (const Netlist *nl) |
| std::unique_ptr< Netlist > | get_partial_netlist (const Netlist *nl, const std::vector< const Gate * > &subgraph_gates) |
| std::vector< Gate * > | get_next_gates (const Gate *gate, bool get_successors, int depth=0, const std::function< bool(const Gate *)> &filter=nullptr) |
| std::vector< Gate * > | get_next_gates (const Net *net, bool get_successors, int depth=0, const std::function< bool(const Gate *)> &filter=nullptr) |
| std::vector< Gate * > | get_next_sequential_gates (const Gate *gate, bool get_successors, std::unordered_map< u32, std::vector< Gate * >> &cache) |
| std::vector< Gate * > | get_next_sequential_gates (const Gate *gate, bool get_successors) |
| std::vector< Gate * > | get_next_sequential_gates (const Net *net, bool get_successors, std::unordered_map< u32, std::vector< Gate * >> &cache) |
| std::vector< Gate * > | get_next_sequential_gates (const Net *net, bool get_successors) |
| std::vector< Gate * > | get_path (const Gate *gate, bool get_successors, std::set< GateTypeProperty > stop_properties, std::unordered_map< u32, std::vector< Gate * >> &cache) |
| std::vector< Gate * > | get_path (const Gate *gate, bool get_successors, std::set< GateTypeProperty > stop_properties) |
| std::vector< Gate * > | get_path (const Net *net, bool get_successors, std::set< GateTypeProperty > stop_properties, std::unordered_map< u32, std::vector< Gate * >> &cache) |
| std::vector< Gate * > | get_path (const Net *net, bool get_successors, std::set< GateTypeProperty > stop_properties) |
| std::vector< Net * > | get_nets_at_pins (Gate *gate, std::vector< GatePin * > pins) |
| Result< u32 > | remove_buffers (Netlist *netlist, bool analyze_inputs=false) |
| Result< u32 > | remove_unused_lut_endpoints (Netlist *netlist) |
| std::vector< Net * > | get_common_inputs (const std::vector< Gate * > &gates, u32 threshold=0) |
| Result< std::monostate > | replace_gate (Gate *gate, GateType *target_type, std::map< GatePin *, GatePin * > pin_map) |
| std::vector< Gate * > | get_shortest_path (Gate *start_gate, Gate *end_gate, bool search_both_directions=false) |
| std::vector< Gate * > | get_shortest_path (Gate *start_gate, Module *end_module, bool forward_direction) |
| std::vector< std::vector< Gate * > > | get_shortest_path (Module *start_module, Module *end_module) |
Contains various utility functions that operate on a netlist without modifying it, e.g., traversal and analysis helpers.
| [in] | nl | - The netlist to copy. |
Definition at line 167 of file netlist_utils.cpp.
References hal::Netlist::copy(), and log_error.
Referenced by hal::netlist_utils_init().
| std::vector< Net * > hal::netlist_utils::get_common_inputs | ( | const std::vector< Gate * > & | gates, |
| u32 | threshold = 0 |
||
| ) |
Returns all nets that are considered to be common inputs to the provided gates. A threshold value can be provided to specify the number of gates a net must be connected to in order to be classified as a common input. If the theshold value is set to 0, a net must be input to all gates to be considered a common input.
| [in] | gates | - The gates. |
| [in] | threshold | - The threshold value, defaults to 0. |
NetlistTraversalDecorator::get_common_inputs instead. Definition at line 846 of file netlist_utils.cpp.
Referenced by hal::netlist_utils_init().
| std::pair< std::map< u32, Gate * >, std::vector< std::vector< int > > > hal::netlist_utils::get_ff_dependency_matrix | ( | const Netlist * | nl | ) |
Get the FF dependency matrix of a netlist.
| [in] | nl | - The netlist to extract the dependency matrix from. |
boolean_influence::get_ff_dependency_matrix instead. Definition at line 180 of file netlist_utils.cpp.
References hal::ff, hal::Netlist::get_gates(), and get_next_sequential_gates().
Referenced by hal::netlist_utils_init().
| std::vector< Net * > hal::netlist_utils::get_nets_at_pins | ( | Gate * | gate, |
| std::vector< GatePin * > | pins | ||
| ) |
Get the nets that are connected to a subset of pins of the specified gate.
| [in] | gate | - The gate. |
| [in] | pins | - The targeted pins. |
Gate::get_fan_in_net or Gate::get_fan_out_net, depending on each pin's direction. Definition at line 564 of file netlist_utils.cpp.
References direction, hal::Gate::get_fan_in_net(), hal::Gate::get_fan_out_net(), hal::Gate::get_id(), hal::Gate::get_name(), hal::inout, hal::input, log_warning, net, hal::output, and pins.
Referenced by hal::netlist_utils_init().
| std::vector< Gate * > hal::netlist_utils::get_next_gates | ( | const Gate * | gate, |
| bool | get_successors, | ||
| int | depth = 0, |
||
| const std::function< bool(const Gate *)> & | filter = nullptr |
||
| ) |
| [in] | gate | - The initial gate. |
| [in] | get_successors | - true to return successors, false for Predecessors. |
| [in] | depth | - Depth of recursion. |
| [in] | filter | - User-defined filter function. |
Definition at line 238 of file netlist_utils.cpp.
Referenced by hal::CommonSuccessorPredecessorGateQueue::getNext(), and hal::netlist_utils_init().
| std::vector< Gate * > hal::netlist_utils::get_next_gates | ( | const Net * | net, |
| bool | get_successors, | ||
| int | depth = 0, |
||
| const std::function< bool(const Gate *)> & | filter = nullptr |
||
| ) |
false. Only gates matching the filter will be added to the result vector.| [in] | net | - The initial net. |
| [in] | get_successors | - true to return successors, false for Predecessors. |
| [in] | depth | - Depth of recursion. |
| [in] | filter | - User-defined filter function. |
Definition at line 286 of file netlist_utils.cpp.
References net.
| std::vector< Gate * > hal::netlist_utils::get_next_sequential_gates | ( | const Gate * | gate, |
| bool | get_successors | ||
| ) |
| [in] | gate | - The initial gate. |
| [in] | get_successors | - If true, sequential successors are returned, otherwise sequential predecessors are returned. |
Definition at line 467 of file netlist_utils.cpp.
References get_next_sequential_gates().
| std::vector< Gate * > hal::netlist_utils::get_next_sequential_gates | ( | const Gate * | gate, |
| bool | get_successors, | ||
| std::unordered_map< u32, std::vector< Gate * >> & | cache | ||
| ) |
| [in] | gate | - The initial gate. |
| [in] | get_successors | - If true, sequential successors are returned, otherwise sequential predecessors are returned. |
| [in,out] | cache | - The cache. |
Definition at line 446 of file netlist_utils.cpp.
References hal::Gate::get_fan_in_nets(), and hal::Gate::get_fan_out_nets().
Referenced by get_ff_dependency_matrix(), get_next_sequential_gates(), and hal::netlist_utils_init().
| std::vector< Gate * > hal::netlist_utils::get_next_sequential_gates | ( | const Net * | net, |
| bool | get_successors | ||
| ) |
| [in] | net | - The initial net. |
| [in] | get_successors | - If true, sequential successors are returned, otherwise sequential predecessors are returned. |
Definition at line 473 of file netlist_utils.cpp.
References get_next_sequential_gates(), and net.
| std::vector< Gate * > hal::netlist_utils::get_next_sequential_gates | ( | const Net * | net, |
| bool | get_successors, | ||
| std::unordered_map< u32, std::vector< Gate * >> & | cache | ||
| ) |
| [in] | net | - The initial net. |
| [in] | get_successors | - If true, sequential successors are returned, otherwise sequential predecessors are returned. |
| [in,out] | cache | - The cache. |
Definition at line 461 of file netlist_utils.cpp.
References net.
| std::unique_ptr< Netlist > hal::netlist_utils::get_partial_netlist | ( | const Netlist * | nl, |
| const std::vector< const Gate * > & | subgraph_gates | ||
| ) |
| [in] | nl | - The netlist consisting of the subgraph. |
| [in] | subgraph_gates | - The gates the subgraph is supposed to consist of. |
Definition at line 225 of file netlist_utils.cpp.
References hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and log_error.
Referenced by hal::verilator::VerilatorEngine::setSimulationInput().
| std::vector< Gate * > hal::netlist_utils::get_path | ( | const Gate * | gate, |
| bool | get_successors, | ||
| std::set< GateTypeProperty > | stop_properties | ||
| ) |
Find all gates on the predeccessor or successor path of a gate. Traverses all input or output nets until gates of the specified base types are found. The result may include the provided gate itself.
| [in] | gate | - The initial gate. |
| [in] | get_successors | - If true, the successor path is returned, otherwise the predecessor path is returned. |
| [in] | stop_properties | - Stop recursion when reaching a gate of a type with one of the specified properties. |
NetlistTraversalDecorator::get_gates with a negated condition and TraversalStop::at_mismatch instead. Definition at line 552 of file netlist_utils.cpp.
References get_path().
| std::vector< Gate * > hal::netlist_utils::get_path | ( | const Gate * | gate, |
| bool | get_successors, | ||
| std::set< GateTypeProperty > | stop_properties, | ||
| std::unordered_map< u32, std::vector< Gate * >> & | cache | ||
| ) |
Find all gates on the predecessor or successor path of a gate. Traverses all input or output nets until gates of the specified base types are found. The result may include the provided gate itself. The use of the this cached version is recommended in case of extensive usage to improve performance. The cache will be filled by this function and should initially be provided empty. Different caches for different values of get_successors shall be used.
| [in] | gate | - The initial gate. |
| [in] | get_successors | - If true, the successor path is returned, otherwise the predecessor path is returned. |
| [in] | stop_properties | - Stop recursion when reaching a gate of a type with one of the specified properties. |
| [in,out] | cache | - The cache. |
NetlistTraversalDecorator::get_gates with a negated condition and TraversalStop::at_mismatch instead. Definition at line 531 of file netlist_utils.cpp.
References hal::Gate::get_fan_in_nets(), and hal::Gate::get_fan_out_nets().
Referenced by get_path(), and hal::netlist_utils_init().
| std::vector< Gate * > hal::netlist_utils::get_path | ( | const Net * | net, |
| bool | get_successors, | ||
| std::set< GateTypeProperty > | stop_properties | ||
| ) |
Find all gates on the predecessor or successor path of a net. Traverses all input or output nets until gates of the specified base types are found.
| [in] | net | - The initial net. |
| [in] | get_successors | - If true, the successor path is returned, otherwise the predecessor path is returned. |
| [in] | stop_properties | - Stop recursion when reaching a gate of a type with one of the specified properties. |
NetlistTraversalDecorator::get_gates with a negated condition and TraversalStop::at_mismatch instead. Definition at line 558 of file netlist_utils.cpp.
References get_path(), and net.
| std::vector< Gate * > hal::netlist_utils::get_path | ( | const Net * | net, |
| bool | get_successors, | ||
| std::set< GateTypeProperty > | stop_properties, | ||
| std::unordered_map< u32, std::vector< Gate * >> & | cache | ||
| ) |
Find all gates on the predecessor or successor path of a net. Traverses all input or output nets until gates of the specified base types are found. The use of the this cached version is recommended in case of extensive usage to improve performance. The cache will be filled by this function and should initially be provided empty. Different caches for different values of get_successors shall be used.
| [in] | net | - The initial net. |
| [in] | get_successors | - If true, the successor path is returned, otherwise the predecessor path is returned. |
| [in] | stop_properties | - Stop recursion when reaching a gate of a type with one of the specified properties. |
| [in,out] | cache | - The cache. |
NetlistTraversalDecorator::get_gates with a negated condition and TraversalStop::at_mismatch instead. Definition at line 546 of file netlist_utils.cpp.
References net.
| std::vector< Gate * > hal::netlist_utils::get_shortest_path | ( | Gate * | start_gate, |
| Gate * | end_gate, | ||
| bool | search_both_directions = false |
||
| ) |
Find the shortest path (i.e., the result set with the lowest number of gates) that connects the start gate with the end gate. The gate where the search started from will be the first in the result vector, the end gate will be the last. If there is no such path an empty vector is returned. If there is more than one path with the same length only the first one is returned.
| [in] | start_gate | - The gate to start from. |
| [in] | end_gate | - The gate to connect to. |
| [in] | search_both_directions | - true to additionally check whether a shorter path from end to start exists, false otherwise. |
NetlistTraversalDecorator::get_shortest_path instead. Definition at line 387 of file netlist_utils.cpp.
Referenced by hal::GraphGraphicsView::handleShortestPathToGrouping(), hal::GuiApiClasses::View::isolateModuleToModulePathInNewView(), and hal::netlist_utils_init().
| std::vector< Gate * > hal::netlist_utils::get_shortest_path | ( | Gate * | start_gate, |
| Module * | end_module, | ||
| bool | forward_direction | ||
| ) |
Find the shortest path (i.e., the result set with the lowest number of gates) that connects the start gate with any gate from the given module. The gate where the search started from will be the first in the result vector, the end gate will be the last. If there is no such path an empty vector is returned. If there is more than one path with the same length only the first one is returned.
| [in] | start_gate | - The gate to start from. |
| [in] | end_module | - The module to connect to. |
| [in] | forward_direction | - true to search along the fan-out nets of the start gate, false to search along its fan-in nets. |
NetlistTraversalDecorator::get_shortest_path instead. Definition at line 343 of file netlist_utils.cpp.
References hal::Module::get_gates().
| std::vector< std::vector< Gate * > > hal::netlist_utils::get_shortest_path | ( | Module * | start_module, |
| Module * | end_module | ||
| ) |
Find the shortest path (i.e., the result set with the lowest number of gates) that connects the start module with the target module. There might be more than one connection thus a vector of connecting gate vectors is returned. In each connecting gate vector gate where the search started from will be the first, the end gate will be the last. If there is no such path an empty vector is returned. If there is more than one path with the same length only the first one is returned.
| [in] | start_module | - The module to start from. |
| [in] | end_module | - The module to connect to. |
NetlistTraversalDecorator::get_shortest_path instead. Definition at line 354 of file netlist_utils.cpp.
References hal::Module::get_gates().
| Result< BooleanFunction > hal::netlist_utils::get_subgraph_function | ( | const Net * | net, |
| const std::vector< const Gate * > & | subgraph_gates | ||
| ) |
| [in] | net | - The net for which to generate the Boolean function. |
| [in] | subgraph_gates | - The gates making up the subgraph to consider. |
Definition at line 150 of file netlist_utils.cpp.
References ERR, hal::SubgraphNetlistDecorator::get_subgraph_function(), and net.
| Result< BooleanFunction > hal::netlist_utils::get_subgraph_function | ( | const Net * | net, |
| const std::vector< const Gate * > & | subgraph_gates, | ||
| std::map< std::pair< u32, const GatePin * >, BooleanFunction > & | cache | ||
| ) |
SubgraphNetlistDecorator::make_subgraph_function_cache to share results across calls.| [in] | net | - The net for which to generate the Boolean function. |
| [in] | subgraph_gates | - The gates making up the subgraph to consider. |
| [in,out] | cache | - Unused. |
Definition at line 144 of file netlist_utils.cpp.
Referenced by hal::netlist_utils_init().
| [in] | netlist | - The target netlist. |
| [in] | analyze_inputs | - Set true to dynamically analyze the inputs, false otherwise. |
Definition at line 604 of file netlist_utils.cpp.
References hal::Net::add_destination(), hal::combinational, hal::BooleanFunction::Const(), hal::Netlist::delete_gate(), hal::Netlist::delete_net(), ERR, hal::Gate::get_boolean_functions(), hal::Net::get_destinations(), hal::Gate::get_fan_in_endpoints(), hal::Gate::get_fan_out_endpoints(), hal::Netlist::get_gates(), hal::Netlist::get_gnd_gates(), hal::Gate::get_id(), hal::Net::get_id(), hal::Netlist::get_id(), hal::GateType::get_input_pin_names(), hal::Gate::get_name(), hal::Net::get_name(), hal::BasePin< T >::get_name(), hal::Endpoint::get_net(), hal::Endpoint::get_pin(), hal::Gate::get_type(), hal::Netlist::get_vcc_gates(), hal::ground, hal::GateType::has_property(), OK, hal::power, hal::Net::remove_destination(), hal::BooleanFunction::simplify(), hal::BooleanFunction::substitute(), and hal::BooleanFunction::to_string().
Referenced by hal::netlist_utils_init().
| [in] | netlist | - The target netlist. |
Definition at line 793 of file netlist_utils.cpp.
References hal::Net::add_destination(), ERR, hal::Gate::get_boolean_functions(), hal::Gate::get_fan_in_endpoints(), hal::Netlist::get_gates(), hal::Netlist::get_gnd_gates(), hal::Gate::get_id(), hal::Netlist::get_id(), hal::Gate::get_name(), and OK.
Referenced by hal::netlist_utils_init().
| Result< std::monostate > hal::netlist_utils::replace_gate | ( | Gate * | gate, |
| GateType * | target_type, | ||
| std::map< GatePin *, GatePin * > | pin_map | ||
| ) |
| [in] | gate | - The gate to be replaced. |
| [in] | target_type | - The gate type of the replacement gate. |
| [in] | pin_map | - A map from old to new pins. |
Definition at line 890 of file netlist_utils.cpp.
References ERR, hal::Gate::get_netlist(), OK, and hal::NetlistModificationDecorator::replace_gate().
Referenced by hal::netlist_utils_init().