Automatic date update in version.in
[binutils-gdb.git] / sim / testsuite / frv / cache.ms
blob4ed18d0ddc6fd2a8a59f02fdf23af5c98c6c28d8
1 # mach: frv fr500 fr550
2 # sim: --memory-region 0xff000000,4 --memory-region 0xfe000000,00404000
3 # xfail: "crashes with bad write" *-*
5 ; Exit with return code
7         .macro exit rc
8         setlos.p        #1,gr7
9         setlos          \rc,gr8
10         tira            gr0,#0
11         .endm
13 ; Pass the test case
14         .macro pass
15 pass:
16         setlos.p        #5,gr10
17         setlos          #1,gr8
18         setlos          #5,gr7
19         sethi.p         %hi(passmsg),gr9
20         setlo           %lo(passmsg),gr9
21         tira            gr0,#0
22         exit            #0
23         .endm
25 ; Fail the testcase
26         .macro fail
27 fail\@:
28         setlos.p        #5,gr10
29         setlos          #1,gr8
30         setlos          #5,gr7
31         sethi.p         %hi(failmsg),gr9
32         setlo           %lo(failmsg),gr9
33         tira            gr0,#0
34         exit            #1
35         .endm
37         .data
38 failmsg:
39         .ascii "fail\n"
40 passmsg:
41         .ascii "pass\n"
43         .text
44         .global _start
45 _start:
46         movsg           hsr0,gr10       ; enable insn and data caches
47         sethi.p         0xc800,gr11     ; in copy-back mode
48         setlo           0x0000,gr11
49         or              gr10,gr11,gr10
50         movgs           gr10,hsr0
51         
52         sethi.p         0x7,sp
53         setlo           0x0000,sp
55         ; fill the cache
56         sethi.p         %hi(done1),gr10
57         setlo           %lo(done1),gr10
58         movgs           gr10,lr
59         setlos.p        0x1000,gr10
60         setlos          0x0,gr11
61         movgs           gr10,lcr
62 write1: st.p            gr11,@(sp,gr11)
63         addi.p          gr11,4,gr11
64         bctrlr.p        1,0
65         bra             write1
66 done1:
67         ; read it back
68         sethi.p         %hi(done2),gr10
69         setlo           %lo(done2),gr10
70         movgs           gr10,lr
71         setlos.p        0x1000,gr10
72         setlos          0x0,gr11
73         movgs           gr10,lcr
74 read1:  ld              @(sp,gr11),gr12
75         cmp             gr11,gr12,icc0
76         bne             icc0,1,fail
77         addi.p          gr11,4,gr11
78         bctrlr.p        1,0
79         bra             read1
80 done2:  
81         
82         ; fill the cache twice
83         sethi.p         %hi(done3),gr10
84         setlo           %lo(done3),gr10
85         movgs           gr10,lr
86         setlos.p        0x2000,gr10
87         setlos          0x0,gr11
88         movgs           gr10,lcr
89 write3: st.p            gr11,@(sp,gr11)
90         addi.p          gr11,4,gr11
91         bctrlr.p        1,0
92         bra             write3
93 done3:
94         ; read it back
95         sethi.p         %hi(done4),gr10
96         setlo           %lo(done4),gr10
97         movgs           gr10,lr
98         setlos.p        0x2000,gr10
99         setlos          0x0,gr11
100         movgs           gr10,lcr
101 read4:  ld              @(sp,gr11),gr12
102         cmp             gr11,gr12,icc0
103         bne             icc0,1,fail
104         addi.p          gr11,4,gr11
105         bctrlr.p        1,0
106         bra             read4
107 done4:  
108         ; read it back in reverse
109         sethi.p         %hi(done5),gr10
110         setlo           %lo(done5),gr10
111         movgs           gr10,lr
112         setlos.p        0x2000,gr10
113         setlos          0x7ffc,gr11
114         movgs           gr10,lcr
115 read5:  ld              @(sp,gr11),gr12
116         cmp             gr11,gr12,icc0
117         bne             icc0,1,fail
118         subi.p          gr11,4,gr11
119         bctrlr.p        1,0
120         bra             read5
121 done5:  
123         ; access data and insns in non-cache areas
124         sethi.p         0x8038,gr11             ; bctrlr 0,0
125         setlo           0x2000,gr11
127         sethi.p         0xff00,gr10             ; documented area
128         setlo           0x0000,gr10
129         sti             gr11,@(gr10,0)
130         jmpl            @(gr10,gr0)
132         ;  enable RAM mode
133         movsg           hsr0,gr10
134         sethi.p         0x0040,gr12
135         setlo           0x0000,gr12
136         or              gr10,gr12,gr10
137         movgs           gr10,hsr0
139         sethi.p         0xfe00,gr10             ; documented area
140         setlo           0x0400,gr10
141         sti             gr11,@(gr10,0)
142         jmpl            @(gr10,gr0)
144         sethi.p         0xfe40,gr10             ; documented area
145         setlo           0x0400,gr10
146         sti             gr11,@(gr10,0)
147         dcf             @(gr10,gr0)
148         jmpl            @(gr10,gr0)
150         sethi.p         0x0007,gr10             ; non RAM area
151         setlo           0x0000,gr10
152         sti             gr11,@(gr10,0)
153         jmpl            @(gr10,gr0)
155         sethi.p         0xfe00,gr10             ; insn RAM area
156         setlo           0x0000,gr10
157         sti             gr11,@(gr10,0)
158         jmpl            @(gr10,gr0)
160         sethi.p         0xfe40,gr10             ; data RAM area
161         setlo           0x0000,gr10
162         sti             gr11,@(gr10,0)
163         dcf             @(gr10,gr0)
164         jmpl            @(gr10,gr0)
165         
166         pass
167 fail:
168         fail