* Add magic VU1_CIA register.
authorIan Carmichael <iancarm@cygnus>
Mon, 16 Feb 1998 22:07:11 +0000 (22:07 +0000)
committerIan Carmichael <iancarm@cygnus>
Mon, 16 Feb 1998 22:07:11 +0000 (22:07 +0000)
sim/mips/sky-vu1.c
sim/mips/sky-vu1.h

index 48152869cae59e456b96f940da0f95de570c738b..78fe550ce69fe95cb74488ee36ef510285a3bc6f 100644 (file)
@@ -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);*/
 
index 225b8cb78b5340151a296c5ed23634c9b8203c73..3a67475446f7dce6ac1147b46c9425bac76a8a84 100644 (file)
@@ -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)