1 from nmigen
import Module
, Signal
2 from soc
.simple
.test
.test_issuer
import TestRunner
3 from openpower
.simulator
.program
import Program
4 from openpower
.endian
import bigendian
7 from openpower
.test
.common
import (
8 TestAccumulatorBase
, skip_case
, TestCase
, ALUHelpers
)
10 # this test case takes about half a minute to run on my Talos II
11 class MMUTestCase(TestAccumulatorBase
):
12 # MMU on microwatt handles MTSPR, MFSPR, DCBZ and TLBIE.
13 # libre-soc has own SPR unit
14 # other instructions here -> must be load/store
16 def case_mmu_dar(self
):
17 lst
= [ "mfspr 1, 19", # DAR to reg 1
20 initial_regs
= [0] * 32
23 initial_sprs
= {'DAR': 0x87654321,
25 self
.add_case(Program(lst
, bigendian
),
26 initial_regs
, initial_sprs
)
28 def cse_mmu_ldst(self
):
31 "tlbie 0,0,0,0,0", # RB,RS,RIC,PRS,R
32 "mtspr 18, 1", # reg 1 to DSISR
33 "mtspr 19, 2", # reg 2 to DAR
34 "mfspr 5, 18", # DSISR to reg 5
35 "mfspr 6, 19", # DAR to reg 6
36 "mtspr 48, 3", # set MMU PID
37 "mtspr 720, 4", # set MMU PRTBL
38 "lhz 3, 0(1)", # load some data
42 initial_regs
= [0] * 32
44 initial_regs
[2] = 0x2020
46 initial_regs
[4] = 0xDEADBEEF
48 initial_sprs
= {'DSISR': 0x12345678, 'DAR': 0x87654321,
49 'PIDR': 0xabcd, 'PRTBL': 0x0def}
50 self
.add_case(Program(lst
, bigendian
),
51 initial_regs
, initial_sprs
)
54 if __name__
== "__main__":
55 unittest
.main(exit
=False)
56 suite
= unittest
.TestSuite()
57 suite
.addTest(TestRunner(MMUTestCase().test_data
,
60 runner
= unittest
.TextTestRunner()