参数资料
型号: IPT-C2H-NIOS
厂商: Altera
文件页数: 67/138页
文件大小: 0K
描述: C2H COMPILER FOR NIOS II
标准包装: 1
系列: Nios®II
类型: Nios II
功能: C 到硬件编译器
许可证: 初始许可证
C-to-Hardware Mapping Reference
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 demonstrates that indexing to the first level of a two-
dimensional array does not result in a memory access.
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 = a[3];
char *dereferencing = *(a + 3);
char *offset = (char *) (a + 3);
char *ptr_arithmetic = (char *) ((void *)a + 3*WIDTH);
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 Example 3–18 . If the size of the resultant array is an
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 “Unregistered Operations and Assignments” on
page 3–3 .)
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. Example 3–19 illustrates several cases that
generate an Avalon-MM master port to dereference an array variable.
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]; /* b is a one-dimensional array */
// The following assignments are equivalent.
char *subscripting_b = b[1];
char *dereferencing_b = *(b + 1);
Altera Corporation
November 2009
9.1
3–27
Nios II C2H Compiler User Guide
相关PDF资料
PDF描述
IPTR-DSPBUILDER DSP BUILDER SOFTWARE
IR11662SPBF IC CNTROL SMART RECTIFIER 8-SOIC
IR1166STRPBF IC MOSFET DRIVER N-CH 200V 8SOIC
IR11672ASPBF IC MOSFET DRIVER 200V 8-SOIC
IR1167ASTRPBF IC SMART SECONDARY DRIVER 8-SOIC
相关代理商/技术参数
参数描述
IPT-DSPBUILDER 功能描述:开发软件 DSP Builder MATLAB SIMULINK RoHS:否 制造商:Atollic Inc. 产品:Compilers/Debuggers 用于:ARM7, ARM9, Cortex-A, Cortex-M, Cortex-R Processors
IPTE-75GF-1000-70D 制造商: 功能描述: 制造商:undefined 功能描述:
IPTG06A18-11SZC 制造商:GLENAIR 制造商全称:Glenair, Inc. 功能描述:Straight Plug Connector with Backshell to Accommodate
IPTG06A18-11SZCPH16 制造商:GLENAIR 制造商全称:Glenair, Inc. 功能描述:Straight Plug Connector
IPTG06A18-11SZCPHM18 制造商:GLENAIR 制造商全称:Glenair, Inc. 功能描述:Straight Plug Connector