From: Cesar Strauss Date: Sat, 23 Jan 2021 20:31:39 +0000 (-0300) Subject: Implement PartitionedSignal.like() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7f8a35ae6f514a55bcdee2f6bd6871c129fc6379;p=ieee754fpu.git Implement PartitionedSignal.like() --- diff --git a/src/ieee754/part/partsig.py b/src/ieee754/part/partsig.py index ab14bf99..fb06a1b9 100644 --- a/src/ieee754/part/partsig.py +++ b/src/ieee754/part/partsig.py @@ -60,6 +60,14 @@ class PartitionedSignal: def eq(self, val): return self.sig.eq(getsig(val)) + @staticmethod + def like(other, *args, **kwargs): + """Builds a new PartitionedSignal with the same PartitionPoints and + Signal properties as the other""" + result = PartitionedSignal(other.partpoints) + result.sig = Signal.like(other.sig, *args, **kwargs) + return result + # unary ops that do not require partitioning def __invert__(self):