5b6be6ec8dd1fefd059c5bae748f2b05d5cd159f
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
, op_wid
=None):
18 FPState
.__init
__(self
, "align")
22 SimpleHandshake
.__init
__(self
, self
) # pipeline is its own stage
23 self
.m1o
= self
.ospec()
26 return FPSCData(self
.width
, self
.id_wid
, False, self
.op_wid
)
29 return FPAddStage1Data(self
.width
, self
.id_wid
, self
.op_wid
)
31 def setup(self
, m
, i
):
32 """ links module to inputs and outputs
35 # chain MulStage0 and MulStage1
36 m0mod
= FPMulStage0Mod(self
.width
, self
.id_wid
, self
.op_wid
)
37 m1mod
= FPMulStage1Mod(self
.width
, self
.id_wid
, self
.op_wid
)
39 chain
= StageChain([m0mod
, m1mod
])
48 m
.d
.sync
+= self
.m1o
.eq(self
.process(None))
49 m
.next
= "normalise_1"