From bb86ad410e26c25ab9101a5ba4d4a0004d1cddf5 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 16 Feb 2019 09:01:43 +0000 Subject: [PATCH] add normalise_1 function --- src/add/nmigen_add_experiment.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index 5b648b9a..19ba5a67 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -122,6 +122,18 @@ class FPADD: with m.Else(): m.d.sync += op.ack.eq(1) + def normalise_1(self, m, z, of, next_state): + with m.If((z.m[-1] == 0) & (z.e > z.N126)): + m.d.sync +=[ + z.e.eq(z.e - 1), # DECREASE exponent + z.m.eq(z.m << 1), # shift mantissa UP + z.m[0].eq(of.guard), # steal guard bit (was tot[2]) + of.guard.eq(of.round_bit), # steal round_bit (was tot[1]) + of.round_bit.eq(0), # reset round bit + ] + with m.Else(): + m.next = next_state + def get_fragment(self, platform=None): m = Module() -- 2.30.2