Reducing arbitration logic – Altera Nios II C2H Compiler User Manual

Page 120

Advertising
background image

6–2

9.1

Altera Corporation

Nios II C2H Compiler User Guide

November 2009

Connection Pragma

Reducing Arbitration Logic

Example 6–1

illustrates use of the connection pragma to connect two

master ports for the variable

my_ptr

to the memory module named

onchip_buffer

.

Example 6–1. Pragma Connecting Master Ports to a Slave Port

#pragma altera_accelerate connect_variable foo/my_ptr to onchip_buffer

int foo(int *my_ptr)
{
int x = *my_ptr;
my_ptr[8] = 23;
}

Example 6–2

illustrates using multiple pragmas to connect a pointer

variable's master ports to multiple slave ports.

Example 6–2. Pragma Connecting a Master Ports to Multiple Slave Ports

#pragma altera_accelerate connect_variable foo/my_ptr to onchip_buffer_0
#pragma altera_accelerate connect_variable foo/my_ptr to ext_ram_bridge
#pragma altera_accelerate connect_variable foo/my_ptr to sdram
#pragma altera_accelerate connect_variable \

foo/my_ptr to onchip_buffer_1/s2

int foo(int *my_ptr)
{
int x = *my_ptr;
my_ptr[8] = 23;
}

In addition to reducing arbitration logic, the connection pragma helps the
C2H Compiler determine if two pointers overlap. If the memory
connections for two separate variables are mutually exclusive, the
compiler concludes that the pointers are never dependent on each other.
For more information, refer to

“Pointer Aliasing” on page 3–32

.

Optimizing Sequential Memory Access with Arbitration Shares

Arbitration shares benefit memories that have higher efficiency when
accessed sequentially, such as SDRAM. You can use arbitration shares to
reduce interruptions to sequences of transfers with a specific slave. For
example, if a master-slave connection has an arbitration share value of
ten, then the arbitrator grants at least ten consecutive transfers to the

Advertising