def isSame(self, other): if isinstance(other, self.__class__): if isSameHVal(self.dst, other.dst)\ and isSameHVal(self.src, other.src)\ and areSameHVals(self.indexes, other.indexes): return True return False
def isSame(self, other: HdlStatement) -> bool: """ Doc on parent class :meth:`HdlStatement.isSame` """ if self is other: return True if self.rank != other.rank: return False if isinstance(other, SwitchContainer) \ and isSameHVal(self.switchOn, other.switchOn)\ and len(self.cases) == len(other.cases)\ and isSameStatementList(self.default, other.default): for (ac, astm), (bc, bstm) in zip(self.cases, other.cases): if not isSameHVal(ac, bc)\ or not isSameStatementList(astm, bstm): return False return True return False
def HArrayValAsHdl(cls, t, val: HArrayVal, ctx: HwtSerializerCtx): if not val.vldMask: return "None" else: if len(val.val) == val._dtype.size: allValuesSame = True values = iter(val.val.values()) reference = next(values) for v in values: if allValuesSame: allValuesSame = isSameHVal(reference, v) else: break if allValuesSame: # all values of items in array are same, use generator # exression return "[%s for _ in range(%d)]" % (cls.Value( reference, ctx)) # if value can not be simplified it is required to serialize it item # by item return cls.Dict_valAsHdl(val.val, ctx)