add b inf special case
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 14 Feb 2019 06:26:25 +0000 (06:26 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 14 Feb 2019 06:26:25 +0000 (06:26 +0000)
src/add/nmigen_add_experiment.py

index 1a1189a7bee2b5bd15fe27545b0ffd36954dc0f0..ee4abf5a884a63942d38e32fd503f07af134c086 100644 (file)
@@ -133,6 +133,15 @@ class FPADD:
                           z[22].eq(1),      # mantissa top bit: 1
                           z[0:22].eq(0)     # mantissa rest: 0b0000...
                         ]
+                # if b is inf return inf
+                with m.Elif(b_e == 128):
+                    m.next = "put_z"
+                    m.d.sync += [
+                        z[31].eq(b_s),    # sign: b_s
+                        z[23:31].eq(255), # exp: 0b11111...
+                        z[0:23].eq(0)     # mantissa rest: 0b0000...
+                    ]
+
         return m
 
 """