diff --git a/sim/mips/.Sanitize b/sim/mips/.Sanitize index 29ff045ce5..30edef2fb7 100644 --- a/sim/mips/.Sanitize +++ b/sim/mips/.Sanitize @@ -24,7 +24,7 @@ else lose_these_too="${r5900_files} ${lose_these_too}" fi -sky_files="ChangeLog.sky sky-device.c sky-device.h sky-dma.c sky-dma.h" +sky_files="ChangeLog.sky sky-device.c sky-device.h sky-dma.c sky-dma.h sky-bits.h" sky_files="$sky_files sky-engine.c sky-gpuif.c sky-gpuif.h" sky_files="$sky_files sky-hardware.c sky-hardware.h" sky_files="$sky_files sky-libvpe.c sky-libvpe.h sky-pke.c sky-pke.h" diff --git a/sim/mips/sky-vu1.c b/sim/mips/sky-vu1.c index 6fbb81e7d0..48152869ca 100644 --- a/sim/mips/sky-vu1.c +++ b/sim/mips/sky-vu1.c @@ -9,6 +9,9 @@ #include "sky-vu1.h" #include "sky-libvpe.h" #include "sky-vu.h" +#include "sky-bits.h" + +#include VectorUnitState vu1_state; @@ -36,24 +39,35 @@ vu1_io_read_register_window(device *me, { /* Slow and crappy hack ... */ + int i; char source_buffer[VU1_REGISTER_WINDOW_SIZE]; char* src; + assert(nr_bytes == 1 || nr_bytes == 2 || nr_bytes == 4 || nr_bytes == 8 || nr_bytes == 16); + memcpy(source_buffer, &vu1_state.regs.VF[0][0], 0x200); /* copy VF registers */ for (i = 0; i<16; i++ ) { *(short*)&source_buffer[0x200 + i*16] = vu1_state.regs.VI[i]; } - *(u_long*)&source_buffer[VU1_MST - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MST; - *(u_long*)&source_buffer[VU1_MMC - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MMC; - *(u_long*)&source_buffer[VU1_MCP - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MCP; - *(u_long*)&source_buffer[VU1_MR - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MR; - *(u_long*)&source_buffer[VU1_MI - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MI; - *(u_long*)&source_buffer[VU1_MQ - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MQ; - *(u_long*)&source_buffer[VU1_MP - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MP; - *(u_long*)&source_buffer[VU1_MTPC - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MTPC; - *(VpeStat*)&source_buffer[VPE1_STAT - VU1_REGISTER_WINDOW_START] = vu1_state.regs.VPE_STAT; + *(u_long*)&source_buffer[VU1_MST - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MST; + *(u_long*)&source_buffer[VU1_MMC - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MMC; + *(u_long*)&source_buffer[VU1_MCP - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MCP; + *(u_long*)&source_buffer[VU1_MR - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MR; + *(u_long*)&source_buffer[VU1_MI - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MI; + *(u_long*)&source_buffer[VU1_MQ - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MQ; + *(u_long*)&source_buffer[VU1_MP - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MP; + *(u_long*)&source_buffer[VU1_MTPC - VU1_REGISTER_WINDOW_START] = vu1_state.regs.MTPC; + + { + u_long stat; + stat = 0; + if (vu1_state.runState == VU_RUN || vu1_state.runState == VU_BREAK) + SET_BIT(stat, VPU_STAT_VBS1_BIT); + + *(u_long*)&source_buffer[VPE1_STAT - VU1_REGISTER_WINDOW_START] = stat; + } #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)); @@ -84,7 +98,6 @@ vu1_io_write_register_window(device *me, 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.regs.VPE_STAT.vbs = 1; vu1_state.junk.eflag = 0; vu1_state.junk.peflag = 0; /*printf("Magic start run...\n");*/ diff --git a/sim/mips/sky-vu1.h b/sim/mips/sky-vu1.h index 88fe3e925c..225b8cb78b 100644 --- a/sim/mips/sky-vu1.h +++ b/sim/mips/sky-vu1.h @@ -7,9 +7,9 @@ #include "sim-main.h" -void vu1_attach(SIM_DESC sd); void vu1_issue(void); void vu1_init(SIM_DESC sd); +int vu1_status(void); #define VU1_MEM0_WINDOW_START 0x11008000 #define VU1_MEM0_SIZE 0x4000 /* 16K = 16384 */