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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [ldm3.S] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 csantifort
/*****************************************************************
2
//                                                              //
3
//  Amber 2 Core Instruction Test                               //
4
//                                                              //
5
//  This file is part of the Amber project                      //
6
//  http://www.opencores.org/project,amber                      //
7
//                                                              //
8
//  Description                                                 //
9
//  Tests the usage of ldm where the status bits are loaded     //
10
//                                                              //
11
//  Author(s):                                                  //
12
//      - Conor Santifort, csantifort.amber@gmail.com           //
13
//                                                              //
14
//////////////////////////////////////////////////////////////////
15
//                                                              //
16
// Copyright (C) 2010 Authors and OPENCORES.ORG                 //
17
//                                                              //
18
// This source file may be used and distributed without         //
19
// restriction provided that this copyright statement is not    //
20
// removed from the file and that any derivative work contains  //
21
// the original copyright notice and the associated disclaimer. //
22
//                                                              //
23
// This source file is free software; you can redistribute it   //
24
// and/or modify it under the terms of the GNU Lesser General   //
25
// Public License as published by the Free Software Foundation; //
26
// either version 2.1 of the License, or (at your option) any   //
27
// later version.                                               //
28
//                                                              //
29
// This source is distributed in the hope that it will be       //
30
// useful, but WITHOUT ANY WARRANTY; without even the implied   //
31
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
32
// PURPOSE.  See the GNU Lesser General Public License for more //
33
// details.                                                     //
34
//                                                              //
35
// You should have received a copy of the GNU Lesser General    //
36
// Public License along with this source; if not, download it   //
37
// from http://www.opencores.org/lgpl.shtml                     //
38
//                                                              //
39
*****************************************************************/
40
 
41
#include "amber_registers.h"
42
 
43
        .section .text
44
        .globl  main
45
main:
46
        @ Write values to user mode registers r13 and r14
47
        mov     r0, #0x200
48
        mov     r1, #0x66
49
        str     r1, [r0]
50
        mov     r1, #0x77
51
        str     r1, [r0, #4]
52
        ldmia   r0, {r13, r14}^
53
 
54
        @ set the condition flags, and stay in supervisor mode
55
        teqp    pc, #0xf0000003
56
 
57
        @ Because pc is included here, ldm loads the
58
        @ mode bits, These are zero so this load changes
59
        @ to the user mode with all status bits set to zero
60
        ldr     r3, StaticBase
61
        ldmia   r3, {r0-pc}^
62
        b       testfail
63
        b       testfail
64
        b       testfail
65
        b       testfail
66
 
67
ldm_jump:
68
        @ Check that we're in user mode now
69
        mov     r4, pc
70
        ldr     r5, PCMask
71
        bics    r6, r4, r5
72
        movne   r10, #10
73
        bne     testfail
74
 
75
        @ Check that User Mode r13 and r14 were not changed by the ldm instruction
76
        cmp     r13, #0x66
77
        movne   r10, #20
78
        bne     testfail
79
        cmp     r14, #0x77
80
        movne   r10, #30
81
        bne     testfail
82
 
83
 
84
        @ Check that r0 got loaded with the correct value
85
        cmp     r0,  #0
86
        movne   r10, #40
87
        bne     testfail
88
 
89
        @ Check that r1 got loaded with the correct value
90
        cmp     r1,  #1
91
        movne   r10, #50
92
        bne     testfail
93
 
94
        @ Check that r12 got loaded with the correct value
95
        cmp     r12, #12
96
        movne   r10, #60
97
        bne     testfail
98
 
99
@ ------------------------------------------
100
@ ------------------------------------------
101
 
102
        b       testpass
103
 
104
testfail:
105
        ldr     r11, AdrTestStatus
106
        str     r10, [r11]
107
        b       testfail
108
 
109
testpass:
110
        ldr     r11, AdrTestStatus
111
        mov     r10, #17
112
        str     r10, [r11]
113
        b       testpass
114
 
115
 
116
/* Write 17 to this address to generate a Test Passed message */
117
AdrTestStatus:  .word  ADR_AMBER_TEST_STATUS
118
StaticBase:     .word  Data1
119
PCMask:         .word  0x03fffffc
120
 
121
Data1:          .word  0x00
122
                .word  0x01
123
                .word  0x02
124
                .word  0x03
125
                .word  0x04
126
                .word  0x05
127
                .word  0x06
128
                .word  0x07
129
                .word  0x08
130
                .word  0x09
131
                .word  0x0a
132
                .word  0x0b
133
                .word  0x0c
134
                .word  0x0d
135
                .word  0x0e
136
                .word  ldm_jump
137
                .word  0x10
138
Data18:         .word  0x11
139
 
140
/* ========================================================================= */
141
/* ========================================================================= */
142
 
143
 

powered by: WebSVN 2.1.0

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