HLS Optimization: Local Memory Bandwidth

本文详细解析了HLS指令中的ArrayPartition和ArrayReshape,通过实例展示了如何使用这些指令来重塑和分区数组,以提高内存带宽和硬件性能。介绍了不同映射方式(block、cyclic、complete)以及factor和dim参数的使用方法。

Array Partition

#pragma HLS array_partition variable=<variable> <block, cyclic, complete> factor=<int> dim=<int>

Array Reshape

#pragma HLS array_reshape variable=<variable> <block, cyclic, complete> factor=<int> dim=<int>

Example 1

Reshapes (partition and maps) an 8-bit array with 17 elements, AB[17], into a new 32-bit array with five elements using block mapping.

#pragma HLS array_reshape variable=AB block factor=4

TIP: factor=4 indicates that the array should be divided into four. So 17 elements is reshaped into an array of 5 elements, with four times the bit-width. In this case, the last element, AB[17], is mapped to the lower eight bits of the fifth element, and the rest of the fifth element is empty.

Example 2

Reshapes the two-dimensional array AB[6][4] into a new array of dimension [6][2], in which dimension 2 has twice the bit-width:

#pragma HLS array_reshape variable=AB block factor=2 dim=2

Example 3

Reshapes the three-dimensional 8-bit array, AB[4][2][2] in function foo, into a new single element array (a register), 128 bits wide (4*2*2*8):

#pragma HLS array_reshape variable=AB complete dim=0

TIP: dim=0 means to reshape all dimensions of the array.

 Reference:

1. https://www.xilinx.com/support/documentation/sw_manuals/xilinx2015_2/sdsoc_doc/topics/calling-coding-guidelines/concept_increasing_local_memory_bandwidth.html

2. https://japan.xilinx.com/html_docs/xilinx2017_4/sdaccel_doc/mrl1504034361747.html

转载于:https://www.cnblogs.com/wordchao/p/10964294.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值