1 # Copyright (c) 2020 The Regents of the University of California
4 # Copyright (c) 2018, Cornell University
7 # Redistribution and use in source and binary forms, with or
8 # without modification, are permitted provided that the following
11 # Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
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.
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.
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.
40 def asm_test(test
, #The full path of the test
45 debug_flags
=None, # Debug flags passed to gem5
50 config_file
= os
.path
.join(config
.base_dir
,
51 'configs', 'example', 'fs.py')
53 config_file
= os
.path
.join(config
.base_dir
,
54 'configs', 'example', 'se.py')
56 gem5_args
= ['--listener-mode', 'off']
58 if not debug_flags
is None:
59 gem5_args
+= ['--debug-flags', str(debug_flags
)]
63 '--cpu-type', cpu_type
,
69 '--mem-size', '3072MB',
75 '--ruby' if ruby
else '--caches',
80 name
= 'asm-' + os
.path
.basename(test
) + '-' + cpu_type
,
81 fixtures
= (program
,),
83 gem5_args
= gem5_args
,
85 config_args
= config_args
,
86 valid_isas
= ('RISCV',),
87 valid_hosts
= constants
.supported_hosts
90 cpu_types
= ('AtomicSimpleCPU', 'TimingSimpleCPU', 'MinorCPU', 'DerivO3CPU')
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:
95 # https://gem5.atlassian.net/browse/GEM5-494
96 # https://gem5.atlassian.net/browse/GEM5-496
97 # https://gem5.atlassian.net/browse/GEM5-497
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',
118 'rv64ua-ps-amoswap_d',
119 'rv64ua-ps-amoswap_w',
120 'rv64ua-ps-amoxor_d',
121 'rv64ua-ps-amoxor_w',
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',
143 'rv64ud-ps-recoding',
144 'rv64ud-ps-structural',
155 'rv64uf-ps-recoding',
224 bin_path
= config
.bin_path
226 bin_path
= joinpath(absdirpath(__file__
), '..', 'resources', 'asmtest')
228 urlbase
= config
.resource_url
+ '/test-progs/asmtest/bin/'
230 for cpu
in cpu_types
:
231 for binary
in binaries
:
232 url
= urlbase
+ binary
233 path
= joinpath(bin_path
, binary
)
235 program
= DownloadedProgram(url
, path
, binary
)
238 asm_test(joinpath(bin_path
, binary
, binary
), cpu
)