add code comments
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 14 Feb 2019 08:36:46 +0000 (08:36 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 14 Feb 2019 08:36:46 +0000 (08:36 +0000)
src/add/nmigen_add_experiment.py

index 601b56e900d5fe131a384d923a175bbb9062eb07..6628d766ea9733187c5b344c0b58e69e95b64f87 100644 (file)
@@ -188,16 +188,19 @@ class FPADD:
                 with m.State("add_0"):
                     m.next = "add_1"
                     m.d.sync += z_e.eq(a_e)
+                    # same-sign (both negative or both positive) add mantissas
                     with m.If(a_s == b_s):
                         m.d.sync += [
                             tot.eq(a_m + b_m),
                             z_s.eq(a_s)
                         ]
+                    # a mantissa greater than b, use a
                     with m.Else(a_m >= b_m):
                         m.d.sync += [
                             tot.eq(a_m - b_m),
                             z_s.eq(a_s)
                         ]
+                    # b mantissa greater than a, use b
                     with m.Else():
                         m.sync += [
                             tot.eq(b_m - a_m),