Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 25 additions & 0 deletions docs/algorithms/balancing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Balancing
---------

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

Parameters and Statistics
~~~~~~~~~~~~~~~~~~~~~~~~~

.. doxygenstruct:: mockturtle::balancing_params
:members:

.. doxygenstruct:: mockturtle::balancing_stats
:members:

Algorithm
~~~~~~~~~

.. doxygenfunction:: mockturtle::balancing

Rebalancing engines
~~~~~~~~~~~~~~~~~~~

**Header:** ``mockturtle/algorithms/balancing/sop_balancing.hpp``

.. doxygenstruct:: mockturtle::sop_balancing
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ v0.2 (not yet released)
- XAG optimization by linear resynthesis (`linear_resynthesis_optimization`, `exact_linear_resynthesis_optimization`) `#296 <https://github.com/lsils/mockturtle/pull/296>`_
- Davio decomposition (`positive_davio_decomposition`, `positive_davio_decomposition`) `#308 <https://github.com/lsils/mockturtle/pull/308>`_
- 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>`_
* 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`) `#181 <https://github.com/lsils/mockturtle/pull/274>`_ `#184 <https://github.com/lsils/mockturtle/pull/274>`_
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Welcome to mockturtle's documentation!
algorithms/node_resynthesis
algorithms/cut_rewriting
algorithms/refactoring
algorithms/balancing
algorithms/mig_algebraic_rewriting
algorithms/akers_synthesis
algorithms/resubstitution
Expand Down
81 changes: 81 additions & 0 deletions experiments/sop_balancing.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/* mockturtle: C++ logic network library
* Copyright (C) 2018-2019 EPFL
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/

#include <string>
#include <fmt/format.h>
#include <lorina/aiger.hpp>
#include <mockturtle/algorithms/balancing.hpp>
#include <mockturtle/algorithms/balancing/sop_balancing.hpp>
#include <mockturtle/io/aiger_reader.hpp>
#include <mockturtle/networks/aig.hpp>
#include <mockturtle/views/depth_view.hpp>

#include <experiments.hpp>

int main()
{
using namespace experiments;
using namespace mockturtle;

experiment<std::string, uint32_t, uint32_t, uint32_t, uint32_t, double, bool, uint32_t, uint32_t, double, bool> exp( "sop_balancing", "benchmark", "size", "depth", "size 4", "depth 4", "RT 4", "cec 4", "size 6", "depth 6", "RT 6", "cec 6" );

sop_rebalancing<aig_network> sop_balancing;

for ( auto const& benchmark : epfl_benchmarks( ~experiments::hyp ) )
{
fmt::print( "[i] processing {}\n", benchmark );
aig_network aig;
lorina::read_aiger( benchmark_path( benchmark ), aiger_reader( aig ) );

balancing_params ps;
balancing_stats st4, st6;

ps.progress = true;
ps.cut_enumeration_ps.cut_size = 4u;
const auto aig4 = balancing( aig, {sop_balancing}, ps, &st4 );

ps.cut_enumeration_ps.cut_size = 6u;
const auto aig6 = balancing( aig, {sop_balancing}, ps, &st6 );

depth_view daig{aig};
depth_view daig4{aig4};
depth_view daig6{aig6};

const auto cec4 = abc_cec( aig4, benchmark );
const auto cec6 = abc_cec( aig6, benchmark );

exp( benchmark,
aig.num_gates(), daig.depth(),
aig4.num_gates(), daig4.depth(),
to_seconds( st4.time_total ), cec4,
aig6.num_gates(), daig6.depth(),
to_seconds( st6.time_total ), cec6 );
}

exp.save();
exp.table();

return 0;
}
Loading