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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [flow1.S] - Blame information for rev 15

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

Line No. Rev Author Line
1 15 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 instruction and data flow.                            //
10
//  Specifically tests that a stm writing to cached memory      //
11
//  also writes all data through to main memory.                //
12
//                                                              //
13
//  Author(s):                                                  //
14
//      - Conor Santifort, csantifort.amber@gmail.com           //
15
//                                                              //
16
//////////////////////////////////////////////////////////////////
17
//                                                              //
18
// Copyright (C) 2010 Authors and OPENCORES.ORG                 //
19
//                                                              //
20
// This source file may be used and distributed without         //
21
// restriction provided that this copyright statement is not    //
22
// removed from the file and that any derivative work contains  //
23
// the original copyright notice and the associated disclaimer. //
24
//                                                              //
25
// This source file is free software; you can redistribute it   //
26
// and/or modify it under the terms of the GNU Lesser General   //
27
// Public License as published by the Free Software Foundation; //
28
// either version 2.1 of the License, or (at your option) any   //
29
// later version.                                               //
30
//                                                              //
31
// This source is distributed in the hope that it will be       //
32
// useful, but WITHOUT ANY WARRANTY; without even the implied   //
33
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
34
// PURPOSE.  See the GNU Lesser General Public License for more //
35
// details.                                                     //
36
//                                                              //
37
// You should have received a copy of the GNU Lesser General    //
38
// Public License along with this source; if not, download it   //
39
// from http://www.opencores.org/lgpl.shtml                     //
40
//                                                              //
41
*****************************************************************/
42
 
43
#include "amber_registers.h"
44
 
45
        .section .text
46
        .globl  main
47
main:
48
 
49
        @ ---------------------
50
        @ Enable the cache
51
        @ ---------------------
52
        mvn     r0,  #0
53
        mcr     15, 0, r0, cr3, cr0, 0   @ cacheable area
54
        mov     r0,  #1
55
        mcr     15, 0, r0, cr2, cr0, 0   @ cache enable
56
 
57
        mov     r13, #0x1000
58
        orr     r13, r13, #0x08
59
 
60
        ldr     r0, =Data1
61
        ldm     r0,  {r1-r5}
62
        stm     r13, {r1-r5}
63
        @ load the data values back to put them into the data cache
64
        ldm     r13, {r6-r10}
65
 
66
        ldr     r0, =Data2
67
        ldm     r0,  {r1-r5}
68
        @ second stm will be to cached memory
69
        stm     r13, {r1-r5}
70
        @ load it back from the cache to check thaat
71
        @ it was written to the cache correctly
72
        ldm     r13, {r6-r10}
73
        cmp     r1, r6
74
        cmpeq   r2, r7
75
        cmpeq   r3, r8
76
        cmpeq   r4, r9
77
        cmpeq   r5, r10
78
        movne   r10, #100
79
        bne     testfail
80
 
81
        @ Clear the cache and read back the data from main memory
82
        @ Write any value to cp15 reg1 to flush the cache
83
        mcr     15, 0, r0, cr1, cr0, 0
84
 
85
        ldm     r13, {r6-r10}
86
        cmp     r1, r6
87
        cmpeq   r2, r7
88
        cmpeq   r3, r8
89
        cmpeq   r4, r9
90
        cmpeq   r5, r10
91
        movne   r10, #200
92
        bne     testfail
93
 
94
        b       testpass
95
 
96
testfail:
97
        ldr     r11, AdrTestStatus
98
        str     r10, [r11]
99
        b       testfail
100
 
101
testpass:
102
        ldr     r11, AdrTestStatus
103
        mov     r10, #17
104
        str     r10, [r11]
105
        b       testpass
106
 
107
 
108
/* Write 17 to this address to generate a Test Passed message */
109
AdrTestStatus:  .word  ADR_AMBER_TEST_STATUS
110
 
111
Data1:          .word  0x3
112
                .word  0x4
113
                .word  0x5
114
                .word  0x6
115
                .word  0x7
116
Data2:          .word  0x13
117
                .word  0x14
118
                .word  0x15
119
                .word  0x16
120
                .word  0x17
121
 
122
 
123
 
124
/* ========================================================================= */
125
/* ========================================================================= */
126
 

powered by: WebSVN 2.1.0

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