tidyup, use FPModBaseChain and FPModBase
[ieee754fpu.git] / src / ieee754 / fpcommon / normtopack.py
1 # IEEE Floating Point Adder (Single Precision)
2 # Copyright (C) Jonathan P Dawson 2013
3 # 2013-12-12
4
5 #from nmigen.cli import main, verilog
6
7 from nmutil.singlepipe import StageChain
8
9 from ieee754.fpcommon.modbase import FPModBaseChain
10 from ieee754.fpcommon.postcalc import FPAddStage1Data
11 from ieee754.fpcommon.postnormalise import FPNorm1ModSingle
12 from ieee754.fpcommon.roundz import FPRoundMod
13 from ieee754.fpcommon.corrections import FPCorrectionsMod
14 from ieee754.fpcommon.pack import FPPackData, FPPackMod
15
16
17 class FPNormToPack(FPModBaseChain):
18
19 def __init__(self, pspec, e_extra=False):
20 self.e_extra = e_extra
21 super().__init__(pspec)
22
23 def get_chain(self):
24 """ gets chain of modules
25 """
26 # Normalisation, Rounding Corrections, Pack - in a chain
27 nmod = FPNorm1ModSingle(self.pspec, e_extra=self.e_extra)
28 rmod = FPRoundMod(self.pspec)
29 cmod = FPCorrectionsMod(self.pspec)
30 pmod = FPPackMod(self.pspec)
31
32 return [nmod, rmod, cmod, pmod]