sim: ft32: new port
[deliverable/binutils-gdb.git] / sim / testsuite / sim / ft32 / testutils.inc
1
2 # Write ch to the standard output
3 .macro outch ch
4 ldk $r0,\ch
5 sta 0x10000,$r0
6 .endm
7
8 # End the test with return code c
9 .macro exit c
10 ldk $r0,\c
11 sta 0x1fffc,$r0
12 .endm
13
14 # All assembler tests should start with this macro "start"
15 .macro start
16 .text
17
18 jmp __start
19 jmp __start
20 reti
21
22 .data
23 ccsave: .long 0
24 .text
25
26 # Fiddling to load $cc from the following word in program memory
27 loadcc:
28 exi $r29,$sp,0
29 lpmi $cc,$r29,0
30 add $r29,$r29,4
31 exi $r29,$sp,0
32 return
33
34 failcase:
35 outch 'f'
36 outch 'a'
37 outch 'i'
38 outch 'l'
39 outch '\n'
40 exit 1
41
42 __start:
43
44 .endm
45
46 # At the end of the test, the code should reach this macro PASS
47 .macro PASS
48 outch 'p'
49 outch 'a'
50 outch 's'
51 outch 's'
52 outch '\n'
53 exit 0
54 .endm
55
56 # Confirm that reg has value, and fail immediately if not
57 # Preserves all registers
58 .macro EXPECT reg,value
59 sta ccsave,$cc
60 call loadcc
61 .long \value
62 cmp \reg,$cc
63 jmpc nz,failcase
64 lda $cc,ccsave
65 .endm
This page took 0.043808 seconds and 4 git commands to generate.