enable both linux-5.7 tests
[soc.git] / src / soc / simple / test / test_issuer_linux_5_7.py
1 """simple core test, runs instructions from a TestMemory
2
3 related bugs:
4
5 * https://bugs.libre-soc.org/show_bug.cgi?id=363
6 """
7
8 # NOTE: to use cxxsim, export NMIGEN_SIM_MODE=cxxsim from the shell
9 # Also, check out the cxxsim nmigen branch, and latest yosys from git
10
11 import unittest
12 import sys
13
14 # here is the logic which takes test cases and "executes" them.
15 # in this instance (TestRunner) its job is to instantiate both
16 # a Libre-SOC nmigen-based HDL instance and an ISACaller python
17 # simulator. it's also responsible for performing the single
18 # step and comparison.
19 from soc.simple.test.test_runner import TestRunner
20
21 #@platen:bookmarks
22 #src/openpower/test/runner.py:class TestRunnerBase(FHDLTestCase):
23
24 # test with MMU
25 from openpower.test.mmu.mmu_cases import MMUTestCase
26 from openpower.test.mmu.mmu_rom_cases import MMUTestCaseROM, default_mem
27 from openpower.test.ldst.ldst_cases import LDSTTestCase
28 from openpower.test.ldst.ldst_exc_cases import LDSTExceptionTestCase
29 #from openpower.simulator.test_sim import (GeneralTestCases, AttnTestCase)
30 from soc.experiment.test import pagetables
31
32
33 from openpower.simulator.program import Program
34 from openpower.endian import bigendian
35 from openpower.test.common import TestAccumulatorBase
36
37 from openpower.consts import MSR
38
39 from soc.experiment.test import pagetables
40
41
42 class MMUTestCase(TestAccumulatorBase):
43
44 def case_first_vm_enabled(self):
45 lst = [
46 "std 6,0(2)",
47 ]
48
49 # set up regs
50 initial_regs = [0] * 32
51 initial_regs[2] = 0xc0000000005fc190
52 initial_regs[6] = 0x0101
53
54 # memory same as microwatt test
55 initial_mem = pagetables.microwatt_linux_5_7_boot
56
57 # set virtual and non-privileged
58 # msr: 8000000000000011
59 initial_msr = 0 << MSR.PR # must set "problem" state
60 initial_msr |= 1 << MSR.LE # little-endian
61 initial_msr |= 1 << MSR.SF # 64-bit
62 initial_msr |= 1 << MSR.DR # set "virtual" state for data
63
64 # set PRTBL to 0xe000000
65 initial_sprs = {720: 0xe000000, # PRTBL
66 48: 1 # PIDR
67 }
68
69 print("MMUTEST: initial_msr=",initial_msr)
70 self.add_case(Program(lst, bigendian), initial_regs,
71 initial_mem=initial_mem,
72 initial_sprs=initial_sprs,
73 initial_msr=initial_msr)
74
75
76 def case_first_vm_enabled_2(self):
77 lst = [
78 "std 6,0(2)",
79 ]
80
81 # set up regs
82 initial_regs = [0] * 32
83 initial_regs[2] = 0xc000000000598000
84 initial_regs[6] = 0x0101
85
86 # memory same as microwatt test
87 initial_mem = pagetables.microwatt_linux_5_7_boot
88
89 # set virtual and non-privileged
90 # msr: 8000000000000011
91 initial_msr = 0 << MSR.PR # must set "problem" state
92 initial_msr |= 1 << MSR.LE # little-endian
93 initial_msr |= 1 << MSR.SF # 64-bit
94 initial_msr |= 1 << MSR.DR # set "virtual" state for data
95
96 # set PRTBL to 0xe000000
97 initial_sprs = {720: 0xe00000c, # PRTBL
98 48: 1 # PIDR
99 }
100
101 print("MMUTEST: initial_msr=",initial_msr)
102 self.add_case(Program(lst, bigendian), initial_regs,
103 initial_mem=initial_mem,
104 initial_sprs=initial_sprs,
105 initial_msr=initial_msr)
106
107
108 if __name__ == "__main__":
109 svp64 = True
110 if len(sys.argv) == 2:
111 if sys.argv[1] == 'nosvp64':
112 svp64 = False
113 sys.argv.pop()
114
115 print ("SVP64 test mode enabled", svp64)
116
117 unittest.main(exit=False)
118 suite = unittest.TestSuite()
119
120 # MMU/DCache integration tests
121 suite.addTest(TestRunner(MMUTestCase().test_data, svp64=svp64,
122 microwatt_mmu=True,
123 rom=pagetables.microwatt_linux_5_7_boot))
124
125 runner = unittest.TextTestRunner()
126 runner.run(suite)