@classmethod<EOL><INDENT>def HWProcess(cls, proc, ctx):<DEDENT>
body = proc.statements<EOL>extraVars = []<EOL>extraVarsSerialized = []<EOL>hasToBeVhdlProcess = extraVars orarr_any(body,<EOL>lambda x: isinstance(x,<EOL>(IfContainer,<EOL>SwitchContainer,<EOL>WhileContainer,<EOL>WaitStm)) or<EOL>(isinstance(x, Assignment) and<EOL>x.indexes))<EOL>anyIsEventDependnt = arr_any(<EOL>proc.sensitivityList, lambda s: isinstance(s, Operator))<EOL>sensitivityList = sorted(<EOL>map(lambda s: cls.sensitivityListItem(s, ctx,<EOL>anyIsEventDependnt),<EOL>proc.sensitivityList))<EOL>if hasToBeVhdlProcess:<EOL><INDENT>childCtx = ctx.withIndent()<EOL><DEDENT>else:<EOL><INDENT>childCtx = ctx<EOL><DEDENT>def createTmpVarFn(suggestedName, dtype):<EOL><INDENT>s = SignalItem(None, dtype, virtualOnly=True)<EOL>s.name = childCtx.scope.checkedName(suggestedName, s)<EOL>s.hidden = False<EOL>serializedS = cls.SignalItem(s, childCtx, declaration=True)<EOL>extraVars.append(s)<EOL>extraVarsSerialized.append(serializedS)<EOL>return s<EOL><DEDENT>childCtx.createTmpVarFn = createTmpVarFn<EOL>statemets = [cls.asHdl(s, childCtx) for s in body]<EOL>if hasToBeVhdlProcess:<EOL><INDENT>proc.name = ctx.scope.checkedName(proc.name, proc)<EOL><DEDENT>extraVarsInit = []<EOL>for s in extraVars:<EOL><INDENT>a = Assignment(s.defVal, s, virtualOnly=True)<EOL>extraVarsInit.append(cls.Assignment(a, childCtx))<EOL><DEDENT>return cls.processTmpl.render(<EOL>indent=getIndent(ctx.indent),<EOL>name=proc.name,<EOL>hasToBeVhdlProcess=hasToBeVhdlProcess,<EOL>extraVars=extraVarsSerialized,<EOL>sensitivityList="<STR_LIT>".join(sensitivityList),<EOL>statements=extraVarsInit + statemets<EOL>)<EOL>
Serialize HWProcess objects