OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [sw/] [tests/] [or1200/] [sim/] [or1200-ext.S] - Blame information for rev 499

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 499 julius
/*
2
        OR1200 zero and sign extension instruction tests
3
 
4
        Very basic, testing
5
 
6
        Julius Baxter, ORSoC AB, julius.baxter@orsoc.se
7
 
8
*/
9
//////////////////////////////////////////////////////////////////////
10
////                                                              ////
11
//// Copyright (C) 2010 Authors and OPENCORES.ORG                 ////
12
////                                                              ////
13
//// This source file may be used and distributed without         ////
14
//// restriction provided that this copyright statement is not    ////
15
//// removed from the file and that any derivative work contains  ////
16
//// the original copyright notice and the associated disclaimer. ////
17
////                                                              ////
18
//// This source file is free software; you can redistribute it   ////
19
//// and/or modify it under the terms of the GNU Lesser General   ////
20
//// Public License as published by the Free Software Foundation; ////
21
//// either version 2.1 of the License, or (at your option) any   ////
22
//// later version.                                               ////
23
////                                                              ////
24
//// This source is distributed in the hope that it will be       ////
25
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
26
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
27
//// PURPOSE.  See the GNU Lesser General Public License for more ////
28
//// details.                                                     ////
29
////                                                              ////
30
//// You should have received a copy of the GNU Lesser General    ////
31
//// Public License along with this source; if not, download it   ////
32
//// from http://www.opencores.org/lgpl.shtml                     ////
33
////                                                              ////
34
//////////////////////////////////////////////////////////////////////
35
 
36
 
37
#include "spr-defs.h"
38
#include "board.h"
39
#include "or1200-defines.h"
40
 
41
 
42
/* =================================================== [ exceptions ] === */
43
        .section .vectors, "ax"
44
 
45
 
46
/* ---[ 0x100: RESET exception ]----------------------------------------- */
47
        .org 0x100
48
        l.movhi r0, 0
49
        /* Clear status register */
50
        l.ori r1, r0, SPR_SR_SM
51
        l.mtspr r0, r1, SPR_SR
52
        /* Clear timer  */
53
        l.mtspr r0, r0, SPR_TTMR
54
 
55
        /* Jump to program initialisation code */
56
        .global _start
57
        l.movhi r4, hi(_start)
58
        l.ori r4, r4, lo(_start)
59
        l.jr    r4
60
        l.nop
61
 
62
        .org 0x600
63
        l.nop 0x1
64
 
65
 
66
/* ---[ 0x700: Illegal instruction exception ]-------------------------- */
67
        .org 0x700
68
#ifndef OR1200_IMPL_ALU_EXT
69
        // No problem - instruction not supported
70
        l.movhi r3, hi(0x8000000d)
71
        l.ori   r3, r3, lo(0x8000000d)
72
        l.nop   0x2
73
        l.ori   r3, r0, 0
74
#else
75
        l.ori   r3, r0, 1
76
#endif
77
        l.nop   0x1
78
 
79
 
80
/* =================================================== [ text ] === */
81
        .section .text
82
 
83
/* =================================================== [ start ] === */
84
 
85
        .global _start
86
_start:
87
        // Kick off test
88
        l.jal   _main
89
        l.nop
90
 
91
 
92
 
93
/* =================================================== [ main ] === */
94
 
95
        .global _main
96
_main:
97
        // l.exth tests first
98
        l.ori   r4,r0,0xffff
99
        l.ori   r5,r0,0x7fff
100
 
101
        l.exths r3,r4
102
 
103
        l.movhi r8,0xffff
104
        l.ori   r8,r8,0xffff
105
 
106
        l.nop   0x2
107
        l.sfne  r8,r3
108
        l.bf    fail
109
        l.nop
110
 
111
        l.ori   r8,r0,0xffff
112
 
113
        l.exthz r3,r4
114
 
115
        l.nop   0x2
116
 
117
        l.sfne  r8,r3
118
        l.bf    fail
119
        l.nop
120
 
121
        l.exths r3,r5
122
 
123
        l.nop   0x2
124
 
125
        l.sfne  r3,r5
126
        l.bf    fail
127
        l.nop
128
 
129
        l.exthz r3,r5
130
 
131
        l.nop   0x2
132
 
133
        l.sfne  r3,r5
134
        l.bf    fail
135
        l.nop
136
 
137
        // l.extb tests
138
 
139
        l.ori   r4,r0,0x00ff
140
        l.ori   r5,r0,0x007f
141
 
142
        l.extbs r3,r4
143
 
144
        l.nop   0x2
145
 
146
        l.movhi r8,0xffff
147
        l.ori   r8,r8,0xffff
148
 
149
        l.sfne  r8,r3
150
        l.bf    fail
151
        l.nop
152
 
153
        l.ori   r8,r0,0x00ff
154
 
155
        l.extbz r3,r4
156
 
157
        l.nop   0x2
158
 
159
        l.sfne  r8,r3
160
        l.bf    fail
161
        l.nop
162
 
163
        l.extbs r3,r5
164
 
165
        l.nop   0x2
166
 
167
        l.sfne  r3,r5
168
        l.bf    fail
169
        l.nop
170
 
171
        l.extbz r3,r5
172
 
173
        l.nop   0x2
174
 
175
        l.sfne  r3,r5
176
        l.bf    fail
177
        l.nop
178
 
179
        // l.extw tests - shouldn't change anything
180
        l.movhi r4,0xffff
181
        l.ori   r4,r4,0xffff
182
 
183
        l.extws r3,r4
184
 
185
        l.nop   0x2
186
 
187
        l.sfne  r3,r4
188
        l.bf    fail
189
        l.nop
190
 
191
        l.extwz r3,r4
192
 
193
        l.nop   0x2
194
 
195
        l.sfne  r3,r4
196
        l.bf    fail
197
        l.nop
198
 
199
 
200
        l.movhi r3, hi(0x8000000d)
201
        l.ori   r3, r3, lo(0x8000000d)
202
        l.nop   0x2
203
        l.ori   r3, r0, 0
204
        l.nop   0x1
205
 
206
fail:
207
        l.ori   r3, r0, 1
208
        l.nop   0x1

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.