From: Luke Kenneth Casson Leighton Date: Thu, 14 Feb 2019 08:36:46 +0000 (+0000) Subject: add code comments X-Git-Tag: ls180-24jan2020~2023 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4d34c747aad8cff48a6f0ef0ef4c6380d08bcae4;p=ieee754fpu.git add code comments --- 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),