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

Subversion Repositories xulalx25soc

[/] [xulalx25soc/] [trunk/] [bench/] [asm/] [memtest.s] - Blame information for rev 50

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

Line No. Rev Author Line
1 35 dgisselq
;///////////////////////////////////////////////////////////////////////////////
2
;/
3
;/ Filename:    memtest.S
4
;/
5
;/ Project:     XuLA2 board
6
;/
7
;/ Purpose:     To test whether or not we can interface with the SDRAM on the
8
;/              XuLA2 board.
9
;/
10
;/
11
;/ Creator:     Dan Gisselquist, Ph.D.
12
;/              Gisselquist Technology, LLC
13
;/
14
;///////////////////////////////////////////////////////////////////////////////
15
;/
16
;/ Copyright (C) 2015, Gisselquist Technology, LLC
17
;/
18
;/ This program is free software (firmware): you can redistribute it and/or
19
;/ modify it under the terms of  the GNU General Public License as published
20
;/ by the Free Software Foundation, either version 3 of the License, or (at
21
;/ your option) any later version.
22
;/
23
;/ This program is distributed in the hope that it will be useful, but WITHOUT
24
;/ ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
25
;/ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
26
;/ for more details.
27
;/
28
;/ License:     GPL, v3, as defined and found on www.gnu.org,
29
;/              http://www.gnu.org/licenses/gpl.html
30
;/
31
;/
32
;///////////////////////////////////////////////////////////////////////////////
33
;/
34
;/
35 10 dgisselq
#define LFSRFILL        0x000001
36 35 dgisselq
;/ #define      LFSRTAPS        0x004597f
37 10 dgisselq
#define LFSRTAPS        0x0408b85
38
#define SDRAMBASE       0x0800000
39 35 dgisselq
;/ #define      SDRAMLEN        0x0800000
40 10 dgisselq
#define SDRAMLEN        0x0800000
41
#define RAMSCOPE        0x011c
42
#define ZIPSCOPE        0x011e
43 35 dgisselq
        .section .start
44
        .global _start
45
        .type   _start,@function
46
_start:
47
        LDI     user_entry,R0
48
        MOV     R0,uPC
49 10 dgisselq
        ; LDI   RAMSCOPE,R8
50
        ; LDI   0x04000000,R9
51
        ; STO   R9,(R8)
52
        RTU
53
        ; // Capture what just happened
54
        ; LDI   0x8c000000,R9
55
        ; STO   R9,(R8)
56
        ; NOP
57
        ; 
58
        HALT
59 35 dgisselq
        .section .text
60 10 dgisselq
user_entry:
61 35 dgisselq
;/ #define      CLEAR_MEMORY
62 10 dgisselq
#ifdef  CLEAR_MEMORY
63
clear_memory:
64
        LDI     SDRAMBASE,R0
65
        LDI     SDRAMLEN,R1
66
        ADD     R0,R1
67
        CLR     R2
68
clear_memory_loop:
69
        STO     R2,(R0)
70
        ADD     1,R0
71
        CMP     R0,R1
72
        BGT     clear_memory_loop
73
end_clear_memory:
74
#endif
75
 
76
        LDI     LFSRFILL,R2
77
        LDI     LFSRTAPS,R3
78
        CLR     R12
79
 
80
write_test:
81
        LDI     SDRAMBASE,R0
82
        LDI     SDRAMLEN,R1
83
        MOV     R2,R7           ; Copy our initial fill
84
        CMP     0,R2
85
        HALT.Z
86 35 dgisselq
;/ #define      WAIT_FOR_WRITE_SCOPE
87 10 dgisselq
#ifdef  WAIT_FOR_WRITE_SCOPE
88
        LDI     RAMSCOPE,R8
89
        LDI     0x01ffc,R9
90
        STO     R9,(R8)                 ; Reset the SDRAM scope
91
        NOP                             ; Give it a chance to reset
92
        LDI     0x10000000,R10
93
scope_not_ready:
94
        NOP
95
        LOD     (R8),R9
96
        TST     R10,R9
97
        BZ      scope_not_ready
98
#endif
99
 
100
write_test_loop:
101
        LSR     1,R2
102
        XOR.C   R3,R2
103
        MOV     R2,R4
104
 
105
        LSR     1,R2
106
        XOR.C   R3,R2
107
        MOV     R2,R5
108
 
109
        LSR     1,R2
110
        XOR.C   R3,R2           ; wr_reg_ce = R2
111
 
112
        STO     R4,(R0)         ; op = R4
113
        STO     R5,1(R0)        ; dcdA = R5
114
        STO     R2,2(R0)        ; instruction - R2
115
        ADD     3,R0
116
        SUB     3,R1
117
        CMP     3,R1
118
        BGE     write_test_loop
119
 
120
read_test:
121
        LDI     SDRAMBASE,R0
122
        LDI     SDRAMLEN,R1
123 35 dgisselq
;/ #define      WAIT_FOR_READ_SCOPE
124 10 dgisselq
#ifdef  WAIT_FOR_READ_SCOPE
125
        LDI     RAMSCOPE,R8
126
        LDI     0x01ffc,R9
127
        STO     R9,(R8)                 ; Reset the SDRAM scope
128
        NOP                             ; Give it a chance to reset
129
        LDI     0x10000000,R10
130
not_ready:
131
        NOP
132
        LOD     (R8),R9
133
        TST     R10,R9
134
        BZ      not_ready
135
#endif
136 35 dgisselq
;/
137
;/      RAM[49072] = 0x02b39ba ... not RAM[0].  What's going on here?
138
;/      
139 10 dgisselq
read_test_loop:
140
        LOD     (R0),R4
141
        LOD     1(R0),R5
142
        LOD     2(R0),R6
143
 
144
        LSR     1,R7
145
        XOR.C   R3,R7
146
        CMP     R7,R4
147
        TRAP.NZ 0
148
 
149
        LSR     1,R7
150
        XOR.C   R3,R7
151
        CMP     R7,R5
152
        TRAP.NZ 0
153
 
154
        LSR     1,R7
155
        XOR.C   R3,R7
156
        CMP     R7,R6
157
        TRAP.NZ 0
158
 
159
        ADD     3,R0
160
        SUB     3,R1
161
        CMP     3,R1
162
 
163
        BGE     read_test_loop
164
 
165
        ADD     1,R12
166
        BRA     write_test
167
;
168
;
169
;
170
;       0x0408b85
171
;       0x060ce47
172
;       0x070eca6
173
;       0x0387653
174
;       0x05cb0ac
175
;       0x02e5856
176
;       0x0172c2b
177
;       0x04b1d90
178
;       0x0258ec8
179
;       0x012c764
180
;       0x00963b2
181
;       0x004b1d9
182
;       0x042d369
183
;       0x061e231
184
;       0x0707a9d
185 15 dgisselq
;       ...
186 10 dgisselq
;
187
;

powered by: WebSVN 2.1.0

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