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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [sw/] [tests/] [sdram/] [sim/] [sdram-bankrows.c] - Blame information for rev 393

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 349 julius
/*
2
 * SDRAM row/bank test
3
 *
4
 * Tests accessing different rows on different banks
5
 *
6
*/
7
 
8 393 julius
#include "cpu-utils.h"
9 349 julius
#include "board.h"
10
#include "sdram.h"
11
 
12
#define NUM_SDRAM_BANKS 4
13
#define SDRAM_BANK_SIZE (SDRAM_SIZE / NUM_SDRAM_BANKS)
14
#define SDRAM_BANK_START(bank) ((SDRAM_BANK_SIZE*bank) + SDRAM_BASE)
15
#define SDRAM_BANK_LAST_WORD(bank) ((SDRAM_BANK_START((bank+1)))-4)
16
#define SDRAM_BANK_MIDDLE_WORD(bank) ((SDRAM_BANK_START((bank)))+(SDRAM_BANK_SIZE/2))
17
 
18
int main()
19
{
20
 
21
  REG32(SDRAM_BANK_LAST_WORD(0))   = 0x00001111;
22
  REG32(SDRAM_BANK_MIDDLE_WORD(1)) = 0x22223333;
23
  REG32(SDRAM_BANK_LAST_WORD(1))   = 0x44445555;
24
  REG32(SDRAM_BANK_MIDDLE_WORD(2)) = 0x66667777;
25
  REG32(SDRAM_BANK_LAST_WORD(2))   = 0x88889999;
26
  REG32(SDRAM_BANK_MIDDLE_WORD(3)) = 0xaaaabbbb;
27
  REG32(SDRAM_BANK_LAST_WORD(3))   = 0xccccdddd;
28
 
29
  unsigned long read_result = 0;
30
  read_result += REG32(SDRAM_BANK_LAST_WORD(0));
31
  read_result += REG32(SDRAM_BANK_MIDDLE_WORD(1));
32
  read_result += REG32(SDRAM_BANK_LAST_WORD(1));
33
  read_result += REG32(SDRAM_BANK_MIDDLE_WORD(2));
34
  read_result += REG32(SDRAM_BANK_LAST_WORD(2));
35
  read_result += REG32(SDRAM_BANK_MIDDLE_WORD(3));
36
  read_result += REG32(SDRAM_BANK_LAST_WORD(3));
37
  report(read_result);
38
  // read_result should be 0xCCCD4441
39
  exit((read_result^0x4ccd444c)); /* should result in 8000000d */
40
}

powered by: WebSVN 2.1.0

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