[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 21:15:19 BST 2022
https://bugs.libre-soc.org/show_bug.cgi?id=784
--- Comment #18 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Jacob Lifshay from comment #13)
> (In reply to Luke Kenneth Casson Leighton from comment #5)
> > comb += addend1.eq(a ^ b)
> > comb += addend2.eq(a | b)
>
> I explicitly have it more complex so I can explain all the cases and to
> match 1:1 with the reference algorithm.
that could be achieved with a comment (not too big! the code's really
elegant and small without the case statement. something like:
"""
for i in range(self.width):
for each bit a[i] b[i] set addend1[i], addend2[i]
case 1,1 both have no leading zeros so far, so set carry 1,1
case 0/1 1/0 different number of leading zeros, so clear carry 0,0
case 0,0 propagate results from lower bits, so set 1,0
this is basically equivalent to: addend1 = a^b and addend2 = a|b
"""
does that look reasonably obvious?
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list