Altera_Forum
Honored Contributor
20 years agoDMA SPEED PROBLEM!
I have system with 3 SDRAM controllers
1'st is x16 SDRAM for storing code and data (MAIN_SDRAM) 2,3 is x8 for video memory (V1_SDARM,V2_SDRAM) All SDRAMs work on 100Mhz I try to copy one page from MAIN_SDRAM to V1 or V2 SDARMS using following code : //////////...............in void main() unsigned char *p1 = (unsigned char*)(SDRAM_V1_BASE); unsigned char *p2 = (unsigned char*)(SDRAM_V2_BASE); static byte array[800]; memcpy(p1,array,800); //////////............... I run it on Modelsim and calculate oparation speed transer Time need to transfer 800 bytes is 57810000ps The transfer speed = 800/(57810000*10^(-12)*2^20)= 13.19736124 MB/sec!!!!! After that i try to impement DMA (WR_DMA) for that and i run following code void memcpy_my(int *where,int * from,int howmurch) { while ((IORD_ALTERA_AVALON_DMA_STATUS(WR_DMA_BASE) & ALTERA_AVALON_DMA_STATUS_BUSY_MSK)); IOWR_ALTERA_AVALON_DMA_CONTROL(WR_DMA_BASE,0); IOWR_ALTERA_AVALON_DMA_STATUS(WR_DMA_BASE, 0); IOWR_ALTERA_AVALON_DMA_LENGTH(WR_DMA_BASE, howmurch); IOWR_ALTERA_AVALON_DMA_RADDRESS(WR_DMA_BASE, from); IOWR_ALTERA_AVALON_DMA_WADDRESS(WR_DMA_BASE, where); IOWR_ALTERA_AVALON_DMA_CONTROL(WR_DMA_BASE,ALTERA_AVALON_DMA_CONTROL_GO_MSK | ALTERA_AVALON_DMA_CONTROL_BYTE_MSK| ALTERA_AVALON_DMA_CONTROL_WEEN_MSK| ALTERA_AVALON_DMA_CONTROL_LEEN_MSK); while ((IORD_ALTERA_AVALON_DMA_STATUS(WR_DMA_BASE) & ALTERA_AVALON_DMA_STATUS_BUSY_MSK));# ifdef DEBUG printf("\nDMA packet\nfrom 0x%x\nwhere - 0x%x\nhowmurch - %d",from,where,howmurch); short status=0;# endif } //////////...............in main() unsigned char *p1 = (unsigned char*)(SDRAM_V1_BASE); unsigned char *p2 = (unsigned char*)(SDRAM_V2_BASE); static byte array[800]; my_memcpy(p1,array,800); //////////............... Time need to transfer 800 bytes is 22450000ps The transfer speed 800/(22450000*10^(-12)*2^20)= 33.98394001 mb/sec !!!!!!!! Any way it is very low value corresponds to random modes of SDRAM How i understand DMA just not use burst mode of SDRAM ! http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/mad.gif Is it possible to make something with DMA or processor to FIX that ? (in fact i don't want use DMA for that )