Line 295... |
Line 295... |
break;
|
break;
|
case 4:
|
case 4:
|
temp = cur_area->readfunc(memaddr);
|
temp = cur_area->readfunc(memaddr);
|
break;
|
break;
|
}
|
}
|
|
if (cur_area->log)
|
|
fprintf (cur_area->log, "[%08x] -> read %08x\n", memaddr, temp);
|
} else {
|
} else {
|
printf("EXCEPTION: read out of memory (32-bit access to %.8lx)\n", memaddr);
|
printf("EXCEPTION: read out of memory (32-bit access to %.8lx)\n", memaddr);
|
cont_run = 0;
|
cont_run = 0;
|
temp = 0;
|
temp = 0;
|
}
|
}
|
Line 336... |
Line 338... |
case 4:
|
case 4:
|
printf("EXCEPTION: read 16-bit value from 32-bit region (address 0x%08lX)\n", cur_area->granularity * 8, memaddr);
|
printf("EXCEPTION: read 16-bit value from 32-bit region (address 0x%08lX)\n", cur_area->granularity * 8, memaddr);
|
cont_run = 0;
|
cont_run = 0;
|
break;
|
break;
|
}
|
}
|
|
if (cur_area->log)
|
|
fprintf (cur_area->log, "[%08x] -> read %08x\n", memaddr, temp);
|
} else {
|
} else {
|
printf("EXCEPTION: read out of memory (16-bit access to %.8lx)\n", memaddr);
|
printf("EXCEPTION: read out of memory (16-bit access to %.8lx)\n", memaddr);
|
cont_run = 0;
|
cont_run = 0;
|
temp = 0;
|
temp = 0;
|
}
|
}
|
Line 375... |
Line 379... |
case 4:
|
case 4:
|
printf("EXCEPTION: read 8-bit value from %u-bit region (address 0x%08lX)\n", cur_area->granularity * 8, memaddr);
|
printf("EXCEPTION: read 8-bit value from %u-bit region (address 0x%08lX)\n", cur_area->granularity * 8, memaddr);
|
cont_run = 0;
|
cont_run = 0;
|
break;
|
break;
|
}
|
}
|
|
if (cur_area->log)
|
|
fprintf (cur_area->log, "[%08x] -> read %08x\n", memaddr, temp);
|
} else {
|
} else {
|
printf("EXCEPTION: read out of memory (8-bit access to %.8lx)\n", memaddr);
|
printf("EXCEPTION: read out of memory (8-bit access to %.8lx)\n", memaddr);
|
cont_run = 0;
|
cont_run = 0;
|
temp = 0;
|
temp = 0;
|
}
|
}
|
Line 403... |
Line 409... |
void setsim_mem32(unsigned long memaddr, unsigned long value)
|
void setsim_mem32(unsigned long memaddr, unsigned long value)
|
{
|
{
|
struct dev_memarea *dev;
|
struct dev_memarea *dev;
|
|
|
if (verify_memoryarea(memaddr)) {
|
if (verify_memoryarea(memaddr)) {
|
|
if (cur_area->log)
|
|
fprintf (cur_area->log, "[%08x] -> write %08x\n", memaddr, value);
|
switch(cur_area->granularity) {
|
switch(cur_area->granularity) {
|
case 1:
|
case 1:
|
cur_area->writefunc(memaddr , (value >> 24) & 0xFF);
|
cur_area->writefunc(memaddr , (value >> 24) & 0xFF);
|
cur_area->writefunc(memaddr + 1, (value >> 16) & 0xFF);
|
cur_area->writefunc(memaddr + 1, (value >> 16) & 0xFF);
|
cur_area->writefunc(memaddr + 2, (value >> 8) & 0xFF);
|
cur_area->writefunc(memaddr + 2, (value >> 8) & 0xFF);
|
Line 441... |
Line 449... |
}
|
}
|
|
|
void setsim_mem16(unsigned long memaddr, unsigned short value)
|
void setsim_mem16(unsigned long memaddr, unsigned short value)
|
{
|
{
|
if (verify_memoryarea(memaddr)) {
|
if (verify_memoryarea(memaddr)) {
|
|
if (cur_area->log)
|
|
fprintf (cur_area->log, "[%08x] -> write %08x\n", memaddr, value);
|
switch(cur_area->granularity) {
|
switch(cur_area->granularity) {
|
case 1:
|
case 1:
|
cur_area->writefunc(memaddr, (value >> 8) & 0xFF);
|
cur_area->writefunc(memaddr, (value >> 8) & 0xFF);
|
cur_area->writefunc(memaddr + 1, value & 0xFF);
|
cur_area->writefunc(memaddr + 1, value & 0xFF);
|
break;
|
break;
|
Line 477... |
Line 487... |
}
|
}
|
|
|
void setsim_mem8(unsigned long memaddr, unsigned char value)
|
void setsim_mem8(unsigned long memaddr, unsigned char value)
|
{
|
{
|
if (verify_memoryarea(memaddr)) {
|
if (verify_memoryarea(memaddr)) {
|
|
if (cur_area->log)
|
|
fprintf (cur_area->log, "[%08x] -> write %08x\n", memaddr, value);
|
if (cur_area->granularity == 1)
|
if (cur_area->granularity == 1)
|
cur_area->writefunc(memaddr, value);
|
cur_area->writefunc(memaddr, value);
|
else {
|
else {
|
printf("EXCEPTION: write 8-bit value to %u-bit region (address 0x%08lX)\n", cur_area->granularity * 8, memaddr);
|
printf("EXCEPTION: write 8-bit value to %u-bit region (address 0x%08lX)\n", cur_area->granularity * 8, memaddr);
|
cont_run = 0;
|
cont_run = 0;
|
Line 563... |
Line 575... |
/* Initialize memory table from a config struct */
|
/* Initialize memory table from a config struct */
|
|
|
void init_memory_table ()
|
void init_memory_table ()
|
{
|
{
|
unsigned long memory_needed = 0;
|
unsigned long memory_needed = 0;
|
|
|
/* If nothing was defined, use default memory block */
|
/* If nothing was defined, use default memory block */
|
if (config.memory.nmemories) {
|
if (config.memory.nmemories) {
|
int i;
|
int i;
|
for (i = 0; i < config.memory.nmemories; i++) {
|
for (i = 0; i < config.memory.nmemories; i++) {
|
unsigned long start = config.memory.table[i].baseaddr;
|
unsigned long start = config.memory.table[i].baseaddr;
|
Line 580... |
Line 593... |
start, length, length >> 10, type, ce, rd, wd);
|
start, length, length >> 10, type, ce, rd, wd);
|
register_memoryarea(start, length, 1, &simmem_read_byte, &simmem_write_byte);
|
register_memoryarea(start, length, 1, &simmem_read_byte, &simmem_write_byte);
|
cur_area->misc = memory_needed;
|
cur_area->misc = memory_needed;
|
cur_area->delayw = wd;
|
cur_area->delayw = wd;
|
cur_area->delayr = rd;
|
cur_area->delayr = rd;
|
|
if (config.memory.table[i].log[0] != '\0') {
|
|
if ((cur_area->log = fopen (config.memory.table[i].log, "wt+")) == NULL)
|
|
fprintf (stderr, "WARNING: Cannot open '%s'.\n", config.memory.table[i].log);
|
|
} else
|
|
cur_area->log = 0;
|
memory_needed += cur_area->size;
|
memory_needed += cur_area->size;
|
}
|
}
|
printf ("\n");
|
printf ("\n");
|
} else {
|
} else {
|
if (config.sim.verbose)
|
if (config.sim.verbose)
|
Line 612... |
Line 630... |
if (ptmp->delayw < 0 && ptmp->writefunc == &simmem_write_byte)
|
if (ptmp->delayw < 0 && ptmp->writefunc == &simmem_write_byte)
|
ptmp->writefunc = &simmem_write_null;
|
ptmp->writefunc = &simmem_write_null;
|
}
|
}
|
}
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|
|
/* Closes files, etc. */
|
|
|
|
void done_memory_table ()
|
|
{
|
|
struct dev_memarea *ptmp;
|
|
|
|
/* Check list of registered devices. */
|
|
for(ptmp = dev_list; ptmp; ptmp = ptmp->next) {
|
|
if (ptmp->log)
|
|
fclose (ptmp->log);
|
|
}
|
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|