Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

Problem with Alignment

Hey ,

I got the warning message about "Non Using DMA for transfer ... lack of alignment".

The data structure I used looks like as follows :

"""""

typedef struct{

double test1 , test2;

int test3;

}Test;

typedef struct{

double temp1;

double temp2;

double temp3;

double temp4;

Test temp5[256];

Test temp6;

}temp;

"""""

And I add the " __attribute__((aligned(64))) " in host and kernel like as shown :

"""""

typedef struct{

double test1 , test2;

int test3;

}Test;

__attribute__((aligned(64)))

typedef struct{

double temp1;

double temp2;

double temp3;

double temp4;

Test temp5[256];

Test temp6;

}temp;

"""""

Then I executed the program and the warning message still happened and segmentation fault.

It seems that the data can't not transfer between host and FPGA , and the program will be stopped.

Could anyone help me , please : (((

Thanks

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You probably need to manually align the data structure on the host side for example, using posix_memalign.

    ...

    temp tmp_struct;

    posix_memalign((void**)&tmp_struct, 64, sizeof(temp));

    ...