Virtual PI Network

A logic network type that extends any mockturtle logic network. It enables copies of PIs, called virtual PIs. Virtual PIs are created by passing an existing real_pi to the create_virtual_pi function. This function calls the create_pi function of the extended network and stores the newly created virtual_pi in a node map, which maps it to the originating real_pi. Additionally, delete_virtual_pis returns a network with all virtual_pi nodes removed and reassigns the edges connected to them to the corresponding real_pi node stored in the node_map.

Header: fiction/networks/virtual_pi_network.hpp

template<typename Ntk>
class virtual_pi_network : public Ntk

Public Functions

inline explicit virtual_pi_network()

Default constructor for the virtual_pi_network class. Initializes v_storage as a shared pointer.

inline explicit virtual_pi_network(const Ntk &ntk, std::shared_ptr<virtual_storage> s)

Constructor for the virtual_pi_network class that takes a network and a shared pointer to a virtual_storage object. This is used for cloning.

Template Parameters:

Ntk – Network type.

Parameters:
inline virtual_pi_network clone() const

Clones the virtual_pi_network object.

inline uint32_t real_size() const

Calculate the real size of the virtual_pi_network.

The real size of the network is considered the size without virtual PIs.

Returns:

The real size of the virtual_pi_network as a uint32_t.

inline bool is_virtual_pi(node const &n) const

Check if a given node is a virtual PI. Virtual PIs are created with create_virtual_pi().

Parameters:

n – The node to check.

Returns:

true if the node is a virtual PI, false otherwise.

inline bool is_real_pi(node const &n) const

Check if a given node is a real PI. Real PIs are created with create_pi().

Parameters:

n – The node to check.

Returns:

true if the node is a real PI, false otherwise.

inline signal create_virtual_pi(const signal &real_pi)

Create a virtual PI, which is a mapping to a real PI.

This function adds a PI to the parent network, but marks it as virtual and stores a mapping to a real PI.

Parameters:

real_pi – The node representing the real PI in the network.

Returns:

The signal of the newly created virtual PI.

inline bool is_virtual_ci(node const &n) const

Check if a given node is a virtual CI in the virtual_pi_network.

Parameters:

n – The node to check.

Returns:

true if the node is a virtual CI, false otherwise.

inline bool is_real_ci(node const &n) const

Check if a given node is a real CI in the virtual_pi_network.

Parameters:

n – The node to check.

Returns:

true if the node is a real CI, false otherwise.

inline uint32_t num_virtual_cis() const

Get the number of virtual CIs in the virtual_pi_network.

Returns:

The number of virtual CIs as a uint32_t.

inline uint32_t num_real_cis() const

Get the number of real CIs in the virtual_pi_network.

Returns:

The number of real CIs as a uint32_t.

inline uint32_t num_virtual_pis() const

Get the number of virtual PIs in the virtual_pi_network.

Returns:

The number of virtual PIs as a uint32_t.

inline uint32_t num_real_pis() const

Get the number of real PIs in the virtual_pi_network.

Returns:

The number of real PIs as a uint32_t.

inline node get_real_pi(const node &v_pi) const

Get the real PI associated with a virtual PI node.

Parameters:

v_pi – The virtual pi node to retrieve the real PI for.

Returns:

The real pi associated with the virtual PI node.

template<typename Fn>
inline void foreach_real_pi(Fn &&fn) const

Iterates over the real PIs of the circuit and applies a given function.

Template Parameters:

Fn – The type of the function to be applied.

Parameters:

fn – The function to be applied.

template<typename Fn>
inline void foreach_virtual_pi(Fn &&fn) const

Iterates over the virtual PIs of the circuit and applies a given function.

Template Parameters:

Fn – The type of the function to be applied.

Parameters:

fn – The function to be applied.

template<typename Fn>
inline void foreach_real_ci(Fn &&fn) const

Iterates over the virtual CIs of the circuit and applies a given function.

Template Parameters:

Fn – The type of the function to be applied.

Parameters:

fn – The function to be applied.

template<typename Fn>
inline void foreach_virtual_ci(Fn &&fn) const

Iterates over the virtual CIs of the circuit and applies a given function.

Template Parameters:

Fn – The type of the function to be applied.

Parameters:

fn – The function to be applied.

struct virtual_storage

Public Members

std::vector<node> virtual_inputs = {}

Vector storing virtual_inputs.

phmap::parallel_flat_hash_map<node, node> map_virtual_to_real_pi = {}

Map from virtual_pis to real_pis.