Forum Discussion

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

Speedup of NIOS2?

Hello!

How I can speedup of execution my program on NIOS 2?

I'm trying to make calculation of video data before output it to

monitor, but cpu makes it very slowly. I want to calculate video sprites and

alpha chanal.

System clock and SDRAM clock are 100 MHz,

Nios CPU is f-version with icash=2K and dcash=1K,

I'm using EP1C6Q240C6.

Program memory and video memory are working on the different SDRAM controllers

(2 video chips and 1 program chip). The data to video controller are transmitting by DMA.

For example this operation execute very slowly:

*****

unsigned char *mem = ... program memory //(16 bits data bus)

unsignde char *vmem = ... video memory //(8 bits data bus)

*****

//Write to video memory some sprite

for (int i=600; --i; )

for (int j=800; --j; )

if (*mem != 0xF7) {

*--vmem = *mem;

mem--;

}

*****

//Transmitting to VGA

IOWR_ALTERA_AVALON_DMA_STATUS(SD_DMA_BASE, 0);

IOWR_ALTERA_AVALON_DMA_RADDRESS(SD_DMA_BASE, (int)vmem);

IOWR_ALTERA_AVALON_DMA_WADDRESS(SD_DMA_BASE, SD_BASE);

IOWR_ALTERA_AVALON_DMA_LENGTH(SD_DMA_BASE, 800*600);

IOWR_ALTERA_AVALON_DMA_CONTROL(SD_DMA_BASE, 0x02DC);

******

I need to do this cycle about for 25-30 times per second, but really it works only for 5-10 times per second.

How I can speedup this block?

Maybe someone had the same problem before or has any idea?

Thanks.

1 Reply

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

    See your identical post in the General section, I left my answer there.