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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [ldm4.S] - Blame information for rev 57

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

powered by: WebSVN 2.1.0

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