From: Luke Kenneth Casson Leighton Date: Fri, 8 Apr 2022 08:15:43 +0000 (+0100) Subject: move NOT into carrysum so that variable name X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=377d0d86e9f542dd752909a6dd276d33f5f65a43;p=nmigen-gf.git move NOT into carrysum so that variable name "different" preserves its meaning compared to the reference code --- diff --git a/src/nmigen_gf/hdl/cldivrem.py b/src/nmigen_gf/hdl/cldivrem.py index 01f8c20..77c4b14 100644 --- a/src/nmigen_gf/hdl/cldivrem.py +++ b/src/nmigen_gf/hdl/cldivrem.py @@ -92,12 +92,12 @@ class EqualLeadingZeroCount(Elaboratable): m.d.comb += both_ones.eq(self.a & self.b) # `different` is set if there are a different number of leading # zeros so far - m.d.comb += different.eq(~(self.a ^ self.b)) + m.d.comb += different.eq(self.a ^ self.b) # now [ab]use add: the last bit [carry-out] is the result csum = Signal(self.width + 1) carry_in = 1 # both have no leading zeros so far, so set carry - m.d.comb += csum.eq(both_ones + different + carry_in) + m.d.comb += csum.eq(both_ones + (~different) + carry_in) m.d.comb += self.out.eq(csum[self.width]) # out is carry-out return m