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

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_1_x/] [or1ksim/] [peripheral/] [test.c] - Rev 970

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

#include <stdio.h>
#include "sim-config.h"
#include "abstract.h"
#include "except.h"
 
unsigned long array[128];
 
/* Test write */
void test_write32 (unsigned long addr, unsigned long value)
{
  if (addr & 0x00000080)
    array[addr & 0x7f] = value;
  else
    except_handle(EXCEPT_BUSERR, cur_vadd);
}
 
/* Test read */
unsigned long test_read32 (unsigned long addr)
{
  if (addr & 0x00000080)
    return ~array[addr & 0x7f];
  else
    except_handle(EXCEPT_BUSERR, cur_vadd);
    return 0x00000000;
}
 
void test_reset ()
{
  int i;
 
  for (i = 0; i < 128; i++)
    array[i] = 0x00000000;
 
  if (config.test.enabled) {
    if (config.test.baseaddr)
      register_memoryarea(config.test.baseaddr, 256, 4, 0, test_read32, test_write32);
  }
}
 

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

powered by: WebSVN 2.1.0

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