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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [ddr32.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 DDR3 Memory Access                             //
4
//                                                              //
5
//  This file is part of the Amber project                      //
6
//  http://www.opencores.org/project,amber                      //
7
//                                                              //
8
//  Description                                                 //
9
//  Tests byte read and write accesses.                         //
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
 
44
        .section .text
45
        .globl  main
46
main:
47
 
48
        mov     r3, #4      @ main loop count
49
        ldr     r0,  AdrRanNum
50
mainl:  ldr     r1, [r0]    @ load a random number
51
        mov     r1, r1, lsl #12
52
 
53
        @ --------------------------------------------
54
        @ write phase
55
        ldr     r8,  DDRBase
56
        add     r8, r8, r1
57
        mov     r9,  #0xff
58
1:      strb    r9, [r8], #1
59
        subs    r9, r9, #1
60
        bne     1b
61
 
62
        @ read phase
63
        ldr     r8,  DDRBase
64
        add     r8, r8, r1
65
        mov     r9,  #0xff
66
2:      ldrb    r7, [r8], #1
67
        cmp     r7, r9
68
        movne   r10, #10
69
        bne     testfail
70
        subs    r9, r9, #1
71
        bne     2b
72
 
73
        @ --------------------------------------------
74
        subs    r3, r3, #1
75
        bne     mainl
76
 
77
        b       testpass
78
 
79
 
80
testfail:
81
        ldr     r11, AdrTestStatus
82
        str     r10, [r11]
83
        b       testfail
84
 
85
testpass:
86
        ldr     r11, AdrTestStatus
87
        mov     r10, #17
88
        str     r10, [r11]
89
        b       testpass
90
 
91
 
92
/* Write 17 to this address to generate a Test Passed message */
93
AdrTestStatus:  .word ADR_AMBER_TEST_STATUS
94
AdrRanNum:      .word ADR_AMBER_TEST_RANDOM_NUM
95
DDRBase:        .word 0x100000

powered by: WebSVN 2.1.0

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