Exemple #1
0
    def __init__(
        self,
        arg_template=DefaultEntityArgTemplate,
        precision=ML_Binary32,
        libm_compliant=True,
        debug_flag=False,
        target=VHDLBackend(),
        output_file="fp_adder.vhd",
        entity_name="fp_adder",
        language=VHDL_Code,
    ):
        # initializing I/O precision
        precision = ArgDefault.select_value(
            [arg_template.precision, precision])
        io_precisions = [precision] * 2

        # initializing base class
        ML_EntityBasis.__init__(self,
                                base_name="fp_adder",
                                entity_name=entity_name,
                                output_file=output_file,
                                io_precisions=io_precisions,
                                backend=target,
                                debug_flag=debug_flag,
                                language=language,
                                arg_template=arg_template)

        self.precision = precision
Exemple #2
0
    def __init__(self,
                 arg_template=DefaultEntityArgTemplate,
                 precision=ML_Binary32,
                 accuracy=ML_Faithful,
                 libm_compliant=True,
                 debug_flag=False,
                 fuse_fma=True,
                 fast_path_extract=True,
                 target=VHDLBackend(),
                 output_file="fp_fma.vhd",
                 entity_name="fp_fma",
                 language=VHDL_Code,
                 vector_size=1):
        # initializing I/O precision
        precision = ArgDefault.select_value(
            [arg_template.precision, precision])
        io_precisions = [precision] * 2

        # initializing base class
        ML_EntityBasis.__init__(self,
                                base_name="fp_fma",
                                entity_name=entity_name,
                                output_file=output_file,
                                io_precisions=io_precisions,
                                abs_accuracy=None,
                                backend=target,
                                fuse_fma=fuse_fma,
                                fast_path_extract=fast_path_extract,
                                debug_flag=debug_flag,
                                language=language,
                                arg_template=arg_template)

        self.accuracy = accuracy
        self.precision = precision
Exemple #3
0
    def __init__(self,
                 arg_template=DefaultEntityArgTemplate,
                 precision=HdlVirtualFormat(ML_Binary32),
                 accuracy=ML_Faithful,
                 debug_flag=False,
                 target=VHDLBackend(),
                 output_file="fp_mpfma.vhd",
                 entity_name="fp_mpfma",
                 language=VHDL_Code,
                 acc_prec=None,
                 pipelined=False):
        # initializing I/O precision
        precision = ArgDefault.select_value(
            [arg_template.precision, precision])
        io_precisions = [precision] * 2

        # initializing base class
        ML_EntityBasis.__init__(self,
                                base_name="fp_mpfma",
                                entity_name=entity_name,
                                output_file=output_file,
                                io_precisions=io_precisions,
                                backend=target,
                                debug_flag=debug_flag,
                                language=language,
                                arg_template=arg_template)

        self.accuracy = accuracy
        # main precision (used for product operand and default for accumulator)
        self.precision = precision
        # accumulator precision
        self.acc_precision = precision if acc_prec is None else acc_prec
        # enable operator pipelining
        self.pipelined = pipelined
Exemple #4
0
    def __init__(self, arg_template=DefaultEntityArgTemplate):
        # initializing I/O precision

        # initializing base class
        ML_EntityBasis.__init__(self, arg_template=arg_template)

        self.precision = arg_template.precision
Exemple #5
0
    def __init__(self, arg_template=None):
        """ Initialize """
        # building default arg_template if necessary
        arg_template = SubComponentInstance.get_default_args() if \
            arg_template is None else arg_template
        # initializing I/O precision
        self.width = arg_template.width
        precision = arg_template.precision
        io_precisions = [precision] * 2
        Log.report(
            Log.Info,
            "generating Adaptative Entity with width={}".format(self.width)
        )

        # initializing base class
        ML_EntityBasis.__init__(self,
                                base_name="adaptative_design",
                                arg_template=arg_template
                                )

        self.accuracy = arg_template.accuracy
        self.precision = arg_template.precision

        int_size = 3
        frac_size = 7

        self.input_precision = fixed_point(int_size, frac_size)
        self.output_precision = fixed_point(int_size, frac_size)
Exemple #6
0
    def __init__(
        self,
        arg_template=DefaultEntityArgTemplate,
    ):

        # initializing base class
        ML_EntityBasis.__init__(self, arg_template=arg_template)

        self.pipelined = arg_template.pipelined
Exemple #7
0
    def __init__(self, arg_template=None):
        # initializing I/O precision
        precision = arg_template.precision
        io_precisions = [precision] * 2

        # initializing base class
        ML_EntityBasis.__init__(self,
                                base_name="ut_rtl_report",
                                arg_template=arg_template)

        self.precision = arg_template.precision
Exemple #8
0
    def __init__(self, arg_template=None):
        # building default arg_template if necessary
        arg_template = CompoundAdder.get_default_args(
        ) if arg_template is None else arg_template

        # initializing base class
        ML_EntityBasis.__init__(self,
                                base_name="compound_adder",
                                arg_template=arg_template)

        self.accuracy = arg_template.accuracy
        self.precision = arg_template.precision
        self.lower_limit = arg_template.lower_limit
    def __init__(self, arg_template=None):
        """ Initialize """
        # building default arg_template if necessary
        arg_template = UT_FixedPointPosition.get_default_args() if \
            arg_template is None else arg_template

        # initializing base class
        ML_EntityBasis.__init__(self,
                                base_name="ut_fixed_point_position",
                                arg_template=arg_template)

        self.accuracy = arg_template.accuracy
        self.precision = arg_template.precision
        # extra width parameter
        self.width = arg_template.width
Exemple #10
0
    def __init__(self, arg_template=None):
        # building default arg_template if necessary
        arg_template = ML_LeadingZeroCounter.get_default_args(
        ) if arg_template is None else arg_template
        # initializing I/O precision
        self.width = arg_template.width
        precision = arg_template.precision
        io_precisions = [precision] * 2
        Log.report(Log.Info, "generating LZC with width={}".format(self.width))

        # initializing base class
        ML_EntityBasis.__init__(self,
                                base_name="ml_lzc",
                                arg_template=arg_template)

        self.accuracy = arg_template.accuracy
        self.precision = arg_template.precision
Exemple #11
0
    def __init__(self, arg_template=None):
        """ Initialize """
        # building default arg_template if necessary
        arg_template = UTSpecialValues.get_default_args() if \
            arg_template is None else arg_template
        # initializing I/O precision
        precision = arg_template.precision
        io_precisions = [precision] * 2
        self.width = 17

        # initializing base class
        ML_EntityBasis.__init__(self,
                                base_name="adaptative_design",
                                arg_template=arg_template)

        self.accuracy = arg_template.accuracy
        self.precision = arg_template.precision
Exemple #12
0
    def __init__(self, arg_template=None):
        # building default arg_template if necessary
        arg_template = ML_UT_EntityPass.get_default_args(
        ) if arg_template is None else arg_template
        # initializing I/O precision
        self.width = arg_template.width
        precision = arg_template.precision
        io_precisions = [precision] * 2
        Log.report(Log.Info, "generating LZC with width={}".format(self.width))

        # initializing base class
        ML_EntityBasis.__init__(self,
                                base_name="ml_lzc",
                                arg_template=arg_template)

        pass_scheduler = self.get_pass_scheduler()
        pass_5 = LocalPass("pass 5", 5)
        pass_3 = LocalPass("pass 3", 3)
        pass_4 = LocalPass("pass 4", 4)
        pass_1 = LocalPass("pass 1", 1)
        pass_2 = LocalPass("pass 2", 2)
        pass_3_deps = CombineAnd(
            AfterPassById(pass_5.get_pass_id()),
            CombineAnd(AfterPassById(pass_2.get_pass_id()),
                       AfterPassByClass(LocalPass)))
        pass_4_deps = CombineAnd(AfterPassById(pass_3.get_pass_id()),
                                 pass_3_deps)
        pass_5_deps = CombineOr(AfterPassById(pass_3.get_pass_id()),
                                AfterPassById(pass_2.get_pass_id()))
        # registerting pass in arbitrary order
        pass_scheduler.register_pass(pass_4,
                                     pass_dep=pass_4_deps,
                                     pass_slot=PassScheduler.JustBeforeCodeGen)
        pass_scheduler.register_pass(pass_5,
                                     pass_dep=pass_5_deps,
                                     pass_slot=PassScheduler.JustBeforeCodeGen)
        pass_scheduler.register_pass(pass_3,
                                     pass_dep=pass_3_deps,
                                     pass_slot=PassScheduler.JustBeforeCodeGen)
        pass_scheduler.register_pass(pass_1, pass_slot=PassScheduler.Start)
        pass_scheduler.register_pass(pass_2,
                                     pass_slot=PassScheduler.JustBeforeCodeGen)

        self.accuracy = arg_template.accuracy
        self.precision = arg_template.precision
    def __init__(self, arg_template=None):
        """ Initialize """
        # building default arg_template if necessary
        arg_template = UnifyPipelineBench.get_default_args() if \
            arg_template is None else arg_template
        # initializing I/O precision
        self.width = arg_template.width
        precision = arg_template.precision
        io_precisions = [precision] * 2
        Log.report(
            Log.Info,
            "generating Adaptative Entity with width={}".format(self.width)
        )

        # initializing base class
        ML_EntityBasis.__init__(self,
                                base_name="adaptative_design",
                                arg_template=arg_template
                                )

        self.accuracy = arg_template.accuracy
        self.precision = arg_template.precision

        def check_function(optree):
            """ Check that every node (except Statements) have a defined
                init_stage attributes """
            if isinstance(optree, Statement):
                return True
            else:
                init_stage = optree.attributes.get_dyn_attribute("init_stage")
                if init_stage is None:
                    raise Exception("Check of init_state definition failed")
                else:
                    return True

        Log.report(Log.Info, "registering pass to check results")
        check_pass = Pass_CheckGeneric(
            self.backend,
            check_function,
            "checking pass"
        )
        self.get_pass_scheduler().register_pass(
            check_pass, pass_slot = PassScheduler.JustBeforeCodeGen
        )
Exemple #14
0
    def __init__(
        self,
        arg_template=DefaultEntityArgTemplate,
    ):

        # initializing base class
        ML_EntityBasis.__init__(self, arg_template=arg_template)
        self.pipelined = arg_template.pipelined
        # function to be approximated
        self.function = arg_template.function
        # interval on which the approximation must be valid
        self.interval = arg_template.interval

        self.disable_sub_testing = arg_template.disable_sub_testing
        self.disable_sv_testing = arg_template.disable_sv_testing

        self.alpha = arg_template.alpha
        self.beta = arg_template.beta
        self.gamma = arg_template.gamma
        self.guard_bits = arg_template.guard_bits
Exemple #15
0
    def __init__(self, arg_template=None):
        """ Initialize """
        # building default arg_template if necessary
        arg_template = MinMaxSelectEntity.get_default_args() if \
            arg_template is None else arg_template
        # initializing I/O precision
        self.width = arg_template.width
        precision = arg_template.precision
        io_precisions = [precision] * 2
        Log.report(
            Log.Info,
            "generating Adaptative Entity with width={}".format(self.width))

        # initializing base class
        ML_EntityBasis.__init__(self,
                                base_name="adaptative_design",
                                arg_template=arg_template)

        self.accuracy = arg_template.accuracy
        self.precision = arg_template.precision
Exemple #16
0
    def __init__(self,
                 arg_template=DefaultEntityArgTemplate,
                 precision=fixed_point(32, 0, signed=False),
                 accuracy=ML_Faithful,
                 debug_flag=False,
                 target=VHDLBackend(),
                 output_file="mult_array.vhd",
                 entity_name="mult_array",
                 language=VHDL_Code,
                 acc_prec=None,
                 pipelined=False):
        # initializing I/O precision
        precision = arg_template.precision
        io_precisions = [precision] * 2

        # initializing base class
        ML_EntityBasis.__init__(self,
                                base_name="mult_array",
                                entity_name=entity_name,
                                output_file=output_file,
                                io_precisions=io_precisions,
                                backend=target,
                                debug_flag=debug_flag,
                                language=language,
                                arg_template=arg_template)

        self.accuracy = accuracy
        # main precision (used for product operand and default for accumulator)
        self.precision = precision
        # enable operator pipelining
        self.pipelined = pipelined
        # multiplication input descriptor
        self.op_expr = arg_template.op_expr
        self.dummy_mode = arg_template.dummy_mode
        self.booth_mode = arg_template.booth_mode
        # reduction method
        self.reduction_method = arg_template.method
        # limit of height for each compression stage
        self.stage_height_limit = arg_template.stage_height_limit
    def __init__(
        self,
        arg_template=DefaultEntityArgTemplate,
        precision=ML_Binary32,
        target=VHDLBackend(),
        debug_flag=False,
        output_file="fp_fixed_mpfma.vhd",
        entity_name="fp_fixed_mpfma",
        language=VHDL_Code,
        vector_size=1,
    ):
        # initializing I/O precision
        precision = ArgDefault.select_value(
            [arg_template.precision, precision])
        io_precisions = [precision] * 2

        # initializing base class
        ML_EntityBasis.__init__(self,
                                base_name="fp_fixed_mpfma",
                                entity_name=entity_name,
                                output_file=output_file,
                                io_precisions=io_precisions,
                                abs_accuracy=None,
                                backend=target,
                                debug_flag=debug_flag,
                                language=language,
                                arg_template=arg_template)

        self.precision = precision
        # number of extra bits to add to the accumulator fixed precision
        self.extra_digit = arg_template.extra_digit

        min_prod_exp = self.precision.get_emin_subnormal() * 2
        self.acc_lsb_index = min_prod_exp
        # select sign-magintude encoded accumulator
        self.sign_magnitude = arg_template.sign_magnitude
        # enable/disable operator pipelining
        self.pipelined = arg_template.pipelined