From: Luke Kenneth Casson Leighton Date: Sun, 25 Aug 2019 10:06:49 +0000 (+0100) Subject: use Mux instead of m.If/Elif on add sign X-Git-Tag: ls180-24jan2020~387 X-Git-Url: https://git.libre-soc.org/?p=ieee754fpu.git;a=commitdiff_plain;h=c1d00c6b8f244fa83c432b6521943c43f421a219;hp=5922c8304ac8abce20d2f2297f28899f9d98f4cb use Mux instead of m.If/Elif on add sign --- diff --git a/src/ieee754/fpadd/add0.py b/src/ieee754/fpadd/add0.py index a88dc061..c3300a60 100644 --- a/src/ieee754/fpadd/add0.py +++ b/src/ieee754/fpadd/add0.py @@ -4,7 +4,7 @@ Copyright (C) 2019 Luke Kenneth Casson Leighton """ -from nmigen import Module, Signal, Cat +from nmigen import Module, Signal, Cat, Mux from nmigen.cli import main, verilog from nmutil.pipemodbase import PipeModBase @@ -41,22 +41,20 @@ class FPAddStage0Mod(PipeModBase): bm0.eq(Cat(self.i.b.m, 0)) ] comb += self.o.z.e.eq(self.i.a.e) + comb += self.o.z.s.eq(Mux(seq | mge, self.i.a.s, self.i.b.s)) with m.If(seq): comb += [ self.o.tot.eq(am0 + bm0), - self.o.z.s.eq(self.i.a.s) ] # a mantissa greater than b, use a with m.Elif(mge): comb += [ self.o.tot.eq(am0 - bm0), - self.o.z.s.eq(self.i.a.s) ] # b mantissa greater than a, use b with m.Else(): comb += [ self.o.tot.eq(bm0 - am0), - self.o.z.s.eq(self.i.b.s) ] # pass-through context