MyFPGA Forum
标题:
設定Data Struture Alignment
[打印本页]
作者:
rich
时间:
2010-4-24 15:26
标题:
設定Data Struture Alignment
compiler 會根據cpu 特性, 將資料結構的欄位作最佳的alignment,
以減少memory access time.
所以在不同系統下, 資料結構在記憶體內所佔的大小是不一致的.
兩不同系統進行通訊, 就必須使用相同的data structure alignemnet.
在NIOS II code 內, 設定Byte-aligned 範例如下:
#define NIOS_PACK1 __attribute__ ((packed,aligned(1)))
typedef struct{
unsigned char Type; // MEM_XXX
unsigned int Addr; // byte addr
unsigned int Len; // byte len
unsigned char Data[BUF_SIZE];
}NIOS_PACK1 SET_MEM;
作者:
pex857617729
时间:
2010-5-12 08:24
顶一个。
作者:
IamDavid
时间:
2010-7-21 10:51
楼主能不能给个完整的例子参考下...还是不大知道具体怎么弄的...谢谢...
欢迎光临 MyFPGA Forum (http://www.myfpga.org/discuz/)
Powered by Discuz! X3