random modifications
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 22 Jul 2019 16:19:37 +0000 (17:19 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 22 Jul 2019 16:19:37 +0000 (17:19 +0100)
src/ieee754/fpcommon/test/fpmux.py
src/ieee754/fpdiv/div2.py

index 5228ed6b158fe10779c89dc669674c57b0c9615f..24bc78248f370e0c77eda82d50822a714b58ecf6 100644 (file)
@@ -168,9 +168,9 @@ def create_random(num_rows, width, single_op=False, n_vals=10):
                 op1 = randint(0, (1<<width)-1)
                 op2 = randint(0, (1<<width)-1)
 
-                op2 = 0x4100
-                op1 = 0x4000
-                #op2 = 0x3c00
+                op2 = 0x4000
+                op1 = 0x3c00
+                op2 = 0x3e00
                 vals.append((op1, op2,))
     return vals
 
index 83b1e4f4aee7bf639bb292b83a00fda6812198b5..ddc6f905ee349854f4dd2fec17d59076414c2e04 100644 (file)
@@ -66,7 +66,7 @@ class FPDivStage2Mod(FPState, Elaboratable):
             pl = len(self.i.quotient_root) + len(self.i.remainder)
             pt = Signal(pl, reset_less=True)
             m.d.comb += pt.eq(Cat(self.i.remainder, self.i.quotient_root))
-            p = Signal(pl, reset_less=True)
+            p = Signal(pl-1, reset_less=True) # drop top bit
             with m.If(self.i.quotient_root[-1]):
                 m.d.comb += p.eq(pt)
             with m.Else():
@@ -78,11 +78,11 @@ class FPDivStage2Mod(FPState, Elaboratable):
             # XXX what to do about remainder? shift that as well?
             # hmm, how about concatenate remainder and quotient...
             m.d.comb += [
-                self.o.z.m.eq(p[-mw-2:]),
-                self.o.of.m0.eq(p[-mw-2]), # copy of LSB
+                self.o.z.m.eq(p[-mw:]),
+                self.o.of.m0.eq(p[-mw]), # copy of LSB
                 self.o.of.guard.eq(p[-mw-1]),
-                self.o.of.round_bit.eq(p[-mw]),
-                self.o.of.sticky.eq(p[:-mw].bool())
+                self.o.of.round_bit.eq(p[-mw-2]),
+                self.o.of.sticky.eq(p[:-mw-2].bool())
             ]
 
         m.d.comb += self.o.out_do_z.eq(self.i.out_do_z)