1 |
6 |
jlechner |
; CPU description file generator for the simulator testsuite.
|
2 |
|
|
; Copyright (C) 2000, 2009 Red Hat, Inc.
|
3 |
|
|
; This file is part of CGEN.
|
4 |
|
|
; See file COPYING.CGEN for details.
|
5 |
|
|
|
6 |
|
|
; generate allinsn.s and allinsn.d.
|
7 |
|
|
; Specify which application.
|
8 |
|
|
|
9 |
|
|
; Called after .cpu file has been read and global error checks are done.
|
10 |
|
|
; We use the `tmp' member to record the syntax split up into its components.
|
11 |
|
|
|
12 |
|
|
; The result is a list of strings to be inserted in the assembler
|
13 |
|
|
|
14 |
|
|
; FIXME: floating point support
|
15 |
|
|
; FIXME: Need to handle mach variants.
|
16 |
|
|
|
17 |
|
|
; resolve the hardware reference.
|
18 |
|
|
; Given an operand, return a set of N test data.
|
19 |
|
|
|
20 |
|
|
; For a number, return N numbers.
|
21 |
|
|
; Given the broken out assembler syntax string, return the list of operand
|
22 |
|
|
; objects.
|
23 |
|
|
; Given a list of operands for an instruction, return the test set
|
24 |
|
|
; (all possible combinations).
|
25 |
|
|
; N is the number of testcases for each operand.
|
26 |
|
|
; The result has N to-the-power (length OP-LIST) elements.
|
27 |
|
|
|
28 |
|
|
; Given an assembler expression and a set of operands build a testcase.
|
29 |
|
|
; SYNTAX-LIST is a list of syntax elements (characters) and <operand> objects.
|
30 |
|
|
; TEST-DATA is a list of strings, one element per operand.
|
31 |
|
|
|
32 |
|
|
"Building a testcase for: "" "", test data: "" ""\n";(display (list result sl td "\n"))
|
33 |
|
|
"\t""\n"; Generate a set of testcases for INSN.
|
34 |
|
|
; FIXME: wip
|
35 |
|
|
"Generating sim test set for "" ...\n""\t.global ""\n"":\n"; Generate the shell script that builds the .cgs files.
|
36 |
|
|
; .cgs are .s files except that there may be other .s files in the directory
|
37 |
|
|
; and we want the .exp driver script to easily find the files.
|
38 |
|
|
;
|
39 |
|
|
; Eventually it would be nice to generate as much of the testcase as possible.
|
40 |
|
|
; For now we just generate the template and leave the programmer to fill in
|
41 |
|
|
; the guts of the test (i.e. set up various registers, execute the insn to be
|
42 |
|
|
; tested, and then verify the results).
|
43 |
|
|
; Clearly some hand generated testcases will also be needed, but this
|
44 |
|
|
; provides a good start for each instruction.
|
45 |
|
|
|
46 |
|
|
#/bin/sh
|
47 |
|
|
# Generate test result data for "" simulator testing.
|
48 |
|
|
# This script is machine generated.
|
49 |
|
|
# It is intended to be run in the testsuite source directory.
|
50 |
|
|
#
|
51 |
|
|
# Syntax: /bin/sh sim-build.sh
|
52 |
|
|
|
53 |
|
|
# Put results here, so we preserve the existing set for comparison.
|
54 |
|
|
|
55 |
|
|
mkdir tmpdir
|
56 |
|
|
cd tmpdir
|
57 |
|
|
\n""cat <<EOF > "".cgs\n"; FIXME: Need to record assembler line comment char in .cpu.
|
58 |
|
|
"# "" testcase for ""$"" -*- Asm -*-\n""# mach: ""all"",""\n\n""\t.include \"testutils.inc\"\n\n""\tstart\n\n""\n\tpass\n""EOF\n\n"; Generate the dejagnu allinsn.exp file that drives the tests.
|
59 |
|
|
"Generating sim-allinsn.exp ...\n""\
|
60 |
|
|
# "" simulator testsuite.
|
61 |
|
|
|
62 |
|
|
if [istarget ""*-*-*] {
|
63 |
|
|
# load support procs (none yet)
|
64 |
|
|
# load_lib cgen.exp
|
65 |
|
|
|
66 |
|
|
# all machines
|
67 |
|
|
set all_machs \""" ""\"
|
68 |
|
|
|
69 |
|
|
# The .cgs suffix is for \"cgen .s\".
|
70 |
|
|
foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.cgs]] {
|
71 |
|
|
|
72 |
|
|
# skip it.
|
73 |
|
|
if ![runtest_file_p $runtests $src] {
|
74 |
|
|
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
run_sim_test $src $all_machs
|
78 |
|
|
}
|
79 |
|
|
}\n"
|