Turned the normalise_2 verilog state into nmigen
authorAleksandar Kostovic <alexandar.kostovic@gmail.com>
Thu, 14 Feb 2019 09:16:54 +0000 (10:16 +0100)
committerAleksandar Kostovic <alexandar.kostovic@gmail.com>
Thu, 14 Feb 2019 09:16:54 +0000 (10:16 +0100)
src/add/nmigen_add_experiment.py

index c197d735ed531d73a1671a9d2ecedd8cc1daa4cb..df100d1cf62f7317ed97d4491ad7f90a3a0d5e40 100644 (file)
@@ -251,6 +251,20 @@ class FPADD:
                         round_bit.eq(tot[1]),
                         sticky.eq(tot[0])
                 ]
+
+            with m.State("normalise_2"):
+                with m.If(z_e < -126):
+                    m.d.sync +=[
+                        z_e.eq(z_e + 1),
+                        z_m.eq(z_m >> 1),
+                        guard.eq(z_m[0]),
+                        round_bit.eq(guard),
+                        sticky.eq(sticky | round_bit)
+                ]
+
+                with m.Else():
+                    m.next = "round"
+
         return m
 
 """