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

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
Example 3–18. Indexing a Multidimensional Array without Causing a Memory Access
char a[LENGTH][WIDTH]; // Here's a two-dimensional array
// The following assignments are all equivalent.
char *subscripting
char *dereferencing
char *offset
char *ptr_arithmetic = (char *) ((void *)a + 3*WIDTH);
Example 3–19. Indexing an Array and Causing a Memory Access
char a[LENGTH][WIDTH]; /* a is a two-dimensional array */
// The following assignments are equivalent.
char *subscripting_a = a[3][2];
char *dereferencing_a = *(*(a + 3) + 2);
char b[LENGTH];
// The following assignments are equivalent.
char *subscripting_b = b[1];
char *dereferencing_b = *(b + 1);
Altera Corporation
November 2009
Although an array is considered to be a pointer type, dereferencing an
array variable does not always mean the same thing as dereferencing a
pointer. For example, dereferencing or indexing once into a
multidimensional array returns a pointer to the first element in another
array. For an N-dimensional array, a dereference or index into any of the
first (N-1) dimensions does not read a value from the array memory; it
computes an offset from the array's base address to determine the address
of a subsection of the array.
Example 3–18
dimensional array does not result in a memory access.
Indexing into any of the first (N-1) dimensions of an N-dimensional array
requires a multiplication operation, as demonstrated by the evaluation of
ptr_arithmetic in
integer power of two, then the multiplication operation is reduced to a
constant-shift operation, which does not require a hardware multiplier.
(Refer to section
page
A series of subscript operations that index into all N dimensions of an N-
dimensional array is equivalent to an indirection operation, which creates
an Avalon-MM master port.
generate an Avalon-MM master port to dereference an array variable.
=
=
= (char *) (a + 3);
/* b is a one-dimensional array */
3–3.)
demonstrates that indexing to the first level of a two-
*(a + 3);
“Unregistered Operations and Assignments” on
a[3];
Example
9.1
Example 3–19
3–18. If the size of the resultant array is an
C-to-Hardware Mapping Reference
Nios II C2H Compiler User Guide
illustrates several cases that
3–27

Related parts for IPT-C2H-NIOS