54e8bd2d6a9632f12f82d513611f712e4df2be11
1 # IEEE Floating Point Adder (Single Precision)
2 # Copyright (C) Jonathan P Dawson 2013
5 from nmigen
import Module
, Mux
6 from nmigen
.cli
import main
, verilog
8 from nmutil
.pipemodbase
import PipeModBase
9 from ieee754
.fpcommon
.fpbase
import FPNumBase
10 from ieee754
.fpcommon
.roundz
import FPRoundData
13 class FPCorrectionsMod(PipeModBase
):
15 def __init__(self
, pspec
):
16 super().__init
__(pspec
, "corrections")
19 return FPRoundData(self
.pspec
)
22 return FPRoundData(self
.pspec
)
24 def elaborate(self
, platform
):
27 m
.submodules
.corr_in_z
= in_z
= FPNumBase(self
.i
.z
)
28 comb
+= self
.o
.eq(self
.i
) # copies mid, z, out_do_z
29 comb
+= self
.o
.z
.e
.eq(Mux(in_z
.is_denormalised
,
30 self
.i
.z
.N127
, self
.i
.z
.e
))