From: Ian Carmichael Date: Mon, 16 Feb 1998 22:07:11 +0000 (+0000) Subject: * Add magic VU1_CIA register. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=04a7f72aea44e13b9b8982d7cf0dff4e08ff7d26;p=binutils-gdb.git * Add magic VU1_CIA register. --- diff --git a/sim/mips/sky-vu1.c b/sim/mips/sky-vu1.c index 48152869cae..78fe550ce69 100644 --- a/sim/mips/sky-vu1.c +++ b/sim/mips/sky-vu1.c @@ -15,6 +15,8 @@ VectorUnitState vu1_state; +#define sim_warning printf + static char vu1_umem_buffer[VU1_MEM0_SIZE] __attribute__ ((aligned(16))); static char vu1_mem_buffer[VU1_MEM1_SIZE] __attribute__ ((aligned(16))); @@ -69,6 +71,8 @@ vu1_io_read_register_window(device *me, *(u_long*)&source_buffer[VPE1_STAT - VU1_REGISTER_WINDOW_START] = stat; } + *(u_long*)&source_buffer[VU1_CIA - VU1_REGISTER_WINDOW_START] = vu1_state.junk._vpepc; + #if 0 printf("%s: Read: %x, %d, dest: %x, space: %d, %x!\n", me->name, (int)addr, nr_bytes, (int)dest, space, *(int*)&(vu1_state.regs.VPE_STAT)); printf(" vu1_state.regs.VPE_STAT = %x\n", *(int*)&(vu1_state.regs.VPE_STAT)); @@ -95,19 +99,27 @@ vu1_io_write_register_window(device *me, { char *dest; - if (addr == VPE1_STAT && nr_bytes == 4) { - /* Magic to switch VU to run state, until other methods are available. */ - vu1_state.runState = VU_RUN; - vu1_state.junk.eflag = 0; - vu1_state.junk.peflag = 0; -/*printf("Magic start run...\n");*/ + assert(nr_bytes == 4); + + if (addr == VPE1_STAT) { + /* Do nothing, read only register. */ + sim_warning("vu1: Write to read/only register at address %lx.\n", (u_long)addr); return nr_bytes; - } else if (addr == VU1_MST && nr_bytes == 4) { + } else if (addr == VU1_MST) { /* Magic switch to set _TOP register */ -/*printf("Magic set TOP register to %d\n", T2H_4(*(int*)source));*/ vu1_state.junk._TOP = T2H_4(*(int*)source); return nr_bytes; - } + } else if (addr == VU1_CIA) { + vu1_state.junk._vpepc = T2H_4(*(int*)source); + vu1_state.runState = VU_RUN; + vu1_state.junk.eflag = 0; + vu1_state.junk.peflag = 0; + return nr_bytes; + } + + /* Everything else does nothing... */ + sim_warning("vu1: Write to unimplemented control register at address %lx.\n", (u_long)addr); + return nr_bytes; /*printf("%s: Write: %x, %d, source: %x, space: %d!\n", me->name, (int)addr, nr_bytes, (int)source, space);*/ diff --git a/sim/mips/sky-vu1.h b/sim/mips/sky-vu1.h index 225b8cb78b5..3a67475446f 100644 --- a/sim/mips/sky-vu1.h +++ b/sim/mips/sky-vu1.h @@ -37,7 +37,12 @@ int vu1_status(void); #define VU1_MTPC 0x110073a0 #define VPE1_STAT 0x110073d0 -#define VU1_REGISTER_WINDOW_END 0x110073e0 +#define VPU_STAT 0x110073d0 + +#define VU1_CIA 0x110073e0 + + +#define VU1_REGISTER_WINDOW_END 0x110073f0 #define VU1_REGISTER_WINDOW_SIZE (VU1_REGISTER_WINDOW_END - VU1_REGISTER_WINDOW_START)