def __init__(self, switchOn): switchOn = _intfToSig(switchOn) if not isinstance(switchOn, RtlSignalBase): raise HwtSyntaxError("Select is not signal, it is not certain" " if this an error or desire") if arr_any(discoverEventDependency(switchOn), lambda x: True): raise HwtSyntaxError("Can not switch on result of event operator") super(Switch, self).__init__(switchOn, []) switchOn.ctx.statements.add(self)
def Elif(self, cond, *statements): assert self.parentStm is None self.rank += 1 cond_sig = _intfToSig(cond) self._now_is_event_dependent = arr_any( discoverEventDependency(cond_sig), lambda x: True) self._inputs.append(cond_sig) cond_sig.endpoints.append(self) case = [] self.elIfs.append((cond_sig, case)) self._register_stements(statements, case) return self
def __init__(self, cond, *statements): """ :param cond: condition in if statement :param statements: list of statements which should be active if condition is met """ cond_sig = _intfToSig(cond) if not isinstance(cond_sig, RtlSignalBase): raise IntfLvlConfErr("Condition is not signal, it is not certain" " if this is an error or desire ", cond_sig) super(If, self).__init__(cond_sig) self.rank = 1 self._inputs.append(cond_sig) cond_sig.endpoints.append(self) ev_dep = arr_any(discoverEventDependency(cond_sig), lambda x: True) self._event_dependent_from_branch = 0 if ev_dep else None self._register_stements(statements, self.ifTrue) self._get_rtl_context().statements.add(self)