From: Luke Kenneth Casson Leighton Date: Wed, 1 Jul 2020 14:32:15 +0000 (+0100) Subject: add rfid and td/tw trap test X-Git-Tag: div_pipeline~189 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=faa3a713ac93eaf0e11164be9a9afa80bd75005e;p=soc.git add rfid and td/tw trap test --- diff --git a/src/soc/decoder/power_decoder2.py b/src/soc/decoder/power_decoder2.py index 90df1ac6..e6ee5840 100644 --- a/src/soc/decoder/power_decoder2.py +++ b/src/soc/decoder/power_decoder2.py @@ -582,7 +582,7 @@ class PowerDecode2(Elaboratable): 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) diff --git a/src/soc/fu/trap/test/test_pipe_caller.py b/src/soc/fu/trap/test/test_pipe_caller.py index 3d63754b..8c32fc73 100644 --- a/src/soc/fu/trap/test/test_pipe_caller.py +++ b/src/soc/fu/trap/test/test_pipe_caller.py @@ -78,8 +78,14 @@ class TrapTestCase(FHDLTestCase): 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 @@ -87,6 +93,16 @@ class TrapTestCase(FHDLTestCase): 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)