def to_arglist(self,obj, name,parent, withDefault = False, astParser=None):
        ret = []
        
        xs = hdl.extract_conversion_types(obj)

        for x in xs:
            ret += self.to_arglist_self(
                    obj, 
                    name,
                    parent,
                    element=x, 
                    withDefault = withDefault, 
                    astParser=astParser
                )
            ret += self.to_arglist_signal(
                    obj, 
                    name,
                    parent,
                    element=x, 
                    withDefault = withDefault, 
                    astParser=astParser
                )


        r =join_str(ret,Delimeter="; ",IgnoreIfEmpty=True)
        return r
    def get_self_func_name(self, obj, IsFunction = False, suffix = ""):
        xs = hdl.extract_conversion_types(obj ,filter_inout=InOut_t.Internal_t)
        content = []
             

        for x in xs:
            inout = " inout "
            if x["symbol"].__v_classType__ == v_classType_t.transition_t:
                pass
            elif x["symbol"]._varSigConst != varSig.variable_t:
                inout = " in "

            if IsFunction:
                inout = "  "
                

            
            line = "self" +x["suffix"] + " : " + inout + x["symbol"].get_type()  + suffix
            content.append(line)

        
        
        ret=join_str(
            content, 
            Delimeter="; "
            )
        
        return ret
示例#3
0
    def get_selfHandles(self):
        selfHandles = []

        xs = hdl.extract_conversion_types(self.obj)
        for x in xs:
            arg = "self" + x["suffix"] + "  =>  " + str(self.obj) + x["suffix"]
            selfHandles.append(arg)
        return selfHandles
示例#4
0
    def get_self_args(self):
        content = []

        xs = hdl.extract_conversion_types(self.obj)
        for x in xs:
            line = "self" + x["suffix"] + " =>  self" + x["suffix"] + "(i)"
            content.append(line)

        return content
示例#5
0
    def impl_get_attribute(self, obj, attName, parent=None):
        attName = str(attName)

        xs = hdl.extract_conversion_types(obj)

        for x in xs:
            for y in x["symbol"].getMember():
                if y["name"] == attName:
                    return append_suffex(obj.get_vhdl_name(),
                                         x["suffix"]) + "." + attName

        return obj.get_vhdl_name() + "." + str(attName)
    def impl_function_argument(self, obj,func_arg, arg):
        ret = []
        ys = hdl.extract_conversion_types(func_arg["symbol"])
        for y in ys:
            line = func_arg["name"] + y["suffix"]+ " => " + str(arg) + y["suffix"]
            ret.append(line)
            if y["symbol"]._varSigConst ==varSig.signal_t:
                members = y["symbol"].getMember()
                for m in members:
                    if m["symbol"].__writeRead__ == InOut_t.output_t or  m["symbol"].__writeRead__ == InOut_t.InOut_tt:
                        line = func_arg["name"] + y["suffix"]+"_"+ m["name"] +" => " + arg.__hdl_name__ + y["suffix"]  +"."+m["name"]
                        ret.append(line)
                        #print_cnvt(line)

        return ret
示例#7
0
    def def_record_Member_Default(self, obj, name, parent, Inout=None):

        if obj._Inout == InOut_t.Slave_t:
            Inout = InoutFlip(Inout)

        if not (obj._varSigConst == varSig.signal_t
                and Inout == InOut_t.InOut_tt):
            return name + " => " + hdl.impl_get_init_values(
                obj, parent=parent, InOut_Filter=Inout)

        ret = []
        xs = hdl.extract_conversion_types(
            obj, exclude_class_type=v_classType_t.transition_t)
        for x in xs:
            ret.append(name + x["suffix"] + " => " +
                       hdl.impl_constructor(x["symbol"]))
        return ret
示例#8
0
    def def_record_Member(self, obj, name, parent, Inout=None):
        if not issubclass(type(parent), v_class):
            return []

        if obj._Inout == InOut_t.Slave_t:
            Inout = InoutFlip(Inout)

        if not (obj._varSigConst == varSig.signal_t
                and Inout == InOut_t.InOut_tt):
            return name + " : " + obj.getType(Inout)

        ret = []
        xs = hdl.extract_conversion_types(
            obj, exclude_class_type=v_classType_t.transition_t)
        for x in xs:
            ret.append(name + x["suffix"] + " : " + x["symbol"].getType())
        return ret
示例#9
0
    def get_Self(self):
        members_args = []

        if not self.IncludeSelf:
            return members_args

        xs = hdl.extract_conversion_types(self.obj)
        for x in xs:
            isSignal = x["symbol"]._varSigConst == varSig.signal_t
            varsig = if_true_get_first(isSignal, [" signal ", " "])
            self_InOut = " inout "
            type_name = hdl.get_type_simple(x["symbol"])
            members_args.append(varsig + "self" + x["suffix"] + " : " +
                                self_InOut + " " + type_name + self.suffix)

        members_args += self.get_SelfPush()

        return members_args
    def getMemeber_Connect(self,obj, InOut_Filter,PushPull,PushPullPrefix=""):
        ret = []
        

            
        members = obj.getMember() 
        
        for x in members:
            if x["symbol"]._Inout == InOut_t.Internal_t:
                continue
            ys =hdl.extract_conversion_types(
                x["symbol"],
                exclude_class_type= v_classType_t.transition_t,
                filter_inout=InOut_Filter)
            for y in ys:

                ret.append(PushPull+"(clk, self." + x["name"]+", "+PushPullPrefix + x["name"] +");")
        return ret      
    def to_arglist(self,obj, name,parent, withDefault = False, astParser=None):
        ret = []
        
        xs = hdl.extract_conversion_types(obj)

        for x in xs:
            inoutstr =  " inout " # fixme 

            varSignal = "" if x["symbol"]._varSigConst == varSig.variable_t else " Signal "
            Default_str =  " := " + hdl.get_default_value(obj) \
                if withDefault and obj.__writeRead__ != InOut_t.output_t and obj._Inout != InOut_t.output_t \
                else ""

            TypeName = hdl.get_type_simple(x["symbol"])
            ret.append(varSignal + name + x["suffix"] + " : " + inoutstr +" " +  TypeName +Default_str)
            

        r =join_str(ret,Delimeter="; ",IgnoreIfEmpty=True)
        return r
示例#12
0
    def set_vhdl_name(self, name, Overwrite=False):
        if self.__hdl_name__ and self.__hdl_name__ != name and not Overwrite:
            raise Exception("double Conversion to vhdl")

        self.__hdl_name__ = name

        if self._varSigConst == varSig.variable_t:
            mem = self.getMember()
            for x in mem:
                x["symbol"].set_vhdl_name(name + "." + x["name"], Overwrite)
        else:
            xs = hdl.extract_conversion_types(
                self,
                exclude_class_type=v_classType_t.transition_t,
            )
            for x in xs:
                mem = x["symbol"].getMember()
                for m in mem:
                    m["symbol"].set_vhdl_name(
                        name + x["suffix"] + "." + m["name"], Overwrite)
    def get_process_sensitivity_list(self, obj):
        content = []
        for x in obj.getMember( ):
            n_connector = vc_helper._get_connector( x["symbol"])
            if n_connector is None:
                continue

            inout = InOut_t.input_t if x["symbol"]._Inout == InOut_t.Master_t else InOut_t.output_t

            ys =n_connector.__hdl_converter__.extract_conversion_types(
                    n_connector,
                    exclude_class_type= v_classType_t.transition_t,
                    filter_inout=InOut_t.input_t
                )
            for y in ys:
                content.append( y["symbol"].get_vhdl_name() )

        ys = hdl.extract_conversion_types(obj)
        content += [ x["symbol"] for x in ys if x["symbol"]._varSigConst == varSig.signal_t ]
        return content
示例#14
0
    def get_internal_connections(self):
        content = []
        if not self.PushPull == "push":
            return content

        members = self.obj.__hdl_converter__.get_internal_connections(self.obj)
        for x in members:
            inout_local = InoutFlip_if(self.InOut_Filter,
                                       x["type"] == 'sig2var')

            sig = hdl.extract_conversion_types(
                x["destination"]["symbol"],
                exclude_class_type=v_classType_t.transition_t,
                filter_inout=inout_local)

            content.append(self.obj.__hdl_name__ + "_sig_" +
                           x["source"]["name"] + sig[0]["suffix"] + " => " +
                           self.obj.__hdl_name__ + "_sig_" +
                           x["source"]["name"] + sig[0]["suffix"] + "(i)")

        return content
示例#15
0
def extract_primitive_records(obj):
    ret = []
    ts = hdl.extract_conversion_types(obj)
    for t in ts:
        name = hdl.get_type_simple(obj)
        suffix = t["suffix"]
        record_obj = get_Constructor("v_data_record")(name + suffix,
                                                      t["symbol"]._varSigConst)
        record_obj._Inout = t["symbol"]._Inout if len(
            ts) > 1 else InOut_t.Default_t
        members = t["symbol"].getMember()
        record_obj.__v_classType__ = t["symbol"].__v_classType__

        record_obj.__abstract_type_info__.vetoHDLConversion = True
        for x in members:
            if x["symbol"].__isFreeType__:
                continue
            setattr(record_obj, x["name"], x["symbol"])

        ret.append(extracted_record_t(record_obj, t["suffix"]))

    return ret
示例#16
0
    def __str__(self):
        members_args = self.get_Self()

        members = self.obj.getMember(self.InOut_Filter)

        for i in members:
            n_connector = _get_connector(i["symbol"])
            xs = hdl.extract_conversion_types(
                i["symbol"],
                exclude_class_type=v_classType_t.transition_t,
                filter_inout=self.InOut_Filter)

            for x in xs:

                varsig = " "
                if n_connector._varSigConst == varSig.signal_t:
                    varsig = " signal "
                type_name = hdl.get_type_simple(x["symbol"])
                members_args.append(varsig + i["name"] + " : " + self.InOut +
                                    " " + type_name + self.suffix)

        ret = join_str(members_args, Delimeter="; ")
        return ret
示例#17
0
    def get_SelfPush(self):
        members_args = []

        if not self.PushPull == "push":
            return members_args

        varsig = " signal "

        i_members = self.obj.__hdl_converter__.get_internal_connections(
            self.obj)
        for m in i_members:
            internal_inout_filter = InoutFlip_if(self.InOut_Filter,
                                                 m["type"] == 'sig2var')

            sig = hdl.extract_conversion_types(
                m["source"]["symbol"],
                exclude_class_type=v_classType_t.transition_t,
                filter_inout=internal_inout_filter)
            type_name = hdl.get_type_simple(sig[0]["symbol"])
            members_args.append(varsig + "self_sig_" + m["source"]["name"] +
                                sig[0]["suffix"] + " : out " + type_name +
                                self.suffix)

        return members_args