AnsweredAssumed Answered

execption 2c addr 0 when enter asm function cycle count using icc

Question asked by willrobot on Nov 16, 2011
Latest reply on Dec 12, 2011 by Smiao

Hi,

 

I did previously convert and implement the ADI VDSP FFT code and made it work.

 

I'm now implementing the ADI VDSP code of FIR filter which follow exaclty the same structure than for the FFT one.

 

I did allocate memory to my FIR in and  out array as I did it with FFT using icc allocation memories functions.

 

this seem to work fine except that I sometime have using the same code exception when filling the array. When I run again the exact same code after a reboot of the board it then run until having finish to fill the FFT and the FIR arrays (an intermitent error of mem allocation that I'm not sur how to fix).

 

Anyway, when this intermitent mem problem pass and I reach   Compute_Cycle_Count function:

.....

COREB: in_FIR = 0                                                              
COREB: in_FIR = 0                                                              
COREB: in_FIR = 0                                                              
COREB: in_FIR = 0                                                              
COREB: in_FIR = 0                                                              
COREB: before cycle count                                                      
COREB: execption 2c addr 0                                                     
COREB: execption 2c addr 0                                                     
COREB: execption 2c addr 0                                                     
COREB: execption 2c addr 0                                                     
COREB: execption 2c addr 0                                                     
COREB: execption 2c addr 0  

....

 

I've got as you can see an exception 2c addr 0.

 

in my main file this correspond to:

 

coreb_msg("before cycle count");

 

    cycle_count[0] = Compute_Cycle_Count_FIR(&in_FIR[1], out_FIR,nsamples/2, h_\
FIR, 16, 2, 8,d_FIR);

 

and Compute_Cycle_Count_FIR look like that:

 

.align 4                         ;                                             
_Ret_Add_FIR:              .int 0    ;                                         
_Save_R7_FIR:              .int 0    ;                                         
.global _Compute_Cycle_Count_FIR;                                              
.align 8;                                                                      
_Compute_Cycle_Count_FIR:

 

    P0.L = _Ret_Add_FIR;                                                   
    P0.H = _Ret_Add_FIR;                                                   
    R3 = RETS;                                                             
        [P0] = R3;                                                            

 

        P0.L = _Save_R7_FIR;                                                   
        P0.H = _Save_R7_FIR;                                                   
        [P0] = R7;           

P0.L = _f1;                                                            
        P0.H = _f1;                                                            
    P0 = [P0];                                                            

 

    NOP;NOP;NOP;NOP;                                                      

 

        R7 = CYCLES;                                                           
    CALL (P0);                                                             
        R0 = CYCLES;                                                           
        NOP;                                                                   
        R0 = R0 - R7; 

R0 += -5;                                                             

 

        P0.L = _Save_R7_FIR;                                                   
    P0.H = _Save_R7_FIR;                                                   
    R7 = [P0];                                                            

 

    P0.L = _Ret_Add_FIR;                                                   
    P0.H = _Ret_Add_FIR;                                                   
    R3 = [P0];                                                             
    RETS = R3;                                                            

 

    NOP;NOP;NOP;NOP; 

RTS;                                                                  

 

_Compute_Cycle_Count_FIR.end:

 

this function is exactly the same than _Compute_Cycle_Count: which is declared above it and do run before with the test_FFT function.

 

So I don't know why it doesn't run properly after. I just modify this function by adding _FIR at the and of it for diferentiation as the f1 function has different arguments I couldn't declare it the same way in test_ad1686_driver.c:

 

//FFT DSP lib declaration                                                      
extern void _CFFT_Rad4_NS_NBRev(struct complex_fract16 *in,struct complex_fract\
16 *out,int N, struct complex_fract16 *w);

 

extern void _fir_decima_spl(const fract16 *in, fract16 *out, int n, fract16 *h,\
int L, int M, int LBYM, fract16 *d);

 

void (*f1)();
int error_flag = 0;
int cycle_count[10];

 

extern int Compute_Cycle_Count(struct complex_fract16 *in, struct complex_fract\
16 *output, int n, struct complex_fract16 *w);

 

extern int Compute_Cycle_Count_FIR(const fract16 *in, fract16 *out,int n, fract\
16 *h, int L, int M, int LBYM, fract16 *d);

 

I attach test_ad1686_driver.c and cycle_count.asm if more clarity needed.

Outcomes