Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
9 years ago

How to square a fixed point number?

Assuming I have a 16 bit fixed point number that needs to be squared, how should this be implemented?

The number format is Q2.14. Squaring it shall produce a result that is 32 bits instead and seems to have format of Q4.28 (right?). Now since I am squaring this fixed point number, I shall have to shift it right to become Q4.14 and then feed it back in. But how can I feed in a result of format Q4.14 when the input is of format Q2.14. What is wrong in my understanding?

13 Replies