Pragma reference, Introduction, Connection pragma – Altera Nios II C2H Compiler User Manual

Page 119: Chapter 6. pragma reference, Introduction –1, Connection pragma –1, Chapter 6, pragma reference

Advertising
background image

Altera Corporation

9.1

6–1

November 2009

6. Pragma Reference

Introduction

The C2H Compiler uses pragmas that allow user control of master-slave
connections and arbitration shares. This chapter describes these pragmas
in detail.

The C language specification dictates that when a compiler
implementation encounters a

pragma

directive it does not recognize, the

compiler ignores the pragma. By using pragmas, you can write directives
to optimize the C2H Compiler results, without making the C code
incompatible with other compilers.

Connection
Pragma

The C2H Compiler provides a connection pragma that associates a
pointer variable with an Avalon-MM slave port, which is typically a
memory. A pointer variable can translate to one or more master ports,
depending on how many times it is dereferenced in the C code. The
connection pragma directs the C2H Compiler to connect all master ports
generated for a particular variable to a specific slave port in the SOPC
Builder system, reducing arbitration logic.

The connection pragma syntax is as follows:

#pragma altera_accelerate connect_variable \

<

function name

>/<

variable name

> to \

<

module

>[/<

slave name

>] [arbitration_share <

shares

>]

<function name> and <variable name> are the exact names of the
accelerated function and the pointer variable. <module> is the exact name
of the component instance, as specified in SOPC Builder. <slave name> is
optional. If provided, <slave name> is the exact name of a specific slave
port on <module>; if not provided, the master port connects to all slave
ports on <module>. <shares> is a positive integer from 1 to 100.

Define the connection pragma in the same file as the function to be
accelerated, outside the function body.

To connect a variable's master ports to multiple slave ports, you can use
multiple pragmas. If you use the connection pragma for a specific
variable, the C2H Compiler connects only the slave ports specified in
pragma statements.

Advertising