Browse Source
into single PKE-style vu.[ch].
[ChangeLog]
Fri Mar 27 16:19:29 1998 Frank Ch. Eigler <fche@cygnus.com>
start-sanitize-sky
* Makefile.in (SIM_SKY_OBJS): Replaced sky-vu[01].o with sky-vu.o.
* interp.c (sim_{load,store}_register): Use new vu[01]_device
static to access VU registers.
(decode_coproc): Added skeleton of sky COP2 (VU) instruction
decoding. Work in progress.
* mips.igen (LDCzz, SDCzz): Removed *5900 case for this
overlapping/redundant bit pattern.
(LQC2, SQC2): Added *5900 COP2 instruction skeleta. Work in
progress.
* sim-main.h (status_CU[012]): Added COP[n]-enabled flags for
status register.
end-sanitize-sky
* interp.c (cop_lq, cop_sq): New functions for future 128-bit
access to coprocessor registers.
* sim-main.h (COP_LQ, COP_SQ): New macro front-ends for above.
[ChangeLog.sky]
* sky-engine.c (engine_run): Adapted from vu[01] -> vu merge.
* sky-hardware.c (register_devices): Ditto
* sky-pke.c (pke_fifo_*): Made these functions private again, now
that the GPUIF code does not use them.
* sky-pke.h (pke_fifo_*): Removed newly private declarations.
* sky-vu.c (*): Major rework: merge of old sky-vu0.c and
sky-vu1.c. Management of two VU devices parallels two PKEs.
Work in progress.
* sky-vu.h (*): Other half of merge.
(vu_device): New struct, parallel to pke_device.
gdb-4_18-branch
12 changed files with 864 additions and 506 deletions
File diff suppressed because it is too large
@ -1,111 +0,0 @@ |
|||
/* Copyright (C) 1998, Cygnus Solutions
|
|||
|
|||
*/ |
|||
|
|||
#include "sim-main.h" |
|||
|
|||
#include "sky-device.h" |
|||
#include "sky-vu.h" |
|||
#include "sky-vu0.h" |
|||
|
|||
VectorUnitState vu0_state; |
|||
|
|||
/* these are aligned versions of zalloc() pointers - do not zfree()! */ |
|||
static char* vu0_mem0_buffer = 0; |
|||
static char* vu0_mem1_buffer = 0; |
|||
|
|||
|
|||
void |
|||
vu0_issue(void) |
|||
{ |
|||
} |
|||
|
|||
static int |
|||
vu0_io_read_buffer(device *me, |
|||
void *dest, |
|||
int space, |
|||
address_word addr, |
|||
unsigned nr_bytes, |
|||
sim_cpu *processor, |
|||
sim_cia cia) |
|||
{ |
|||
if (addr < VU0_REGISTER_WINDOW_START) |
|||
return 0; |
|||
|
|||
addr -= VU0_REGISTER_WINDOW_START; |
|||
|
|||
/* Adjust nr_bytes if too big */ |
|||
if ((addr + nr_bytes) > VU_REG_END) |
|||
nr_bytes -= addr + nr_bytes - VU_REG_END; |
|||
|
|||
return read_vu_registers (&vu0_state, addr, nr_bytes, dest); |
|||
} |
|||
|
|||
static int |
|||
vu0_io_write_buffer(device *me, |
|||
const void *source, |
|||
int space, |
|||
address_word addr, |
|||
unsigned nr_bytes, |
|||
sim_cpu *processor, |
|||
sim_cia cia) |
|||
{ |
|||
if (addr < VU0_REGISTER_WINDOW_START) |
|||
return 0; |
|||
|
|||
addr -= VU0_REGISTER_WINDOW_START; |
|||
|
|||
/* Adjust nr_bytes if too big */ |
|||
if ((addr + nr_bytes) > VU_REG_END) |
|||
nr_bytes -= addr + nr_bytes - VU_REG_END; |
|||
|
|||
return write_vu_registers (&vu0_state, addr, nr_bytes, source); |
|||
} |
|||
|
|||
device vu0_device = |
|||
{ |
|||
"vu0", |
|||
&vu0_io_read_buffer, |
|||
&vu0_io_write_buffer |
|||
}; |
|||
|
|||
void |
|||
vu0_attach(SIM_DESC sd) |
|||
{ |
|||
sim_core_attach (sd, |
|||
NULL, |
|||
0 /*level*/, |
|||
access_read_write, |
|||
0 /*space ???*/, |
|||
VU0_REGISTER_WINDOW_START, |
|||
VU_REG_END /*nr_bytes*/, |
|||
0 /*modulo*/, |
|||
&vu0_device, |
|||
NULL /*buffer*/); |
|||
|
|||
vu0_mem0_buffer = zalloc(VU0_MEM0_SIZE); |
|||
vu0_mem0_buffer = (void*) ALIGN_16((unsigned)vu0_mem0_buffer); |
|||
sim_core_attach (sd, |
|||
NULL, |
|||
0 /*level*/, |
|||
access_read_write, |
|||
0 /*space ???*/, |
|||
VU0_MEM0_WINDOW_START, |
|||
VU0_MEM0_SIZE /*nr_bytes*/, |
|||
0 /*modulo*/, |
|||
0 /*device*/, |
|||
vu0_mem0_buffer /*buffer*/); |
|||
|
|||
vu0_mem1_buffer = zalloc(VU0_MEM1_SIZE); |
|||
vu0_mem1_buffer = (void*) ALIGN_16((unsigned)vu0_mem1_buffer); |
|||
sim_core_attach (sd, |
|||
NULL, |
|||
0 /*level*/, |
|||
access_read_write, |
|||
0 /*space ???*/, |
|||
VU0_MEM1_WINDOW_START, |
|||
VU0_MEM1_SIZE /*nr_bytes*/, |
|||
0 /*modulo*/, |
|||
0 /*device*/, |
|||
vu0_mem1_buffer /*buffer*/); |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
/* Copyright (C) 1998, Cygnus Solutions
|
|||
|
|||
*/ |
|||
|
|||
#ifndef VU0_H_ |
|||
#define VU0_H_ |
|||
|
|||
#include "sim-main.h" |
|||
|
|||
void vu0_attach(SIM_DESC sd); |
|||
void vu0_issue(void); |
|||
|
|||
#define VU0_MEM0_WINDOW_START 0x11000000 |
|||
#define VU0_MEM0_SIZE 0x1000 /* 4K = 4096 */ |
|||
|
|||
#define VU0_MEM1_WINDOW_START 0x11004000 |
|||
#define VU0_MEM1_SIZE 0x1000 /* 4K = 4096 */ |
|||
|
|||
#define VU0_REGISTER_WINDOW_START 0x10000c00 |
|||
|
|||
#define VPE0_STAT 0x10000fd0 |
|||
#define VU0_CIA 0x10000fe0 |
|||
|
|||
#endif |
|||
@ -1,310 +0,0 @@ |
|||
/* Copyright (C) 1998, Cygnus Solutions
|
|||
|
|||
*/ |
|||
|
|||
#include "sim-main.h" |
|||
#include "sim-endian.h" |
|||
|
|||
#include "sky-device.h" |
|||
#include "sky-vu1.h" |
|||
#include "sky-libvpe.h" |
|||
#include "sky-vu.h" |
|||
#include "sky-bits.h" |
|||
|
|||
#include <assert.h> |
|||
|
|||
VectorUnitState vu1_state; |
|||
|
|||
#define sim_warning printf |
|||
|
|||
/* these are aligned versions of zalloc() pointers - do not zfree()! */ |
|||
static char* vu1_umem_buffer = 0; |
|||
static char* vu1_mem_buffer = 0; |
|||
|
|||
void init_vu1(void); |
|||
void init_vu(VectorUnitState *state, |
|||
char* umem_buffer, unsigned umem_dw_size, |
|||
char* mem_buffer, unsigned mem_qw_size); |
|||
|
|||
#if 0 |
|||
static void dump_mem() { |
|||
int i; |
|||
typedef int T[2048][4]; |
|||
T *mem = (T*)&vu1_mem_buffer; |
|||
|
|||
for (i = 0; i < 200; i++) { |
|||
printf("%d: %x %x %x %x\n", i, (*mem)[i][0], (*mem)[i][1], (*mem)[i][2], (*mem)[i][3]); |
|||
} |
|||
} |
|||
#endif |
|||
|
|||
void |
|||
vu1_issue(void) |
|||
{ |
|||
if (vu1_state.runState == VU_RUN) |
|||
vpecallms_cycle(&vu1_state); |
|||
} |
|||
|
|||
static int |
|||
vu1_io_read_register_window(device *me, |
|||
void *dest, |
|||
int space, |
|||
address_word addr, |
|||
unsigned nr_bytes, |
|||
sim_cpu *processor, |
|||
sim_cia cia) |
|||
{ |
|||
if (addr < VU1_REGISTER_WINDOW_START) |
|||
return 0; |
|||
|
|||
addr -= VU1_REGISTER_WINDOW_START; |
|||
|
|||
/* Adjust nr_bytes if too big */ |
|||
if ((addr + nr_bytes) > VU_REG_END) |
|||
nr_bytes -= addr + nr_bytes - VU_REG_END; |
|||
|
|||
return read_vu_registers (&vu1_state, addr, nr_bytes, dest); |
|||
} |
|||
|
|||
static int |
|||
vu1_io_write_register_window(device *me, |
|||
const void *source, |
|||
int space, |
|||
address_word addr, |
|||
unsigned nr_bytes, |
|||
sim_cpu *processor, |
|||
sim_cia cia) |
|||
{ |
|||
if (addr < VU1_REGISTER_WINDOW_START) |
|||
return 0; |
|||
|
|||
addr -= VU1_REGISTER_WINDOW_START; |
|||
|
|||
/* Adjust nr_bytes if too big */ |
|||
if ((addr + nr_bytes) > VU_REG_END) |
|||
nr_bytes -= addr + nr_bytes - VU_REG_END; |
|||
|
|||
return write_vu_registers (&vu1_state, addr, nr_bytes, source); |
|||
} |
|||
|
|||
device vu1_device = |
|||
{ |
|||
"vu1", |
|||
&vu1_io_read_register_window, |
|||
&vu1_io_write_register_window |
|||
}; |
|||
|
|||
void |
|||
vu1_init(SIM_DESC sd) |
|||
{ |
|||
|
|||
sim_core_attach (sd, |
|||
NULL, |
|||
0 /*level*/, |
|||
access_read_write, |
|||
0 /*space ???*/, |
|||
VU1_REGISTER_WINDOW_START, |
|||
VU_REG_END /*nr_bytes*/, |
|||
0 /*modulo*/, |
|||
&vu1_device, |
|||
NULL /*buffer*/); |
|||
|
|||
vu1_umem_buffer = zalloc(VU1_MEM0_SIZE); |
|||
vu1_umem_buffer = (void*) ALIGN_16((unsigned)vu1_umem_buffer); |
|||
sim_core_attach (sd, |
|||
NULL, |
|||
0 /*level*/, |
|||
access_read_write, |
|||
0 /*space ???*/, |
|||
VU1_MEM0_WINDOW_START, |
|||
VU1_MEM0_SIZE /*nr_bytes*/, |
|||
0 /*modulo*/, |
|||
0 /*device*/, |
|||
vu1_umem_buffer /*buffer*/); |
|||
|
|||
vu1_mem_buffer = zalloc(VU1_MEM1_SIZE + 2*sizeof(unsigned_16)); |
|||
vu1_mem_buffer = (void*) ALIGN_16((unsigned)vu1_mem_buffer); |
|||
sim_core_attach (sd, |
|||
NULL, |
|||
0 /*level*/, |
|||
access_read_write, |
|||
0 /*space ???*/, |
|||
VU1_MEM1_WINDOW_START, |
|||
VU1_MEM1_SIZE /*nr_bytes*/, |
|||
0 /*modulo*/, |
|||
0 /*device*/, |
|||
vu1_mem_buffer /*buffer*/); |
|||
|
|||
init_vu1(); |
|||
/*initvpe();*/ |
|||
vpecallms_init(&vu1_state); |
|||
} |
|||
|
|||
/****************************************************************************/ |
|||
/* */ |
|||
/* Sony Computer Entertainment CONFIDENTIAL */ |
|||
/* (C) 1997 Sony Computer Entertainment Inc. All Rights Reserved */ |
|||
/* */ |
|||
/* VPE1 simulator */ |
|||
/* */ |
|||
/****************************************************************************/ |
|||
|
|||
#include <stdio.h> |
|||
#include <sys/types.h> |
|||
#include <strings.h> |
|||
#include "sky-libvpe.h" |
|||
|
|||
char ifilename[64] = "vu.bin"; |
|||
char ofilename[64] = ""; |
|||
char pfilename[64] = ""; |
|||
|
|||
static void abend2(char *fmt, char* p) { |
|||
fprintf(stderr, fmt, p); |
|||
exit(1); |
|||
} |
|||
|
|||
void getoption(VectorUnitState* state); |
|||
|
|||
void init_vu1(void) { |
|||
init_vu(&vu1_state, |
|||
&vu1_umem_buffer[0], VU1_MEM0_SIZE/8, |
|||
&vu1_mem_buffer[0], VU1_MEM1_SIZE/16); |
|||
} |
|||
|
|||
void init_vu(VectorUnitState *state, |
|||
char* umem_buffer, unsigned umem_dw_size, |
|||
char* mem_buffer, unsigned mem_qw_size) |
|||
{ |
|||
FILE *fp; |
|||
int i, j; |
|||
u_long data[4]; |
|||
|
|||
/* set up memory buffers */ |
|||
state->uMEM_buffer = (uMEM_Entry_Type *) umem_buffer; |
|||
state->uMEM_size = umem_dw_size; |
|||
state->MEM_buffer = (MEM_Entry_Type*) mem_buffer; |
|||
state->MEM_size = mem_qw_size; |
|||
|
|||
/* set up run state */ |
|||
state->runState = VU_READY; |
|||
|
|||
/* read option */ |
|||
getoption(state); |
|||
|
|||
/* read instruction file (mandatory) */ |
|||
if (*ifilename) { |
|||
if((fp = fopen(ifilename, "r")) != NULL) { |
|||
for (i = 0; fread(&data[0], 4, 1, fp) != 0; i++) { |
|||
fread(&data[1], 4, 1, fp); |
|||
LoadMMem(state, i, data, 1); |
|||
} |
|||
fclose(fp); |
|||
} |
|||
} |
|||
|
|||
/* PKE dirven simvpe */ |
|||
if (*pfilename) { |
|||
/* initpke(pfilename); */ |
|||
initvpe(&vu1_state); |
|||
/* while (simpke() != -1)
|
|||
simvpe(); */ |
|||
} |
|||
|
|||
/* conventional simvpe */ |
|||
else { |
|||
initvpe(&vu1_state); |
|||
/*simvpe();*/ |
|||
} |
|||
|
|||
/* write result memory image (optional) */ |
|||
if (*ofilename) { |
|||
if((fp = fopen(ofilename, "w")) == NULL) |
|||
abend2("%s: can not open\n", ofilename); |
|||
|
|||
for(i = 0; i < 2048; i++){ |
|||
StoreVUMem(state, i, data, 1); |
|||
for(j = 0; j < 4; j++) |
|||
fwrite(&data[j], 4, 1, fp); |
|||
} |
|||
fclose(fp); |
|||
} |
|||
} |
|||
|
|||
#if 0 |
|||
static void Usage(void) |
|||
{ |
|||
fprintf(stderr, "Usage: simvpe [options]\n"); |
|||
fprintf(stderr, "\t\t-i instruction-file\n"); |
|||
fprintf(stderr, "\t\t-o output-memory-file\n"); |
|||
fprintf(stderr, "\t\t-t PKE-file (text type)\n"); |
|||
fprintf(stderr, "\t\t-s start-address [default = 0]\n"); |
|||
fprintf(stderr, "\t\t-d [interactive mode enable: default desable]\n"); |
|||
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(VectorUnitState* state) |
|||
{ |
|||
#if 0 |
|||
int startline = 0; |
|||
int count = 1; |
|||
#endif |
|||
|
|||
state->junk._is_dbg = 1; |
|||
state->junk._vpepc = 0; |
|||
state->junk._is_verb = 0; |
|||
state->junk._is_dump = 0; |
|||
state->junk._pgpuif = 4; /* MEMGPUIF */ |
|||
state->junk._ITOP = 20; |
|||
state->junk._TOP = 10; |
|||
|
|||
#if 0 |
|||
while(argc - count){ |
|||
if(argv[count][0] == '-'){ |
|||
switch(argv[count][1]){ |
|||
case 'i': |
|||
strcpy(ifilename, argv[count+1]); |
|||
count += 2; |
|||
break; |
|||
case 'o': |
|||
strcpy(ofilename, argv[count+1]); |
|||
count += 2; |
|||
break; |
|||
case 't': |
|||
strcpy(pfilename, argv[count+1]); |
|||
count += 2; |
|||
break; |
|||
case 's': |
|||
sscanf(argv[count+1], "%d", &startline); |
|||
state->junk._vpepc = startline; |
|||
count += 2; |
|||
break; |
|||
case 'd': |
|||
state->junk._is_dbg = 1; |
|||
count += 1; |
|||
break; |
|||
case 'v': |
|||
state->junk._is_verb = 1; |
|||
count += 1; |
|||
break; |
|||
case 'p': |
|||
state->junk._is_dump = 1; |
|||
count += 1; |
|||
break; |
|||
case 'h': |
|||
case '?': |
|||
Usage(); |
|||
exit(1); |
|||
break; |
|||
default: |
|||
Usage(); |
|||
exit(1); |
|||
} |
|||
}else{ |
|||
Usage(); |
|||
exit(1); |
|||
} |
|||
} |
|||
#endif |
|||
} |
|||
@ -1,27 +0,0 @@ |
|||
/* Copyright (C) 1998, Cygnus Solutions
|
|||
|
|||
*/ |
|||
|
|||
#ifndef VU1_H_ |
|||
#define VU1_H_ |
|||
|
|||
#include "sim-main.h" |
|||
|
|||
void vu1_issue(void); |
|||
void vu1_init(SIM_DESC sd); |
|||
int vu1_status(void); |
|||
int vu1_busy(void); |
|||
|
|||
#define VU1_MEM0_WINDOW_START 0x11008000 |
|||
#define VU1_MEM0_SIZE 0x4000 /* 16K = 16384 */ |
|||
|
|||
#define VU1_MEM1_WINDOW_START 0x1100c000 |
|||
#define VU1_MEM1_SIZE 0x4000 /* 16K = 16384 */ |
|||
|
|||
#define VU1_REGISTER_WINDOW_START 0x11007000 |
|||
|
|||
/* FIX ME: These should be derived from enum in sky-vu.h */ |
|||
#define VPU_STAT 0x110073d0 |
|||
#define VU1_CIA 0x110073e0 |
|||
|
|||
#endif |
|||
Loading…
Reference in new issue