From: Luke Kenneth Casson Leighton Date: Thu, 7 Apr 2022 13:43:43 +0000 (+0100) Subject: add TODO comment-notes and rename part_prods to just parts, X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ff7c0c5720b304befdf2f23a17232594d1d25cb8;p=nmigen-gf.git add TODO comment-notes and rename part_prods to just parts, starting it from self.terms --- 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