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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [tests/] [ethmac_mem.S] - Blame information for rev 45

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

Line No. Rev Author Line
1 2 csantifort
/*****************************************************************
2
//                                                              //
3
//  Amber 2 System Ethernet MAC Test                            //
4
//                                                              //
5
//  This file is part of the Amber project                      //
6
//  http://www.opencores.org/project,amber                      //
7
//                                                              //
8
//  Description                                                 //
9
//  Tests wishbone access to the internal memory in the         //
10
//  Ethernet MAC module.                                        //
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
 
48
        @ Test reading of ethmac's internal BD memory
49
        @ 0x400 to 0x7ff
50
        ldr     r0, AdrEthMacMemBase
51
        ldr     r1, Data0
52
        str     r1, [r0], #4
53
        ldr     r1, Data1
54
        str     r1, [r0], #4
55
        ldr     r1, Data2
56
        str     r1, [r0], #4
57
        ldr     r1, Data3
58
        str     r1, [r0], #4
59
 
60
        @ Read back and check the 4 values
61
        ldr     r0, AdrEthMacMemBase
62
        ldr     r2, [r0], #4
63
        ldr     r3, Data0
64
        cmp     r2, r3
65
        movne   r10, #10
66
        bne     testfail
67
 
68
        ldr     r2, [r0], #4
69
        ldr     r3, Data1
70
        cmp     r2, r3
71
        movne   r10, #20
72
        bne     testfail
73
 
74
        ldr     r2, [r0], #4
75
        ldr     r3, Data2
76
        cmp     r2, r3
77
        movne   r10, #30
78
        bne     testfail
79
 
80
        ldr     r2, [r0], #4
81
        ldr     r3, Data3
82
        cmp     r2, r3
83
        movne   r10, #40
84
        bne     testfail
85
 
86
 
87
        @ Write all locations from 0x400 to 0x7ff, with Data == Address
88
        ldr     r0, AdrEthMacMemBase
89
        add     r1, r0, #0x400
90
        mov     r2, #0
91
 
92
1:      str     r2, [r0], #4
93
        cmp     r0, r1
94
        beq     checkem
95
        add     r2, r2, #4
96
        b       1b
97
 
98
checkem:
99
        @ Now read back all the locations, checking the values
100
        ldr     r0, AdrEthMacMemBase
101
        mov     r2, #0
102
 
103
2:      ldr     r3, [r0], #4
104
 
105
        cmp     r2, r3
106
        movne   r10, r0
107
        subne   r10, r10, #4
108
        bne     testfail
109
 
110
        add     r2, r2, #4
111
 
112
        cmp     r0, r1
113
        beq     testpass
114
        b       2b
115
 
116
 
117
testfail:
118
        ldr     r11, AdrTestStatus
119
        str     r10, [r11]
120
        b       testfail
121
 
122
testpass:
123
        ldr     r11, AdrTestStatus
124
        mov     r10, #17
125
        str     r10, [r11]
126
        b       testpass
127
 
128
 
129
/* Write 17 to this address to generate a Test Passed message */
130
AdrTestStatus:          .word  ADR_AMBER_TEST_STATUS
131
AdrEthMacModer:         .word  ADR_ETHMAC_MODER
132
AdrEthMacMIIModer:      .word  ADR_ETHMAC_MIIMODER
133
AdrEthMacMIICommand:    .word  ADR_ETHMAC_MIICOMMAND
134
AdrEthMacMIIAddress:    .word  ADR_ETHMAC_MIIADDRESS
135
AdrEthMacMIITxData:     .word  ADR_ETHMAC_MIITXDATA
136
AdrEthMacMIIRxData:     .word  ADR_ETHMAC_MIIRXDATA
137
AdrEthMacMIIStatus:     .word  ADR_ETHMAC_MIISTATUS
138
AdrEthMacMemBase:       .word  ADR_ETHMAC_BDBASE
139
 
140
Data0:                  .word  0xc0c0c0c0
141
Data1:                  .word  0xff00ff00
142
Data2:                  .word  0x12345678
143
Data3:                  .word  0x77777777
144
 
145
 
146
/* ========================================================================= */
147
/* ========================================================================= */

powered by: WebSVN 2.1.0

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