AnsweredAssumed Answered

How to implement circular buffer using EMAC and MASK register?

Question asked by Javier Cambra Enguix on Jun 27, 2013
Latest reply on Jun 27, 2013 by TomE

Hello,

 

I need to implement a circular buffer for DSP purposes. I am optimizing a code using EMAC unit. I am using the mac instruction with MASK register:

 

For example, in a simple test: MASK = 0xF0000F and loading A5 with value 0x00800004 (init address of my data buffer)

 

Doing a loop with:

 

mac.l d0, d5, (a5)+&, d5, acc0


I am getting the following address sequence:


0x00800004 OK

0x00800008

0x0080000c

0x00800000 BAD

0x00800004 OK

0x00800008

0x0080000c

0x00800000 BAD

0x00800004 OK

0x00800008

0x0080000c


I undestand what is happening, but I want a circular buffer like code below..., I don't want reset to the address 0x00800000 every time.


0x00800004

0x00800008

0x0080000c

0x00800004

0x00800008

0x0080000c


Has anybody an idea of how to implement a circular buffer, for any start address, using only the mac instruction with the mask?

 

Processor: ColdFire V1+ 51QM128VLH

 

Thanks

Javier

 

 



 

 

 




Outcomes