diff options
author | Frank Ch. Eigler <fche@redhat.com> | 1998-03-20 22:12:06 +0000 |
---|---|---|
committer | Frank Ch. Eigler <fche@redhat.com> | 1998-03-20 22:12:06 +0000 |
commit | 121d6745bc73a2e3f33e51a5c07db966eb9a5fbe (patch) | |
tree | 1eb12ba14eeaf1bc386ce20a5421c8b2fcdad713 /sim/mips/sky-pke.c | |
parent | a748b374f588c3700dbe4ceaa8c987574ad184e4 (diff) | |
download | gdb-121d6745bc73a2e3f33e51a5c07db966eb9a5fbe.zip gdb-121d6745bc73a2e3f33e51a5c07db966eb9a5fbe.tar.gz gdb-121d6745bc73a2e3f33e51a5c07db966eb9a5fbe.tar.bz2 |
* 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.
Diffstat (limited to 'sim/mips/sky-pke.c')
-rw-r--r-- | sim/mips/sky-pke.c | 60 |
1 files changed, 51 insertions, 9 deletions
diff --git a/sim/mips/sky-pke.c b/sim/mips/sky-pke.c index 1689fc1..cf7408b 100644 --- a/sim/mips/sky-pke.c +++ b/sim/mips/sky-pke.c @@ -30,10 +30,6 @@ static int pke_io_write_buffer(device*, const void*, int, address_word, unsigned, sim_cpu*, sim_cia); static void pke_reset(struct pke_device*); static void pke_issue(SIM_DESC, struct pke_device*); -static unsigned_4 pke_fifo_flush(struct pke_fifo*); -static struct fifo_quadword* pke_fifo_fit(struct pke_fifo*); -static inline struct fifo_quadword* pke_fifo_access(struct pke_fifo*, unsigned_4 qwnum); -static void pke_fifo_old(struct pke_fifo*, unsigned_4 qwnum); static void pke_pc_advance(struct pke_device*, int num_words); static struct fifo_quadword* pke_pcrel_fifo(struct pke_device*, int operand_num, unsigned_4** operand); @@ -81,6 +77,7 @@ struct pke_device pke0_device = {}, 0, /* FIFO write buffer */ { NULL, 0, 0, 0 }, /* FIFO */ NULL, /* FIFO trace file */ + -1, -1, 0, 0, 0, /* invalid FIFO cache */ 0, 0 /* pc */ }; @@ -93,6 +90,7 @@ struct pke_device pke1_device = {}, 0, /* FIFO write buffer */ { NULL, 0, 0, 0 }, /* FIFO */ NULL, /* FIFO trace file */ + -1, -1, 0, 0, 0, /* invalid FIFO cache */ 0, 0 /* pc */ }; @@ -683,6 +681,27 @@ pke_fifo_flush(struct pke_fifo* fifo) +/* Clear out contents of FIFO; make it really empty. */ + +void +pke_fifo_reset(struct pke_fifo* fifo) +{ + int i; + + /* clear fifo quadwords */ + for(i=0; i<fifo->next; i++) + { + zfree(fifo->quadwords[i]); + fifo->quadwords[i] = NULL; + } + + /* reset pointers */ + fifo->origin = 0; + fifo->next = 0; +} + + + /* Make space for the next quadword in the FIFO. Allocate/enlarge FIFO pointer block if necessary. Return a pointer to it. */ @@ -886,15 +905,29 @@ pke_pc_advance(struct pke_device* me, int num_words) struct fifo_quadword* pke_pcrel_fifo(struct pke_device* me, int operand_num, unsigned_4** operand) { - int num = operand_num; + int num; int new_qw_pc, new_fifo_pc; struct fifo_quadword* fq = NULL; - ASSERT(num > 0); + /* check for validity of last search results in cache */ + if(me->last_fifo_pc == me->fifo_pc && + me->last_qw_pc == me->qw_pc && + operand_num > me->last_num) + { + /* continue search from last stop */ + new_fifo_pc = me->last_new_fifo_pc; + new_qw_pc = me->last_new_qw_pc; + num = operand_num - me->last_num; + } + else + { + /* start search from scratch */ + new_fifo_pc = me->fifo_pc; + new_qw_pc = me->qw_pc; + num = operand_num; + } - /* snapshot current pointers */ - new_fifo_pc = me->fifo_pc; - new_qw_pc = me->qw_pc; + ASSERT(num > 0); /* printf("pke %d pcrel_fifo operand_num %d\n", me->pke_number, operand_num); */ @@ -944,6 +977,15 @@ pke_pcrel_fifo(struct pke_device* me, int operand_num, unsigned_4** operand) /* annote the word where the pseudo-PC lands as an PKE operand */ ASSERT(fq->word_class[new_qw_pc] == wc_pkedata || fq->word_class[new_qw_pc] == wc_unknown); fq->word_class[new_qw_pc] = wc_pkedata; + + /* store search results in cache */ + /* keys */ + me->last_fifo_pc = me->fifo_pc; + me->last_qw_pc = me->qw_pc; + /* values */ + me->last_num = operand_num; + me->last_new_fifo_pc = new_fifo_pc; + me->last_new_qw_pc = new_qw_pc; } return fq; |