1 # IEEE Floating Point Adder (Single Precision)
2 # Copyright (C) Jonathan P Dawson 2013
5 #from nmigen.cli import main, verilog
7 from nmutil
.singlepipe
import StageChain
9 from ieee754
.pipeline
import DynamicPipe
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
17 class FPNormToPack(DynamicPipe
):
19 def __init__(self
, pspec
, e_extra
=False):
20 #print ("normtopack", pspec)
22 self
.e_extra
= e_extra
23 super().__init
__(pspec
)
26 return FPAddStage1Data(self
.pspec
, e_extra
=self
.e_extra
)
29 return FPPackData(self
.pspec
) # FPPackMod
31 def setup(self
, m
, i
):
32 """ links module to inputs and outputs
35 # Normalisation, Rounding Corrections, Pack - in a chain
36 nmod
= FPNorm1ModSingle(self
.pspec
, e_extra
=self
.e_extra
)
37 rmod
= FPRoundMod(self
.pspec
)
38 cmod
= FPCorrectionsMod(self
.pspec
)
39 pmod
= FPPackMod(self
.pspec
)
40 stages
= [nmod
, rmod
, cmod
, pmod
]
41 chain
= StageChain(stages
)
43 self
.out_z
= pmod
.ospec()