From: Luke Kenneth Casson Leighton Date: Wed, 31 Jul 2019 12:30:48 +0000 (+0100) Subject: tidyup, use FPModBaseChain and FPModBase X-Git-Tag: ls180-24jan2020~626 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ec11944576065d91861079327c414a828550448b;p=ieee754fpu.git tidyup, use FPModBaseChain and FPModBase --- diff --git a/src/ieee754/fpcommon/normtopack.py b/src/ieee754/fpcommon/normtopack.py index 453c5c22..796f1884 100644 --- a/src/ieee754/fpcommon/normtopack.py +++ b/src/ieee754/fpcommon/normtopack.py @@ -6,7 +6,7 @@ from nmutil.singlepipe import StageChain -from ieee754.pipeline import DynamicPipe +from ieee754.fpcommon.modbase import FPModBaseChain from ieee754.fpcommon.postcalc import FPAddStage1Data from ieee754.fpcommon.postnormalise import FPNorm1ModSingle from ieee754.fpcommon.roundz import FPRoundMod @@ -14,35 +14,19 @@ from ieee754.fpcommon.corrections import FPCorrectionsMod from ieee754.fpcommon.pack import FPPackData, FPPackMod -class FPNormToPack(DynamicPipe): +class FPNormToPack(FPModBaseChain): def __init__(self, pspec, e_extra=False): - #print ("normtopack", pspec) - self.pspec = pspec self.e_extra = e_extra super().__init__(pspec) - def ispec(self): - return FPAddStage1Data(self.pspec, e_extra=self.e_extra) - - def ospec(self): - return FPPackData(self.pspec) # FPPackMod - - def setup(self, m, i): - """ links module to inputs and outputs + def get_chain(self): + """ gets chain of modules """ - # Normalisation, Rounding Corrections, Pack - in a chain nmod = FPNorm1ModSingle(self.pspec, e_extra=self.e_extra) rmod = FPRoundMod(self.pspec) cmod = FPCorrectionsMod(self.pspec) pmod = FPPackMod(self.pspec) - stages = [nmod, rmod, cmod, pmod] - chain = StageChain(stages) - chain.setup(m, i) - self.out_z = pmod.ospec() - - self.o = pmod.o - def process(self, i): - return self.o + return [nmod, rmod, cmod, pmod]