针对FPGA中计算超越函数时所采用的分段线性逼近法对计算精度及资源占用存在直接影响的问题,提出一种最佳等距分段线性逼近计算方法。该方法通过优化分段方法缩减查找表,可以在可控计算精度条件下减少计算资源消耗。利用XilinxVirtex-5实现IP核设计后,分别采用指数函数、双曲正切函数、对数s型函数的计算进行了实验研究。实验结果表明:相对于CORDIC算法、区间等分分段线性逼近法等常规的超越函数FPGA计算方法,新方法在精度可控前提下,能够有效减少硬件资源消耗,并提高计算效率。
The piecewise strategy directly influences the computation precision and resource occupation when piecewise linear approximation algorithm is applied to the calculation of transcendental functions with FPGA. Aiming at this problem, a new method called optimal equidistant piecewise linear approximation algorithm is proposed. According to different accuracy requirement of specific applications, the proposed algorithm can cut down the lookup table and reduce the resource consumption through optimizing the segmentation strategy. After designing corresponding IP cores with Xilinx Virtex-5 FPGA, experiment studies on the computation of exponential, hyperbolic tangent and log sigmoid functions were conducted. The results demonstrate that, compared with some common transcendental function computation algorithms, such as CORDIC algorithm and the piecewise linear approximation algorithm with equal interval, the proposed method can not only reduce the hardware resource occupation, hut also improve the calculation efficiency, under the premise of controllable precision.