OSDN Git Service

Extend pmacro language, add testsuite.
[pf3gnuchains/pf3gnuchains3x.git] / cgen / testsuite / testsuite.cpu
1 ;; CPU to use for the testsuite. -*- Scheme -*-
2
3 (define-arch
4   (name testsuite) ; name of cpu
5   (comment ".cpu file for the testsuite")
6   (insn-lsb0? #t)
7   (machs testb)
8   (isas test)
9 )
10
11 (define-isa
12   (name test)
13   (base-insn-bitsize 16)
14   (decode-assist (0 1 2 3))
15 )
16   
17 (define-cpu
18   (name testf)
19   (comment "experimental cpu family")
20   (endian little)
21   (word-bitsize 32)
22 )
23
24 (define-mach
25   (name testb)
26   (comment "mach for testsuite")
27   (cpu testf)
28 )
29
30 (define-model
31   (name test) (comment "test") (attrs)
32   (mach testb)
33   ;(pipeline all "" () ((fetch) (decode) (execute) (writeback)))
34   (unit u-exec "Execution Unit" () 1 1 () () () ())
35 )
36 \f
37 ;; Some useful pmacros for testcases.
38
39 (define-pmacro (newline) (.print "\n"))
40
41 ;; Record name of test for debugging purposes.
42
43 (define-pmacro (test-name name)
44   (.print "TEST: " name "\n")
45 )
46
47 ;; Print TEXT as the expected output.
48
49 (define-pmacro (print-match text)
50   (.begin
51    (.print "MATCH: ")
52    (.print text)
53    (newline))
54 )
55
56 ;; Print EXPR as the text to be verified.
57
58 (define-pmacro (print-expr expr)
59   (.begin
60    (.print "EXPR: ")
61    (.dump expr)
62    (newline))
63 )
64
65 ;; THUNK is invoked to exercise whatever is being tested.
66
67 (define-pmacro (print-thunk thunk)
68   (.begin
69    (.print "EXPR: ")
70    (thunk)
71    (newline))
72 )