got rounding working again for fmul
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 14 Mar 2019 05:09:36 +0000 (05:09 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 14 Mar 2019 05:09:36 +0000 (05:09 +0000)
src/add/fmul.py
src/add/fpbase.py

index 9ed2bf39b9bb67392c602b91484e8b8fdf47ce17..8ddd45eb8bda5eb5a18dd14feeb56fab6124f876 100644 (file)
@@ -127,7 +127,7 @@ class FPMUL(FPBase):
             # rounding stage
 
             with m.State("round"):
-                #self.roundz(m, z, of.roundz)
+                self.roundz(m, z, of)
                 m.next = "corrections"
 
             # ******
index db95eb13e2a4ef7ae7199c6a29e05865674fc62a..db95dcccba623d026138f3d998934633aed6a751 100644 (file)
@@ -558,10 +558,10 @@ class FPBase:
         with m.Else():
             m.next = next_state
 
-    def roundz(self, m, z, roundz):
+    def roundz(self, m, z, of):
         """ performs rounding on the output.  TODO: different kinds of rounding
         """
-        with m.If(roundz):
+        with m.If(of.guard & (of.round_bit | of.sticky | z.m[0])):
             m.d.sync += z.m.eq(z.m + 1) # mantissa rounds up
             with m.If(z.m == z.m1s): # all 1s
                 m.d.sync += z.e.eq(z.e + 1) # exponent rounds up