/* Return a bit-field extract of given operand# in FIFO, and its
- source-addr. `bit_offset' starts at 0, referring to LSB after PKE
- instruction word. Width must be >0, <=32. Assume FIFO is full
- enough. Skip over DMA tags, but mark them as an error (ER0). */
+ word-accurate source-addr. `bit_offset' starts at 0, referring to
+ LSB after PKE instruction word. Width must be >0, <=32. Assume
+ FIFO is full enough. Skip over DMA tags, but mark them as an error
+ (ER0). */
unsigned_4
pke_pcrel_operand_bits(struct pke_device* me, int bit_offset, int bit_width, unsigned_4* source_addr)
unsigned_4 value;
struct fifo_quadword* fifo_operand;
int wordnumber, bitnumber;
+ int i;
wordnumber = bit_offset/32;
bitnumber = bit_offset%32;
/* extract source addr from fifo word */
*source_addr = fifo_operand->source_address;
+ /* add word offset */
+ for(i=0; i<3; i++)
+ if(word == & fifo_operand->data[i])
+ *source_addr += sizeof(unsigned_4) * i;
+
return value;
}
address_word vu_addr_max_size;
unsigned_4 vu_lower_opcode, vu_upper_opcode;
unsigned_4* operand;
+ unsigned_4 source_addr;
struct fifo_quadword* fq;
int next_num;
/* Fetch operand words; assume they are already little-endian for VU imem */
fq = pke_pcrel_fifo(me, i*2 + 1, & operand);
vu_lower_opcode = *operand;
- vu_upper_opcode = *pke_pcrel_operand(me, i*2 + 2);
+
+ source_addr = fq->source_address;
+ /* add word offset */
+ for(i=0; i<3; i++)
+ if(operand == & fq->data[i])
+ source_addr += sizeof(unsigned_4) * i;
+
+ fq = pke_pcrel_fifo(me, i*2 + 2, & operand);
+ vu_upper_opcode = *operand;
/* write data into VU memory */
/* lower (scalar) opcode comes in first word ; macro performs H2T! */
/* write tracking address in target byte-order */
ASSERT(sizeof(unsigned_4) == 4);
PKE_MEM_WRITE(me, vutrack_addr,
- & fq->source_address,
+ & source_addr,
4);
} /* VU xfer loop */