From 58ed1a5b82eb23003e3a787d0da59cf81aae253f Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 21 Aug 2019 08:27:56 +0100 Subject: [PATCH] add AddReduceData class --- src/ieee754/part_mul_add/multiply.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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. -- 2.30.2