代码里有_cmpyr1(c, 0x80000000), 从实际结果看, c实部/虚部都乘上了-1.
0x8000为什么是-1呢, Q15的话, -1应该是0xffff吧?
和cmpyr有什么区别呢? cmpyr小1/2 ?
Allen35065:
最高位是符号位,15位数据。
Allen35065:
回复 Allen35065:
见CPU and instruction set reference guide的描述
cmpyr1
sat((lsb16(src1) × msb16(src2)) + (msb16(src1) × lsb16(src2))) → tmp_emsb16(sat((tmp_e + 00004000h) << 1)) → lsb16(dst)sat((msb16(src1) × msb16(src2)) – (lsb16(src1) × lsb16(src2))) → tmp_omsb16(sat((tmp_e + 00004000h) << 1)) → msb16(dst)
cmpyr
sat((lsb16(src1) × msb16(src2)) + (msb16(src1) × lsb16(src2))) → tmp_emsb16(sat(tmp_e + 00008000h)) → lsb16(dst)sat((msb16(src1) × msb16(src2)) – (lsb16(src1) × lsb16(src2))) → tmp_omsb16(sat(tmp_o + 00008000h)) → msb16(dst)
l l5:
回复 Allen35065:
以c=0x00010002, IQ实部虚部是(1,2).
_cmpyr1(0x00010002, 0x80000000)为例,
cmpyr1
sat((lsb16(src1) × msb16(src2)) + (msb16(src1) × lsb16(src2))) → tmp_e : 0x10000msb16(sat((tmp_e + 00004000h) << 1)) → lsb16(dst) : 0x0002sat((msb16(src1) × msb16(src2)) – (lsb16(src1) × lsb16(src2))) → tmp_o : 0x8000msb16(sat((tmp_e + 00004000h) << 1)) → msb16(dst) : 0x0001
这样结果没变啊?但我从内部打印上看,结果应该变成(-1,-2)