IPTR-C2H-NIOS Altera, IPTR-C2H-NIOS Datasheet - Page 130

no-image

IPTR-C2H-NIOS

Manufacturer Part Number
IPTR-C2H-NIOS
Description
IP CORE Renewal Of IPT-C2H-NIOS
Manufacturer
Altera
Datasheet

Specifications of IPTR-C2H-NIOS

Software Application
IP CORE, NIOS Processor And Functions
Core Architecture
Nios II
Features
ANSI C Compliance, Straightforward C-to-Hardware Mapping, Reporting Of Generated Results
Core Sub-architecture
Cyclone
Rohs Compliant
NA
Lead Free Status / RoHS Status
na
Language
Example 7–1. Use of Function Pointers Inside the C2H Accelerator
int sub_plus_one(int in)
{
}
int sub_plus_two(int in)
{
}
int sub_plus_three(int in)
{
}
int c2h_fnc(int in, int one_two_or_three)
{
}
7–6
Nios II C2H Compiler User Guide
return in + 1;
return in + 2;
return in + 3;
int (*fp)(int);
fp = ((one_two_or_three == 3) ? sub_plus_three :
return fp(in);
((one_two_or_three == 2) ? sub_plus_two :
sub_plus_one));
Example 7–1
sub_plus_two() and sub_plus_three(). A fourth function,
c2h_fnc(), returns a pointer to one of the three sub-functions,
depending on the value of the input argument one_two_or_three. The
C2H Compiler supports this use of function pointers as long as all four
functions are part of the hardware accelerator.
Function Argument Types (Section 6.9.1, Paragraph 13)
Functions must define the types of the arguments passed.
For example, the following declaration of foo() is not supported
because the arguments a,b, and c are not typed:
The following function declaration which defines the argument types
inside the function argument list is supported:
void foo(a,b,c);
void foo(char a, char b, char c);
defines three sub-functions, sub_plus_one(),
9.1
Altera Corporation
November 2009

Related parts for IPTR-C2H-NIOS