Multidimensional coeffs array - xrun: Program received signal ET_LOAD_STORE, Memory access exception. Topic is solved

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
notDilbert
Member
Posts: 14
Joined: Mon Feb 25, 2019 3:05 pm

Multidimensional coeffs array - xrun: Program received signal ET_LOAD_STORE, Memory access exception.

Post by notDilbert »

Hi,

What is going wrong with the following code? All I can think of is a possible 64-bit word align issue.

main.xc

Code: Select all

#include <dsp.h>

#define Q_N 24
#define IIR_CASCADE_DEPTH 3
#define IIR_STATE_LENGTH DSP_NUM_STATES_PER_BIQUAD * IIR_CASCADE_DEPTH
#define BUFFER_LENGTH 32

void filter_buffer(int32_t out_buffer[], const int32_t in_buffer[], const int N)
{
    int32_t iir_coeffs[2][15] = {
        {
            Q24(0.03),Q24(0),Q24(-0.03),Q24(1.90),Q24(-0.93),
            Q24(0.03),Q24(0),Q24(-0.03),Q24(1.95),Q24(-0.97),
            Q24(0.01),Q24(0),Q24(-0.01),Q24(1.96),Q24(-0.98)
        },
        {
            Q24(0.02),Q24(0),Q24(-0.02),Q24(1.93),Q24(-0.95),
            Q24(0.04),Q24(0),Q24(-0.03),Q24(1.91),Q24(-0.96),
            Q24(0.02),Q24(0),Q24(-0.02),Q24(1.94),Q24(-0.97)
        }
    };

    int32_t filter_state[IIR_STATE_LENGTH];

    for (int i = 0; i < BUFFER_LENGTH; i++)
    {
        out_buffer[i] = dsp_filters_biquads(in_buffer[i], iir_coeffs[N], filter_state, IIR_CASCADE_DEPTH, Q_N);
    }
}

int main()
{
    int32_t input[BUFFER_LENGTH];
    int32_t result[BUFFER_LENGTH];

    for (int i = 0; i < 2; i++)
    {
        filter_buffer(result, input, i);

        /*
            xrun: Program received signal ET_LOAD_STORE, Memory access exception.
                  dsp_filters_biquads (input_sample=-267368897, filter_coeffs=0x7fe04, state_data=0x7fd98, num_sections=3, q_format=24) at C:/Users/Dev/workspace/proj/lib_dsp/src\dsp_filters.c:1181
                  1181              asm("ldd %0,%1,%2[0]":"=r"(b1),"=r"(b0):"r"(filter_coeffs));
                  Current language:  auto; currently minimal
        */
    }

    return 0;
}
Kind regards


View Solution
User avatar
mon2
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »