Sign in

username:

password:



Not a member?

Search c6x



Search tips

Subscribe to c6x



c6x by Keywords

AD535 | BIOS | Booting | Bootloader | C621 | C6211 | C6415 | C671 | C6711 | C6711DSK | C6713 | CCS | Chassaing | COFF | DAT | DM64 | DM642 | DMA | DSK671 | DSK6711 | EDM | EDMA | EMIF | Emulator | EVM | EVM620 | FFT | FIR | GPIO | Halting | HPI | HWI | IDK | JTAG | LDB | LDH | LDW | Linker | LMS | LOG_printf | Matlab | McBSP | MEM_alloc | MIPS | PCI | PCM3003 | Pipeline | Profiling | QDM | Reset | ROM | RTDX | Sampling | SDRAM | Stack | TEB | THS1206 | TMS320C621 | TMS320C6416 | TMS320C6711 | TMS320C6713 | UART | Vector Table | XBUS | XDS560

Sponsor

Industry's highest performing at the lowest power DSPs now as low as $5.00*
Start development today!
*volume pricing for 10ku

Discussion Groups

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | TMS320C6x | circular buffer with DSK6713

Technical discussions about the TI C6000 DSPs (including the c62x, c64x and c67x DSPs).

  

Post a new Thread

circular buffer with DSK6713 - asim...@yahoo.de - May 6 16:41:44 2010

Hi everyone,

i am trying to understand the circular buffer example(see bottom) in chassing's
book and have some questions.

Q1: i ran the code with breakpoints and noticed that in "last_addr"
the last address of the buffer is stored. So, is "last_addr" a command
that does this? i coudlnt find anything in the support files.

Q2: "delays" is defined in line 3, but isnt used in the code. Why is
it defined?

Q3: A7 is initiliazed as a pointer to the circ buffer. It points to the last
address of the buffer. Does it do this automatically? i mean if i set a register
as a pointer to the buffer, does it point to the last address of the buffer
everytime at the beginning of the code?

Thank u for ur answers,

Burak

Here is the code:

;FIRcircfunc.asm ASM function called from C using circular addressing
;A4=newest sample, B4=coefficient address, A6=filter order 
;Delay samples organized: x[n-(N-1)]...x[n]; coeff as h(0)...h[N-1]

            .def  _fircircfunc
            .def   last_addr 
            .def   delays  
	    .sect "circdata"   ;circular data section
            .align 256         ;align delay buffer 256-byte boundary
delays      .space 256         ;init 256-byte buffer with 0's
last_addr   .int   last_addr-1 ;point to bottom of delays buffer
            .text	       ;code section
_fircircfunc:		 ;FIR function using circ addr                    
           
             MV    A6,A1       ;setup loop count 
 	     MPY   A6,2,A6     ;since dly buffer data as byte
	     ZERO  A8          ;init A8 for accumulation				   		
	     ADD   A6,B4,B4    ;since coeff buffer data as bytes
	     SUB   B4,1,B4     ;B4=bottom coeff array h[N-1] 
    
             MVKL 0x00070040,B6 ;select A7 as pointer and BK0
             MVKH 0x00070040,B6 ;BK0 for 256 bytes (128 shorts) 
       
             MVC   B6,AMR       ;set address mode register AMR		

	     MVKL  last_addr,A9 ;A9=last circ addr(lower 16 bits)
	     MVKH last_addr,A9  ;last circ addr (higher 16 bits)		
             LDW   *A9,A7       ;A7=last circ addr
             NOP   4 
             STH   A4,*A7++	;newest sample-->last address

loop:				;begin FIR loop
             LDH   *A7++,A2     ;A2=x[n-(N-1)+i] i=0,1,...,N-1  
    ||       LDH   *B4--,B2     ;B2=h[N-1-i] i=0,1,...,N-1
             SUB   A1,1,A1	;decrement count
    [A1]     B     loop    	;branch to loop if count # 0
             NOP   2
 	     MPY   A2,B2,A6     ;A6=x[n-(N-1)+i]*h[N-1+i]
             NOP   
             ADD   A6,A8,A8     ;accumulate in A8 			
          
             STW   A7,*A9	;store last circ addr to last_addr
             B     B3           ;return addr to calling routine
             MV    A8,A4	;result returned in A4
             NOP   4

_____________________________________

______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of c6x -- send a blank email to c6x-subscribe@yahoogroups.com )