Allow the formal engine to perform a same-cycle result in the ALU
[soc.git] / src / soc / experiment / test / pagetables.py
1 def b(x): # byte-reverse function
2 return int.from_bytes(x.to_bytes(8, byteorder='little'),
3 byteorder='big', signed=False)
4
5 test1 = {
6 0x10000: # PARTITION_TABLE_2
7 # PATB_GR=1 PRTB=0x1000 PRTS=0xb
8 b(0x800000000100000b),
9
10 0x30000: # RADIX_ROOT_PTE
11 # V = 1 L = 0 NLB = 0x400 NLS = 9
12 b(0x8000000000040009),
13
14 0x40000: # RADIX_SECOND_LEVEL
15 # V = 1 L = 1 SW = 0 RPN = 0
16 # R = 1 C = 1 ATT = 0 EAA 0x3
17 b(0xc000000000000183),
18
19 0x1000000: # PROCESS_TABLE_3
20 # RTS1 = 0x2 RPDB = 0x300 RTS2 = 0x5 RPDS = 13
21 b(0x40000000000300ad),
22
23 #0x10004: 0
24
25 }
26
27
28 # executable permission is barred here (EAA=0x2)
29 test2 = {
30 0x10000: # PARTITION_TABLE_2
31 # PATB_GR=1 PRTB=0x1000 PRTS=0xb
32 b(0x800000000100000b),
33
34 0x30000: # RADIX_ROOT_PTE
35 # V = 1 L = 0 NLB = 0x400 NLS = 9
36 b(0x8000000000040009),
37
38 0x40000: # RADIX_SECOND_LEVEL
39 # V = 1 L = 1 SW = 0 RPN = 0
40 # R = 1 C = 1 ATT = 0 EAA 0x2
41 b(0xc000000000000182),
42
43 0x1000000: # PROCESS_TABLE_3
44 # RTS1 = 0x2 RPDB = 0x300 RTS2 = 0x5 RPDS = 13
45 b(0x40000000000300ad),
46
47 #0x10004: 0
48
49 }
50
51
52 # microwatt mmu.bin first part of test 2. PRTBL must be set to 0x12000, PID to 1
53 microwatt_test2 = {
54 0x13920: 0x86810000000000c0, # leaf node
55 0x10000: 0x0930010000000080, # directory node
56 0x12010: 0x0a00010000000000, # page table
57 0x8108: 0x0000000badc0ffee, # memory to be looked up
58 }
59
60 microwatt_test4 = {
61 0x13858: 0x86a10000000000c0, # leaf node
62 0x10000: 0x0930010000000080, # directory node
63 0x12010: 0x0a00010000000000, # page table
64 }
65
66 # microwatt mmu.bin test 5: a misaligned read which crosses over to a TLB that
67 # is not valid. must attempt a 64-bit read at address 0x39fffd to trigger
68
69 microwatt_test5 = {
70 0x13cf8: 0x86b10000000000c0, # leaf, covers up to 0x39ffff
71 0x10008: 0x0930010000000080, # directory node
72 0x12010: 0x0a00010000000000, # page table
73 0x39fff8: 0x0123456badc0ffee, # to be looked up (should fail)
74 0x400000: 0x0123456badc0ffee, # not page-mapped
75 }
76
77 # linux kernel 5.7 first MMU enable
78 """
79 rd @ 000bf803 di b000000000001033 sel ff 3.......
80 rd @ 000bf804 di 0 sel ff ........
81 rd @ 000bf805 di 0 sel ff ........
82 rd @ 000bf806 di 10000 sel ff ........
83 rd @ 000bf807 di c0000000005fc380 sel ff ........
84 rd @ 000bf800 di 80000000 sel ff ........
85 rd @ 000bf801 di c00000000059d400 sel ff ..Y.....
86 rd @ 000bf802 di c000000000000000 sel ff ........
87 pc a588 insn 7c7a03a6 msr a000000000000003
88 pc a58c insn 7c9b03a6 msr a000000000000003
89 pc a590 insn 4c000024 msr a000000000000003
90 pc a598 insn f82d0190 msr b000000000000033
91 rd @ 01c00000 di ad005c0000000040 sel ff ........
92 rd @ 01c00001 di 0 sel ff ........
93 rd @ 01c00002 di 0 sel ff ........
94 rd @ 01c00003 di 0 sel ff ........
95 rd @ 01c00004 di 0 sel ff ........
96 rd @ 01c00005 di 0 sel ff ........
97 rd @ 01c00006 di 0 sel ff ........
98 rd @ 01c00007 di 0 sel ff ........
99 rd @ 000b8000 di 9e0ff0f00000080 sel ff ........
100 rd @ 000b8001 di 0 sel ff ........
101 rd @ 000b8002 di 0 sel ff ........
102 rd @ 000b8003 di 0 sel ff ........
103 rd @ 000b8004 di 0 sel ff ........
104 rd @ 000b8005 di 0 sel ff ........
105 rd @ 000b8006 di 0 sel ff ........
106 rd @ 000b8007 di 0 sel ff ........
107 rd @ 01fffc00 di 9d0ff0f00000080 sel ff ........
108 rd @ 01fffc01 di 0 sel ff ........
109 rd @ 01fffc02 di 0 sel ff ........
110 rd @ 01fffc03 di 0 sel ff ........
111 rd @ 01fffc04 di 0 sel ff ........
112 rd @ 01fffc05 di 0 sel ff ........
113 rd @ 01fffc06 di 0 sel ff ........
114 rd @ 01fffc07 di 0 sel ff ........
115 rd @ 01fffa00 di 8f010000000000c0 sel ff ........
116 rd @ 01fffa01 di 8f012000000000c0 sel ff ........
117 rd @ 01fffa02 di 8f014000000000c0 sel ff ........
118 rd @ 01fffa03 di 8e016000000000c0 sel ff ........
119 rd @ 01fffa04 di 8e018000000000c0 sel ff ........
120 rd @ 01fffa05 di 8e01a000000000c0 sel ff ........
121 rd @ 01fffa06 di 8e01c000000000c0 sel ff ........
122 rd @ 01fffa07 di 8e01e000000000c0 sel ff ........
123 """
124
125 microwatt_linux_5_7_boot = {
126 0x000bf803<<3: 0xb000000000001033,
127 0x000bf804<<3: 0x0,
128 0x000bf805<<3: 0x0,
129 0x000bf806<<3: 0x10000,
130 0x000bf807<<3: 0xc0000000005fc380,
131 0x000bf800<<3: 0x80000000,
132 0x000bf801<<3: 0xc00000000059d400,
133 0x000bf802<<3: 0xc000000000000000,
134 0x01c00000<<3: 0xad005c0000000040,
135 0x01c00001<<3: 0x0,
136 0x01c00002<<3: 0x0,
137 0x01c00003<<3: 0x0,
138 0x01c00004<<3: 0x0,
139 0x01c00005<<3: 0x0,
140 0x01c00006<<3: 0x0,
141 0x01c00007<<3: 0x0,
142 0x000b8000<<3: 0x09e0ff0f00000080,
143 0x000b8001<<3: 0x0,
144 0x000b8002<<3: 0x0,
145 0x000b8003<<3: 0x0,
146 0x000b8004<<3: 0x0,
147 0x000b8005<<3: 0x0,
148 0x000b8006<<3: 0x0,
149 0x000b8007<<3: 0x0,
150 0x01fffc00<<3: 0x09d0ff0f00000080,
151 0x01fffc01<<3: 0x0,
152 0x01fffc02<<3: 0x0,
153 0x01fffc03<<3: 0x0,
154 0x01fffc04<<3: 0x0,
155 0x01fffc05<<3: 0x0,
156 0x01fffc06<<3: 0x0,
157 0x01fffc07<<3: 0x0,
158 0x01fffa00<<3: 0x8f010000000000c0,
159 0x01fffa01<<3: 0x8f012000000000c0,
160 0x01fffa02<<3: 0x8f014000000000c0,
161 0x01fffa03<<3: 0x8e016000000000c0,
162 0x01fffa04<<3: 0x8e018000000000c0,
163 0x01fffa05<<3: 0x8e01a000000000c0,
164 0x01fffa06<<3: 0x8e01c000000000c0,
165 0x01fffa07<<3: 0x8e01e000000000c0,
166 }