Example #1
0
def body_unfold_Attribute(astParser, Node):
    val = astParser.Unfold_body(Node.value)

    if type(val).__name__ == "str":

        obj = astParser.getInstantByName(val)
    else:
        obj = val
    if issubclass(type(obj), v_enum):
        return v_enum(getattr(obj._type, Node.attr))
    att = getattr(obj, Node.attr)

    if type(type(att)).__name__ == "EnumMeta":
        return v_enum(att)

    parend = astParser.get_parant(obj)
    set_v_classType(obj, parend)
    n = hdl.impl_get_attribute(obj, Node.attr, parend)
    if type(att).__name__ == "str":
        att = to_v_object(att)

    att.set_vhdl_name(n, True)
    att._add_used()

    astParser.add_child(obj, att)

    #    att._Inout =  obj._Inout
    astParser.FuncArgs.append({
        "name": att.__hdl_name__,
        "symbol": att,
        "ScopeType": obj._Inout
    })
    return att
Example #2
0
 def getBody(self,obj, name,parent):
     ret = ""
     for t  in obj.PackageContent:
         t = to_v_object(t)
         ret += t.__hdl_converter__.getBody(t,"",obj)
     
     return ret
Example #3
0
    def def_packet_body(self, obj, name, parent):
        ret = ""
        for t in obj.PackageContent:
            t = to_v_object(t)
            ret += hdl.def_packet_body(t, "", obj)

        return ret
Example #4
0
 def get_entity_definition(self, obj):
     ret = ""
     for t  in obj.PackageContent:
         t = to_v_object(t)
         entity_def = t.__hdl_converter__.get_entity_definition(t)
         if entity_def.strip():
             ret += "\n\n" + entity_def + "\n\n"
     
     return ret
Example #5
0
 def def_includes(self, obj, name, parent):
     #print(obj.PackageName)
     bufffer = ""
     for t in obj.PackageContent:
         t = to_v_object(t)
         bufffer += hdl.def_includes(t, "", obj)
         dep_list = hdl.get_dependency_objects(t, [])
         for y in dep_list:
             bufffer += hdl.def_includes(y, "", obj)
     ret = make_unique_includes(bufffer, obj.PackageName)
     return ret
Example #6
0
def body_unfold_assign(astParser, Node):
    if len(Node.targets) > 1:
        raise Exception(
            Node_line_col_2_str(astParser, Node) +
            "Multible Targets are not supported")

    for x in astParser.Archetecture_vars:
        if x["name"] == Node.targets[0].id:
            x["symbol"].set_vhdl_name(Node.targets[0].id, True)
            return v_noop()
    for x in astParser.LocalVar:
        if Node.targets[0].id in x.__hdl_name__:
            raise Exception(
                Node_line_col_2_str(astParser, Node) +
                " Target already exist. Use << operate to assigne new value to existing object."
            )

    for x in astParser.FuncArgs:
        if Node.targets[0].id == x["name"]:
            raise Exception(
                Node_line_col_2_str(astParser, Node) +
                " Target already exist. Use << operate to assigne new value to existing object."
            )

    if type(Node.targets[0]).__name__ != "Name":
        raise Exception(Node_line_col_2_str(astParser, Node) + " unknown type")
    if not astParser.get_scope_name():
        raise Exception(
            Node_line_col_2_str(astParser, Node) +
            " Symbol is not defined. use end_architecture() function at the end of the archetecture "
        )
    lhs = v_name(Node.targets[0].id)
    rhs = astParser.Unfold_body(Node.value)
    rhs = to_v_object(rhs)
    rhs.set_vhdl_name(lhs.Value, True)
    astParser.LocalVar.append(rhs)
    ret = v_variable_cration(lhs, rhs)
    return ret
Example #7
0
    def parse_file(self, obj):

        for t in obj.PackageContent:
            t = to_v_object(t)

            hdl.parse_file(t)
Example #8
0
 def parse_file(self,obj):
     
     for t  in obj.PackageContent:
         t = to_v_object(t)
         
         t.__hdl_converter__.parse_file(t)