From: Luke Kenneth Casson Leighton Date: Wed, 21 Aug 2019 07:27:56 +0000 (+0100) Subject: add AddReduceData class X-Git-Tag: ls180-24jan2020~449 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=58ed1a5b82eb23003e3a787d0da59cf81aae253f;p=ieee754fpu.git add AddReduceData class --- diff --git a/src/ieee754/part_mul_add/multiply.py b/src/ieee754/part_mul_add/multiply.py index 269ff8b7..de40a89d 100644 --- a/src/ieee754/part_mul_add/multiply.py +++ b/src/ieee754/part_mul_add/multiply.py @@ -300,6 +300,22 @@ class PartitionedAdder(Elaboratable): FULL_ADDER_INPUT_COUNT = 3 +class AddReduceData: + + def __init__(self, ppoints, output_width, n_parts) + self.part_ops = [Signal(2, name=f"part_ops_{i}") + for i in range(n_parts)] + self.inputs = [Signal(output_width, name=f"inputs[{i}]") + for i in range(len(self.inputs))] + self.reg_partition_points = partition_points.like() + + def eq(self, rhs): + return [self.reg_partition_points.eq(rhs.reg_partition_points)] + \ + [self.inputs[i].eq(rhs.inputs[i]) + for i in range(len(self.inputs))] + \ + [self.part_ops[i].eq(rhs.part_ops[i]) + for i in range(len(self.part_ops))] + class AddReduceSingle(Elaboratable): """Add list of numbers together.