1 # This stage is intended to do the main work of an actual multiply
3 from nmigen
import Module
4 from nmutil
.pipemodbase
import PipeModBase
5 from soc
.fu
.mul
.pipe_data
import MulIntermediateData
, MulOutputData
6 from ieee754
.part
.partsig
import PartitionedSignal
9 class MulMainStage2(PipeModBase
):
10 def __init__(self
, pspec
):
11 super().__init
__(pspec
, "mul2")
14 return MulIntermediateData(self
.pspec
) # pipeline stage input format
17 return MulOutputData(self
.pspec
) # pipeline stage output format
19 def elaborate(self
, platform
):
23 # convenience variables
24 a
, b
, o
= self
.i
.a
, self
.i
.b
, self
.o
.o
26 # actual multiply (TODO: split into stages)
27 # it's ironic that one line of code can create 15,000 gates...
30 ###### xer and context, all pass-through #####
32 comb
+= self
.o
.neg_res
.eq(self
.i
.neg_res
)
33 comb
+= self
.o
.neg_res32
.eq(self
.i
.neg_res32
)
34 comb
+= self
.o
.xer_so
.eq(self
.i
.xer_so
)
35 comb
+= self
.o
.ctx
.eq(self
.i
.ctx
)