参数资料
型号: IPT-C2H-NIOS
厂商: Altera
文件页数: 20/138页
文件大小: 0K
描述: C2H COMPILER FOR NIOS II
标准包装: 1
系列: Nios®II
类型: Nios II
功能: C 到硬件编译器
许可证: 初始许可证
C Code Appropriate for Hardware Acceleration
Example 1–1. Checksum Calculation
u16_t standard_chksum(void *dataptr, int len)
{
u32_t acc;
/* Checksum loop: iterate over all data in buffer */
for(acc = 0; len > 1; len -= 2)
{
acc += *(u16_t *)dataptr;
dataptr = (void *)((u16_t *)dataptr + 1);
}
/* Handle odd buffer lengths */
if (len == 1)
{
acc += htons((u16_t)((*(u8_t *)dataptr)&0xff)<< 8);
}
/* Modify result for IP stack needs */
acc = (acc >> 16) + (acc & 0xffffUL);
if ((acc & 0xffff0000) != 0)
{
acc = (acc >> 16) + (acc & 0xffffUL);
}
return (u16_t)acc;
}
Accelerating this function could have a significant impact on execution
time, especially the amount of time spent in the for loop. The remaining
code executes once per call to format the result and check boundary cases.
Accelerating the code outside the loop has little benefit, unless the entire
standard_chksum() function is a called from another function that is
also a good acceleration candidate. The most efficient hardware
accelerator for this code would replace only the for loop. To accelerate
the for loop only, you need to refactor the code to isolate the loop in a
separate function.
Poor Acceleration Candidates
Accelerating some code can have negative performance impacts, or can
unacceptably increase resource utilization, or both. Use the following
guidelines to identify functions not to accelerate:
Code that contains many data or control dependencies must perform
many sequential operations, and is a poor candidate for acceleration.
A large number of dependencies makes it difficult for the
C2H Compiler to fully optimize loops. Processors are designed to
perform such operations efficiently.
1–14
Nios II C2H Compiler User Guide
9.1
Altera Corporation
November 2009
相关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