TI发布用于M0的新版IQmath DSP库V1.0,这个极具学习价值
https://software-dl.ti.com/msp430/esd/MSPM0-SDK/1_00_00_04/docs/english/MSPM0_SDK_Documentation_Overview.htmlhttps://img.anfulai.cn/dz/attachment/forum/202303/17/021117tqwaxiho0wik7ww5.png
这个库里面,他所有的q格式转换都使用64位。不知道这样对于速度与内存是怎样的影响?比如,我使用q15其实使用32位整形计算就可以了 propu 发表于 2023-9-23 08:06
这个库里面,他所有的q格式转换都使用64位。不知道这样对于速度与内存是怎样的影响?比如,我使用q15其实使 ...
你看的是那个API,我这里看的大部分都是32bit处理。
M内核处理64bit不行,速度太慢了。 eric2013 发表于 2023-9-25 11:39
你看的是那个API,我这里看的大部分都是32bit处理。
M内核处理64bit不行,速度太慢了。
不好意思,没有注意到回贴。
我看的是mpy乘法。因为它内部支持到Q30.所以乘法全部转为64位乘后,再处理的。即使我使用Q15的乘法。使用Q15的乘法,应该可以使用32位的数据来处理。便是好像它统一按64位来处理的。
#if defined (__TI_COMPILER_VERSION__)
#pragma FUNC_ALWAYS_INLINE(__IQNmpyIQX)
#elif defined(__IAR_SYSTEMS_ICC__)
#pragma inline=forced
#endif
__STATIC_INLINE int_fast32_t __IQNmpyIQX(int_fast32_t a, int n1, int_fast32_t b, int n2, int8_t q_value)
{
uint_fast16_t ui16IntState;
uint_fast16_t ui16MPYState;
int_fast32_t i32Shift;
int_fast64_t i64Result;
/*
* Mark the start of any multiplies. This will disable interrupts and set
* the multiplier to fractional mode. This is designed to reduce overhead
* of constantly switching states when using repeated multiplies (MSP430
* only).
*/
__mpy_start(&ui16IntState, &ui16MPYState);
i64Result = __mpyx(a, b);
/*
* Mark the end of all multiplies. This restores MPY and interrupt states
* (MSP430 only).
*/
__mpy_stop(&ui16IntState, &ui16MPYState);
i32Shift = (n1 + n2) - q_value;
if (i32Shift > 0) {
i64Result >>= i32Shift;
}
else {
i64Result <<= -i32Shift;
}
return (int_fast32_t)i64Result;
}
其中的 i64Result = __mpyx(a, b);
static inline int_fast64_t __mpyx(int_fast32_t arg1, int_fast32_t arg2)
{
return ((int_fast64_t)arg1 * (int_fast64_t)arg2);
} 能用在STM32F103不? Stm32Motor 发表于 2024-1-30 16:50
能用在STM32F103不?
没问题。
12、DSP视频教程第12期:TI开源分享IQmath DSP源码,适用于所有Cortex-M内核,本期教程做个手把手移植 (2022-05-22)
https://www.armbbs.cn/forum.php?mod=viewthread&tid=119296
感谢分享
页:
[1]