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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [test-code-or1k/] [flag/] [flag.S] - Blame information for rev 791

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

Line No. Rev Author Line
1 90 jeremybenn
/* flag.S. Test of Or1ksim status register flags
2
 
3
   Copyright (C) 1999-2006 OpenCores
4
   Copyright (C) 2010 Embecosm Limited
5
 
6
   Contributors various OpenCores participants
7
   Contributor Jeremy Bennett 
8
 
9
   This file is part of OpenRISC 1000 Architectural Simulator.
10
 
11
   This program is free software; you can redistribute it and/or modify it
12
   under the terms of the GNU General Public License as published by the Free
13
   Software Foundation; either version 3 of the License, or (at your option)
14
   any later version.
15
 
16
   This program is distributed in the hope that it will be useful, but WITHOUT
17
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
19
   more details.
20
 
21
   You should have received a copy of the GNU General Public License along
22
   with this program.  If not, see .  */
23
 
24
/* ----------------------------------------------------------------------------
25
   This code is commented throughout for use with Doxygen.
26
   --------------------------------------------------------------------------*/
27
 
28
/* Basic SR flag test */
29
 
30
#include "spr-defs.h"
31
 
32
#define SET_ARITH_FLAG   0  /* If this is not set this test has no meaning */
33
 
34
        .section .except, "ax"
35
 
36
        .org 0x100
37
_reset:
38
        l.nop
39 787 jeremybenn
 
40
    // Clear R0 on start-up. There is no guarantee that R0 is hardwired to zero,
41
    // and indeed it is not when simulating the or1200 Verilog core.
42
    l.andi  r0,r0,0x0
43
 
44 458 julius
        l.movhi r10,0x8000
45
        l.addi  r11,r0,-1
46
        l.addi  r12,r0,2
47
        l.addi  r13,r0,0x5678
48
        l.movhi r14,0xdead
49
        l.ori   r14,r14,0xdead
50
        l.addi  r15,r0,0xdead
51
        l.movhi r3,hi(start)
52
        l.ori   r3,r3,lo(start)
53
        l.jr    r3
54
        l.nop
55 90 jeremybenn
 
56 458 julius
 
57
        .section .text
58
start:
59 90 jeremybenn
  /* Test start */
60
 
61
#if SET_ARITH_FLAG
62
  /* Simple zero test */
63
  l.addi r1,r0,1        /* f = 0 */
64
  l.addi  r1, r0, 0
65
  l.bnf     _err
66
  l.bf     _err
67
  l.addi r1,r0,1        /* f = 0 */
68
  l.add  r1, r0, r0
69
  l.bnf     _err
70
  l.addi r1,r0,1        /* f = 0 */
71
  l.andi  r1, r0, 0
72
  l.bnf     _err
73
  l.addi r1,r0,1        /* f = 0 */
74
  l.and  r1, r0, r0
75
  l.bnf     _err
76
 
77
  l.addi r1,r0,1        /* f = 0 */
78
  l.sub  r1, r0, r0
79
  l.bf     _err
80
  l.or   r1, r0, r0
81
  l.bf     _err
82
  l.ori  r1, r0, 0
83
  l.bf     _err
84
  l.xor  r1, r0, r0
85
  l.bf     _err
86
  l.xori r1, r0, 0
87
  l.bf     _err
88
 
89
  l.addi r1,r0,0        /* f = 1 */
90
  l.sub  r1, r0, r0
91
  l.bnf     _err
92
  l.or   r1, r0, r0
93
  l.bnf     _err
94
  l.ori  r1, r0, 0
95
  l.bnf     _err
96
  l.xor  r1, r0, r0
97
  l.bnf     _err
98
  l.xori r1, r0, 0
99
  l.bnf     _err
100
 
101
  l.addi r1,r0,0        /* f = 1 */
102
  l.addi  r1, r0, 0xdead
103
  l.bf     _err
104
  l.addi r1,r0,0        /* f = 1 */
105
  l.add  r1, r0, r15
106
  l.bf     _err
107
  l.addi r1,r0,0        /* f = 1 */
108
  l.andi  r1, r11, 0xdead
109
  l.bf     _err
110
  l.addi r1,r0,0        /* f = 1 */
111
  l.and  r1, r11, r15
112
  l.bf     _err
113
 
114
  l.addi r1,r0,0        /* f = 1 */
115
  l.addi  r1, r11, 0
116
  l.bf     _err
117
  l.addi r1,r0,0        /* f = 1 */
118
  l.add  r1, r11, r0
119
  l.bf     _err
120
  l.addi r1,r0,0        /* f = 1 */
121
  l.andi  r1, r11, 0x1234
122
  l.bf     _err
123
  l.addi r1,r0,0        /* f = 1 */
124
  l.and  r1, r11, r10
125
  l.bf     _err
126
#endif
127
 
128
  l.movhi r3,0xdead
129
  l.ori   r3,r3,0xdead
130
  l.nop   NOP_REPORT
131
  l.ori   r3,r0,0
132
  l.nop   NOP_EXIT
133
 
134
_err:
135
  l.ori   r3,r1,0
136
  l.nop   NOP_REPORT
137
  l.mfspr r3,r0,SPR_SR
138
  l.nop   NOP_REPORT
139
  l.nop   NOP_EXIT

powered by: WebSVN 2.1.0

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