fix a - b = zero by adding special case
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 18 Feb 2019 11:55:33 +0000 (11:55 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 18 Feb 2019 11:55:33 +0000 (11:55 +0000)
src/add/nmigen_add_experiment.py

index a751ea2e2505a0e4766d28b991126349450f9903..7d9ccb71ef4987d652723c3445b5791161118382 100644 (file)
@@ -88,6 +88,10 @@ class FPADD(FPBase):
                     m.next = "put_z"
                     m.d.sync += z.create(a.s, a.e, a.m[3:-1])
 
+                with m.Elif((a.s != b.s) & (a.m == b.m) & (a.e == b.e)):
+                    m.next = "put_z"
+                    m.d.sync += z.zero(0)
+
                 # Denormalised Number checks
                 with m.Else():
                     m.next = "align"