add in comments on add 2nd stage
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 14 Feb 2019 09:05:21 +0000 (09:05 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 14 Feb 2019 09:05:21 +0000 (09:05 +0000)
src/add/nmigen_add_experiment.py

index 991335c915a55a980c13a4e9529b35e8cd3ff717..fc06092c31dc96e2b48052116a1e73a59ec7c7ad 100644 (file)
@@ -232,9 +232,12 @@ class FPADD:
                         z_s.eq(b_s)
                 ]
 
+            # ******
+            # Second stage of add: preparation for normalisation
+
             with m.State("add_1"):
                 m.next = "normalise_1"
-
+                # tot[27] gets set when the sum overflows. shift result down
                 with m.If(tot[27]):
                     m.d.sync += [
                         z_m.eq(tot[4:28]),
@@ -243,7 +246,7 @@ class FPADD:
                         sticky.eq(tot[1] | tot[0]),
                         z_e.eq(z_e + 1)
                 ]
-
+                # tot[27] zero case
                 with m.Else():
                     m.d.sync += [
                         z_m.eq(tot[3:27]),