From: Luke Kenneth Casson Leighton Date: Thu, 14 Feb 2019 06:12:44 +0000 (+0000) Subject: add first of special_cases X-Git-Tag: ls180-24jan2020~2032 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e5987629000197e645730a39ac1f51bc24e88cfd;p=ieee754fpu.git add first of special_cases --- diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index 2d4c175d..53c8b2f3 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -88,6 +88,17 @@ class FPADD: b_s.eq(Cat(b[31])) ] + with m.State("special_cases"): + # if a is NaN or b is NaN return NaN + with m.If(((a_e == 128) & (a_m != 0)) | \ + ((b_e == 128) & (b_m != 0))): + m.next = "put_z" + m.d.sync += [ + z[31].eq(1), # sign: 1 + z[23:31].eq(255), # exp: 0b11111... + z[22].eq(1), # mantissa top bit: 1 + z[0:22].eq(0) # mantissa rest: 0b0000... + ] return m """