def _replace_input(self, toReplace: RtlSignalBase, replacement: RtlSignalBase): isTopStm = self.parentStm is None if isTopStm: if replace_input_in_expr(self, self.cond, toReplace, replacement, isTopStm): self.cond = replacement for stm in self.ifTrue: stm._replace_input(toReplace, replacement) cond_to_replace = [] for i, (cond, stms) in enumerate(self.elIfs): if replace_input_in_expr(self, cond, toReplace, replacement, isTopStm): cond_to_replace.append((i, replacement)) for stm in stms: stm._replace_input(toReplace, replacement) for i, newCond in cond_to_replace: stm = self.elIfs[i][1] self.elIfs[i] = (newCond, stm) if self.ifFalse is not None: for stm in self.ifFalse: stm._replace_input(toReplace, replacement) self._replace_input_update_sensitivity_and_enclosure(toReplace, replacement)
def _replace_input(self, toReplace: RtlSignalBase, replacement: RtlSignalBase): isTopStm = self.parentStm is None if isTopStm: self.cond = replace_input_in_expr(self, self.cond, toReplace, replacement, isTopStm) for stm in self.ifTrue: stm._replace_input(toReplace, replacement) new_elifs = [] for (cond, stms) in self.elIfs: new_cond = replace_input_in_expr(self, cond, toReplace, replacement, isTopStm) for stm in stms: stm._replace_input(toReplace, replacement) new_elifs.append((new_cond, stms)) self.elIfs = new_elifs if self.ifFalse is not None: for stm in self.ifFalse: stm._replace_input(toReplace, replacement) self._replace_input_update_sensitivity_and_enclosure( toReplace, replacement)
def _replace_input(self, toReplace: RtlSignalBase, replacement: RtlSignalBase) -> None: isTopStatement = self.parentStm is None if self.indexes: new_indexes = [] for ind in self.indexes: new_i = replace_input_in_expr(self, ind, toReplace, replacement, isTopStatement) new_indexes.append(new_i) self.indexes = new_indexes self.src = replace_input_in_expr(self, self.src, toReplace, replacement, isTopStatement) self._replace_input_update_sensitivity_and_enclosure( toReplace, replacement)
def _replace_input(self, toReplace: RtlSignalBase, replacement: RtlSignalBase) -> None: isTopStatement = self.parentStm is None if self.indexes: indexes_to_replace = [] for i, ind in enumerate(self.indexes): if replace_input_in_expr(self, ind, toReplace, replacement, isTopStatement): indexes_to_replace.append((i, replacement)) for i, newInd in indexes_to_replace: self.indexes[i] = newInd if replace_input_in_expr(self, self.src, toReplace, replacement, isTopStatement): self.src = replacement self._replace_input_update_sensitivity_and_enclosure(toReplace, replacement)
def _replace_input(self, toReplace: RtlSignalBase, replacement: RtlSignalBase): new_operands = [] for o in self.operands: if replace_input_in_expr(self, o, toReplace, replacement, True): new_operands.append(replacement) else: new_operands.append(o) self.operands = tuple(new_operands)
def _replace_input(self, toReplace: RtlSignalBase, replacement: RtlSignalBase) -> None: isTopStatement = self.parentStm is None self.switchOn = replace_input_in_expr(self, self.switchOn, toReplace, replacement, isTopStatement) for (_, stms) in self.cases: for stm in stms: stm._replace_input(toReplace, replacement) if self.default is not None: for stm in self.default: stm._replace_input(toReplace, replacement) self._replace_input_update_sensitivity_and_enclosure( toReplace, replacement)