电子小生 发表于 2015-4-23 17:31:49

DSC中mult用法

请教一下,在CodeWarrior中自带的一个函数mult作用是啥,本以为是乘法,但经运行发现不是。
下面是帮助文档中的说明。
mult

Multiply two 16-bit fractional values and truncate into a 16-bit fractional result. Saturates only for the case of 0x8000 x 0x8000. When an accumulator is the destination, zeroes out the LSP portion.

Assumptions
OMR's SA bit was set to 1 at least three cycles before this code, that is, saturation on data ALU results enabled.

Prototype
Word16 mult(Word16 sinp1, Word16 sinp2)

Example
short s1 = 0x2000;/*0.25 */
short s2 = 0x2000;/*0.25 */
short result;
result = mult(s1,s2);
// Expected value of result: 0.625 = 0x0800

电子小生 发表于 2015-4-23 17:37:50

应该是两个数相乘,然后取最高16位。

ccrt 发表于 2015-4-23 17:58:40

电子小生 发表于 2015-4-23 17:37
应该是两个数相乘,然后取最高16位。

分数
zishubuding

FSL_TICS_Robin 发表于 2015-4-30 09:52:54

非常感谢你关于IDE的经验分享 !
页: [1]
查看完整版本: DSC中mult用法