PDF(1116 KB)
PDF(1116 KB)
PDF(1116 KB)
基于RISC-V自定义指令的数学函数的高效实现
Efficient implementation of mathematical functions based on RISC-V custom instructions
在工业控制算法中,数学函数的计算往往需要大量的时钟周期,会影响算法的性能。本文对相关数学函数计算方法进行深入分析和方案对比,设计了一种适合硬件电路实现的基于Remez算法的分段查表多项式拟合方法来计算浮点数学函数,同时实现了相应的硬件电路以RISC-V自定义指令的方式与RISC-V处理器内核紧耦合。实验结果表明,与无自定义扩展指令相比,处理器计算数学函数的延迟减小了93.62%。相较于CORDIC指令集计算数学函数的方法,计算延迟减小了79.83%。这一成果为低成本、高实时性要求的RISC-V架构的嵌入式微处理器提供了新的思路和解决方案。
In industrial control algorithms, the calculation of mathematical functions typically requires a large number of clock cycles, affecting the performance of the algorithms. This paper conducts an in-depth analysis and comparison of related methods for calculating floating mathematical functions, and designs a piecewise table lookup polynomial fitting method based on the Remez algorithm. This method is suitable for hardware circuit implementation to calculate mathematical functions. At the same time, the corresponding hardware circuits are implemented in the form of RISC-V custom instructions, closely coupled with the RISC-V processor core. The experimental results show that compared with no custom extension instructions, the processor's delay in calculating mathematical functions is reduced by 93.62%. Compared with the method of calculating mathematical functions using the CORDIC instruction set, the calculation delay is reduced by 79.83%. This achievement provides new ideas and solutions for RISC-V architecture embedded microprocessors with low-cost, high real-time requirements.
RISC-V / 软硬件协同优化 / 数学函数 / 分段多项式拟合 / 嵌入式系统
RISC-V / hardware-software co-optimization / mathematical functions / piecewise polynomial fitting / embedded system
| [1] |
|
| [2] |
李飞, 郭绍忠, 郝江伟, 等. 面向RISC-V的基础数学库实现[J]. 电子学报, 2024, 52(5):1633-1647.
|
| [3] |
吴昊, 刘楠, 丁朋, 等. 改进CORDIC算法实现及其在边缘检测中的应用[J]. 电子测量技术, 2023, 46(16):148-157.
|
| [4] |
胡雄龙, 陈进华, 乔海, 等. 跳跃迭代的高速高精COR-DIC算法及FPGA实现[J]. 计算机仿真, 2023, 40(10):365-370,398.
|
| [5] |
侯强, 彭玉龙, 王育新, 等. 低时延CORDIC算法计算平方根电路设计研究[J]. 湖南大学学报(自然科学版), 2022, 49(2):111-116.
|
| [6] |
程甜甜, 宋宇鲲. 基于FPGA的2底指数函数算法优化与实现[J]. 电子科技, 2023, 36(9):66-72.
|
| [7] |
龙科莅, 汪东, 陈虎, 等. 基于Piecewise算法的反正切运算器的设计[J]. 计算机工程与科学, 2022, 44(8):1342-1348.
|
| [8] |
潘树朋, 刘有耀. RISC-V微处理器以及商业IP的综述[J]. 单片机与嵌入式系统应用, 2020, 20(6):5-8,12.
|
| [9] |
郑添, 蔡刚, 黄志洪. 基于RISC-V架构的CORDIC指令集设计与实现[J]. 单片机与嵌入式系统应用, 2022, 22(8):20-23.
|
| [10] |
蒲清涛, 仵杰. 基于RISC-V架构MCU的永磁同步电机控制系统设计[J]. 电子制作, 2024, 32(21):18-22,27.
|
| [11] |
王凯. 基于NPU张量加速单元的激活函数实现与验证技术研究[D]. 西安: 西安电子科技大学, 2023.
|
| [12] |
|
/
| 〈 |
|
〉 |