From e5987629000197e645730a39ac1f51bc24e88cfd Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 14 Feb 2019 06:12:44 +0000 Subject: [PATCH] add first of special_cases --- src/add/nmigen_add_experiment.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 """ -- 2.30.2