[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 10:50:10 BST 2022


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

--- Comment #5 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
  73         for i in range(self.width):
  74             with m.Switch(Cat(self.a[i], self.b[i])):
  75                 with m.Case('11'):
  76                     # both have no leading zeros so far, so set carry
  77                     m.d.comb += [
  78                         addend1[i].eq(1),
  79                         addend2[i].eq(1),
  80                     ]
  81                 with m.Case('01', '10'):
  82                     # different number of leading zeros, so clear carry
  83                     m.d.comb += [
  84                         addend1[i].eq(0),
  85                         addend2[i].eq(0),
  86                     ]
  87                 with m.Case('00'):
  88                     # propagate results from lower bits
  89                     m.d.comb += [
  90                         addend1[i].eq(1),
  91                         addend2[i].eq(0),
  92                     ]

that's just:

   comb += addend1.eq(a ^ b)
   comb += addend2.eq(a | b)

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


More information about the libre-soc-bugs mailing list