adf68d38dbef52bb505806a1102174f496071157
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
, width
, id_wid
):
18 FPState
.__init
__(self
, "align")
21 SimpleHandshake
.__init
__(self
, self
) # pipeline is its own stage
22 self
.m1o
= self
.ospec()
25 return FPSCData(self
.width
, self
.id_wid
)
28 return FPAddStage1Data(self
.width
, self
.id_wid
) # AddStage1 ospec
30 def setup(self
, m
, i
):
31 """ links module to inputs and outputs
34 # chain MulStage0 and MulStage1
35 m0mod
= FPMulStage0Mod(self
.width
, self
.id_wid
)
36 m1mod
= FPMulStage1Mod(self
.width
, self
.id_wid
)
38 chain
= StageChain([m0mod
, m1mod
])
47 m
.d
.sync
+= self
.m1o
.eq(self
.process(None))
48 m
.next
= "normalise_1"