7d871f42efe73611a7c47348721e9e1fad07ea8c
1 # IEEE Floating Point Adder (Single Precision)
2 # Copyright (C) Jonathan P Dawson 2013
5 #from nmigen.cli import main, verilog
7 from singlepipe
import StageChain
, SimpleHandshake
9 from fpbase
import FPState
, FPID
10 from .postcalc
import FPAddStage1Data
11 from .postnormalise
import FPNorm1ModSingle
12 from .roundz
import FPRoundMod
13 from .corrections
import FPCorrectionsMod
14 from .pack
import FPPackData
, FPPackMod
17 class FPNormToPack(FPState
, SimpleHandshake
):
19 def __init__(self
, width
, id_wid
):
20 FPState
.__init
__(self
, "normalise_1")
23 SimpleHandshake
.__init
__(self
, self
) # pipeline is its own stage
26 return FPAddStage1Data(self
.width
, self
.id_wid
) # Norm1ModSingle ispec
29 return FPPackData(self
.width
, self
.id_wid
) # FPPackMod ospec
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
.width
, self
.id_wid
)
37 rmod
= FPRoundMod(self
.width
, self
.id_wid
)
38 cmod
= FPCorrectionsMod(self
.width
, self
.id_wid
)
39 pmod
= FPPackMod(self
.width
, self
.id_wid
)
40 stages
= [nmod
, rmod
, cmod
, pmod
]
41 chain
= StageChain(stages
)
43 self
.out_z
= pmod
.ospec()
51 m
.d
.sync
+= self
.out_z
.eq(self
.process(None))