From: Luke Kenneth Casson Leighton Date: Sun, 25 Aug 2019 08:57:05 +0000 (+0100) Subject: use Mux in fp corrections X-Git-Tag: ls180-24jan2020~392 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a982016324ffeea66582e2d582bfbfdcf955351e;p=ieee754fpu.git use Mux in fp corrections --- diff --git a/src/ieee754/fpcommon/corrections.py b/src/ieee754/fpcommon/corrections.py index 3a069167..54e8bd2d 100644 --- a/src/ieee754/fpcommon/corrections.py +++ b/src/ieee754/fpcommon/corrections.py @@ -2,7 +2,7 @@ # Copyright (C) Jonathan P Dawson 2013 # 2013-12-12 -from nmigen import Module +from nmigen import Module, Mux from nmigen.cli import main, verilog from nmutil.pipemodbase import PipeModBase @@ -23,11 +23,11 @@ class FPCorrectionsMod(PipeModBase): def elaborate(self, platform): m = Module() + comb = m.d.comb m.submodules.corr_in_z = in_z = FPNumBase(self.i.z) - m.d.comb += self.o.eq(self.i) # copies mid, z, out_do_z - with m.If(~self.i.out_do_z): - with m.If(in_z.is_denormalised): - m.d.comb += self.o.z.e.eq(self.i.z.N127) + comb += self.o.eq(self.i) # copies mid, z, out_do_z + comb += self.o.z.e.eq(Mux(in_z.is_denormalised, + self.i.z.N127, self.i.z.e)) return m