Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

FIR Filter Implementation

Madhukar kumar Deshant R. Fusate Agni swaroop


2014EE10451 2014EE10436 2014EE10439
A. Asymmetric FIR Filter (4-tap Filter)

N .set 4
M .set 4
.mmregs
.def start

start
BCLR C54CM
BCLR AR0LC ;Linear Mode
AMOV #010000h,XAR0 ;Starting Address for Input
BCLR AR1LC ;Linear Mode

AMOV #010020h,XAR1 ;Starting Address for Output


BSET CDPLC ;Circular Addressing

BSET SATD ;To Saturate Accumulator


BSET FRCT ;To shift Accumulator left by one bit

AMOV #000100h,XCDP ;Starting Address for coefficient

MOV #0h,BSAC ;Offset for circular Addressing of CDP


MOV #N,BKC ;Size of Block for Circular Addressing
MOV #0,AC0

MOV #(M+N-2),BRC0 ;Initializing for local block repeat


MOV #N,T0 ;Offset to move pointer of AR0 back.

RPTBLOCAL LOOP
MPYM *AR0-,*CDP+,AC0

RPT #N-3
MACM *AR0-,*CDP+,AC0

MACM *(AR0+T0),*CDP+,AC0
LOOP MOV HI(AC0),*AR1+ ;Storing Output

IDLE
B. FIR Filter (Using FIRSADD)

N .set 4;h
M .set 4;x
.mmregs
.def start

start
BCLR C54CM
BCLR AR0LC ;Linear Mode
AMOV #01000h,XAR0 ;Starting Address for Input X
AMOV #01000h-N+1,XAR2 ;Second Pointer for X
BCLR AR1LC ;Linear Mode

AMOV #010020h,XAR1 ;Starting Address for Output


BSET CDPLC ;Circular Addressing
BSET SATD ;To Saturate Accumulator
BSET FRCT ;To shift Accumulator left by one bit
AMOV #000100h,XCDP ;Starting Address for coefficient H
MOV #0h,BSAC ;Offset for circular Addressing of CDP
MOV #N/2,BKC ;Size of Block for Circular Addressing
MOV #0,AC0
MOV #0,AC1
MOV #(M+N-2),BRC0 ;Initializing for local block repeat BR0+1 times
MOV #N/2,T0 ;Offset to move pointer of AR0 back.
RPTBLOCAL LOOP
MOV #0,AC0
MOV #0,AC1
ADD *AR2+,*AR0-,AC0
FIRSADD *AR2,*AR0,*CDP+,AC0,AC1
MACM *CDP+,AC0,AC1
MOV *(AR0+T0),*AR0
LOOP MOV HI(AC1),*AR1+ ;Storing Output

IDLE

You might also like