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