Add real ADSP-2191 assembly examples + open21xx assembler test

This commit is contained in:
Siggi
2026-04-12 18:10:08 +00:00
parent d325e04765
commit d7f0569a47
34 changed files with 6283 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,101 @@
****************************************************************************
fir.asm N-tap finite impulse response filter (FIR)
Analog Devices, Inc.
DSP Division
Three Technology Way
P.O. Box 9106
Norwood, MA 02062
23-JUNE-2001 BJM
This directory contains an example ADSP-2191, single-core subroutine
that implements a N-tap finite impulse response filter (FIR) using coefficients.
Files contained in this directory:
fir.dpj VisualDSP project file
fir.asm ADSP-2191 source for FIR
fir_test.asm Calling function for fic.asm
ADSP-2191.ldf Linker description file
input_dec.dat Sample data for FIR
_________________________________________________________________
CONTENTS
I. FUNCTION/ALGORITHM DESCRIPTION
II. IMPLEMENTATION DESCRIPTION
III. DESCRIPTION OF INPUT DATA
I. FUNCTION/ALGORITHM DESCRIPTION
The project fir.dpj contains an implementation of a single-core subroutine
that implements a N-tap finite impulse response filter (FIR). This
routine has been optimized to take advantage of the repetitive multiply
accumulates inherent to the algorithm.
y(n) = Summation from k=0 to M of h(k)*x(n-k)
II. IMPLEMENTATION DESCRIPTION
The assembly language module FIR_TEST.ASM initializes the input and
coefficient buffers and then calls FIR.ASM.
The first buffer declared, IN, is Num_Samp locations long.
The next buffer declared, OUT, is also Num_Samp long, and stores the
output of the filter.
Delay_Line is the third buffer declared. This buffer holds the delay line.
Since there are past intermediate values for each stage of the FIR, the length of
this buffer is as long as the number of Taps.
The coefficient buffer, COEFF, contains the FIR filter coefficients. The
coefficients are typically generated by a filter design software package.
The linker descriptive file is ADSP-2191.LDF, which describes the hardware in
terms of memory spaces and peripherals.
Because there is no data dependency between DSP cores, it is possible
to do perform an FIR in DSP core 1, while also performing an FIR in DSP core 2
on separate input data, using different coefficients.
III. DESCRIPTION OF INPUT DATA
1. INPUT SAMPLES:
-----------------
This FIR routine expects input data which conforms to the following criteria:
Generate input data such that an array of input fixed point values are arranged
in the following order:
INPUT DATA
indata(0)
indata(1)
indata(2)
indata(3)
...
...
...
2. COEFFICIENT DATA:
-----------------------
This FIR routine expects TAPS 1.15 fixed point values to be used as coefficients.
COEFFICIENT DATA
coef(0)
coef(1)
coef(2)
coef(3)
...
...
...

View File

@@ -0,0 +1,115 @@
ARCHITECTURE(ADSP-2191)
$OBJECTS = $COMMAND_LINE_OBJECTS;
// This memory map is set up to facilite testing of the tool
// chain -- code and data area are as large as possible.
MEMORY
{
seg_dmy { TYPE(PM RAM) START(0x000000) END(0x000003) WIDTH(24) }
seg_itab { TYPE(PM RAM) START(0x000004) END(0x00003f) WIDTH(24) }
seg_code { TYPE(PM RAM) START(0x000040) END(0x003fff) WIDTH(24) }
seg_buf2 { TYPE(DM RAM) START(0x008000) END(0x0088ff) WIDTH(16) }
seg_buf1 { TYPE(DM RAM) START(0x008900) END(0x0095ff) WIDTH(16) }
seg_data1 { TYPE(DM RAM) START(0x009600) END(0x00afff) WIDTH(16) }
seg_data2 { TYPE(PM RAM) START(0x004000) END(0x006bff) WIDTH(24) }
seg_heap { TYPE(DM RAM) START(0x00f200) END(0x00f9ff) WIDTH(16) }
seg_stack { TYPE(DM RAM) START(0x00fa00) END(0x00ffff) WIDTH(16) }
}
PROCESSOR p0
{
LINK_AGAINST( $COMMAND_LINE_LINK_AGAINST)
OUTPUT( $COMMAND_LINE_OUTPUT_FILE )
SECTIONS
{
sec_dmy
{
INPUT_SECTIONS( $OBJECTS(IVreset))
} > seg_dmy
sec_itab
{
INPUT_SECTIONS( $OBJECTS(IVpwrdwn))
. = .+0x1;
INPUT_SECTIONS( $OBJECTS(IVkernel))
. = .+0x1;
INPUT_SECTIONS( $OBJECTS(IVstackint))
. = .+0x1;
INPUT_SECTIONS( $OBJECTS(IVmailboxint))
. = .+0x1;
INPUT_SECTIONS( $OBJECTS(IVtimerint))
. = .+0x1;
INPUT_SECTIONS( $OBJECTS(IVringint))
. = .+0x1;
INPUT_SECTIONS( $OBJECTS(IVpcibmint))
. = .+0x1;
INPUT_SECTIONS( $OBJECTS(IVdspdspint))
. = .+0x1;
INPUT_SECTIONS( $OBJECTS(IVfifo0tmitint))
. = .+0x1;
INPUT_SECTIONS( $OBJECTS(IVfifo0rcveint))
. = .+0x1;
INPUT_SECTIONS( $OBJECTS(IVfifo1tmitint))
. = .+0x1;
INPUT_SECTIONS( $OBJECTS(IVfifo1rcveint))
. = .+0x1;
INPUT_SECTIONS( $OBJECTS(IVint13))
. = .+0x1;
INPUT_SECTIONS( $OBJECTS(IVint14))
. = .+0x1;
INPUT_SECTIONS( $OBJECTS(IVac97frint))
. = .+0x1;
} > seg_itab
seg_code
{
INPUT_SECTIONS( $OBJECTS(program) )
} >seg_code
sec_buf1
{
INPUT_SECTIONS($OBJECTS(seg_buf1) )
}>seg_buf1
sec_buf2
{
INPUT_SECTIONS($OBJECTS(seg_buf2) )
}>seg_buf2
sec_data1
{
INPUT_SECTIONS( $OBJECTS(data1) )
} >seg_data1
sec_data2
{
INPUT_SECTIONS( $OBJECTS(data2) )
INPUT_SECTIONS( $OBJECTS(program2) )
} >seg_data2
// support for initialization, including C++
sec_ctor
{
INPUT_SECTIONS( $OBJECTS(ctor))
} >seg_data1
// provide linker variables describing the stack (grows down)
// ldf_stack_limit is the lowest address in the stack
// ldf_stack_base is the highest address in the stack
sec_stack
{
ldf_stack_limit = .;
ldf_stack_base = . + MEMORY_SIZEOF(seg_stack) - 1;
} >seg_stack
sec_heap
{
.heap = .;
.heap_size = MEMORY_SIZEOF(seg_heap);
.heap_end = . + MEMORY_SIZEOF(seg_heap) - 1;
} >seg_heap
}
}

View File

@@ -0,0 +1,101 @@
****************************************************************************
fir.asm N-tap finite impulse response filter (FIR)
Analog Devices, Inc.
DSP Division
Three Technology Way
P.O. Box 9106
Norwood, MA 02062
23-JUNE-2001 BJM
This directory contains an example ADSP-2191, single-core subroutine
that implements a N-tap finite impulse response filter (FIR) using coefficients.
Files contained in this directory:
fir.dpj VisualDSP project file
fir.asm ADSP-2191 source for FIR
fir_test.asm Calling function for fic.asm
ADSP-2191.ldf Linker description file
input_dec.dat Sample data for FIR
_________________________________________________________________
CONTENTS
I. FUNCTION/ALGORITHM DESCRIPTION
II. IMPLEMENTATION DESCRIPTION
III. DESCRIPTION OF INPUT DATA
I. FUNCTION/ALGORITHM DESCRIPTION
The project fir.dpj contains an implementation of a single-core subroutine
that implements a N-tap finite impulse response filter (FIR). This
routine has been optimized to take advantage of the repetitive multiply
accumulates inherent to the algorithm.
y(n) = Summation from k=0 to M of h(k)*x(n-k)
II. IMPLEMENTATION DESCRIPTION
The assembly language module FIR_TEST.ASM initializes the input and
coefficient buffers and then calls FIR.ASM.
The first buffer declared, IN, is Num_Samp locations long.
The next buffer declared, OUT, is also Num_Samp long, and stores the
output of the filter.
Delay_Line is the third buffer declared. This buffer holds the delay line.
Since there are past intermediate values for each stage of the FIR, the length of
this buffer is as long as the number of Taps.
The coefficient buffer, COEFF, contains the FIR filter coefficients. The
coefficients are typically generated by a filter design software package.
The linker descriptive file is ADSP-2191.LDF, which describes the hardware in
terms of memory spaces and peripherals.
Because there is no data dependency between DSP cores, it is possible
to do perform an FIR in DSP core 1, while also performing an FIR in DSP core 2
on separate input data, using different coefficients.
III. DESCRIPTION OF INPUT DATA
1. INPUT SAMPLES:
-----------------
This FIR routine expects input data which conforms to the following criteria:
Generate input data such that an array of input fixed point values are arranged
in the following order:
INPUT DATA
indata(0)
indata(1)
indata(2)
indata(3)
...
...
...
2. COEFFICIENT DATA:
-----------------------
This FIR routine expects TAPS 1.15 fixed point values to be used as coefficients.
COEFFICIENT DATA
coef(0)
coef(1)
coef(2)
coef(3)
...
...
...

View File

@@ -0,0 +1,31 @@
86,
115,
-77,
-103,
24,
187,
18,
-248,
-132,
319,
327,
-374,
-744,
412,
2564,
3671,
2564,
412,
-744,
-374,
327,
319,
-132,
-248,
18,
187,
24,
-103,
-77,
115,
86

View File

@@ -0,0 +1,81 @@
/**************************************************************
File Name: FIR.asm
Date Modified: 6/22/01 BM
Description:
Subroutine that implements a FIR Filter given
coefficients and samples.
Equation: y(n) = Summation from k=0 to M of h(k)*x(n-k)
Calling Parameters:
b0,i0 = address of delay line buffer
l0 = length of delay line buffer
b1,i1 = address of input samples buffer
b4,i4 = address of coefficients buffer
l4 = length of coefficients buffer
b2,i2 = address of output buffer
m1 = 1
m3 = -1
m4 = 1
Assumptions:
Delay line must be of length TAPS
Delay line , Output and Input buffers stored in DM Block.
Instructions, and Coefficients stored in PM Block.
Return Values:
i2 = output buffer
i0 = delay line pointer
Registers Affected:
i0,i1,i2,i4,MX,MY,MR,SR
Cycle Count:
7 + Bin_Samp(Taps-1 + 4) + cache misses
Memory Usage:
Instructions Words (24-bits):
11 + Taps-1 instruction words
Data Words (16 or 24-bits):
Number of taps locations for coefficients (24-bits)
Number of taps locations for the delay line buffer (16-bits)
Number of samples locations for the input buffer (16-bits)
Number of samples locations for the output buffer (16-bits)
Notes:
**************************************************************/
#define Samps_per_Bin 40 /* Number of Input samples in each bin */
#define Taps 31 /* Number of filter taps */
.GLOBAL fir;
/* program memory code */
.section/pm program;
fir:
MR = 0, MX0 = DM(I1,M1), MY0 = PM(I4,m4); /* Read Input sample and coefficient */
DM(I0,M3) = MX0; /* Put Input sample in delay line */
CNTR=Samps_per_Bin; /* Set CNTR to Samps_per_Bin for each bin */
DO mult_acc UNTIL CE;
.repeat (Taps-1);
MR=MR+MX0*MY0(SS), MX0=DM(I0,M3), MY0=PM(I4,M4);
.end_repeat;
MR=MR+MX0*MY0(SS), MX0=DM(I0,M1), MY0=PM(I4,M4);
SR=ASHIFT MR2 (HI), MX0=DM(I1,M1);
SR=SR OR LSHIFT MR1 (LO), DM(I0,M3) = MX0;
mult_acc:
MR = 0, DM(I2,M1)=SR0; /* Write to output */
rts (db);
MX0 = DM(I0,M1); /* Update delay pointer */
MX0 = DM(I1,M3);

View 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 */
/************************************************************************/

View File

@@ -0,0 +1,512 @@
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497,
3290,
-462,
5323,
-5597,
5323,
-8595,
3290,
-18957,
0,
18957,
-3290,
8595,
-5323,
5597,
-5323,
462,
-3290,
-15497,
0,
15497