4742af0f2be31b6422142429bd5d40e7c2348091
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
):
18 "mfspr 1, 720", # DAR to reg 1
20 "mtspr 19, 3", # reg 3 to DAR
24 initial_regs
= [0] * 32
28 initial_sprs
= {'DAR': 0x87654321,
30 self
.add_case(Program(lst
, bigendian
),
31 initial_regs
, initial_sprs
)
33 def cse_mmu_ldst(self
):
36 "tlbie 0,0,0,0,0", # RB,RS,RIC,PRS,R
37 "mtspr 18, 1", # reg 1 to DSISR
38 "mtspr 19, 2", # reg 2 to DAR
39 "mfspr 5, 18", # DSISR to reg 5
40 "mfspr 6, 19", # DAR to reg 6
41 "mtspr 48, 3", # set MMU PID
42 "mtspr 720, 4", # set MMU PRTBL
43 "lhz 3, 0(1)", # load some data
47 initial_regs
= [0] * 32
49 initial_regs
[2] = 0x2020
51 initial_regs
[4] = 0xDEADBEEF
53 initial_sprs
= {'DSISR': 0x12345678, 'DAR': 0x87654321,
54 'PIDR': 0xabcd, 'PRTBL': 0x0def}
55 self
.add_case(Program(lst
, bigendian
),
56 initial_regs
, initial_sprs
)
59 if __name__
== "__main__":
61 unittest
.main(exit
=False)
62 suite
= unittest
.TestSuite()
63 suite
.addTest(TestRunner(MMUTestCase().test_data
,
67 runner
= unittest
.TextTestRunner()