Post Go back to editing

ADSP-BF506F: How to code circular buffer?

Hello,

I used ADSP-2181 where I used to write a code for circular buffer as following.

.VAR/CIRC comm[32];

.

.

.

L0=32;

I0=comm;       

M0=1;

.

.

.

I0=comm; // point to beginning of comm[32] vector
CNTR=32;
AX0=0x0000;
DO comm_zero UNTIL CE;
comm_zero: DM(I0,M0)=ax0;

I like to know what would be the equivalent of the above code in the BF506F ?

Thank you,

Osman Demirci

  • Hi,

    Four sets of circular addressing buffer registers composed of one each Ireg, Breg, and Lreg (i.e., I0/B0/L0, I1/B1/L1, I2/B2/L2, and I3/B3/L3) provide the circular buffering capability in Blackfin processors

    Here is the simple code snippet for circular buffering using I0,B0,L0 registers


    b0.l=lo(data1);      // address of data buffer stored in base register
    b0.h=hi(data1);
    l0=40;                   // length of circular buffer
    m0=4;                   // modifier value
    i0=b0;                   // initialize index regiter to base register

    // circular buffer loop


    loop1:
    r0=[i0];                // read the value from source
    r0+=1;                 // modify the value
    [i0++m0]=r0;       // store it back and increment i0
    jump loop1;

    Regards,

    Nabeel

  • The Cicular Buffers of the Blackfin Processor Family are described in the Blackfin Processor Programming Reference Manual.

  • Hi,

    Thank you for your helpful information. I made minor correction on your response an I made it working. Here is the complete working list for those who are following the discussion.

    Osman Demirci

    #include <defBF506F.h>
    #include <defBF50x_base.h>

    .SECTION L1_data_a;
    .BYTE2 dummy[96]; 


    .SECTION L1_code;
    .VAR prog_memory_var=0; // always 32-bit
    .ALIGN 4;
    .GLOBAL _main;

    _main:

      R0=0;
      R1=0;
      R2=0;
      R3=0;
      R4=0;
      R5=0;
      R6=0;
      R7=0;

    _main.forever:

      B0.L=LO(dummy);
      B0.H=HI(dummy);
      L0=192;          // set L0=2*96=192 due to 16-bit dummy
      M0=1;
      I0=B0;
     
      loop1:
      R1+=1;
      R0.L=W[I0];     // Read first value from dummy vector
      R0+=1;          // Increment R0 by 1
      W[I0++]=R0.L;   // Save R0 back and then increment I0
      jump loop1;


    jump _main.forever;
    _main.end:

  • This question has been closed by the EZ team and is assumed answered.