diff --git a/src/core/balance.rst b/src/core/balance.rst new file mode 100644 index 0000000..2e850f3 --- /dev/null +++ b/src/core/balance.rst @@ -0,0 +1,20 @@ +Balance +============= + +**Header:** ``mockturtle/algorithms/balancing.hpp`` + +Parameters +~~~~~~~~~~ + +.. doxygenstruct:: mockturtle::aig_balancing_params + :members: + +Algorithm +~~~~~~~~~ + +.. doxygenfunction:: mockturtle::aig_balance + +Balancing of a logic network + +This function implements a dynamic-programming and cut-enumeration based balancing algorithm. +It returns a new network of the same type and performs generic balancing by providing a rebalancing function. \ No newline at end of file diff --git a/src/core/resub.rst b/src/core/resub.rst new file mode 100644 index 0000000..064b07f --- /dev/null +++ b/src/core/resub.rst @@ -0,0 +1,80 @@ +Resub +============= + +**Header:** ``mockturtle/algorithms/resubstitution.hpp`` + +Several resubstitution algorithms are implemented and can be called directly, including: + +- ``default_resubstitution`` does functional reduction within a window. + + +Structure +~~~~~~~~~ + +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 depth_view{aig}; + resub_view_t resub_view{depth_view}; + + /* compose the resubstitution framework */ + using validator_t = circuit_validator; + using functor_t = typename detail::sim_aig_resub_functor; + using engine_t = typename detail::simulation_based_resub_engine; + using resub_impl_t = typename detail::resubstitution_impl; + + /* 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: diff --git a/src/core/rewrite.rst b/src/core/rewrite.rst new file mode 100644 index 0000000..cadffe2 --- /dev/null +++ b/src/core/rewrite.rst @@ -0,0 +1,45 @@ +Rewrite +============= + +**Header:** ``mockturtle/algorithms/cut_rewriting.hpp`` + +The following example shows how to rewrite an MIG using precomputed optimum networks. In this case the maximum number of variables for a node function is 4. + +It is possible to change the cost function of nodes in cut rewriting. Here is +an example, in which the cost function only accounts for AND gates in a network, +which corresponds to the multiplicative complexity of a function. + +.. code-block:: c++ + + template + struct mc_cost + { + uint32_t operator()( Ntk const& ntk, node const& n ) const + { + return ntk.is_and( n ) ? 1 : 0; + } + }; + + SomeResynthesisClass resyn; + ntk = cut_rewriting( ntk, resyn ); + +Parameters and statistics +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. doxygenstruct:: mockturtle::cut_rewriting_params + :members: + +.. doxygenstruct:: mockturtle::cut_rewriting_stats + :members: + +Algorithm +~~~~~~~~~ + +.. doxygenfunction:: mockturtle::cut_rewriting +.. doxygenfunction:: mockturtle::cut_rewriting_with_compatibility_graph + +Rewriting functions +~~~~~~~~~~~~~~~~~~~ + +One can use resynthesis functions that can be passed to `node_resynthesis`, see +:ref:`node_resynthesis_functions`.