1 # IEEE Floating Point Multiplier
3 from nmigen
import Module
4 from nmigen
.cli
import main
, verilog
6 from nmutil
.singlepipe
import (StageChain
, SimpleHandshake
)
8 from ieee754
.fpcommon
.fpbase
import FPState
9 from ieee754
.fpcommon
.denorm
import FPSCData
10 from ieee754
.fpcommon
.postcalc
import FPAddStage1Data
11 from .mul0
import FPMulStage0Mod
12 from .mul1
import FPMulStage1Mod
15 class FPMulStages(FPState
, SimpleHandshake
):
17 def __init__(self
, pspec
):
18 FPState
.__init
__(self
, "mulstages")
20 SimpleHandshake
.__init
__(self
, self
) # pipeline is its own stage
21 self
.m1o
= self
.ospec()
24 return FPSCData(self
.pspec
, False)
27 return FPAddStage1Data(self
.pspec
)
29 def setup(self
, m
, i
):
30 """ links module to inputs and outputs
33 # chain MulStage0 and MulStage1
34 m0mod
= FPMulStage0Mod(self
.pspec
)
35 m1mod
= FPMulStage1Mod(self
.pspec
)
37 chain
= StageChain([m0mod
, m1mod
])
46 m
.d
.sync
+= self
.m1o
.eq(self
.process(None))
47 m
.next
= "normalise_1"