Add real ADSP-2191 assembly examples + open21xx assembler test
This commit is contained in:
76
examples/adsp-2191_fir/Fir_test.asm
Normal file
76
examples/adsp-2191_fir/Fir_test.asm
Normal file
@@ -0,0 +1,76 @@
|
||||
/************************************************************************
|
||||
File Name: Fir_test.asm
|
||||
|
||||
Date Modified: 6/22/01 BM
|
||||
|
||||
|
||||
Purpose: Demonstrate initialization and operation of
|
||||
FIR.asm on the ADSP-2192. FIR.asm is a
|
||||
single precision direct form FIR filter. All
|
||||
coefficients and data values are assumed to
|
||||
be in 1.15 format.
|
||||
|
||||
************************************************************************/
|
||||
|
||||
#define Num_Samp 512 /* NUmber of Input samples */
|
||||
#define Taps 31 /* Number of filter taps */
|
||||
#define Shift 2 /* Number of shifts */
|
||||
#define Samps_per_Bin 40 /* Number of Input samples in each bin */
|
||||
#define Num_Bins (Num_Samp/Samps_per_Bin) /* Number of bins */
|
||||
|
||||
.EXTERN fir;
|
||||
|
||||
/* DM data */
|
||||
.section/data data1;
|
||||
.VAR IN[Num_Samp] = "input_dec.dat"; /* Input buffer */
|
||||
.VAR OUT[Num_Samp]; /* Output buffer */
|
||||
.VAR Delay_Line[Taps]; /* Delay line */
|
||||
|
||||
|
||||
/* PM data */
|
||||
.section/pm data2;
|
||||
.VAR COEFF[Taps] = "coeff_l.dat";
|
||||
|
||||
/* PM interrupt vector code */
|
||||
.section/pm IVreset;
|
||||
JUMP start; NOP; NOP; NOP;
|
||||
|
||||
/* Program memory code */
|
||||
.section/pm program;
|
||||
start:
|
||||
I0=Delay_Line; /* Initialize delay line pointer */
|
||||
M1 = 1;
|
||||
I1 = IN; /* Initialize Input pointer */
|
||||
I2 = OUT; /* Initialize Output pointer */
|
||||
L1=0; /* Initialize for modulo addressing */
|
||||
L2=0; /* Initialize for modulo addressing */
|
||||
M3=-1;
|
||||
M4=1;
|
||||
SE = Shift;
|
||||
DMPG2=page(COEFF);
|
||||
|
||||
L0=LENGTH (Delay_Line); /* Initialize delay line circular buffer */
|
||||
ax0 = Delay_Line;
|
||||
REG(b0) = ax0; /* Initialize pointer to delay line */
|
||||
|
||||
L4=length(COEFF); /* Initialize coeficient circular buffer */
|
||||
ax0 = COEFF;
|
||||
reg(b4) = ax0; /* Initialize pointer to coeficient */
|
||||
|
||||
CNTR=Taps; /* 'Taps' location delay line */
|
||||
DO zero UNTIL CE;
|
||||
zero: dm(I0,M1)=L0; /* Delay_line = 0 */
|
||||
|
||||
|
||||
CNTR = Num_Bins; /* Num_Bins to process Num_Samp */
|
||||
do per_bin until CE;
|
||||
call fir (db);
|
||||
I4=COEFF; /* Load Coeff buffer pointer */
|
||||
nop;
|
||||
per_bin:
|
||||
nop;
|
||||
|
||||
looping: JUMP looping; /* Loop upon itself */
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user