md_fields = self.fields.instrs['MD']
mb = Signal(m_fields['MB'][0:-1].shape())
me = Signal(m_fields['ME'][0:-1].shape())
- XO = Signal(md_fields['XO'][0:-1].shape())
+ mb_extra = Signal(1)
comb += mb.eq(m_fields['MB'][0:-1])
comb += me.eq(m_fields['ME'][0:-1])
- comb += XO.eq(md_fields['XO'][0:-1])
+ comb += mb_extra.eq(md_fields['mb'][0:-1][0])
# set up microwatt rotator module
m.submodules.rotator = rotator = Rotator()
comb += [
rotator.me.eq(me),
rotator.mb.eq(mb),
- rotator.XO.eq(XO),
+ rotator.mb_extra.eq(mb_extra),
rotator.rs.eq(self.i.rs),
rotator.ra.eq(self.i.ra),
rotator.shift.eq(self.i.rb),
comb += [rotator.right_shift.eq(0),
rotator.clear_left.eq(1),
rotator.clear_right.eq(1)]
+ with m.Case(InternalOp.OP_RLCL):
+ comb += [rotator.right_shift.eq(0),
+ rotator.clear_left.eq(1),
+ rotator.clear_right.eq(0)]
+ with m.Case(InternalOp.OP_RLCR):
+ comb += [rotator.right_shift.eq(0),
+ rotator.clear_left.eq(0),
+ rotator.clear_right.eq(1)]
# outputs from the microwatt rotator module
comb += [self.o.o.eq(rotator.result_o),
"""
def __init__(self):
# input
- self.me = Signal(5, reset_less=True) # ME field
- self.mb = Signal(5, reset_less=True) # MB field
- self.XO = Signal(1, reset_less=True) # XO field
+ self.me = Signal(5, reset_less=True) # ME field
+ self.mb = Signal(5, reset_less=True) # MB field
+ self.mb_extra = Signal(1, reset_less=True) # NOT XO field, extra bit of mb in MD-form
self.ra = Signal(64, reset_less=True) # RA
self.rs = Signal(64, reset_less=True) # RS
self.ra = Signal(64, reset_less=True) # RA
with m.If(self.is_32bit):
comb += mb.eq(Cat(self.mb, Const(0b01, 2)))
with m.Else():
- comb += mb.eq(Cat(self.mb, self.XO, Const(0b0, 1)))
+ comb += mb.eq(Cat(self.mb, self.mb_extra, Const(0b0, 1)))
with m.Elif(self.right_shift):
# this is basically mb = sh + (is_32bit? 32: 0);
with m.If(self.is_32bit):
comb += me.eq(Cat(self.me, Const(0b01, 2)))
with m.Elif(self.clear_right & ~self.clear_left):
# this is me, have to use fields
- comb += me.eq(Cat(self.mb, self.XO, Const(0b0, 1)))
+ comb += me.eq(Cat(self.mb, self.mb_extra, Const(0b0, 1)))
with m.Else():
# effectively, 63 - sh
comb += me.eq(Cat(~self.shift[0:6], self.shift[6]))
initial_regs[1] = random.randint(0, (1<<64)-1)
initial_regs[2] = random.randint(0, 63)
self.run_tst_program(Program(lst), initial_regs)
-
+
+ def test_rldicl(self):
+ lst = ["rldicl 3, 1, 5, 20"]
+ initial_regs = [0] * 32
+ initial_regs[1] = random.randint(0, (1<<64)-1)
+ self.run_tst_program(Program(lst), initial_regs)
+
+ def test_rldicr(self):
+ lst = ["rldicr 3, 1, 5, 20"]
+ initial_regs = [0] * 32
+ initial_regs[1] = random.randint(0, (1<<64)-1)
+ self.run_tst_program(Program(lst), initial_regs)
+
def test_ilang(self):
rec = CompALUOpSubset()