tests: Add realview64-kvm.py testing platform
[gem5.git] / tests / gem5 / asmtest / tests.py
1 # Copyright (c) 2020 The Regents of the University of California
2 # All Rights Reserved.
3 #
4 # Copyright (c) 2018, Cornell University
5 # All rights reserved.
6 #
7 # Redistribution and use in source and binary forms, with or
8 # without modification, are permitted provided that the following
9 # conditions are met:
10 #
11 # Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 #
14 # Redistributions in binary form must reproduce the above
15 # copyright notice, this list of conditions and the following
16 # disclaimer in the documentation and/or other materials provided
17 # with the distribution.
18 #
19 # Neither the name of Cornell University nor the names of its
20 # contributors may be used to endorse or promote products derived
21 # from this software without specific prior written permission.
22 #
23 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
24 # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
25 # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
28 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
31 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
32 # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 # POSSIBILITY OF SUCH DAMAGE.
36
37 import os
38 from testlib import *
39
40 def asm_test(test, #The full path of the test
41 cpu_type,
42 num_cpus=4,
43 max_tick=10000000000,
44 ruby=True,
45 debug_flags=None, # Debug flags passed to gem5
46 full_system = False
47 ):
48
49 if full_system:
50 config_file = os.path.join(config.base_dir,
51 'configs', 'example', 'fs.py')
52 else:
53 config_file = os.path.join(config.base_dir,
54 'configs', 'example', 'se.py')
55
56 gem5_args = ['--listener-mode', 'off']
57
58 if not debug_flags is None:
59 gem5_args += ['--debug-flags', str(debug_flags)]
60
61 config_args = [
62 '-m', str(max_tick),
63 '--cpu-type', cpu_type,
64 ]
65
66 if full_system:
67 config_args += [
68 '--caches',
69 '--mem-size', '3072MB',
70 '--kernel', test
71 ]
72 else:
73 config_args += [
74 '-n', str(num_cpus),
75 '--ruby' if ruby else '--caches',
76 '--cmd', test
77 ]
78
79 gem5_verify_config(
80 name = 'asm-' + os.path.basename(test) + '-' + cpu_type,
81 fixtures = (program,),
82 verifiers = (),
83 gem5_args = gem5_args,
84 config = config_file,
85 config_args = config_args,
86 valid_isas = ('RISCV',),
87 valid_hosts = constants.supported_hosts
88 )
89
90 cpu_types = ('AtomicSimpleCPU', 'TimingSimpleCPU', 'MinorCPU', 'DerivO3CPU')
91
92 # The following lists the RISCV binaries. Those commented out presently result
93 # in a test failure. They are outlined in the following Jira Issues:
94 #
95 # https://gem5.atlassian.net/browse/GEM5-494
96 # https://gem5.atlassian.net/browse/GEM5-496
97 # https://gem5.atlassian.net/browse/GEM5-497
98 binaries = (
99 # 'rv64samt-ps-sysclone_d',
100 # 'rv64samt-ps-sysfutex1_d',
101 # 'rv64samt-ps-sysfutex2_d',
102 # 'rv64samt-ps-sysfutex3_d',
103 # 'rv64samt-ps-sysfutex_d',
104 'rv64ua-ps-amoadd_d',
105 'rv64ua-ps-amoadd_w',
106 'rv64ua-ps-amoand_d',
107 'rv64ua-ps-amoand_w',
108 'rv64ua-ps-amomax_d',
109 'rv64ua-ps-amomax_w',
110 'rv64ua-ps-amomaxu_d',
111 'rv64ua-ps-amomaxu_w',
112 'rv64ua-ps-amomin_d',
113 'rv64ua-ps-amomin_w',
114 'rv64ua-ps-amominu_d',
115 'rv64ua-ps-amominu_w',
116 'rv64ua-ps-amoor_d',
117 'rv64ua-ps-amoor_w',
118 'rv64ua-ps-amoswap_d',
119 'rv64ua-ps-amoswap_w',
120 'rv64ua-ps-amoxor_d',
121 'rv64ua-ps-amoxor_w',
122 'rv64ua-ps-lrsc',
123 # 'rv64uamt-ps-amoadd_d',
124 # 'rv64uamt-ps-amoand_d',
125 # 'rv64uamt-ps-amomax_d',
126 # 'rv64uamt-ps-amomaxu_d',
127 # 'rv64uamt-ps-amomin_d',
128 # 'rv64uamt-ps-amominu_d',
129 # 'rv64uamt-ps-amoor_d',
130 # 'rv64uamt-ps-amoswap_d',
131 # 'rv64uamt-ps-amoxor_d',
132 # 'rv64uamt-ps-lrsc_d',
133 'rv64ud-ps-fadd',
134 'rv64ud-ps-fclass',
135 'rv64ud-ps-fcmp',
136 'rv64ud-ps-fcvt',
137 'rv64ud-ps-fcvt_w',
138 'rv64ud-ps-fdiv',
139 'rv64ud-ps-fmadd',
140 'rv64ud-ps-fmin',
141 'rv64ud-ps-ldst',
142 'rv64ud-ps-move',
143 'rv64ud-ps-recoding',
144 'rv64ud-ps-structural',
145 'rv64uf-ps-fadd',
146 'rv64uf-ps-fclass',
147 'rv64uf-ps-fcmp',
148 'rv64uf-ps-fcvt',
149 'rv64uf-ps-fcvt_w',
150 'rv64uf-ps-fdiv',
151 'rv64uf-ps-fmadd',
152 'rv64uf-ps-fmin',
153 'rv64uf-ps-ldst',
154 'rv64uf-ps-move',
155 'rv64uf-ps-recoding',
156 'rv64ui-ps-add',
157 'rv64ui-ps-addi',
158 'rv64ui-ps-addiw',
159 'rv64ui-ps-addw',
160 'rv64ui-ps-and',
161 'rv64ui-ps-andi',
162 'rv64ui-ps-auipc',
163 'rv64ui-ps-beq',
164 'rv64ui-ps-bge',
165 'rv64ui-ps-bgeu',
166 'rv64ui-ps-blt',
167 'rv64ui-ps-bltu',
168 'rv64ui-ps-bne',
169 'rv64ui-ps-fence_i',
170 'rv64ui-ps-jal',
171 'rv64ui-ps-jalr',
172 'rv64ui-ps-lb',
173 'rv64ui-ps-lbu',
174 'rv64ui-ps-ld',
175 'rv64ui-ps-lh',
176 'rv64ui-ps-lhu',
177 'rv64ui-ps-lui',
178 'rv64ui-ps-lw',
179 'rv64ui-ps-lwu',
180 'rv64ui-ps-or',
181 'rv64ui-ps-ori',
182 'rv64ui-ps-sb',
183 'rv64ui-ps-sd',
184 'rv64ui-ps-sh',
185 'rv64ui-ps-simple',
186 'rv64ui-ps-sll',
187 'rv64ui-ps-slli',
188 'rv64ui-ps-slliw',
189 'rv64ui-ps-sllw',
190 'rv64ui-ps-slt',
191 'rv64ui-ps-slti',
192 'rv64ui-ps-sltiu',
193 'rv64ui-ps-sltu',
194 'rv64ui-ps-sra',
195 'rv64ui-ps-srai',
196 'rv64ui-ps-sraiw',
197 'rv64ui-ps-sraw',
198 'rv64ui-ps-srl',
199 'rv64ui-ps-srli',
200 'rv64ui-ps-srliw',
201 'rv64ui-ps-srlw',
202 'rv64ui-ps-sub',
203 'rv64ui-ps-subw',
204 'rv64ui-ps-sw',
205 'rv64ui-ps-xor',
206 'rv64ui-ps-xori',
207 'rv64um-ps-div',
208 'rv64um-ps-divu',
209 'rv64um-ps-divuw',
210 'rv64um-ps-divw',
211 'rv64um-ps-mul',
212 'rv64um-ps-mulh',
213 'rv64um-ps-mulhsu',
214 'rv64um-ps-mulhu',
215 'rv64um-ps-mulw',
216 'rv64um-ps-rem',
217 'rv64um-ps-remu',
218 'rv64um-ps-remuw',
219 'rv64um-ps-remw',
220 )
221
222
223 if config.bin_path:
224 bin_path = config.bin_path
225 else:
226 bin_path = joinpath(absdirpath(__file__), '..', 'resources', 'asmtest')
227
228 urlbase = config.resource_url + '/test-progs/asmtest/bin/'
229
230 for cpu in cpu_types:
231 for binary in binaries:
232 url = urlbase + binary
233 path = joinpath(bin_path, binary)
234 try:
235 program = DownloadedProgram(url, path, binary)
236 except:
237 continue
238 asm_test(joinpath(bin_path, binary, binary), cpu)