1 ; CPU description file generator for the simulator testsuite.
2 ; Copyright (C) 2000, 2009 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 (load (string-append srcdir "/read.scm"))
12 (load (string-append srcdir "/desc.scm"))
13 (load (string-append srcdir "/desc-cpu.scm"))
14 (load (string-append srcdir "/opcodes.scm"))
15 (load (string-append srcdir "/opc-asmdis.scm"))
16 (load (string-append srcdir "/opc-ibld.scm"))
17 (load (string-append srcdir "/opc-itab.scm"))
18 (load (string-append srcdir "/opc-opinst.scm"))
19 (load (string-append srcdir "/sim-test.scm"))
22 (define stest-arguments
24 (list "-B" "file" "generate build.sh"
26 (lambda (arg) (file-write arg cgen-build.sh)))
27 (list "-E" "file" "generate the testsuite .exp"
29 (lambda (arg) (file-write arg cgen-allinsn.exp)))
33 ; Kept global so it's available to the other .scm files.
36 ; Scan argv for -s srcdir.
37 ; We can't process any other args until we find the cgen source dir.
38 ; The result is srcdir.
39 ; We assume "-s" isn't the argument to another option. Unwise, yes.
40 ; Alternatives are to require it to be the first argument or at least preceed
41 ; any option with a "-s" argument, or to put knowledge of the common argument
42 ; set and common argument parsing code in every top level file.
44 (define (find-srcdir argv)
45 (let loop ((argv argv))
47 (error "`-s srcdir' not present, can't load cgen"))
48 (if (string=? "-s" (car argv))
50 (if (null? (cdr argv))
51 (error "missing srcdir arg to `-s'"))
56 ; Main routine, parses options and calls generators.
58 (define (cgen-stest argv)
61 ; Find and set srcdir, then load all Scheme code.
62 ; Drop the first argument, it is the script name (i.e. argv[0]).
63 (set! srcdir (find-srcdir (cdr argv)))
64 (set! %load-path (cons srcdir %load-path))
71 #:arg-spec stest-arguments
73 #:finish sim-test-finish!
74 #:analyze sim-test-analyze!)
78 (cgen-stest (program-arguments))
80 ;; FIXME: cgen-all will generate the opcodes files, not what we want