[an error occurred while processing this directive]
|
;16-bit 16-tap FIR benchmark
;MAC based - dsPIC3xF only
;12bit data, 16bit coefficients
;Hardware (modulo addressed) circular buffer used
;
;GNU PIC30-AS assembler used
;(C) =AVR= 2005
;
;Executes in 32 cycles - 0.8 uS @40 MIPS/1.1 uS @33 MIPS
;Single tap procedure requires 1 cycle - 25 nS @40 MIPS/33 nS @33MIPS per tap
;
;Flash usage: 15 words (45 bytes)
;RAM usage: 18.5 words (37 bytes)
;Register usage : 4
;
.equ __30F6012A2, 1
.include "p30f6012.inc" ;SFR definitions for dsPIC30F6012 chip
.list
__reset = 0
.global __reset ;Compatibility issue workaround
;
;WEAK directive "legalizes" unresolved label to a linker
;
.weak buf_ptr ;Global FIR sample buffer pointer
.weak buf_bot ;Global FIR sample buffer start
.weak coeff_tab ;FIR coefficient table (16 16-bit words), located in Flash
;
buf_len = 16 ;FIR sample buffer lenth (in 16-bit words)
;
templ = w4 ;Temporary data register
temph = w5 ;Temporary coeff register
;
firoutl = 0x0022 ;Accumulator A mapped to data memory = 32-bit MAC result (FIR result)
firouth = 0x0024 ;
;
xptr = w8 ;Local FIR sample pointer
zptr = w10 ;Current FIR coefficient pointer
;
.text
FIR:
mov #4,templ
mov templ,CORCON ;Enable Flash to upper RAM mapping
;
mov #buf_bot,templ
mov templ,XMODSRT ;Set modulo start address
;
mov #buf_bot+(buf_len*2),templ
mov templ,XMODEND ;Set modulo end address
;
mov #0x8008,templ
mov templ,MODCON ;Enable w8, X AGU for modulo addressing
;
mov buf_ptr,xptr ;Initialize FIR data sample pointer
mov #(32768+coeff_tab),zptr ;Initialize FIR coeff pointer to RAM mapped code space
;
clr A,[xptr]+=2,templ,[zptr]+=2,temph ;Clear accumulator A, advance pointers and pre-fetch next data/coeff pair
;
repeat #15 ;Repeat the following procedure 16 times
;Single tap procedure start
mac templ*temph,A,[xptr]+=2,templ,[zptr]+=2,temph ;MAC, advance pointers and pre-fetch next data/coeff pair
;Single tap procedure end
;
clr MODCON ;Disable modulo addressing
return
E-mail: info@telesys.ru