projects
/
nmigen-gf.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c91b473
)
code-comments
author
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Thu, 7 Apr 2022 10:56:48 +0000
(11:56 +0100)
committer
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Thu, 7 Apr 2022 10:56:48 +0000
(11:56 +0100)
src/nmigen_gf/hdl/cldivrem.py
patch
|
blob
|
history
diff --git
a/src/nmigen_gf/hdl/cldivrem.py
b/src/nmigen_gf/hdl/cldivrem.py
index 43257e7888680bafabe36cb7c2d3bf2a786706c5..07e6e345497a6163290d98ee058dd7d93f424126 100644
(file)
--- a/
src/nmigen_gf/hdl/cldivrem.py
+++ b/
src/nmigen_gf/hdl/cldivrem.py
@@
-96,10
+96,12
@@
class EqualLeadingZeroCount(Elaboratable):
# OR-in both_ones
m.d.comb += addend2.eq(~different)
+ # 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(addend1 + addend2 + carry_in)
m.d.comb += self.out.eq(csum[self.width]) # out is carry-out
+
return m
# TODO: add CLDivRem