Accelerated Implementation
This section discusses how you can refactor the checksum implementation shown in Example 1 for optimal results using the C2H Compiler. The implementation of the scatter-gather DMA function for the C2H Compiler, shown in Example 2, is straight-forward. It resembles the methodology a software developer would use to access multiple 2 Accelerating Functions with the C2H Compiler Altera Corporation July 2006
Background: Scatter-Gather DMA
buffer locations if no DMA engine were present. The scatter-gather DMA design is integrated with a checksum function to validate Ethernet packets. The checksum validation, which requires the processor to execute a large number of memory accesses, is time consuming. Because the primary bottleneck in the checksum computation is memory throughput, combining the checksum algorithm and DMA operation into a hardware accelerator maximizes system performance. Figure 1 shows a block diagram of the hardware accelerator and its connections to memory. Figure 1: Simplified Scatter-Gather DMA
Altera Corporation July 2006
3 Accelerating Functions with the C2H Compiler
Background: Scatter-Gather DMA
Example 2 shows the C code that has been optimized for hardware mapping by the C2H compiler. The pointer addr is used to access the data in each buffer located in main memory. The value count is used to control the number of iterations of the DMA loop contained in the accelerated function. Example 2: Scatter-gather DMA Code Integrated with Hardware Implementation of Checksum
void hw_checksum(unsigned long * table_address, unsigned long table_length, unsigned short *return_values) { void * addr; unsigned long buffer_ctr; /****************************************************************** * Scatter-gather DMA loop * ******************************************************************* * Use "addr" to perform read operations on the memory and "count" * * to keep track of the length of the buffer. These values are * * loaded from the table using the pointer "table_address." The * * number of entries in the table is "table_length." * *******************************************************************/ for(buffer_ctr = 0; buffer_ctr 3) { temp_data = *(unsigned long *)addr; sum += (temp_data & 0xFFFF) + ((temp_data & 0xFFFF0000) >> 16); count -= 4; addr += 4; } /* Add left-over half word when applicable. This is a half * * word access so the pointer "addr" must advance by 2 */ sum += ((count == 2) || (count == 3)) *(unsigned short*)addr : 0; addr += ((count == 2) || (count == 3)) 2 : 0; /* Add left-over byte when applicable. This is the last * * possible access so no need to move the pointer "addr" */ sum += ((count == 1) || (count == 3)) *(unsigned char *)addr : 0; /* Fold 32-bit sum to 16 bits. The first fold could result in * a 17 bit sum so a second fold guarantees that the result * fits within 16 bits /* 1st fold */ sum = (sum & 0xffff) + (sum >> 16); /* 2nd fold */ return_values[buffer_ctr] = ~((sum & 0xffff) + (sum >> 16)); /****************************************************************** * End of Code that the C2H Compiler Maps to Hardware * /*******************************************************************/ } * * */
- flywiththewind > accelerating functions with the c2h compiler: scatter ...
-
accelerating functions with the c2h compiler: scatter ...
下载该文档 文档格式:PDF 更新时间:2006-07-02 下载次数:0 点击次数:1文档基本属性 文档语言: Simplified Chinese 文档格式: pdf 文档作者: ISOYES 关键词: 主题: 备注: 点击这里显示更多文档属性 经理: 单位: ISOYES国际认证联盟 分类: 创建时间: 上次保存者: 修订次数: 编辑时间: 文档创建者: 修订: 加密标识: 幻灯片: 段落数: 字节数: 备注: 演示格式: 上次保存时间:
- 下载地址 (推荐使用迅雷下载地址,速度快,支持断点续传)
- PDF格式下载
- 更多文档...
-
上一篇:the us alliance with saudi arabia
下一篇:aspy@cbahawaiiedu
点击查看更多关于flywiththewind的相关文档
- 您可能感兴趣的
- flywiththewind flyinthewind gonewiththewind runwiththewind rollwiththewind gongwiththewind conewiththewind comewiththewind gownwiththewind gunwiththewind
- 大家在找
-
- · 台湾安威刀具
- · 河北教育网
- · 四十五年的守望
- · autocad2011激活码
- · 汽车为什么会跑下载
- · 残疾儿童车
- · 历代书法碑帖全集下载
- · 小学五年级体育说课稿
- · 结肠术后饮食
- · 齐齐哈尔有哪些制药厂
- · 安徽农村信用社考试
- · 长度单位练习题
- · 免费下载大智慧机构版
- · 初三化学第二章试卷
- · petct是什么
- · 佳能ix4000打印机使用
- · 官路风流最新章节900
- · 数学六年级上册练习题
- · 电路第二版课后答案
- · mastercamx4下载
- · 建筑地基处理技术规程
- · 单片机函数信号发生器
- · 材料现代分析与测试方法
- · 高级测量员考试
- · 生产车间规章制度范本
- · 头孢福建古田药业
- · 英语听力免费下载
- · 五大财经类院校
- · 别克凯越钥匙点火
- · 开学安全教育讲稿
- 赞助商链接