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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_39/] [or1ksim/] [peripheral/] [test.c] - Blame information for rev 970

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

Line No. Rev Author Line
1 970 simons
#include <stdio.h>
2
#include "sim-config.h"
3
#include "abstract.h"
4
#include "except.h"
5
 
6
unsigned long array[128];
7
 
8
/* Test write */
9
void test_write32 (unsigned long addr, unsigned long value)
10
{
11
  if (addr & 0x00000080)
12
    array[addr & 0x7f] = value;
13
  else
14
    except_handle(EXCEPT_BUSERR, cur_vadd);
15
}
16
 
17
/* Test read */
18
unsigned long test_read32 (unsigned long addr)
19
{
20
  if (addr & 0x00000080)
21
    return ~array[addr & 0x7f];
22
  else
23
    except_handle(EXCEPT_BUSERR, cur_vadd);
24
    return 0x00000000;
25
}
26
 
27
void test_reset ()
28
{
29
  int i;
30
 
31
  for (i = 0; i < 128; i++)
32
    array[i] = 0x00000000;
33
 
34
  if (config.test.enabled) {
35
    if (config.test.baseaddr)
36
      register_memoryarea(config.test.baseaddr, 256, 4, 0, test_read32, test_write32);
37
  }
38
}

powered by: WebSVN 2.1.0

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