comb += e.input_cr.eq(op.cr_in) # condition reg comes in
comb += e.output_cr.eq(op.cr_out) # condition reg goes in
- # TODO, privileged?
+ # set the trapaddr to 0x700 for a td/tw/tdi/twi operation
with m.If(op.internal_op == InternalOp.OP_TRAP):
comb += e.trapaddr.eq(0x70) # addr=0x700 (strip first nibble)
tc = TestCase(prog, self.test_name, initial_regs, initial_sprs)
self.test_data.append(tc)
- def test_trap_eq_imm(self):
- insns = ["twi", "tdi"]
+ def test_1_rfid(self):
+ lst = ["rfid"]
+ initial_regs = [0] * 32
+ initial_regs[1] = 1
+ self.run_tst_program(Program(lst), initial_regs)
+
+ def test_0_trap_eq_imm(self):
+ insns = ["tw", "td"]
for i in range(2):
choice = random.choice(insns)
lst = [f"{choice} 4, 1, %d" % i] # TO=4: trap equal
initial_regs[1] = 1
self.run_tst_program(Program(lst), initial_regs)
+ def test_0_trap_eq(self):
+ insns = ["twi", "tdi"]
+ for i in range(2):
+ choice = insns[i]
+ lst = [f"{choice} 4, 1, 2"] # TO=4: trap equal
+ initial_regs = [0] * 32
+ initial_regs[1] = 1
+ initial_regs[2] = 1
+ self.run_tst_program(Program(lst), initial_regs)
+
def test_ilang(self):
pspec = TrapPipeSpec(id_wid=2)
alu = TrapBasePipe(pspec)