Altera Nios II C2H Compiler User Manual

Page 90

Advertising
background image

3–50

9.1

Altera Corporation

Nios II C2H Compiler User Guide

November 2009

Scheduling

Example 3–38. Pipelined Subfunction

int MAX(int a, int b)
{
return ((a > b)? a : b);
}

#pragma altera_accelerate connect_variable MAX_loop/a to sdram
#pragma altera_accelerate connect_variable MAX_loop/b to
onchip_ram_64_kbytes
int MAX_loop(int * _ _ restrict_ _ a, int * _ _ restrict_ _ b)
{
int i, c = 0;
for (i = 0; i < 1024; i++)
{
c += MAX(a[i], b[i]);
}
return c;
}

If the subfunction performs a memory access that stalls, then the outer
state machine also stalls.

Pipelined subfunctions provide a useful option for controlling shared
resources. For further information, see

“Resource Sharing”

.

Advertising