from nmigen.cli import rtlil
from nmutil.iocontrol import RecordObject
+from nmutil.extend import exts
from soc.decoder.power_decoder import create_pdecode
from soc.decoder.power_enums import (InternalOp, CryIn, Function,
self.imm_out = Data(64, "imm_b")
self.spr_out = Data(10, "spr_b")
- def exts(self, exts_data, width, fullwidth):
- exts_data = exts_data[0:width]
- topbit = exts_data[-1]
- signbits = Repl(topbit, fullwidth-width)
- return Cat(exts_data, signbits)
-
-
def elaborate(self, platform):
m = Module()
comb = m.d.comb
comb += self.imm_out.ok.eq(1)
with m.Case(In2Sel.CONST_SI): # TODO: sign-extend here?
comb += self.imm_out.data.eq(
- self.exts(self.dec.SI, 16, 64))
+ exts(self.dec.SI, 16, 64))
comb += self.imm_out.ok.eq(1)
with m.Case(In2Sel.CONST_UI_HI):
comb += self.imm_out.data.eq(self.dec.UI<<16)
with m.Case(In2Sel.CONST_SI_HI): # TODO: sign-extend here?
comb += self.imm_out.data.eq(self.dec.SI<<16)
comb += self.imm_out.data.eq(
- self.exts(self.dec.SI << 16, 32, 64))
+ exts(self.dec.SI << 16, 32, 64))
comb += self.imm_out.ok.eq(1)
with m.Case(In2Sel.CONST_LI):
comb += self.imm_out.data.eq(self.dec.LI<<2)