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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [boards/] [xilinx/] [s3adsp1800/] [sw/] [tests/] [ddr2cache/] [sim/] [ddr2cache-1.S] - Blame information for rev 568

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 568 julius
/*
2
        Simple test to exercise cache writeback
3
 
4
        Hardcoded for cache with 4 lines of 32 bytes.
5
 
6
        Julius Baxter, ORSoC AB, 
7
 
8
*/
9
#include "spr-defs.h"
10
 
11
#define NUM_LINES 4
12
#define BYTES_PER_LINE 32
13
 
14
        .section .vectors, "ax"
15
 
16
/* ---[ 0x100: RESET exception ]----------------------------------------- */
17
        .org 0x100
18
        l.movhi r0, 0
19
        /* Clear status register */
20
        l.ori r1, r0, SPR_SR_SM
21
        l.mtspr r0, r1, SPR_SR
22
        /* Clear timer  */
23
        l.mtspr r0, r0, SPR_TTMR
24
 
25
        /* Jump to program initialisation code */
26
        .global _start
27
        l.movhi r4, hi(_start)
28
        l.ori r4, r4, lo(_start)
29
        l.jr    r4
30
        l.nop
31
 
32
 
33
/* =================================================== [ text ] === */
34
        .section .text
35
 
36
/* =================================================== [ start ] === */
37
 
38
        .global _start
39
 
40
_start:
41
        l.movhi r1,hi(_stack)
42
        l.ori   r1,r1,lo(_stack)
43
        l.addi  r2, r0, -3
44
        l.and   r1, r1, r2
45
 
46
        l.movhi r2,0    /*r2 is counter */
47
 
48
        /* Write data into addresses that should step through the
49
        lines of the cache */
50
 
51
        l.addi  r5,r0,-(BYTES_PER_LINE-1)
52
        l.and   r4,r1,r5        /* r4 has base address of place to access */
53
        l.addi  r4,r4,BYTES_PER_LINE    /* Go to safe address, past top of stack */
54
 
55
        /* report this address */
56
        l.ori   r3,r4,0
57
        l.nop   0x2
58
 
59
wr_loop:
60
        l.muli  r5,r2,BYTES_PER_LINE    /* offset from base address */
61
        l.add   r6,r5,r4        /* Address to write to (line offset + base) */
62
 
63
        /* report this address */
64
        l.ori   r3,r6,0
65
        l.nop   0x2
66
 
67
        /* report counter */
68
        l.ori   r3,r2,0
69
        l.nop   0x2
70
 
71
        /* do memory access */
72
        l.sw    0(r6),r2        /* Write counter to this address */
73
 
74
        l.sfeqi r2,(NUM_LINES-1)        /* Done all lines? */
75
        l.bnf   wr_loop
76
        l.addi  r2,r2,1         /* increment line counter */
77
 
78
        /* end of write loop */
79
 
80
        /* reset counter */
81
        l.movhi r2,0
82
 
83
rd_loop:
84
        l.muli  r5,r2,BYTES_PER_LINE    /* offset from base address */
85
        l.add   r6,r5,r4        /* Address to write to (line offset + base) */
86
 
87
        /* report this address */
88
        l.ori   r3,r6,0
89
        l.nop   0x2
90
 
91
        /* report counter */
92
        l.ori   r3,r2,0
93
        l.nop   0x2
94
 
95
        /* do memory access */
96
        l.lwz   r7,0(r6)        /* load value */
97
 
98
        /* should equal r2 */
99
        l.sfne  r2,r7
100
        l.bf    fail
101
        l.nop
102
 
103
        l.sfeqi r2,(NUM_LINES-1)        /* Done all lines? */
104
        l.bnf   rd_loop
105
        l.addi  r2,r2,1         /* increment line counter */
106
 
107
        /* end of read loop */
108
pass:
109
        l.movhi r3,0x8000
110
        l.ori   r3,r3,0x000d
111
        l.nop   0x2
112
        l.movhi r3,0
113
        l.nop   0x1
114
 
115
fail:
116
        l.movhi r3,0xbaaa
117
        l.ori   r3,r3,0xaaad
118
        l.nop   0x1
119
 

powered by: WebSVN 2.1.0

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