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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [cacheable_area.S] - Blame information for rev 48

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 cacheable area co-processor function.             //
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
        @ ---------------------
47
        @ Enable the cache
48
        @ ---------------------
49
        mov     r0,  #0x00000001
50 15 csantifort
        mcr     15, 0, r0, cr3, cr0, 0   @ cacheable area
51 2 csantifort
        mov     r0,  #1
52 15 csantifort
        mcr     15, 0, r0, cr2, cr0, 0   @ cache enable
53 2 csantifort
        nop
54
        nop
55
 
56
        @ Write to a block of memory that straddles
57
        @ across a cache region boundary so that
58
        @ the first 16 bytes are cacheable and
59
        @ the second 16 are not
60
        ldr     r0, AdrTestBase
61
        mov     r2, #0x20
62
1:      subs    r2, r2, #1
63
        str     r2, [r0], #4
64
        bne     1b
65
 
66
        @ loop a few times so that
67
        @ the instructions will be caches on the second and
68
        @ subsequent passes
69
        mov     r7, #3
70
 
71
        @ Read back the same block
72
loop:   ldr     r3, AdrTestBase
73
        mov     r5, #0x20
74
        mov     r6, #0
75
2:      ldr     r4, [r3], #4
76
        add     r6, r6, r4
77
        subs    r5, r5, #1
78
        bne     2b
79
 
80
        @ Check that the sum of the data reads is correct
81
        cmp     r6, #0x1f0
82
        movne   r10, #10
83
        bne     testfail
84
 
85
        subs    r7, r7, #1
86
        bne     loop
87
 
88
 
89
        b       testpass
90
@ ------------------------------------------
91
@ ------------------------------------------
92
 
93
testfail:
94
        ldr     r11, AdrTestStatus
95
        str     r10, [r11]
96
        b       testfail
97
 
98
testpass:
99
        ldr     r11, AdrTestStatus
100
        mov     r10, #17
101
        str     r10, [r11]
102
        b       testpass
103
 
104
 
105
 
106
/* Write 17 to this address to generate a Test Passed message */
107
AdrTestStatus:              .word ADR_AMBER_TEST_STATUS
108
AdrTestBase  :              .word 0x001fffc0
109
 
110
/* sum of numbers 0 to 2047 inclusive */
111
MagicNumber1024  :          .word  523776
112
MagicNumber2048  :          .word 2096128
113
 
114
/* ========================================================================= */
115
/* ========================================================================= */
116
 

powered by: WebSVN 2.1.0

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