# 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
                    i.e.op
                    if i != out_port:
                        signals.add(i)
                except AttributeError:
                    pass
            wires.add((op, wire_name(in1), wire_name(in2), wire_name(out)))

        for out, e in ls.items():
            try:
                op, in1, in2 = e.op, e.a1, e.a2
                wire(op, in1, in2, out)
                ops.add(e.op)
            except AttributeError:
                pass
        in_ports = [i.port_name() for i in in_ports]
        out_port = 'p_out'
        signals = [i.signal_name() for i in signals]
        logger.debug(in_ports, signals, wires)
        Template(path=template_file).save(
            path=self.f, directory=self.dir, flopoco=flopoco,
            ops=ops, e=self.expr,
            we=self.we, wf=self.wf,
            in_ports=in_ports, out_port=out_port,
            signals=signals, wires=wires)
        return self.f


def actual_luts(expr, var_env, prec):
    dir = tempfile.mktemp(suffix='/')
    f = _RTLGenerator(expr, var_env, prec, dir=dir).generate()

# 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

                    i.e.op
                    if i != out_port:
                        signals.add(i)
                except AttributeError:
                    pass
            wires.add((op, wire_name(in1), wire_name(in2), wire_name(out)))

        for out, e in ls.items():
            try:
                op, in1, in2 = e.op, e.a1, e.a2
                wire(op, in1, in2, out)
                ops.add(e.op)
            except AttributeError:
                pass
        in_ports = [i.port_name() for i in in_ports]
        out_port = 'p_out'
        signals = [i.signal_name() for i in signals]
        logger.debug(in_ports, signals, wires)
        Template(path=template_file).save(
            path=self.f, directory=self.dir, flopoco=flopoco,
            ops=ops, e=self.expr,
            we=self.we, wf=self.wf,
            in_ports=in_ports, out_port=out_port,
            signals=signals, wires=wires)
        return self.f


def actual_luts(expr, var_env, prec):
    dir = tempfile.mktemp(suffix='/')
    f = _RTLGenerator(expr, var_env, prec, dir=dir).generate()

    logger.debug('Synthesising', str(expr), 'with precision', prec, 'in', f)