Exemplo n.º 1
0
 def get_sensitivity_list(self):
     ret = [str(self.dec[0].argList[0])]
     ret += [
         hdl.impl_process_sensitivity_list(x) for x in self.get_local_var()
     ]
     ret = join_str(ret, Delimeter=", ", IgnoreIfEmpty=True)
     return ret
Exemplo n.º 2
0
    def Show_Error(self):
        with open(self.FileName) as f:
            content = f.readlines()

        ROI = content[max(0, self.LineNo - 6):self.LineNo]
        ROI = join_str(ROI)
        ROI = ROI.rstrip()
        s = ' ' * self.Column
        ret = [str(self), ROI, s + "^", s + "| error msg: " + self.msg]
        return ret
Exemplo n.º 3
0
 def get_combinatorial_push(self):
     ret = [
         hdl.impl_process_push(x, str(self.dec[0].argList[0]))
         for x in self.get_local_var()
     ]
     ret = join_str(ret,
                    LineBeginning="  ",
                    LineEnding=";\n",
                    IgnoreIfEmpty=True)
     return ret
Exemplo n.º 4
0
    def extractFunctionsForClass_impl(self,
                                      funcDef,
                                      FuncArgs,
                                      setDefault=False,
                                      MemFunction_template=None):
        if hasMissingSymbol(FuncArgs):
            return None

        self.astParser.push_scope("function")
        self.astParser.reset_buffers()

        self.astParser.parent = self.parent
        self.astParser.FuncArgs = FuncArgs

        FuncArgsLocal = copy.copy(FuncArgs)
        varSigSuffix = get_function_varSig_suffix(self.astParser.FuncArgs)
        self.astParser.local_function = self.ClassInstance.__init__.__globals__

        body = self.unfold_body(funcDef)

        bodystr = self.convert_to_string(body)
        argList = [
            x["symbol"].__hdl_converter__.to_arglist(
                x["symbol"],
                x['name'],
                type(self.ClassInstance).__name__,
                withDefault=setDefault and (x["name"] != "self"),
                astParser=self.astParser) for x in FuncArgsLocal
        ]
        ArglistProcedure = join_str(argList, Delimeter="; ")
        ret = self.make_function_or_procedure(funcDef.name, body.get_type(),
                                              bodystr, FuncArgsLocal,
                                              ArglistProcedure, varSigSuffix)
        if body.get_type() is not None:
            MemFunction_template.varSigIndependent = True

        self.astParser.pop_scope()
        return ret
    def make_function_or_procedure(self, returnType , bodystr, FuncArgsLocal):
        argList = [
            hdl.to_arglist(
                x["symbol"], 
                x['name'],
                type(self.freeFunction).__name__, 
                withDefault = True,
                astParser=self.astParser
            ) 
            for x in FuncArgsLocal
        ]
        ArglistProcedure = join_str(argList,Delimeter="; ")
        actual_function_name = hdl.function_name_modifier(self.freeFunction, self.freeFunction.FuncName, get_function_varSig_suffix(FuncArgsLocal))

        
        if returnType is not None:
            ArglistProcedure = ArglistProcedure.replace(" in "," ").replace(" out "," ").replace(" inout "," ")
            ret = v_function(
                name=actual_function_name, 
                body=bodystr,
                VariableList=self.astParser.get_local_var_def(), 
                returnType=returnType, #body.get_type(),
                argumentList=ArglistProcedure,
                isFreeFunction=True
            )
            return ret 
            
        ret = v_procedure(
            name=actual_function_name,
            body=bodystr,
            VariableList=self.astParser.get_local_var_def(), 
            argumentList=ArglistProcedure,
            isFreeFunction=True
        )
        
        return ret