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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_47/] [or1ksim/] [peripheral/] [test.c] - Blame information for rev 1350

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

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

powered by: WebSVN 2.1.0

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