old-cross-binutils/sim/mips/sky-vu0.c
Frank Ch. Eigler 121d6745bc * Monster bug fixes & improvements from the last two days' demo-testing work.
* sky-pke.h (pke_fifo*): Exported these formerly private functions.
	(pke_device): Added FIFO cache fields.

	* sky-pke.c (pke_fifo_reset): New function for GPUIF client -
 	clear FIFO contents.
	(pke_pcrel_fifo): Added caching facility to prevent O(n^2) cost for
	searching for consecutive operand words.

	* sky-libvpe.c (MEM, uMEM): New/changed macros that perform modulo
 	calculations to handle out-of-range VU memory addresses.
	(*): Replaced many previous uses of MEM[] and state->uMEM[] with
	calls to above macros.

	* sky-vu.h (struct VectorUnitState): Added qw/dw size fields for
	MEM/uMEM buffers, for overflow prevention.  Renamed MEM/uMEM fields
	to catch all their prior users.

	* sky-vu0.c (vu0_attach): Manually align MEM0/MEM1 buffers to force
	16-byte alignment.  (zalloc is not enough.)

	* sky-vu1.c (vu1_attach): Ditto.
	(init_vu): Store buffer sizes from allocation into VectorUnitState.

	* sky-gpuif.h (GifPath): Use a pke_fifo strucf instead of
 	temporary fixed-size array for flexible FIFO sizing.

	* sky-gpuif.c (SKY_GPU2_REFRESH): This is now an integer value to be
	used as a modulus for periodic refresh.
	(refresh): New function to send GPU2 refresh code periodically.
	(*): Use pke_fifo calls to en/dequeue GPUIF tags & operands.

	* sky-pke.h (struct pke_device): Added fields to allow caching of
 	results from recent FIFO searches.
1998-03-20 22:12:06 +00:00

92 lines
2.3 KiB
C

/* Copyright (C) 1998, Cygnus Solutions
*/
#include "sim-main.h"
#include "sky-device.h"
#include "sky-vu0.h"
/* 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)
{
printf("%s: Read!\n", me->name);
return nr_bytes;
}
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)
{
printf("%s: Write!\n", me->name);
return nr_bytes;
}
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,
VU0_REGISTER_WINDOW_SIZE /*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*/);
}