# Path: soap/logger.py
# class levels():
# def set_context(**kwargs):
# def get_context():
# def header(s, l=levels.info):
# def format(*args):
# def log(*args, **kwargs):
# def line(*args, **kwargs):
# def rewrite(*args, **kwargs):
# def persistent(name, *args, **kwargs):
# def unpersistent(*args):
# def local_context(**kwargs):
# def log_level(l):
#     def wrapper(f):
#         def wrapped(*args, **kwargs):
# def log_enable(l):
#     def wrapper(f):
#         def wrapped(*args, **kwargs):
# def log_context(l):
#     def wrapper():
# def _init_level():
# 
# Path: soap/flopoco/common.py
# def cd(d):
# def flopoco_key(fop, we=-1, wf=-1, wi=-1):
# def flopoco(key, file_name=None, dir_name=None):
# def get_luts(file_name):
# def xilinx(file_name, dir_name=None):
# def _datatype_exponent(op, label):
# _FILTER_OPERATORS = operators.TRADITIONAL_OPERATORS + [
#     operators.TERNARY_SELECT_OP
# ]


import itertools
import pickle
import shutil
import tempfile
    import sh
    import sh
from soap import logger
from soap.flopoco.common import cd, template_file, flopoco, xilinx
        from soap.expression import Expr
        from akpytemp import Template
    from multiprocessing import Pool
    from matplotlib import rc
        from matplotlib import pyplot, pylab
        from matplotlib import pyplot
    from soap.transformer.utils import greedy_trace
    from soap.flopoco.common import wf_range
    dir = tempfile.mktemp(suffix='/')
    f = _RTLGenerator(expr, var_env, prec, dir=dir).generate()
    logger.debug('Synthesising', str(expr), 'with precision', prec, 'in', f)
    try:
        return xilinx(f, dir=dir)
    except (sh.ErrorReturnCode, KeyboardInterrupt):
        raise
    finally:
        shutil.rmtree(dir)


def _para_area(i_n_e_v_p):
    i, n, e, v, p = i_n_e_v_p
    try:
        real_area, estimated_area = e.real_area(v, p), e.area(v, p).area
        logger.info(
            '%d/%d, Expr: %s, Prec: %d, Real Area: %d, Estimated Area: %d' %
            (i + 1, n, str(e), p, real_area, estimated_area))
        return real_area, estimated_area
    except sh.ErrorReturnCode:
        logger.error('Unable to synthesise', str(e), 'with precision', p)
    except Exception as exc:
        logger.error('Unknown failure', exc, 'when synthesising', str(e),
                     'with precision', p)


_pool = None


def pool():

# Path: soap/logger.py
# class levels():
# def set_context(**kwargs):
# def get_context():
# def header(s, l=levels.info):
# def format(*args):
# def log(*args, **kwargs):
# def line(*args, **kwargs):
# def rewrite(*args, **kwargs):
# def persistent(name, *args, **kwargs):
# def unpersistent(*args):
# def local_context(**kwargs):
# def log_level(l):
#     def wrapper(f):
#         def wrapped(*args, **kwargs):
# def log_enable(l):
#     def wrapper(f):
#         def wrapped(*args, **kwargs):
# def log_context(l):
#     def wrapper():
# def _init_level():
# 
# Path: soap/flopoco/common.py
# def cd(d):
# def flopoco_key(fop, we=-1, wf=-1, wi=-1):
# def flopoco(key, file_name=None, dir_name=None):
# def get_luts(file_name):
# def xilinx(file_name, dir_name=None):
# def _datatype_exponent(op, label):
# _FILTER_OPERATORS = operators.TRADITIONAL_OPERATORS + [
#     operators.TERNARY_SELECT_OP
# ]


# Path: soap/flopoco/actual.py
import itertools
import pickle
import shutil
import tempfile
    import sh
    import sh
from soap import logger
from soap.flopoco.common import cd, template_file, flopoco, xilinx
        from soap.expression import Expr
        from akpytemp import Template
    from multiprocessing import Pool
    from matplotlib import rc
        from matplotlib import pyplot, pylab
        from matplotlib import pyplot
    from soap.transformer.utils import greedy_trace
    from soap.flopoco.common import wf_range

    dir = tempfile.mktemp(suffix='/')
    f = _RTLGenerator(expr, var_env, prec, dir=dir).generate()
    logger.debug('Synthesising', str(expr), 'with precision', prec, 'in', f)
    try:
        return xilinx(f, dir=dir)
    except (sh.ErrorReturnCode, KeyboardInterrupt):
        raise
    finally:
        shutil.rmtree(dir)


def _para_area(i_n_e_v_p):
    i, n, e, v, p = i_n_e_v_p
    try:
        real_area, estimated_area = e.real_area(v, p), e.area(v, p).area
        logger.info(
            '%d/%d, Expr: %s, Prec: %d, Real Area: %d, Estimated Area: %d' %
            (i + 1, n, str(e), p, real_area, estimated_area))
        return real_area, estimated_area
    except sh.ErrorReturnCode:
        logger.error('Unable to synthesise', str(e), 'with precision', p)
    except Exception as exc:
        logger.error('Unknown failure', exc, 'when synthesising', str(e),
                     'with precision', p)


_pool = None


def pool():

    global _pool