genlib/divider: fix diff computation
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Mon, 2 Dec 2013 16:56:03 +0000 (17:56 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Mon, 2 Dec 2013 16:56:03 +0000 (17:56 +0100)
migen/genlib/divider.py

index 05459332d041d1ca43ce864979598955b43e194f..7f50a079ee642a0207e31e2c19e07a88d4d82fdb 100644 (file)
@@ -20,7 +20,7 @@ class Divider(Module):
                        self.quotient_o.eq(qr[:w]),
                        self.remainder_o.eq(qr[w:]),
                        self.ready_o.eq(counter == 0),
-                       diff.eq(self.remainder_o - divisor_r)
+                       diff.eq(qr[w-1:] - divisor_r)
                ]
                self.sync += [
                        If(self.start_i,