From f06311995594afbb362c238f43e3dfa573c614e6 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 1 Mar 2019 11:20:18 +0000 Subject: [PATCH] store tests in temp signals --- src/add/nmigen_add_experiment.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/add/nmigen_add_experiment.py b/src/add/nmigen_add_experiment.py index 7bc8dd8d..d69bdabb 100644 --- a/src/add/nmigen_add_experiment.py +++ b/src/add/nmigen_add_experiment.py @@ -416,13 +416,17 @@ class FPAddStage0Mod: m.d.comb += self.out_z.e.eq(self.in_a.e) # same-sign (both negative or both positive) add mantissas - with m.If(self.in_a.s == self.in_b.s): + seq = Signal(reset_less=True) + mge = Signal(reset_less=True) + m.d.comb += seq.eq(self.in_a.s == self.in_b.s) + m.d.comb += mge.eq(self.in_a.m >= self.in_b.m) + with m.If(seq): m.d.comb += [ self.out_tot.eq(Cat(self.in_a.m, 0) + Cat(self.in_b.m, 0)), self.out_z.s.eq(self.in_a.s) ] # a mantissa greater than b, use a - with m.Elif(self.in_a.m >= self.in_b.m): + with m.Elif(mge): m.d.comb += [ self.out_tot.eq(Cat(self.in_a.m, 0) - Cat(self.in_b.m, 0)), self.out_z.s.eq(self.in_a.s) -- 2.30.2