1 # IEEE Floating Point Adder (Single Precision)
2 # Copyright (C) Jonathan P Dawson 2013
5 from nmigen
import Module
6 from nmigen
.cli
import main
, verilog
8 from nmutil
.singlepipe
import StageChain
9 from ieee754
.pipeline
import DynamicPipe
11 from ieee754
.fpcommon
.fpbase
import FPState
12 from ieee754
.fpcommon
.denorm
import FPSCData
13 from ieee754
.fpcommon
.postcalc
import FPAddStage1Data
14 from ieee754
.fpadd
.align
import FPAddAlignSingleMod
15 from ieee754
.fpadd
.add0
import FPAddStage0Mod
16 from ieee754
.fpadd
.add1
import FPAddStage1Mod
18 class FPAddAlignSingleAdd(DynamicPipe
):
20 def __init__(self
, pspec
):
21 #FPState.__init__(self, "align")
23 super().__init
__(pspec
)
24 self
.a1o
= self
.ospec()
27 return FPSCData(self
.pspec
, True)
30 return FPAddStage1Data(self
.pspec
) # AddStage1 ospec
32 def setup(self
, m
, i
):
33 """ links module to inputs and outputs
36 # chain AddAlignSingle, AddStage0 and AddStage1
37 mod
= FPAddAlignSingleMod(self
.pspec
)
38 a0mod
= FPAddStage0Mod(self
.pspec
)
39 a1mod
= FPAddStage1Mod(self
.pspec
)
41 chain
= StageChain([mod
, a0mod
, a1mod
])
50 m
.d
.sync
+= self
.a1o
.eq(self
.process(None))
51 m
.next
= "normalise_1"