From 52793fab2fb6f9591d52978d5f268babd2f777cf Mon Sep 17 00:00:00 2001 From: Ian Carmichael Date: Tue, 10 Feb 1998 20:08:16 +0000 Subject: [PATCH] * Many changes to make sky sim build with --enable-sim-warnings. --- sim/mips/sky-pke.c | 11 ++++++----- sim/mips/sky-pke.h | 9 ++++----- sim/mips/sky-vu0.c | 6 +++--- sim/mips/sky-vu0.h | 2 +- sim/mips/sky-vu1.c | 30 ++++++++++++++++++------------ sim/mips/sky-vu1.h | 3 ++- 6 files changed, 34 insertions(+), 27 deletions(-) diff --git a/sim/mips/sky-pke.c b/sim/mips/sky-pke.c index 94b650257b2..f46873bfc7a 100644 --- a/sim/mips/sky-pke.c +++ b/sim/mips/sky-pke.c @@ -8,7 +8,6 @@ #include "sky-vu1.h" #include "sky-gpuif.h" - /* Imported functions */ void device_error (device *me, char* message); /* device.c */ @@ -75,13 +74,13 @@ pke1_attach(SIM_DESC sd) /* Issue a PKE instruction if possible */ void -pke0_issue() +pke0_issue(void) { pke_issue(& pke0_device); } void -pke1_issue() +pke1_issue(void) { pke_issue(& pke0_device); } @@ -1313,7 +1312,8 @@ pke_pc_advance(struct pke_device* me, int num_words) unsigned_4* pke_pc_operand(struct pke_device* me, int word_num) { - int new_qw_pc, new_fifo_pc; + int new_qw_pc = 0; + int new_fifo_pc; unsigned_4* operand; ASSERT(word_num > 0); @@ -1345,7 +1345,8 @@ pke_pc_operand(struct pke_device* me, int word_num) struct fifo_quadword* pke_pc_fifo(struct pke_device* me, int word_num) { - int new_qw_pc, new_fifo_pc; + int new_qw_pc = 0; + int new_fifo_pc; struct fifo_quadword* operand; ASSERT(word_num > 0); diff --git a/sim/mips/sky-pke.h b/sim/mips/sky-pke.h index e4d0cca01da..74b8bc77a09 100644 --- a/sim/mips/sky-pke.h +++ b/sim/mips/sky-pke.h @@ -15,10 +15,9 @@ /* External functions */ void pke0_attach(SIM_DESC sd); -void pke0_issue(); +void pke0_issue(void); void pke1_attach(SIM_DESC sd); -void pke1_issue(); - +void pke1_issue(void); /* Quadword data type */ @@ -295,8 +294,8 @@ typedef unsigned_4 quadword[4]; /* operations */ /* unsigned 32-bit mask of given width */ -#define BIT_MASK(width) ((((unsigned_4)1) << (width+1)) - 1) -/* e.g.: BIT_MASK(5) = 00011111 */ +#define BIT_MASK(width) (width == 31 ? 0xffffffff : (((unsigned_4)1) << (width+1)) - 1) +/* e.g.: BIT_MASK(4) = 00011111 */ /* mask between given given bits numbers (MSB) */ #define BIT_MASK_BTW(begin,end) (BIT_MASK(end) & ~BIT_MASK(begin)) diff --git a/sim/mips/sky-vu0.c b/sim/mips/sky-vu0.c index 8d8ec99b106..0d212fe1552 100644 --- a/sim/mips/sky-vu0.c +++ b/sim/mips/sky-vu0.c @@ -11,11 +11,11 @@ static char vu0_mem0_buffer[VU0_MEM0_SIZE]; static char vu0_mem1_buffer[VU0_MEM1_SIZE]; void -vu0_issue() +vu0_issue(void) { } -int +static int vu0_io_read_buffer(device *me, void *dest, int space, @@ -28,7 +28,7 @@ vu0_io_read_buffer(device *me, return nr_bytes; } -int +static int vu0_io_write_buffer(device *me, const void *source, int space, diff --git a/sim/mips/sky-vu0.h b/sim/mips/sky-vu0.h index 22d1272678d..c30b7bd328e 100644 --- a/sim/mips/sky-vu0.h +++ b/sim/mips/sky-vu0.h @@ -8,7 +8,7 @@ #include "sim-main.h" void vu0_attach(SIM_DESC sd); -void vu0_issue(); +void vu0_issue(void); #define VU0_MEM0_WINDOW_START 0x11000000 #define VU0_MEM0_SIZE 0x1000 /* 4K = 4096 */ diff --git a/sim/mips/sky-vu1.c b/sim/mips/sky-vu1.c index 41ee0425ffd..e4974c4390f 100644 --- a/sim/mips/sky-vu1.c +++ b/sim/mips/sky-vu1.c @@ -14,17 +14,17 @@ VectorUnitState vu1_state; static char vu1_umem_buffer[VU1_MEM0_SIZE]; static char vu1_mem_buffer[VU1_MEM1_SIZE]; -void init_vu1(); +void init_vu1(void); void init_vu(VectorUnitState *state, char* umem_buffer, char* mem_buffer); void -vu1_issue() +vu1_issue(void) { if (vu1_state.runState == VU_RUN) vpecallms_cycle(&vu1_state); } -int +static int vu1_io_read_register_window(device *me, void *dest, int space, @@ -54,8 +54,8 @@ vu1_io_read_register_window(device *me, *(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; - printf("%s: Read: %x, %d, dest: %x, space: %d, %x!\n", me->name, addr, nr_bytes, dest, space, vu1_state.regs.VPE_STAT); - printf(" vu1_state.regs.VPE_STAT = %x\n", vu1_state.regs.VPE_STAT); + 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)); if (addr + nr_bytes > VU1_REGISTER_WINDOW_END) { fprintf(stderr, "Error: Read past end of vu1 register window!!!\n"); @@ -67,7 +67,7 @@ vu1_io_read_register_window(device *me, return nr_bytes; } -int +static int vu1_io_write_register_window(device *me, const void *source, int space, @@ -83,6 +83,7 @@ vu1_io_write_register_window(device *me, vu1_state.runState = VU_RUN; vu1_state.regs.VPE_STAT.vbs = 1; printf("Magic start run...\n"); +#if 0 printf("%x,%x,%x,%x\n", &vu1_state.regs.VF[0][0], &vu1_state.regs.VPE_STAT, ((char*)&vu1_state.regs.VPE_STAT) - ((char*)&vu1_state.regs.VF[0][0]), ((char*)&vu1_state.regs.VPE_STAT) - ((char*)&vu1_state.regs.VF[0][0]) + VU1_REGISTER_WINDOW_START @@ -96,10 +97,11 @@ printf("%x,%x,%x,%x\n", &vu1_state.regs.VF[0][0], &vu1_state.regs.MST, ((char*)&vu1_state.regs.MST) - ((char*)&vu1_state.regs.VF[0][0]), ((char*)&vu1_state.regs.MST) - ((char*)&vu1_state.regs.VF[0][0]) + VU1_REGISTER_WINDOW_START ); +#endif return nr_bytes; } - printf("%s: Write: %x, %d, source: %x, space: %d!\n", me->name, addr, nr_bytes, source, space); + printf("%s: Write: %x, %d, source: %x, space: %d!\n", me->name, (int)addr, nr_bytes, (int)source, space); if (addr + nr_bytes > VU1_REGISTER_WINDOW_END) { fprintf(stderr, "Error: Read past end of vu1 register window!!!\n"); @@ -180,14 +182,14 @@ char ifilename[64] = "vu.bin"; char ofilename[64] = ""; char pfilename[64] = ""; -void abend2(char *fmt, char* p) { +static void abend2(char *fmt, char* p) { fprintf(stderr, fmt, p); exit(1); } -void getoption(); +void getoption(void); -void init_vu1() { +void init_vu1(void) { init_vu(&vu1_state, &vu1_umem_buffer[0], &vu1_mem_buffer[0]); } @@ -238,7 +240,7 @@ void init_vu(VectorUnitState *state, char* umem_buffer, char* mem_buffer) abend2("%s: can not open\n", ofilename); for(i = 0; i < 2048; i++){ - StoreVUMem(i, data, 1); + StoreVUMem(state, i, data, 1); for(j = 0; j < 4; j++) fwrite(&data[j], 4, 1, fp); } @@ -246,6 +248,7 @@ void init_vu(VectorUnitState *state, char* umem_buffer, char* mem_buffer) } } +#if 0 static void Usage(void) { fprintf(stderr, "Usage: simvpe [options]\n"); @@ -257,11 +260,14 @@ static void Usage(void) fprintf(stderr, "\t\t-v [statistics mode enable: default desable]\n"); fprintf(stderr, "\t\t-p [debug print mode enable: default desable]\n"); } +#endif -void getoption() +void getoption(void) { +#if 0 int startline = 0; int count = 1; +#endif _is_dbg = 1; _vpepc = 0; diff --git a/sim/mips/sky-vu1.h b/sim/mips/sky-vu1.h index 6150b09ea61..88fe3e925c2 100644 --- a/sim/mips/sky-vu1.h +++ b/sim/mips/sky-vu1.h @@ -8,7 +8,8 @@ #include "sim-main.h" void vu1_attach(SIM_DESC sd); -void vu1_issue(); +void vu1_issue(void); +void vu1_init(SIM_DESC sd); #define VU1_MEM0_WINDOW_START 0x11008000 #define VU1_MEM0_SIZE 0x4000 /* 16K = 16384 */ -- 2.30.2