AnsweredAssumed Answered

TigerSHARC  -- quad fetches, DAB circular buffer

Question asked by MikeSmithCanada on Mar 5, 2010
Latest reply on Mar 23, 2010 by jeyanthi.jegadeesan

The following works great for circular buffer operations in assembly code

// void Access_UsingCB_ASM(int *inarray, int numPoints, int *outArray);

 

     .extern _circularBufferStart; 
    .extern _circularBufferLength;
    .extern _nextPositionInCircularBuffer;

 

#if 0

// Externals set up by

void SetUpCircularBuffer(int *inArray, int bufferLength) {
    circularBufferStart = inArray;
    nextPositionInCircularBuffer = inArray;
    circularBufferLength = bufferLength;
}

#endif

.global _Access_UsingCB_ASM;
_Access_UsingCB_ASM:

 

JB0 = [J31 + _circularBufferStart];;
    JL0 = [J31 + _circularBufferLength];;y JB0, JL0

 

    J0 = [J31 + _nextPositionInCircularBuffer];;
    J1  = JB0;;
    J2 = JL0;;         // Can't get VDSP to display  JB0 JL0

 

LC0 = J5;;
CB_LOOP:
    XR4 = CB [J0 += 1];;
    IF NLC0E, JUMP CB_LOOP; [J6 += 1] = XR4;;
   
// MOST IMPORTANT -- REMEMBER WHERE TO ACCESS NEXT POINT IN CIRCULAR BUFFER
    [J31 + _nextPositionInCircularBuffer] =  J0;;

 

  nop; nop; nop; nop;;
_Access_UsingCB_ASM.END:
    CJMP (ABS);;

 

So I tried quad fetches --

 

.global _Access_UsingCB_ASM;
_Access_UsingCB_ASM:

 

   JB0 = [J31 + _circularBufferStart];;
     JL0 = [J31 + _circularBufferLength];;

 

    J0 = [J31 + _nextPositionInCircularBuffer];;
     J1  = JB0;;
     J2 = JL0;;         // Can't get VDSP to display  JB0 JL0

 

J5 = LSHIFTR J5;;
    J5 = LSHIFTR J5;;
    LC0 = J5;;
   
    XR3:0 = DAB Q[J0 += 4];;
CB_LOOP:
    XR3:0 = DAB Q[J0 += 4];;
    IF NLC0E, JUMP CB_LOOP; Q[J6 += 4] = XR3:0;;
    
// MOST IMPORTANT -- REMEMBER WHERE TO ACCESS NEXT POINT IN CIRCULAR BUFFER
     [J31 + _nextPositionInCircularBuffer] =  J0;;

 

  nop; nop; nop; nop;;
_Access_UsingCB_ASM.END:
     CJMP (ABS);;

 

 

Does not seem to get the correct answer unless JL0 is a multiple of 4

 

I would sort of expert that -- but not seeing that in the manual

 

Message was edited by: Michael Smith

Outcomes