Balancing

Header: mockturtle/algorithms/balancing.hpp

Parameters and Statistics

struct balancing_params

Parameters for balancing.

Public Members

cut_enumeration_params cut_enumeration_ps

Cut enumeration params.

bool only_on_critical_path = {false}

Optimize only on critical path.

bool progress = {false}

Show progress.

bool verbose = {false}

Be verbose.

struct balancing_stats

Statistics for balancing.

Public Functions

inline void report() const

Prints report.

Public Members

stopwatch::duration time_total = {}

Total run-time.

cut_enumeration_stats cut_enumeration_st

Cut enumeration run-time.

Algorithm

template<class Ntk>
Ntk mockturtle::sop_balancing(Ntk const &ntk, lut_map_params const &ps = {}, lut_map_stats *pst = nullptr)

SOP balancing of a logic network.

This function implements an LUT-based SOP balancing algorithm. It returns a new network of the same type and performs generic balancing by providing a rebalancing function.

template<class Ntk>
Ntk mockturtle::esop_balancing(Ntk const &ntk, lut_map_params const &ps = {}, lut_map_stats *pst = nullptr)

ESOP balancing of a logic network.

This function implements an LUT-based ESOP balancing algorithm. It returns a new network of the same type and performs generic balancing by providing a rebalancing function.

template<class Ntk, class CostFn = unit_cost<Ntk>>
Ntk mockturtle::balancing(Ntk const &ntk, rebalancing_function_t<Ntk> const &rebalancing_fn = {}, balancing_params const &ps = {}, balancing_stats *pst = nullptr)

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.

The template parameter CostFn is only used to compute the critical paths, when the only_on_critical_path parameter is assigned true. Note that the size for rewriting candidates is computed by the rebalancing function and may not correspond to the cost given by CostFn.

Example

const auto aig = ...;

sop_rebalancing<aig_network> balance_fn;
balancing_params ps;
ps.cut_enumeration_ps.cut_size = 6u;
const auto balanced_aig = balancing( aig, {balance_fn}, ps );

Rebalancing engines

Header: mockturtle/algorithms/balancing/sop_balancing.hpp

template<class Ntk>
struct sop_rebalancing

SOP rebalancing function.

This class can be used together with the generic balancing function. It converts each cut function into an SOP and then performs weight-oriented tree balancing on the AND terms and the outer OR function.

Header: mockturtle/algorithms/balancing/esop_balancing.hpp

template<class Ntk>
struct esop_rebalancing