URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [tags/] [nog_patch_63/] [or1ksim/] [peripheral/] [test.c] - Rev 1359
Go to most recent revision | Compare with Previous | Blame | View Log
#include <stdio.h> #include "config.h" #ifdef HAVE_INTTYPES_H #include <inttypes.h> #endif #include "port.h" #include "arch.h" #include "sim-config.h" #include "abstract.h" #include "except.h" uint32_t array[128]; /* Test write */ void test_write32 (oraddr_t addr, uint32_t value, void *dat) { if (addr & 0x00000080) array[addr & 0x7f] = value; else except_handle(EXCEPT_BUSERR, cur_vadd); } /* Test read */ uint32_t test_read32 (oraddr_t addr, void *dat) { 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, NULL); } } /*---------------------------------------------------[ Test configuration ]---*/ void test_enabled(union param_val val, void *dat) { config.test.enabled = val.int_val; } void test_baseaddr(union param_val val, void *dat) { config.test.baseaddr = val.addr_val; } void reg_test_sec(void) { struct config_section *sec = reg_config_sec("test", NULL, NULL); reg_config_param(sec, "enabled", paramt_int, test_enabled); reg_config_param(sec, "baseaddr", paramt_addr, test_baseaddr); }
Go to most recent revision | Compare with Previous | Blame | View Log