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

Subversion Repositories mips_enhanced

[/] [mips_enhanced/] [trunk/] [grlib-gpl-1.0.19-b3188/] [software/] [leon3/] [ramtest.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimamali
 
2
#include "testmod.h"
3
#define CCTRL_IFP (1<<15)
4
#define CCTRL_DFP (1<<14)
5
 
6
extern rsysreg(int addr);
7
extern wsysreg(int *addr, int data);
8
extern cache_disable();
9
extern cache_enable();
10
 
11
cramtest()
12
{
13
        volatile double mrl[8*1024 + 8];
14
        int i;
15
        int ilinesz, dlinesz, dbytes, ibytes, itmask, dtmask, isets, dsets;
16
        int icconf, dcconf, cachectrl;
17
 
18
        flush();
19
        cache_enable();
20
        icconf = rsysreg(8);
21
        dcconf = rsysreg(12);
22
 
23
        report_subtest(DDAT_TEST);
24
 
25
        isets = ((icconf >> 24) & 3) + 1;
26
        ilinesz = 1 << (((icconf >> 16) & 7) + 2);
27
        ibytes = (1 << (((icconf >> 20) & 15) + 10)) * isets;
28
        itmask = (ilinesz - 1) | (0x80000000 - ibytes);
29
        dsets = ((dcconf >> 24) & 3) + 1;
30
        dlinesz = 1 << (((dcconf >> 16) & 7) + 2);
31
        dbytes = (1 << (((dcconf >> 20) & 15) + 10)) * dsets;
32
        dtmask = (dlinesz - 1) | (0x80000000 - dbytes);
33
 
34
        do cachectrl = rsysreg(0); while(cachectrl & (CCTRL_IFP | CCTRL_DFP));
35
 
36
 
37
        /* dcache data ram */
38
 
39
        if (ddramtest1(dbytes, mrl,0x55555555)) fail(1);
40
        if (ddramtest2(dbytes, mrl,0xaaaaaaaa)) fail(2);
41
 
42
        report_subtest(DTAG_TEST);
43
        cache_disable();
44
 
45
        /* dcache tag ram */
46
 
47
        if (dtramtest(dbytes, (0xaaaaaa00 & dtmask), dtmask, dlinesz,
48
            0xaaaaaaaa)) fail(3);
49
        if (dtramtest(dbytes, (0x55555500 & dtmask), dtmask, dlinesz,
50
            0x55555555)) fail(4);
51
 
52
        /* icache data ram */
53
 
54
        report_subtest(IDAT_TEST);
55
        if (idramtest(ibytes, 0x55555555)) fail(5);
56
        if (idramtest(ibytes, 0xaaaaaaaa)) fail(6);
57
 
58
        /* icache tag ram */
59
 
60
        report_subtest(ITAG_TEST);
61
        if (itramtest(ibytes, itmask, ilinesz, 0xaaaaaaaa)) fail(7);
62
        if (itramtest(ibytes, itmask, ilinesz, 0x55555555)) fail(8);
63
        flush();
64
        cache_enable();
65
        return(0);
66
 
67
}
68
 

powered by: WebSVN 2.1.0

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