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

no-image

IPT-C2H-NIOS

Manufacturer Part Number
IPT-C2H-NIOS
Description
C2H COMPILER FOR NIOS II
Manufacturer
Altera
Series
Nios®IIr
Type
Nios IIr
Datasheet

Specifications of IPT-C2H-NIOS

Function
C to Hardware Compiler
License
Initial License
Software Application
IP CORE, NIOS Processor And Functions
Core Architecture
FPGA
Core Sub-architecture
Cyclone
Rohs Compliant
NA
Lead Free Status / RoHS Status
Not applicable / Not applicable
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 IPT-C2H-NIOS