def conflictResolvStrategy(self, actionSet): """ This functions resolves :param actionSet: set of actions made by process """ invalidate = False l = len(actionSet) if l == 0: return elif l == 1: res = actionSet.pop() else: # we are driving signal with two different values so we invalidate result res = list(actionSet.pop()) invalidate = True l = len(res) if l == 4: dst, val, indexes, isEvDependent = res return (dst, mkArrayUpdater(val, indexes, invalidate), isEvDependent) else: dst, val, isEvDependent = res # print(self.now, dst, val) return (dst, mkUpdater(val, invalidate), isEvDependent)
def _initUnitSignals(self, unit: Unit) -> None: """ * Inject default values to simulation * Instantiate IOs for every process """ # set initial value to all signals and propagate it for s in unit._ctx.signals: if s.defVal.vldMask: v = s.defVal.clone() s.simUpdateVal(self, mkUpdater(v, False)) for u in unit._units: self._initUnitSignals(u) for p in unit._processes: self._addHdlProcToRun(None, p) for p, outputs in unit._outputs.items(): # name has to be explicit because it may be possible that signal # with has this name was replaced by signal from parent/child containerNames = list(map(lambda x: x[0], outputs)) class SpecificIoContainer(IoContainer): __slots__ = containerNames self._outputContainers[p] = SpecificIoContainer(outputs)
def _initUnitSignals(self, unit): """ Inject default values to simulation :return: generator of all HWprocess """ for s in unit._cntx.signals: v = s.defaultVal.clone() # force update all signals to deafut values and propagate it s.simUpdateVal(self, mkUpdater(v, False)) for u in unit._units: self._initUnitSignals(u) for p in unit._processes: self.addHwProcToRun(None, p)
def _conflictResolveStrategy(self, newValue: set)\ -> Tuple[Callable[[Value], bool], bool]: """ This functions resolves write conflicts for signal :param actionSet: set of actions made by process """ invalidate = False resLen = len(newValue) if resLen == 3: # update for item in array val, indexes, isEvDependent = newValue return (mkArrayUpdater(val, indexes, invalidate), isEvDependent) else: # update for simple signal val, isEvDependent = newValue return (mkUpdater(val, invalidate), isEvDependent)