Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
96f0e8f
abcresub library
lee30sonia Jul 6, 2020
7b81b4a
port bill updates
lee30sonia Jul 6, 2020
e0a4aa4
add warnings about PI size in documentations
lee30sonia Jul 6, 2020
dd2ba40
formatting docs
lee30sonia Jul 6, 2020
ac6312f
first try; basic k-resub
lee30sonia Jul 6, 2020
5299ef0
cleanup
lee30sonia Jul 6, 2020
2cf136d
draft of a unified resub framework
lee30sonia Jul 7, 2020
607b9d8
port patch in bill
lee30sonia Jul 7, 2020
9232094
make it work!
lee30sonia Jul 8, 2020
88afeb8
provide stats
lee30sonia Jul 9, 2020
8e588af
sim_resub functor and engine separation
lee30sonia Jul 10, 2020
d2ba5b2
adjust other resub algorithms
lee30sonia Jul 10, 2020
084e6cb
mffc_result_t
lee30sonia Jul 10, 2020
6c9e5e6
fix error & simplify `using`s
lee30sonia Jul 13, 2020
df695e1
fix errors & add test for sim_resub
lee30sonia Jul 13, 2020
ad28127
ordinary sim resub functor (for aig)
lee30sonia Jul 13, 2020
33ae6ba
cleanup exp
lee30sonia Jul 13, 2020
15eac8b
docs
lee30sonia Jul 13, 2020
dc8440a
temporarily not use the callback function to see if this cause the Wi…
lee30sonia Jul 21, 2020
1cd0c58
update mac gcc9 version
lee30sonia Jul 21, 2020
a68e22c
try calling the callback in constructor
lee30sonia Jul 21, 2020
f056499
Merge branch 'lee30sonia/sim_resub' of https://github.com/lsils/mockt…
lee30sonia Jul 21, 2020
cf3b7f4
move callback out of stopwatch
lee30sonia Jul 21, 2020
9f12c6b
make the callback function an argument of `run`, instead of a data me…
lee30sonia Jul 21, 2020
83ff52f
Merge branch 'master' into lee30sonia/sim_resub
lee30sonia Jul 21, 2020
23aab7e
update paper reference
lee30sonia Jul 21, 2020
79c788b
remove TODOs
lee30sonia Jul 21, 2020
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
84 changes: 81 additions & 3 deletions docs/algorithms/resubstitution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ Resubstitution

**Header:** ``mockturtle/algorithms/resubstitution.hpp``

Several resubstitution algorithms are implemented and can be called directly, including:

- ``default_resubstitution`` does functional reduction within a window.

- ``aig_resubstitution``, ``mig_resubstitution`` and ``xmg_resubstitution`` do window-based resubstitution in the corresponding network types.

- ``resubstitution_minmc_withDC`` minimizes multiplicative complexity in XAGs with window-based resubstitution.

- ``sim_resubstitution`` does simulation-guided resubstitution in AIGs or XAGs.


The following example shows how to resubstitute nodes in an MIG.

.. code-block:: c++
Expand All @@ -11,9 +22,10 @@ The following example shows how to resubstitute nodes in an MIG.
mig_network mig = ...;

/* resubstitute nodes */
resubstitution( mig );
mig_resubstitution( mig );
mig = cleanup_dangling( mig );


Parameters and statistics
~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -23,7 +35,73 @@ Parameters and statistics
.. doxygenstruct:: mockturtle::resubstitution_stats
:members:

Algorithm
Structure
~~~~~~~~~

.. doxygenfunction:: mockturtle::resubstitution
In addition to the example algorithms listed above, custom resubstitution algorithms can also be composed.

**Top level**

First, the top-level framework ``detail::resubstitution_impl`` is built-up with a resubstitution engine and a divisor collector.

.. doxygenclass:: mockturtle::detail::resubstitution_impl

.. doxygenfunction:: mockturtle::detail::resubstitution_impl::resubstitution_impl

**ResubEngine**

There are two resubstitution engines implemented: `window_based_resub_engine` and `simulation_based_resub_engine`.

.. doxygenclass:: mockturtle::detail::window_based_resub_engine

.. doxygenclass:: mockturtle::detail::simulation_based_resub_engine

**DivCollector**

Currently, there is only one implementation:

.. doxygenclass:: mockturtle::detail::default_divisor_collector

**Example**

The following example shows how to compose a customized resubstitution algorithm.

.. code-block:: c++

/* derive some AIG */
aig_network aig = ...;

/* prepare the needed views */
using resub_view_t = fanout_view<depth_view<aig_network>>;
depth_view<aig_network> depth_view{aig};
resub_view_t resub_view{depth_view};

/* compose the resubstitution framework */
using validator_t = circuit_validator<Ntk, bill::solvers::bsat2, false, true, false>;
using functor_t = typename detail::sim_aig_resub_functor<resub_view_t, validator_t>;
using engine_t = typename detail::simulation_based_resub_engine<resub_view_t, validator_t, functor_t>;
using resub_impl_t = typename detail::resubstitution_impl<resub_view_t, engine_t>;

/* statistics objects */
resubstitution_stats st;
typename resub_impl_t::engine_st_t engine_st;
typename resub_impl_t::collector_st_t collector_st;

/* instantiate the framework and run it */
resubstitution_params ps;
resub_impl_t p( resub_view, ps, st, engine_st, collector_st );
p.run();

/* report statistics */
st.report();
collector_st.report();
engine_st.report();

Detailed statistics
~~~~~~~~~~~~~~~~~~~

.. doxygenstruct:: mockturtle::detail::window_resub_stats
:members:

.. doxygenstruct:: mockturtle::detail::sim_resub_stats
:members:
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ v0.2 (not yet released)
- Collapse network into single node per output network `#309 <https://github.com/lsils/mockturtle/pull/309>`_
- Generic balancing algorithm `#340 <https://github.com/lsils/mockturtle/pull/340>`_
- Check functional equivalence (`circuit_validator`) `#346 <https://github.com/lsils/mockturtle/pull/346>`_
- Restructured resubstitution framework (`resubstitution`), simulation-guided resubstitution (`sim_resub`) `#373 <https://github.com/lsils/mockturtle/pull/373>`_
* Views:
- Assign names to signals and outputs (`names_view`) `#181 <https://github.com/lsils/mockturtle/pull/181>`_ `#184 <https://github.com/lsils/mockturtle/pull/184>`_
- Creates a CNF while creating a network (`cnf_view`) `#274 <https://github.com/lsils/mockturtle/pull/274>`_
Expand Down
145 changes: 145 additions & 0 deletions experiments/aig_resubstitution.json
Original file line number Diff line number Diff line change
Expand Up @@ -723,5 +723,150 @@
}
],
"version": "fc251b3"
},
{
"entries": [
{
"benchmark": "adder",
"equivalent": true,
"runtime": 0.006387114059180021,
"size_after": 893,
"size_before": 1020
},
{
"benchmark": "bar",
"equivalent": true,
"runtime": 0.021806901320815086,
"size_after": 3336,
"size_before": 3336
},
{
"benchmark": "div",
"equivalent": true,
"runtime": 0.5128353238105774,
"size_after": 52305,
"size_before": 57247
},
{
"benchmark": "hyp",
"equivalent": true,
"runtime": 1.575783133506775,
"size_after": 208375,
"size_before": 214335
},
{
"benchmark": "log2",
"equivalent": true,
"runtime": 0.307009220123291,
"size_after": 32012,
"size_before": 32060
},
{
"benchmark": "max",
"equivalent": true,
"runtime": 0.01488445233553648,
"size_after": 2865,
"size_before": 2865
},
{
"benchmark": "multiplier",
"equivalent": true,
"runtime": 0.25727105140686035,
"size_after": 26971,
"size_before": 27062
},
{
"benchmark": "sin",
"equivalent": true,
"runtime": 0.06176622956991196,
"size_after": 5375,
"size_before": 5416
},
{
"benchmark": "sqrt",
"equivalent": true,
"runtime": 0.2681542932987213,
"size_after": 20526,
"size_before": 24618
},
{
"benchmark": "square",
"equivalent": true,
"runtime": 0.16956447064876556,
"size_after": 18160,
"size_before": 18484
},
{
"benchmark": "arbiter",
"equivalent": true,
"runtime": 0.08660183846950531,
"size_after": 11839,
"size_before": 11839
},
{
"benchmark": "cavlc",
"equivalent": true,
"runtime": 0.014331983402371407,
"size_after": 674,
"size_before": 693
},
{
"benchmark": "ctrl",
"equivalent": true,
"runtime": 0.00372308399528265,
"size_after": 108,
"size_before": 174
},
{
"benchmark": "dec",
"equivalent": true,
"runtime": 0.01071423664689064,
"size_after": 304,
"size_before": 304
},
{
"benchmark": "i2c",
"equivalent": true,
"runtime": 0.011223589070141315,
"size_after": 1241,
"size_before": 1342
},
{
"benchmark": "int2float",
"equivalent": true,
"runtime": 0.0027788400184363127,
"size_after": 236,
"size_before": 260
},
{
"benchmark": "mem_ctrl",
"equivalent": true,
"runtime": 0.4201244115829468,
"size_after": 46446,
"size_before": 46836
},
{
"benchmark": "priority",
"equivalent": true,
"runtime": 0.009349452331662178,
"size_after": 852,
"size_before": 978
},
{
"benchmark": "router",
"equivalent": true,
"runtime": 0.0017743620555847883,
"size_after": 257,
"size_before": 257
},
{
"benchmark": "voter",
"equivalent": true,
"runtime": 0.12908892333507538,
"size_after": 10498,
"size_before": 13758
}
],
"version": "88afeb8"
}
]
1 change: 0 additions & 1 deletion experiments/mig_resubstitution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <lorina/aiger.hpp>
#include <mockturtle/algorithms/mig_resub.hpp>
#include <mockturtle/algorithms/cleanup.hpp>
#include <mockturtle/algorithms/resubstitution.hpp>
#include <mockturtle/io/aiger_reader.hpp>
#include <mockturtle/networks/mig.hpp>

Expand Down
Loading