Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual pi network #543

Open
wants to merge 56 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
73a8d64
:art: experiments_file_cleaned
hibenj Oct 15, 2024
9002bce
:memo: Update pyfiction docstrings
actions-user Oct 15, 2024
bb8f9c4
:art: modified traits.hpp
hibenj Oct 15, 2024
3c0ddeb
Merge remote-tracking branch 'origin/virtual_pi_network' into virtual…
hibenj Oct 15, 2024
77b6867
:art: added docs
hibenj Oct 15, 2024
5aec291
:art: small modifications
hibenj Oct 15, 2024
d06c3cc
:memo: Update pyfiction docstrings
actions-user Oct 15, 2024
a3d07a2
:art: small adjustments
hibenj Oct 16, 2024
55abee5
Merge remote-tracking branch 'origin/virtual_pi_network' into virtual…
hibenj Oct 16, 2024
fbe2eec
:memo: Update pyfiction docstrings
actions-user Oct 16, 2024
940c8af
:art: removed deep copy constructing on top of other network types.
hibenj Oct 16, 2024
366e67a
:memo: Update pyfiction docstrings
actions-user Oct 16, 2024
4dce17d
:art: corrected traits and added name_conservation test case
hibenj Oct 16, 2024
9530ef0
Merge remote-tracking branch 'origin/virtual_pi_network' into virtual…
hibenj Oct 16, 2024
68b1eff
:memo: Update pyfiction docstrings
actions-user Oct 16, 2024
93c3baa
:art: docs updated
hibenj Oct 16, 2024
40eb89b
Merge remote-tracking branch 'origin/virtual_pi_network' into virtual…
hibenj Oct 16, 2024
5c462f9
Merge branch 'main' into virtual_pi_network
hibenj Oct 16, 2024
6e5cd4b
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Oct 16, 2024
5f83617
:art: optimized code coverage and fixed clang-tidy errors
hibenj Oct 17, 2024
4a130c1
Merge remote-tracking branch 'origin/virtual_pi_network' into virtual…
hibenj Oct 17, 2024
ddecd61
:art: fixed function forwarding for foreach functions
hibenj Oct 17, 2024
482bb05
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Oct 17, 2024
e4f5499
:art: fixed clang-tidy warnings for std::optional unchecked access
hibenj Oct 17, 2024
ba87098
Merge remote-tracking branch 'origin/virtual_pi_network' into virtual…
hibenj Oct 17, 2024
c41d1fd
Merge branch 'main' into virtual_pi_network
marcelwa Nov 8, 2024
cfb50db
Merge branch 'main' into virtual_pi_network
hibenj Dec 3, 2024
8abbe4f
Merge remote-tracking branch 'origin/virtual_pi_network' into virtual…
hibenj Dec 3, 2024
548380d
:art: improved code coverage
hibenj Dec 9, 2024
90af75c
Merge branch 'main' into virtual_pi_network
hibenj Dec 9, 2024
2863376
:art: removed clang-tidy errors
hibenj Dec 9, 2024
418f8c5
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Dec 9, 2024
481e0d8
:heavy_plus_sign: virtual_miter added
hibenj Dec 9, 2024
da059df
Merge remote-tracking branch 'origin/virtual_pi_network' into virtual…
hibenj Dec 9, 2024
0e82798
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Dec 9, 2024
db97d7f
:heavy_plus_sign: extended_rank_view added
hibenj Dec 9, 2024
5edd332
:memo: Update pyfiction docstrings
actions-user Dec 9, 2024
a0637a4
:art: better code consistency and readability
hibenj Dec 10, 2024
0fd7942
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Dec 10, 2024
41be15f
:memo: Update pyfiction docstrings
actions-user Dec 10, 2024
726a507
:art: clang tidy corrections
hibenj Dec 10, 2024
05c322d
Merge remote-tracking branch 'origin/virtual_pi_network' into virtual…
hibenj Dec 10, 2024
0c88921
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Dec 10, 2024
e835728
Merge branch 'virtual_pi_network' into extended_rank_view
hibenj Dec 13, 2024
14653f2
:memo: Update pyfiction docstrings
actions-user Dec 13, 2024
b10e337
:heavy_plus_sign: new depth_view and rank_view implementations.
hibenj Jan 2, 2025
1b920d0
Merge remote-tracking branch 'origin/extended_rank_view' into extende…
hibenj Jan 2, 2025
26d02fc
:memo: Update pyfiction docstrings
actions-user Jan 2, 2025
d1a9c04
Merge branch 'main' into extended_rank_view
hibenj Jan 2, 2025
01db414
:memo: Update pyfiction docstrings
actions-user Jan 2, 2025
fade0b4
Merge remote-tracking branch 'origin/extended_rank_view' into extende…
hibenj Jan 2, 2025
0a4555e
Merge branch 'main' into virtual_pi_network
hibenj Jan 2, 2025
3259bfb
Merge branch 'extended_rank_view' into virtual_pi_network
hibenj Jan 2, 2025
09fa50f
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Jan 2, 2025
1cb8605
:art: virtual miter supports update_ranks and update_levels.
hibenj Jan 3, 2025
66c412f
Merge remote-tracking branch 'origin/virtual_pi_network' into virtual…
hibenj Jan 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
252 changes: 252 additions & 0 deletions bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3761,6 +3761,20 @@ Parameter ``neutral_defect_spacing_overwrite``:
A pair of uint16_t values representing the number of horizontal
and vertical SiDBs affected by the given defect type.)doc";

static const char *__doc_fiction_delete_virtual_pis =
R"doc(Deletes virtual primary inputs from a network. This can mainly be used
for equivalence checking. If the network does not have any virtual PIs
stored, the network is returned.

Template parameter ``Ntk``:
The type of network.

Parameter ``ntk``:
The input network.

Returns:
The resulting network after virtual primary inputs are deleted.)doc";

static const char *__doc_fiction_dependent_cell_mode = R"doc(An enumeration of modes for the dependent cell.)doc";

static const char *__doc_fiction_dependent_cell_mode_FIXED =
Expand Down Expand Up @@ -4583,6 +4597,16 @@ Parameter ``bdl_iterator``:

static const char *__doc_fiction_detail_critical_temperature_impl_stats = R"doc(Statistics.)doc";

static const char *__doc_fiction_detail_delete_virtual_pis_impl = R"doc()doc";

static const char *__doc_fiction_detail_delete_virtual_pis_impl_delete_virtual_pis_impl = R"doc()doc";

static const char *__doc_fiction_detail_delete_virtual_pis_impl_ntk = R"doc(Network without virtual PIs.)doc";

static const char *__doc_fiction_detail_delete_virtual_pis_impl_ntk_topo = R"doc(Topological view of the input network.)doc";

static const char *__doc_fiction_detail_delete_virtual_pis_impl_run = R"doc()doc";

static const char *__doc_fiction_detail_delete_wires =
R"doc(This function deletes wires from the provided
`wiring_reduction_layout` based on the specified coordinates and
Expand Down Expand Up @@ -12373,6 +12397,20 @@ Parameter ``m``:

static const char *__doc_fiction_gray_code_iterator_start_number = R"doc(Start number of the iteration.)doc";

static const char *__doc_fiction_handle_virtual_pis =
R"doc(Removes virtual primary inputs from a network if supported. Otherwise
the input network is returned unmodified.

Template parameter ``Ntk``:
The network type.

Parameter ``network``:
The input network to process.

Returns:
The network with virtual primary inputs removed, or the original
network if unsupported.)doc";

static const char *__doc_fiction_has_above = R"doc()doc";

static const char *__doc_fiction_has_assign_charge_state = R"doc()doc";
Expand Down Expand Up @@ -12405,6 +12443,8 @@ static const char *__doc_fiction_has_foreach_incoming_clocked_zone = R"doc()doc"

static const char *__doc_fiction_has_foreach_outgoing_clocked_zone = R"doc()doc";

static const char *__doc_fiction_has_foreach_real_pi = R"doc()doc";

static const char *__doc_fiction_has_foreach_sidb_defect = R"doc()doc";

static const char *__doc_fiction_has_foreach_tile = R"doc()doc";
Expand All @@ -12417,6 +12457,8 @@ static const char *__doc_fiction_has_get_gate_ports = R"doc()doc";

static const char *__doc_fiction_has_get_layout_name = R"doc()doc";

static const char *__doc_fiction_has_get_real_pi = R"doc()doc";

static const char *__doc_fiction_has_get_sidb_defect = R"doc()doc";

static const char *__doc_fiction_has_high_degree_fanin_nodes =
Expand Down Expand Up @@ -12501,6 +12543,10 @@ static const char *__doc_fiction_has_is_outgoing_clocked = R"doc()doc";

static const char *__doc_fiction_has_is_po = R"doc()doc";

static const char *__doc_fiction_has_is_real_pi = R"doc()doc";

static const char *__doc_fiction_has_is_virtual_pi = R"doc()doc";

static const char *__doc_fiction_has_is_wire_tile = R"doc()doc";

static const char *__doc_fiction_has_is_xnor = R"doc()doc";
Expand All @@ -12513,6 +12559,10 @@ static const char *__doc_fiction_has_north_east = R"doc()doc";

static const char *__doc_fiction_has_north_west = R"doc()doc";

static const char *__doc_fiction_has_num_real_pis = R"doc()doc";

static const char *__doc_fiction_has_num_virtual_pis = R"doc()doc";

static const char *__doc_fiction_has_ordinal_operations = R"doc()doc";

static const char *__doc_fiction_has_post_layout_optimization = R"doc()doc";
Expand Down Expand Up @@ -13840,6 +13890,8 @@ static const char *__doc_fiction_is_sidb_lattice_111 = R"doc()doc";

static const char *__doc_fiction_is_tile_based_layout = R"doc()doc";

static const char *__doc_fiction_is_virtual_network_type = R"doc()doc";

static const char *__doc_fiction_jump_point_search =
R"doc(The Jump Point Search (JPS) path finding algorithm for shortest loop-
less paths between a given source and target coordinate in a Cartesian
Expand Down Expand Up @@ -18405,6 +18457,206 @@ static const char *__doc_fiction_vertical_shift_cartesian =
R"doc(\verbatim +-------+ | | | +-------+ | | | +-------+ | | | +-------+
\endverbatim)doc";

static const char *__doc_fiction_virtual_miter =
R"doc(Combines two networks into a combinational miter, similar to
`mockturtle::miter`. Either input network may include virtual primary
inputs (PIs). Virtual PIs are removed during miter construction, and
all edges connected to them are remapped to their corresponding
original PIs, ensuring consistent PI counts when the networks are
equivalent.

The resulting miter connects two networks with the same number of
inputs and produces a single primary output. This output represents
the OR of the XORs of all primary output pairs. Thus, the miter
outputs 1 for any input assignment where the primary outputs of the
two networks differ.

The input networks may have different types. If the two input networks
have mismatched numbers of primary inputs or outputs, the method
returns `nullopt`.

Template parameter ``NtkDest``:
The type of the resulting network.

Template parameter ``NtkSource1``:
The type of the first input network.

Template parameter ``NtkSource2``:
The type of the second input network.

Parameter ``ntk1_in``:
The first input network.

Parameter ``ntk2_in``:
The second input network.

Returns:
An `optional` containing the virtual miter network if successful,
or `nullopt` if the networks are incompatible.)doc";

static const char *__doc_fiction_virtual_pi_network = R"doc()doc";

static const char *__doc_fiction_virtual_pi_network_clone = R"doc(Clones the `virtual_pi_network` object.)doc";

static const char *__doc_fiction_virtual_pi_network_create_virtual_pi =
R"doc(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.

Parameter ``real_pi``:
The node representing the real PI in the network.

Returns:
The signal of the newly created virtual PI.)doc";

static const char *__doc_fiction_virtual_pi_network_foreach_real_ci =
R"doc(Iterates over the virtual CIs of the circuit and applies a given
function.

Template parameter ``Fn``:
The type of the function to be applied.

Parameter ``fn``:
The function to be applied.)doc";

static const char *__doc_fiction_virtual_pi_network_foreach_real_pi =
R"doc(Iterates over the real PIs of the circuit and applies a given
function.

Template parameter ``Fn``:
The type of the function to be applied.

Parameter ``fn``:
The function to be applied.)doc";

static const char *__doc_fiction_virtual_pi_network_foreach_virtual_ci =
R"doc(Iterates over the virtual CIs of the circuit and applies a given
function.

Template parameter ``Fn``:
The type of the function to be applied.

Parameter ``fn``:
The function to be applied.)doc";

static const char *__doc_fiction_virtual_pi_network_foreach_virtual_pi =
R"doc(Iterates over the virtual PIs of the circuit and applies a given
function.

Template parameter ``Fn``:
The type of the function to be applied.

Parameter ``fn``:
The function to be applied.)doc";

static const char *__doc_fiction_virtual_pi_network_get_real_pi =
R"doc(Get the real PI associated with a virtual PI node.

Parameter ``v_pi``:
The virtual pi node to retrieve the real PI for.

Returns:
The real pi associated with the virtual PI node.)doc";

static const char *__doc_fiction_virtual_pi_network_is_real_ci =
R"doc(Check if a given node is a real CI in the `virtual_pi_network`.

Parameter ``n``:
The node to check.

Returns:
`true` if the node is a real CI, `false` otherwise.)doc";

static const char *__doc_fiction_virtual_pi_network_is_real_pi =
R"doc(Check if a given node is a real PI. Real PIs are created with
`create_pi()`.

Parameter ``n``:
The node to check.

Returns:
`true` if the node is a real PI, `false` otherwise.)doc";

static const char *__doc_fiction_virtual_pi_network_is_virtual_ci =
R"doc(Check if a given node is a virtual CI in the `virtual_pi_network`.

Parameter ``n``:
The node to check.

Returns:
`true` if the node is a virtual CI, `false` otherwise.)doc";

static const char *__doc_fiction_virtual_pi_network_is_virtual_pi =
R"doc(Check if a given node is a virtual PI. Virtual PIs are created with
`create_virtual_pi()`.

Parameter ``n``:
The node to check.

Returns:
`true` if the node is a virtual PI, `false` otherwise.)doc";

static const char *__doc_fiction_virtual_pi_network_num_real_cis =
R"doc(Get the number of real CIs in the `virtual_pi_network`.

Returns:
The number of real CIs as a `uint32_t`.)doc";

static const char *__doc_fiction_virtual_pi_network_num_real_pis =
R"doc(Get the number of real PIs in the `virtual_pi_network`.

Returns:
The number of real PIs as a `uint32_t`.)doc";

static const char *__doc_fiction_virtual_pi_network_num_virtual_cis =
R"doc(Get the number of virtual CIs in the `virtual_pi_network`.

Returns:
The number of virtual CIs as a `uint32_t`.)doc";

static const char *__doc_fiction_virtual_pi_network_num_virtual_pis =
R"doc(Get the number of virtual PIs in the `virtual_pi_network`.

Returns:
The number of virtual PIs as a `uint32_t`.)doc";

static const char *__doc_fiction_virtual_pi_network_real_size =
R"doc(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`.)doc";

static const char *__doc_fiction_virtual_pi_network_v_storage = R"doc(Shared pointer of the virtual PI storage.)doc";

static const char *__doc_fiction_virtual_pi_network_virtual_pi_network =
R"doc(Default constructor for the `virtual_pi_network` class. Initializes
`v_storage` as a shared pointer.)doc";

static const char *__doc_fiction_virtual_pi_network_virtual_pi_network_2 =
R"doc(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 parameter ``Ntk``:
Network type.

Parameter ``ntk``:
Input network.

Parameter ``s``:
Shared pointer to the `virtual_storage` object to be used by this
`virtual_pi_network`.)doc";

static const char *__doc_fiction_virtual_pi_network_virtual_storage = R"doc()doc";

static const char *__doc_fiction_virtual_pi_network_virtual_storage_map_virtual_to_real_pi = R"doc(Map from virtual_pis to real_pis.)doc";

static const char *__doc_fiction_virtual_pi_network_virtual_storage_virtual_inputs = R"doc(Vector storing virtual_inputs.)doc";

static const char *__doc_fiction_volume =
R"doc(Computes the volume of a given coordinate assuming its origin is (0,
0, 0). Calculates :math:`(|x| + 1) \cdot (|y| + 1) \cdot (|z| + 1)` by
Expand Down
20 changes: 20 additions & 0 deletions docs/networks/virtual_pi_network.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Technology 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``.

.. tabs::
.. tab:: C++
**Header:** ``fiction/networks/virtual_pi_network.hpp``

.. doxygenclass:: fiction::virtual_pi_network
:members:

.. tab:: Python
.. autoclass:: mnt.pyfiction.virtual_pi_network
:members:
Loading