HAL
hal::SubgraphNetlistDecorator Class Reference

#include <subgraph_netlist_decorator.h>

Collaboration diagram for hal::SubgraphNetlistDecorator:
Collaboration graph

Public Member Functions

 SubgraphNetlistDecorator (const Netlist &netlist)
 
Result< std::unique_ptr< Netlist > > copy_subgraph_netlist (const std::vector< const Gate * > &subgraph_gates, const bool all_global_io=false) const
 
Result< std::unique_ptr< Netlist > > copy_subgraph_netlist (const std::vector< Gate * > &subgraph_gates, const bool all_global_io=false) const
 
Result< std::unique_ptr< Netlist > > copy_subgraph_netlist (const Module *subgraph_module, const bool all_global_io=false) const
 
Result< BooleanFunctionget_subgraph_function (const std::vector< const Gate * > &subgraph_gates, const Net *subgraph_output, std::map< std::pair< u32, const GatePin * >, BooleanFunction > &cache) const
 
Result< BooleanFunctionget_subgraph_function (const std::vector< Gate * > &subgraph_gates, const Net *subgraph_output, std::map< std::pair< u32, const GatePin * >, BooleanFunction > &cache) const
 
Result< BooleanFunctionget_subgraph_function (const Module *subgraph_module, const Net *subgraph_output, std::map< std::pair< u32, const GatePin * >, BooleanFunction > &cache) const
 
Result< BooleanFunctionget_subgraph_function (const std::vector< const Gate * > &subgraph_gates, const Net *subgraph_output) const
 
Result< BooleanFunctionget_subgraph_function (const std::vector< Gate * > &subgraph_gates, const Net *subgraph_output) const
 
Result< BooleanFunctionget_subgraph_function (const Module *subgraph_module, const Net *subgraph_output) const
 
Result< std::set< const Net * > > get_subgraph_function_inputs (const std::vector< const Gate * > &subgraph_gates, const Net *subgraph_output) const
 
Result< std::set< const Net * > > get_subgraph_function_inputs (const std::vector< Gate * > &subgraph_gates, const Net *subgraph_output) const
 
Result< std::set< const Net * > > get_subgraph_function_inputs (const Module *subgraph_module, const Net *subgraph_output) const
 

Detailed Description

A netlist decorator that operates on an existing subgraph of the associated netlist to, e.g., copy the subgraph as a new netlist object or compute a Boolean function describing the subgraph.

Definition at line 40 of file subgraph_netlist_decorator.h.

Constructor & Destructor Documentation

◆ SubgraphNetlistDecorator()

hal::SubgraphNetlistDecorator::SubgraphNetlistDecorator ( const Netlist netlist)

Construct new SubgraphNetlistDecorator object.

Parameters
[in]netlist- The netlist to operate on.

Definition at line 12 of file subgraph_netlist_decorator.cpp.

Member Function Documentation

◆ copy_subgraph_netlist() [1/3]

Result< std::unique_ptr< Netlist > > hal::SubgraphNetlistDecorator::copy_subgraph_netlist ( const Module subgraph_module,
const bool  all_global_io = false 
) const

Get a deep copy of a netlist subgraph including all of its gates and nets, but excluding modules and groupings.

Parameters
[in]subgraph_module- The module making up the subgraph that shall be copied from the netlist.
[in]all_global_io- Set true to mark all nets as global input or output that lost at least one source or destination in the copied netlist, false to only mark them if all sources or destinations were removed. Global inputs and outputs of the parent netlist will always also be annotated as global inputs or outputs. Defaults to false.
Returns
The copied subgraph netlist on success, an error otherwise.

Definition at line 178 of file subgraph_netlist_decorator.cpp.

References copy_subgraph_netlist(), ERR, and hal::Module::get_gates().

◆ copy_subgraph_netlist() [2/3]

Result< std::unique_ptr< Netlist > > hal::SubgraphNetlistDecorator::copy_subgraph_netlist ( const std::vector< const Gate * > &  subgraph_gates,
const bool  all_global_io = false 
) const

Get a deep copy of a netlist subgraph including all of its gates and nets, but excluding modules and groupings.

Parameters
[in]subgraph_gates- The gates making up the subgraph that shall be copied from the netlist.
[in]all_global_io- Set true to mark all nets as global input or output that lost at least one source or destination in the copied netlist, false to only mark them if all sources or destinations were removed. Global inputs and outputs of the parent netlist will always also be annotated as global inputs or outputs. Defaults to false.
Returns
The copied subgraph netlist on success, an error otherwise.

Definition at line 16 of file subgraph_netlist_decorator.cpp.

References hal::Gate::add_boolean_function(), hal::netlist_factory::create_netlist(), hal::Module::create_pin(), ERR_APPEND, hal::Netlist::get_design_name(), hal::Netlist::get_device_name(), hal::Netlist::get_free_gate_ids(), hal::Netlist::get_free_grouping_ids(), hal::Netlist::get_free_module_ids(), hal::Netlist::get_free_net_ids(), hal::Netlist::get_gate_library(), hal::Netlist::get_gates(), hal::Netlist::get_input_filename(), hal::Module::get_input_nets(), hal::Netlist::get_net_by_id(), hal::Netlist::get_next_gate_id(), hal::Netlist::get_next_grouping_id(), hal::Netlist::get_next_module_id(), hal::Netlist::get_next_net_id(), hal::Module::get_output_nets(), hal::Netlist::get_used_gate_ids(), hal::Netlist::get_used_grouping_ids(), hal::Netlist::get_used_module_ids(), hal::Netlist::get_used_net_ids(), hal::Net::mark_global_input_net(), name, net, OK, hal::DataContainer::set_data_map(), and hal::Module::update_nets().

Referenced by copy_subgraph_netlist(), and hal::netlist_utils::get_partial_netlist().

◆ copy_subgraph_netlist() [3/3]

Result< std::unique_ptr< Netlist > > hal::SubgraphNetlistDecorator::copy_subgraph_netlist ( const std::vector< Gate * > &  subgraph_gates,
const bool  all_global_io = false 
) const

Get a deep copy of a netlist subgraph including all of its gates and nets, but excluding modules and groupings.

Parameters
[in]subgraph_gates- The gates making up the subgraph that shall be copied from the netlist.
[in]all_global_io- Set true to mark all nets as global input or output that lost at least one source or destination in the copied netlist, false to only mark them if all sources or destinations were removed. Global inputs and outputs of the parent netlist will always also be annotated as global inputs or outputs. Defaults to false.
Returns
The copied subgraph netlist on success, an error otherwise.

Definition at line 165 of file subgraph_netlist_decorator.cpp.

References copy_subgraph_netlist(), and ERR.

◆ get_subgraph_function() [1/6]

Result< BooleanFunction > hal::SubgraphNetlistDecorator::get_subgraph_function ( const Module subgraph_module,
const Net subgraph_output 
) const

Get the combined Boolean function of a subgraph of combinational gates starting at the source of the provided subgraph output net. The variables of the resulting Boolean function are created from the subgraph input nets using BooleanFunctionNetDecorator::get_boolean_variable.

Parameters
[in]subgraph_module- The module making up the subgraph to consider.
[in]subgraph_output- The subgraph oputput net for which to generate the Boolean function.
Returns
The combined Boolean function of the subgraph on success, an error otherwise.

Definition at line 469 of file subgraph_netlist_decorator.cpp.

References ERR, hal::Module::get_gates(), and get_subgraph_function().

◆ get_subgraph_function() [2/6]

Result< BooleanFunction > hal::SubgraphNetlistDecorator::get_subgraph_function ( const Module subgraph_module,
const Net subgraph_output,
std::map< std::pair< u32, const GatePin * >, BooleanFunction > &  cache 
) const

Get the combined Boolean function of a subgraph of combinational gates starting at the source of the provided subgraph output net. The variables of the resulting Boolean function are created from the subgraph input nets using BooleanFunctionNetDecorator::get_boolean_variable. Utilizes a cache for speedup on consecutive calls.

Parameters
[in]subgraph_module- The module making up the subgraph to consider.
[in]subgraph_output- The subgraph oputput net for which to generate the Boolean function.
[in,out]cache- Cache to speed up computations. The cache is filled by this function.
Returns
The combined Boolean function of the subgraph on success, an error otherwise.

Definition at line 431 of file subgraph_netlist_decorator.cpp.

References ERR, hal::Module::get_gates(), and get_subgraph_function().

◆ get_subgraph_function() [3/6]

Result< BooleanFunction > hal::SubgraphNetlistDecorator::get_subgraph_function ( const std::vector< const Gate * > &  subgraph_gates,
const Net subgraph_output 
) const

Get the combined Boolean function of a subgraph of combinational gates starting at the source of the provided subgraph output net. The variables of the resulting Boolean function are created from the subgraph input nets using BooleanFunctionNetDecorator::get_boolean_variable.

Parameters
[in]subgraph_gates- The gates making up the subgraph to consider.
[in]subgraph_output- The subgraph oputput net for which to generate the Boolean function.
Returns
The combined Boolean function of the subgraph on success, an error otherwise.

Definition at line 443 of file subgraph_netlist_decorator.cpp.

References ERR, and get_subgraph_function().

◆ get_subgraph_function() [4/6]

Result< BooleanFunction > hal::SubgraphNetlistDecorator::get_subgraph_function ( const std::vector< const Gate * > &  subgraph_gates,
const Net subgraph_output,
std::map< std::pair< u32, const GatePin * >, BooleanFunction > &  cache 
) const

Get the combined Boolean function of a subgraph of combinational gates starting at the source of the provided subgraph output net. The variables of the resulting Boolean function are created from the subgraph input nets using BooleanFunctionNetDecorator::get_boolean_variable. Utilizes a cache for speedup on consecutive calls.

Parameters
[in]subgraph_gates- The gates making up the subgraph to consider.
[in]subgraph_output- The subgraph oputput net for which to generate the Boolean function.
[in,out]cache- Cache to speed up computations. The cache is filled by this function.
Returns
The combined Boolean function of the subgraph on success, an error otherwise.

Definition at line 371 of file subgraph_netlist_decorator.cpp.

References ERR, test_plugin::g, hal::Net::get_id(), hal::Net::get_name(), hal::Net::get_num_of_sources(), hal::Net::get_sources(), hal::Net::is_global_input_net(), and OK.

Referenced by hal::netlist_utils::get_subgraph_function(), and get_subgraph_function().

◆ get_subgraph_function() [5/6]

Result< BooleanFunction > hal::SubgraphNetlistDecorator::get_subgraph_function ( const std::vector< Gate * > &  subgraph_gates,
const Net subgraph_output 
) const

Get the combined Boolean function of a subgraph of combinational gates starting at the source of the provided subgraph output net. The variables of the resulting Boolean function are created from the subgraph input nets using BooleanFunctionNetDecorator::get_boolean_variable.

Parameters
[in]subgraph_gates- The gates making up the subgraph to consider.
[in]subgraph_output- The subgraph oputput net for which to generate the Boolean function.
Returns
The combined Boolean function of the subgraph on success, an error otherwise.

Definition at line 456 of file subgraph_netlist_decorator.cpp.

References ERR, and get_subgraph_function().

◆ get_subgraph_function() [6/6]

Result< BooleanFunction > hal::SubgraphNetlistDecorator::get_subgraph_function ( const std::vector< Gate * > &  subgraph_gates,
const Net subgraph_output,
std::map< std::pair< u32, const GatePin * >, BooleanFunction > &  cache 
) const

Get the combined Boolean function of a subgraph of combinational gates starting at the source of the provided subgraph output net. The variables of the resulting Boolean function are created from the subgraph input nets using BooleanFunctionNetDecorator::get_boolean_variable. Utilizes a cache for speedup on consecutive calls.

Parameters
[in]subgraph_gates- The gates making up the subgraph to consider.
[in]subgraph_output- The subgraph oputput net for which to generate the Boolean function.
[in,out]cache- Cache to speed up computations. The cache is filled by this function.
Returns
The combined Boolean function of the subgraph on success, an error otherwise.

Definition at line 415 of file subgraph_netlist_decorator.cpp.

References ERR, and get_subgraph_function().

◆ get_subgraph_function_inputs() [1/3]

Result< std::set< const Net * > > hal::SubgraphNetlistDecorator::get_subgraph_function_inputs ( const Module subgraph_module,
const Net subgraph_output 
) const

Get the inputs of the combined Boolean function of a subgraph of combinational gates starting at the source of the provided subgraph output net. This does not actually build the boolean function but only determines the inputs the subgraph function would have, which is a lot faster.

Parameters
[in]subgraph_module- The module making up the subgraph to consider.
[in]subgraph_output- The subgraph oputput net from which to start the back propagation from.
Returns
The input nets that would be the input for the subgraph function on success, an error otherwise;

Definition at line 528 of file subgraph_netlist_decorator.cpp.

References hal::Module::get_gates(), and get_subgraph_function_inputs().

◆ get_subgraph_function_inputs() [2/3]

Result< std::set< const Net * > > hal::SubgraphNetlistDecorator::get_subgraph_function_inputs ( const std::vector< const Gate * > &  subgraph_gates,
const Net subgraph_output 
) const

Get the inputs of the combined Boolean function of a subgraph of combinational gates starting at the source of the provided subgraph output net. This does not actually build the boolean function but only determines the inputs the subgraph function would have, which is a lot faster.

Parameters
[in]subgraph_gates- The subgraph gates making up the subgraph to consider.
[in]subgraph_output- The subgraph oputput net from which to start the back propagation from.
Returns
The input nets that would be the input for the subgraph function on success, an error otherwise;

Definition at line 481 of file subgraph_netlist_decorator.cpp.

References ERR, test_plugin::g, hal::Net::get_id(), hal::Net::get_name(), hal::Net::get_num_of_sources(), hal::Net::get_sources(), hal::Net::is_global_input_net(), and OK.

Referenced by get_subgraph_function_inputs().

◆ get_subgraph_function_inputs() [3/3]

Result< std::set< const Net * > > hal::SubgraphNetlistDecorator::get_subgraph_function_inputs ( const std::vector< Gate * > &  subgraph_gates,
const Net subgraph_output 
) const

Get the inputs of the combined Boolean function of a subgraph of combinational gates starting at the source of the provided subgraph output net. This does not actually build the boolean function but only determines the inputs the subgraph function would have, which is a lot faster.

Parameters
[in]subgraph_gates- The subgraph gates making up the subgraph to consider.
[in]subgraph_output- The subgraph oputput net from which to start the back propagation from.
Returns
The input nets that would be the input for the subgraph function on success, an error otherwise;

Definition at line 522 of file subgraph_netlist_decorator.cpp.

References get_subgraph_function_inputs().


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