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_networkclass. Initializesv_storageas a shared pointer.
Constructor for the
virtual_pi_networkclass that takes a network and a shared pointer to avirtual_storageobject. This is used for cloning.- Template Parameters:
Ntk – Network type.
- Parameters:
ntk – Input network.
s – Shared pointer to the
virtual_storageobject to be used by thisvirtual_pi_network.
-
inline virtual_pi_network clone() const
Clones the
virtual_pi_networkobject.
-
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_networkas auint32_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:
trueif the node is a virtual PI,falseotherwise.
-
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:
trueif the node is a real PI,falseotherwise.
-
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:
trueif the node is a virtual CI,falseotherwise.
-
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:
trueif the node is a real CI,falseotherwise.
-
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.
-
struct virtual_storage
-
inline explicit virtual_pi_network()