HAL
hal::Net Class Reference

#include <net.h>

Inheritance diagram for hal::Net:
Inheritance graph
Collaboration diagram for hal::Net:
Collaboration graph

Public Member Functions

bool operator== (const Net &other) const
 
bool operator!= (const Net &other) const
 
ssize_t get_hash () const
 
u32 get_id () const
 
Netlistget_netlist () const
 
const std::string & get_name () const
 
void set_name (const std::string &name)
 
Groupingget_grouping () const
 
Endpointadd_source (Gate *gate, const std::string &pin_name)
 
Endpointadd_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
 
Endpointadd_destination (Gate *gate, const std::string &pin_name)
 
Endpointadd_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
 

Detailed Description

Net class containing information about a net including its source and destination.

Definition at line 57 of file net.h.

Member Function Documentation

◆ add_destination() [1/2]

Endpoint * hal::Net::add_destination ( Gate gate,
const std::string &  pin_name 
)

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.

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

Definition at line 288 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_utils::remove_unused_lut_endpoints().

◆ add_destination() [2/2]

Endpoint * hal::Net::add_destination ( Gate gate,
GatePin pin 
)

Add a destination endpoint to the net. The endpoint is specified by a tuple of a gate and an input pin of that gate.

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

Definition at line 283 of file net.cpp.

◆ add_source() [1/2]

Endpoint * hal::Net::add_source ( Gate gate,
const std::string &  pin_name 
)

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.

Parameters
[in]gate- The gate.
[in]pin_name- The name of an output pin of the gate.
Returns
The endpoint on success, a 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(), and hal::net_init().

◆ add_source() [2/2]

Endpoint * hal::Net::add_source ( Gate gate,
GatePin pin 
)

Add a source endpoint to the net. The endpoint is specified by a tuple of a gate and an output pin of that gate.

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

Definition at line 122 of file net.cpp.

◆ get_destinations()

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.

Parameters
[in]filter- An optional filter.
Returns
A vector of destination endpoints.

Definition at line 426 of file net.cpp.

Referenced by hal::NetlistModificationDecorator::connect_nets(), hal::NetlistTraversalDecorator::get_next_combinational_gates(), hal::NetlistTraversalDecorator::get_next_matching_gates_until_depth(), hal::NetlistTraversalDecorator::get_next_sequential_gates(), hal::net_init(), operator==(), hal::netlist_utils::remove_buffers(), and hal::TEST_F().

◆ get_grouping()

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.

Returns
The grouping.

Definition at line 117 of file net.cpp.

Referenced by hal::net_init().

◆ get_hash()

ssize_t hal::Net::get_hash ( ) const

Hash function for python binding

Returns
Pybind11 compatible hash

Definition at line 83 of file net.cpp.

Referenced by hal::net_init().

◆ get_id()

◆ get_name()

◆ get_netlist()

Netlist * hal::Net::get_netlist ( ) const

Get the netlist this net is associated with.

Returns
The netlist.

Definition at line 93 of file net.cpp.

Referenced by hal::net_init().

◆ get_num_of_destinations()

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.

Parameters
[in]filter- An optional filter.
Returns
The number of destinations.

Definition at line 408 of file net.cpp.

Referenced by hal::VHDLParser::instantiate(), hal::net_init(), and operator==().

◆ get_num_of_sources()

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.

Parameters
[in]filter- An optional filter.
Returns
The number of sources.

Definition at line 246 of file net.cpp.

Referenced by hal::SubgraphNetlistDecorator::get_subgraph_function(), hal::SubgraphNetlistDecorator::get_subgraph_function_inputs(), hal::net_init(), and operator==().

◆ get_sources()

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.

Parameters
[in]filter- An optional filter.
Returns
A vector of source endpoints.

Definition at line 264 of file net.cpp.

Referenced by hal::NetlistModificationDecorator::connect_nets(), hal::NetlistTraversalDecorator::get_next_combinational_gates(), 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::net_init(), operator==(), and hal::TEST_F().

◆ is_a_destination() [1/4]

bool hal::Net::is_a_destination ( const Endpoint ep) const

Check whether an endpoint is a destination of the net.

Parameters
[in]ep- The endpoint.
Returns
true if the endpoint is a destination of the net, false otherwise.

Definition at line 394 of file net.cpp.

References hal::Endpoint::is_destination_pin().

◆ is_a_destination() [2/4]

bool hal::Net::is_a_destination ( const Gate gate) const

Check whether a gate is a destination of the net independent of the pin.

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

Definition at line 349 of file net.cpp.

References log_warning.

Referenced by is_a_destination(), and hal::net_init().

◆ is_a_destination() [3/4]

bool hal::Net::is_a_destination ( const Gate gate,
const GatePin pin 
) const

TODO test 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.

Parameters
[in]gate- The gate.
[in]pin- The input pin of the gate.
Returns
true if the endpoint is a destination of the net, false otherwise.

Definition at line 360 of file net.cpp.

References log_warning.

◆ is_a_destination() [4/4]

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.

Parameters
[in]gate- The gate.
[in]pin_name- The name of an input pin of the gate.
Returns
true if the endpoint is a destination of the net, false otherwise.

Definition at line 377 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.

◆ is_a_source() [1/4]

bool hal::Net::is_a_source ( const Endpoint ep) const

Check whether an endpoint is a source of the net.

Parameters
[in]ep- The endpoint.
Returns
true if the endpoint is a source of the net, false otherwise.

Definition at line 232 of file net.cpp.

References hal::Endpoint::is_source_pin().

◆ is_a_source() [2/4]

bool hal::Net::is_a_source ( const Gate gate) const

Check whether a gate is a source of the net independent of the pin.

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

Definition at line 187 of file net.cpp.

References log_warning.

Referenced by is_a_source(), and hal::net_init().

◆ is_a_source() [3/4]

bool hal::Net::is_a_source ( const Gate gate,
const GatePin pin 
) const

TODO test 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.

Parameters
[in]gate- The gate.
[in]pin- The output pin of the gate.
Returns
true if the endpoint is a source of the net, false otherwise.

Definition at line 198 of file net.cpp.

References log_warning.

◆ is_a_source() [4/4]

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.

Parameters
[in]gate- The gate.
[in]pin_name- The name of an output pin of the gate.
Returns
true if the endpoint is a source of the net, false otherwise.

Definition at line 215 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.

◆ is_global_input_net()

bool hal::Net::is_global_input_net ( ) const

Checks whether this net is a global input net.

Returns
true if the net is a global input net, false otherwise.

Definition at line 480 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(), operator==(), and hal::TEST_F().

◆ is_global_output_net()

bool hal::Net::is_global_output_net ( ) const

Checks whether this net is a global output net.

Returns
true if the net is a global output net, false otherwise.

Definition at line 485 of file net.cpp.

References hal::Netlist::is_global_output_net().

Referenced by hal::NetlistModificationDecorator::connect_nets(), hal::net_init(), operator==(), and hal::TEST_F().

◆ is_gnd_net()

bool hal::Net::is_gnd_net ( ) const

Check whether the net is connected to GND.

Returns
true if the net is connected to GND, false otherwise.

Definition at line 450 of file net.cpp.

Referenced by hal::net_init().

◆ is_unrouted()

bool hal::Net::is_unrouted ( ) const

Check whether the net is unrouted, i.e., it has no source or no destination.

Returns
true if the net is unrouted, false otherwise.

Definition at line 445 of file net.cpp.

Referenced by hal::net_init().

◆ is_vcc_net()

bool hal::Net::is_vcc_net ( ) const

Check whether the net is connected to VCC.

Returns
true if the net is connected to VCC, false otherwise.

Definition at line 455 of file net.cpp.

Referenced by hal::net_init().

◆ mark_global_input_net()

bool hal::Net::mark_global_input_net ( )

Mark this net as a global input net.

Returns
true on success, false otherwise.

Definition at line 460 of file net.cpp.

References hal::Netlist::mark_global_input_net().

Referenced by hal::SubgraphNetlistDecorator::copy_subgraph_netlist(), and hal::net_init().

◆ mark_global_output_net()

bool hal::Net::mark_global_output_net ( )

Mark this net as a global output net.

Returns
true on success, false otherwise.

Definition at line 465 of file net.cpp.

References hal::Netlist::mark_global_output_net().

Referenced by hal::net_init().

◆ operator!=()

bool hal::Net::operator!= ( const Net other) const

Check whether two nets are unequal.

Parameters
[in]other- The net to compare against.
Returns
True if both nets are unequal, false otherwise.

Definition at line 78 of file net.cpp.

References operator==().

◆ operator==()

bool hal::Net::operator== ( const Net other) const

Check whether two nets are equal.

Parameters
[in]other- The net to compare against.
Returns
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!=().

◆ remove_destination() [1/3]

bool hal::Net::remove_destination ( Endpoint ep)

TODO test Remove a destination endpoint from the net.

Parameters
[in]ep- The endpoint.
Returns
true on success, false otherwise.

Definition at line 340 of file net.cpp.

◆ remove_destination() [2/3]

bool hal::Net::remove_destination ( Gate gate,
const GatePin pin 
)

TODO test Remove a destination endpoint from the net. The endpoint is specified by a tuple of a gate and an input pin of that gate.

Parameters
[in]gate- The gate.
[in]pin- The input pin of the gate.
Returns
true on success, false otherwise.

Definition at line 309 of file net.cpp.

◆ remove_destination() [3/3]

bool hal::Net::remove_destination ( Gate gate,
const std::string &  pin_name 
)

TODO test 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.

Parameters
[in]gate- The gate.
[in]pin_name- The name of an input pin of the gate.
Returns
true on success, false otherwise.

Definition at line 319 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(), and hal::netlist_utils::remove_buffers().

◆ remove_source() [1/3]

bool hal::Net::remove_source ( Endpoint ep)

TODO test Remove a source endpoint from the net.

Parameters
[in]ep- The endpoint.
Returns
true on success, false otherwise.

Definition at line 178 of file net.cpp.

◆ remove_source() [2/3]

bool hal::Net::remove_source ( Gate gate,
const GatePin pin 
)

TODO test Remove a source endpoint from the net. The endpoint is specified by a tuple of a gate and an output pin of that gate.

Parameters
[in]gate- The gate.
[in]pin- The output pin of the gate.
Returns
true on success, false otherwise.

Definition at line 148 of file net.cpp.

◆ remove_source() [3/3]

bool hal::Net::remove_source ( Gate gate,
const std::string &  pin_name 
)

TODO test 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.

Parameters
[in]gate- The gate.
[in]pin_name- The name of an output pin of the gate.
Returns
true on success, false otherwise.

Definition at line 157 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().

◆ set_name()

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

Set the name of the net.

Parameters
[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::net_init().

◆ unmark_global_input_net()

bool hal::Net::unmark_global_input_net ( )

Unmark this net as a global input net.

Returns
true on success, false otherwise.

Definition at line 470 of file net.cpp.

References hal::Netlist::unmark_global_input_net().

Referenced by hal::net_init().

◆ unmark_global_output_net()

bool hal::Net::unmark_global_output_net ( )

Unmark this net as a global output net.

Returns
true on success, false otherwise.

Definition at line 475 of file net.cpp.

References hal::Netlist::unmark_global_output_net().

Referenced by hal::net_init().

Friends And Related Function Documentation

◆ NetlistInternalManager

friend class NetlistInternalManager
friend

Definition at line 403 of file net.h.


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