HAL
hal::NetlistModificationDecorator Class Reference

#include <netlist_modification_decorator.h>

Collaboration diagram for hal::NetlistModificationDecorator:
Collaboration graph

Public Member Functions

 NetlistModificationDecorator (Netlist &netlist)
 
Result< std::monostate > delete_modules (const std::function< bool(const Module *)> &filter=nullptr)
 
Result< Gate * > replace_gate (Gate *gate, GateType *target_type, const std::map< GatePin *, GatePin * > &pin_map)
 
Result< Net * > connect_gates (Gate *src_gate, GatePin *src_pin, Gate *dst_gate, GatePin *dst_pin)
 
Result< Net * > connect_nets (Net *master_net, Net *slave_net)
 
Result< std::vector< Net * > > create_gnd_net ()
 
Result< std::vector< Net * > > create_vcc_net ()
 

Detailed Description

A netlist decorator that provides functionality to modify the associated netlist.

Definition at line 40 of file netlist_modification_decorator.h.

Constructor & Destructor Documentation

◆ NetlistModificationDecorator()

hal::NetlistModificationDecorator::NetlistModificationDecorator ( Netlist netlist)

Construct new NetlistModificationDecorator object.

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

Definition at line 11 of file netlist_modification_decorator.cpp.

Member Function Documentation

◆ connect_gates()

Result< Net * > hal::NetlistModificationDecorator::connect_gates ( Gate src_gate,
GatePin src_pin,
Gate dst_gate,
GatePin dst_pin 
)

Connects two gates through the specified pins. If both pins are not yet connected to a net, a new net is created to connect both pins. If one of the pins is already connected to a net, that net is connected to the other pin. If both pins are already connected to a net, an error is returned.

Parameters
[in]src_gate- The source gate.
[in]src_pin- The output pin of the source gate.
[in]dst_gate- The destination gate.
[in]dst_pin- The input pin of the destination gate.
Returns
The connecting net on success, an error otherwise.

Definition at line 119 of file netlist_modification_decorator.cpp.

References hal::Netlist::create_net(), ERR, hal::Gate::get_fan_in_net(), hal::Gate::get_fan_out_net(), hal::Gate::get_id(), hal::Gate::get_name(), hal::BasePin< T >::get_name(), net, and OK.

◆ connect_nets()

Result< Net * > hal::NetlistModificationDecorator::connect_nets ( Net master_net,
Net slave_net 
)

Connects (and thereby merges) two nets. All properties of the slave net are transfered to the master net and the slave net is subsequently deleted.

Parameters
[in]master_net- The net that receives all properties from the slave net.
[in]slave_net- The net that transfers all properties to the master net and is subsequently deleted.
Returns
The merged net on success, an error otherwise.

Definition at line 192 of file netlist_modification_decorator.cpp.

References hal::Net::add_destination(), hal::Net::add_source(), hal::PinGroup< T >::assign_pin(), hal::Netlist::delete_net(), ERR, ERR_APPEND, hal::DataContainer::get_data_map(), hal::Net::get_destinations(), hal::Net::get_id(), hal::Netlist::get_modules(), hal::Net::get_name(), hal::Net::get_sources(), hal::Net::is_global_input_net(), hal::Net::is_global_output_net(), hal::Netlist::mark_global_input_net(), hal::Netlist::mark_global_output_net(), hal::PinGroup< T >::move_pin(), hal::none, OK, hal::Net::remove_destination(), hal::Net::remove_source(), and hal::DataContainer::set_data_map().

◆ create_gnd_net()

Result< std::vector< Net * > > hal::NetlistModificationDecorator::create_gnd_net ( )

Searches for a GND net in the netlist. If there are no existing ones then the function will try to search for a GND gate type in the gate library and create a GND net with corresponding gate source.

Returns
A vector containing the either newly created or all already existing GND nets.

Definition at line 349 of file netlist_modification_decorator.cpp.

References hal::Netlist::create_gate(), hal::Netlist::create_net(), direction, ERR, hal::Netlist::get_gate_library(), hal::GateLibrary::get_gnd_gate_types(), hal::Netlist::get_gnd_nets(), hal::GateLibrary::get_name(), hal::ground, OK, hal::output, and type.

◆ create_vcc_net()

Result< std::vector< Net * > > hal::NetlistModificationDecorator::create_vcc_net ( )

Searches for a VCC net in the netlist. If there are no existing ones then the function will try to search for a VCC gate type in the gate library and create a VCC net with corresponding gate source.

Returns
A vector containing the either newly created or all already existing VCC nets.

Definition at line 411 of file netlist_modification_decorator.cpp.

References hal::Netlist::create_gate(), hal::Netlist::create_net(), direction, ERR, hal::Netlist::get_gate_library(), hal::GateLibrary::get_name(), hal::GateLibrary::get_vcc_gate_types(), hal::Netlist::get_vcc_nets(), OK, hal::output, hal::power, and type.

◆ delete_modules()

Result< std::monostate > hal::NetlistModificationDecorator::delete_modules ( const std::function< bool(const Module *)> &  filter = nullptr)

Delete all modules in the netlist except the top module. An optional filter can be specified to delete only modules fulfilling a certain condition.

Parameters
[in]filter- An optional filter to be applied to the modules before deletion.

Definition at line 15 of file netlist_modification_decorator.cpp.

References hal::Netlist::delete_module(), ERR, hal::Module::get_id(), hal::Netlist::get_id(), hal::Netlist::get_modules(), hal::Module::get_name(), hal::Module::is_top_module(), hal::ShortestPath::module(), and OK.

◆ replace_gate()

Result< Gate * > hal::NetlistModificationDecorator::replace_gate ( Gate gate,
GateType target_type,
const std::map< GatePin *, GatePin * > &  pin_map 
)

Replace the given gate with a gate of the specified gate type. A map from old to new pins must be provided in order to correctly connect the gates inputs and outputs. A pin can be omitted if no connection at that pin is desired.

Parameters
[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.
Returns
The new gate on success, an error otherwise.

Definition at line 31 of file netlist_modification_decorator.cpp.

References hal::Module::assign_gate(), hal::Grouping::assign_gate(), hal::Netlist::create_gate(), hal::Netlist::delete_gate(), ERR, hal::DataContainer::get_data_map(), hal::Gate::get_fan_in_endpoints(), hal::Gate::get_fan_out_endpoints(), hal::Gate::get_grouping(), hal::Gate::get_id(), hal::Gate::get_location(), hal::Gate::get_module(), hal::Gate::get_name(), hal::GateType::get_name(), hal::Gate::get_type(), hal::Module::is_top_module(), OK, and hal::DataContainer::set_data_map().

Referenced by hal::netlist_utils::replace_gate().


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