From ff7c0c5720b304befdf2f23a17232594d1d25cb8 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 7 Apr 2022 14:43:43 +0100 Subject: [PATCH] add TODO comment-notes and rename part_prods to just parts, starting it from self.terms --- src/nmigen_gf/hdl/clmul.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/nmigen_gf/hdl/clmul.py b/src/nmigen_gf/hdl/clmul.py index a3831aa..c332575 100644 --- a/src/nmigen_gf/hdl/clmul.py +++ b/src/nmigen_gf/hdl/clmul.py @@ -63,13 +63,15 @@ class CLMulAdd(Elaboratable): def elaborate(self, platform): m = Module() - part_prods = [] + parts = self.terms for shift in range(self.factor_width): part_prod = Signal(self.output.width, name=f"part_prod_{shift}") + # TODO comment (nice ASCII diagram in docstring then refer to it?) mask = Repl(self.factor2[shift], self.factor_width) - m.d.comb += part_prod.eq((self.factor1 & mask) << shift) - part_prods.append(part_prod) + m.d.comb += parts.eq((self.factor1 & mask) << shift) + parts.append(parts) - output = treereduce(part_prods + self.terms, operator.xor) + # TODO comment + output = treereduce(parts, operator.xor) m.d.comb += self.output.eq(output) return m -- 2.30.2