Hi, Can you tel me, is this code can represents IIR filter in 56300 procesor? MOVE #STATES,R0 MOVE #COEF,R4 MOVE #N-1,M0 MOVE #2*N, M4 MOVE #OUT,R1 DO FOREVER , END MOVE X:(R0)+,X0 Y:(R4)+,Y0 REP #N-1 MAC -X0,Y0,A X:(R0)+,X0 Y:(R4)+,Y0 MACR -X0,Y0,A X:(R0)+,X0 Y:(R4)+,Y0 CLR A A,Y1 REP #N-1 MAC +X0,Y0,A X:(R0)+,X0 Y:(R4)+,Y0 MAC +X0,Y0,A X(R0)-,X0 Y:(R4)+,Y0 MACR +Y1,Y0,A Y1,X:(R0) MOVE A1,X:(R1)+ END Thank You for help, Best Regards Bartosz Rzemek
IIR filter in 56300
Started by ●February 8, 2007
Reply by ●February 9, 20072007-02-09
On Feb 8, 5:41 pm, "i...@nazwisko.com" <bartosz.rze...@gmail.com> wrote:> Hi, Can you tel me, is this code can represents IIR filter in 56300 > procesor? > > MOVE #STATES,R0 > MOVE #COEF,R4 > MOVE #N-1,M0 > MOVE #2*N, M4 > MOVE #OUT,R1 > > DO FOREVER , END > > MOVE X:(R0)+,X0 Y:(R4)+,Y0 > > REP #N-1 > MAC -X0,Y0,A X:(R0)+,X0 Y:(R4)+,Y0 > MACR -X0,Y0,A X:(R0)+,X0 Y:(R4)+,Y0 > > CLR A A,Y1 > > REP #N-1 > MAC +X0,Y0,A X:(R0)+,X0 Y:(R4)+,Y0 > MAC +X0,Y0,A X(R0)-,X0 Y:(R4)+,Y0 > > MACR +Y1,Y0,A Y1,X:(R0) > MOVE A1,X:(R1)+ > > ENDit approximates working code (i think it's a Direct Form 2), but will not work for a few reasons i can identify. you have to indent the executable lines if they aren't to be mistaken as labels. "END" is not a good choice for a label as it is an assembler directive. you need to reset your state pointer, R0, before doing the feedforward signal paths (oh, maybe you don't since you have modulo arithmetic on that pointer). and you're not inputing any signal at the beginning. that first MAC instruction, what is the value of accumlator A before it is executed (i think it should be your input). what platform are you running this on and what is your application? if it is audio, i don't think the Direct Form 2 is your best choice, particularly for a fixed-point DSP as the 56K is. r b-j