add mul factor to PartitionPoints.like
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 21 Aug 2019 04:47:06 +0000 (05:47 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 21 Aug 2019 04:47:06 +0000 (05:47 +0100)
src/ieee754/part_mul_add/multiply.py

index 64994ad36c9feff26d84cd6b52acd05193456fa9..0a05c587fcc417582cf3a0c4ed479a9789467021 100644 (file)
@@ -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