[Libre-soc-bugs] [Bug 784] Implement cl* instructions for carry-less operations

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Tue Apr 5 12:40:35 BST 2022


https://bugs.libre-soc.org/show_bug.cgi?id=784

--- Comment #8 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
  19 class BitwiseXorReduce(Elaboratable):
  29     def __init__(self, input_values):
  30         self.input_values = tuple(map(Value.cast, input_values))

this is confusing as hell and so non-standard it will freak people out.

  89     def __reduce_inputs(self):
  90         for shift in range(self.factor_width):
  91             mask = Repl(self.factor2[shift], self.factor_width)
  92             yield (self.factor1 & mask) << shift
  93         yield from self.terms
  94 
  95     def elaborate(self, platform):
  96         m = Module()
  97         xor_reduce = BitwiseXorReduce(self.__reduce_inputs())

yeah don't use non-standard styles like this please.  have BitwiseXorReduce
either explicitly set up Signals as inputs, pass in its list of Signals,
or pass in a list of Signal lengths.

or, better, just a width and an array quantity.  then the zero-extension
becomes irrelevant / redundant and can be removed.

the assignment to the inputs can be done explicitly by enumerating
self.reduce_inputs() and comb assigning thrm one by one to
the xor_reduce.input_values using a straightforward zip()

for i1, i2 in zip(xor_reduce.input_values, self.reduce_imputs()):
    comb += i2.eq(i2)

also add a docstring to reduce_inputs to let people know it's doing
a shift-and-mask, but explain it in terms of why factor2 was set up
rather thab repeat what the code actually does.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list