2bc23df0dabf89f8a4e194d5e573a88d5d740d0e
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
, SimpleHandshake
,
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
19 class FPAddAlignSingleAdd(FPState
, SimpleHandshake
):
21 def __init__(self
, pspec
):
22 FPState
.__init
__(self
, "align")
24 SimpleHandshake
.__init
__(self
, self
) # pipeline is its own stage
25 self
.a1o
= self
.ospec()
28 return FPSCData(self
.pspec
, True)
31 return FPAddStage1Data(self
.pspec
) # AddStage1 ospec
33 def setup(self
, m
, i
):
34 """ links module to inputs and outputs
37 # chain AddAlignSingle, AddStage0 and AddStage1
38 mod
= FPAddAlignSingleMod(self
.pspec
)
39 a0mod
= FPAddStage0Mod(self
.pspec
)
40 a1mod
= FPAddStage1Mod(self
.pspec
)
42 chain
= StageChain([mod
, a0mod
, a1mod
])
51 m
.d
.sync
+= self
.a1o
.eq(self
.process(None))
52 m
.next
= "normalise_1"