DSPRelated.com
Forums

Converting q31 format to q15

Started by gmar...@aluno.feis.unesp.br December 14, 2006
Hello!

Does someone knows how to convert a q31 value to a q15 value? Im
doing a power of a vector, using the power function od DSPLib, but the
results is on q31 format. After, I need to do a sum, but the add
function only accept q15 values. Could anyone help me?

Thanks a lot,

Guilherme

Hi,
Q15 = Q31>>16

A rounded result would be,

Q15 = (Q31 + 0x8000)>>16
Cheers,
Ajith.
On 12/14/06, g...@aluno.feis.unesp.br
wrote:
>
> Hello!
>
> Does someone knows how to convert a q31 value to a q15 value? Im
> doing a power of a vector, using the power function od DSPLib, but the
> results is on q31 format. After, I need to do a sum, but the add
> function only accept q15 values. Could anyone help me?
>
> Thanks a lot,
>
> Guilherme
>
>
Guilherme-

> Does someone knows how to convert a q31 value to a q15 value? Im
> doing a power of a vector, using the power function od DSPLib, but the
> results is on q31 format. After, I need to do a sum, but the add
> function only accept q15 values. Could anyone help me?

Ajith showed how to convert from Q31 to Q15. I might also suggest that you perform
additions in Q31 format, then convert the result to Q15 -- should get you a more
accurate result. You don't need an add() dsplib function for summing; you can use
"long" variables in C code, or you can use C code intrinsics which call specific 54x
asm instructions (look for "intrinsics" in the 54x C programming guide doc).

-Jeff