From 4d34c747aad8cff48a6f0ef0ef4c6380d08bcae4 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 14 Feb 2019 08:36:46 +0000 Subject: [PATCH] add code comments --- src/add/nmigen_add_experiment.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index 601b56e9..6628d766 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -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), -- 2.30.2