1 ; CPU description file generator for the simulator testsuite.
2 ; Copyright (C) 2000 Red Hat, Inc.
3 ; This file is part of CGEN.
5 ; This is invoked to build several .s files and a script to run to
6 ; generate the .d files and .exp file.
7 ; This is invoked to build: tmp-build.sh cpu-cpu.exp
9 ; Load the various support routines
10 (define (load-files srcdir)
11 ; Fix up Scheme to be what we use (guile is always in flux).
12 (primitive-load-path (string-append srcdir "/fixup.scm"))
14 (load (string-append srcdir "/read.scm"))
15 (load (string-append srcdir "/desc.scm"))
16 (load (string-append srcdir "/desc-cpu.scm"))
17 (load (string-append srcdir "/opcodes.scm"))
18 (load (string-append srcdir "/opc-asmdis.scm"))
19 (load (string-append srcdir "/opc-ibld.scm"))
20 (load (string-append srcdir "/opc-itab.scm"))
21 (load (string-append srcdir "/opc-opinst.scm"))
22 (load (string-append srcdir "/sim-test.scm"))
25 (define stest-arguments
27 (list '-B "file" "generate build.sh"
28 (lambda (arg) (file-write arg cgen-build.sh)))
29 (list '-E "file" "generate the testsuite .exp"
30 (lambda (arg) (file-write arg cgen-allinsn.exp)))
34 ; Kept global so it's available to the other .scm files.
37 ; Scan argv for -s srcdir.
38 ; We can't process any other args until we find the cgen source dir.
39 ; The result is srcdir.
40 ; We assume "-s" isn't the argument to another option. Unwise, yes.
41 ; Alternatives are to require it to be the first argument or at least preceed
42 ; any option with a "-s" argument, or to put knowledge of the common argument
43 ; set and common argument parsing code in every top level file.
45 (define (find-srcdir argv)
46 (let loop ((argv argv))
48 (error "`-s srcdir' not present, can't load cgen"))
49 (if (string=? "-s" (car argv))
51 (if (null? (cdr argv))
52 (error "missing srcdir arg to `-s'"))
57 ; Main routine, parses options and calls generators.
59 (define (cgen-stest argv)
62 ; Find and set srcdir, then load all Scheme code.
63 ; Drop the first argument, it is the script name (i.e. argv[0]).
64 (set! srcdir (find-srcdir (cdr argv)))
65 (set! %load-path (cons srcdir %load-path))
72 #:arg-spec stest-arguments
74 #:finish sim-test-finish!
75 #:analyze sim-test-analyze!)
79 (cgen-stest (program-arguments))