From: Luke Kenneth Casson Leighton Date: Wed, 21 Aug 2019 04:47:06 +0000 (+0100) Subject: add mul factor to PartitionPoints.like X-Git-Tag: ls180-24jan2020~454 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f113af4636afad4bc2e495363b6c9c411f126b2e;p=ieee754fpu.git add mul factor to PartitionPoints.like --- diff --git a/src/ieee754/part_mul_add/multiply.py b/src/ieee754/part_mul_add/multiply.py index 64994ad3..0a05c587 100644 --- a/src/ieee754/part_mul_add/multiply.py +++ b/src/ieee754/part_mul_add/multiply.py @@ -50,15 +50,17 @@ class PartitionPoints(dict): raise ValueError("point must be a non-negative integer") self[point] = Value.wrap(enabled) - def like(self, name=None, src_loc_at=0): + def like(self, name=None, src_loc_at=0, mul=1): """Create a new ``PartitionPoints`` with ``Signal``s for all values. :param name: the base name for the new ``Signal``s. + :param mul: a multiplication factor on the indices """ if name is None: name = Signal(src_loc_at=1+src_loc_at).name # get variable name retval = PartitionPoints() for point, enabled in self.items(): + point *= mul retval[point] = Signal(enabled.shape(), name=f"{name}_{point}") return retval