ee8234515a5ace12cbba79328c39781264ead618
1 from nmigen
import (Module
, Signal
)
2 from nmutil
.pipemodbase
import PipeModBase
3 from soc
.alu
.pipe_data
import ALUInputData
, ALUOutputData
4 from ieee754
.part
.partsig
import PartitionedSignal
5 from soc
.decoder
.power_enums
import InternalOp
8 class ALUMainStage(PipeModBase
):
9 def __init__(self
, pspec
):
10 super().__init
__(pspec
, "main")
13 return ALUInputData(self
.pspec
)
16 return ALUOutputData(self
.pspec
)
18 def elaborate(self
, platform
):
22 add_output
= Signal(self
.i
.a
.width
+ 1, reset_less
=True)
23 comb
+= add_output
.eq(self
.i
.a
+ self
.i
.b
)
26 with m
.Switch(self
.i
.ctx
.op
.insn_type
):
27 with m
.Case(InternalOp
.OP_ADD
):
28 comb
+= self
.o
.o
.eq(add_output
[0:64])
30 comb
+= self
.o
.ctx
.eq(self
.i
.ctx
)