move over to from openpower imports
[soc.git] / src / soc / fu / mmu / test / test_issuer_mmu_data_path.py
1 from nmigen import Module, Signal
2 from soc.simple.test.test_issuer import TestRunner
3 from openpower.simulator.program import Program
4 from soc.config.endian import bigendian
5 import unittest
6
7 from soc.fu.test.common import (
8 TestAccumulatorBase, skip_case, TestCase, ALUHelpers)
9
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
15
16 def case_mmu_ldst(self):
17 lst = [
18 "dcbz 1,2",
19 "tlbie 0,0,0,0,0", # RB,RS,RIC,PRS,R
20 "mtspr 18, 1", # reg 1 to DSISR
21 "mtspr 19, 2", # reg 2 to DAR
22 "mfspr 1, 18", # DSISR to reg 1
23 "mfspr 2, 19", # DAR to reg 2
24 "mtspr 48, 3", # set MMU PID
25 "mtspr 720, 4", # set MMU PRTBL
26 "lhz 3, 0(1)" # load some data
27 ]
28
29 initial_regs = [0] * 32
30 initial_regs[3] = 1
31 initial_regs[4] = 0xDEADBEEF
32 #initial_regs[1] = 0xDEADBEEF
33
34 #FIXME initial_sprs = {'DSISR': 0x12345678, 'DAR': 0x87654321}
35 initial_sprs = {}
36 self.add_case(Program(lst, bigendian),
37 initial_regs, initial_sprs)
38
39
40 if __name__ == "__main__":
41 unittest.main(exit=False)
42 suite = unittest.TestSuite()
43 suite.addTest(TestRunner(MMUTestCase().test_data,microwatt_mmu=True))
44 runner = unittest.TextTestRunner()
45 runner.run(suite)