07.03.2014 Views

IQmath Library

IQmath Library

IQmath Library

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

IQNrmpy<br />

IQ Multiplication with rounding (IQN*IQN)<br />

Description<br />

Declaration<br />

This function multiplies two IQ number and rounds the result. In cases<br />

where absolute accuracy is necessary, this operation performs the IQ<br />

multiply and rounds the result before storing back as an IQ number. This<br />

gives an additional 1/2 LSBit of accuracy.<br />

Global IQ function (IQ format = GLOBAL_Q)<br />

_iq _IQrmpy(_iq A, _iq B)<br />

Q format specific IQ function (IQ format = IQ1 to IQ30)<br />

_iqN _IQNrmpy(_iqN A, _iqN B)<br />

Input Format<br />

Global IQ function (IQ format = GLOBAL_Q)<br />

Input “A” & “B” are IQ number in GLOBAL_Q format<br />

Q format specific IQ function (IQ format = IQ1 to IQ30)<br />

Input “A” & “B” are IQ number in IQN format<br />

Output Format<br />

Global IQ function (IQ format = GLOBAL_Q)<br />

Result of multiplication in GLOBAL_Q format<br />

Q format specific IQ function (IQ format = IQ1 to IQ30)<br />

Result of multiplication in IQN format.<br />

Usage<br />

Example 1:<br />

Following code computes "Y = M*X + B" in GLOBAL_Q format with<br />

rounding but no saturation:<br />

_iq Y, M, X, B;<br />

Y = _IQrmpy(M,X) + B;<br />

Example 2:<br />

Following code computes "Y = M*X + B" in IQ10 format with rounding but<br />

no saturation:<br />

_iq10 Y, M, X, B;<br />

Y = _IQ10rmpy(M,X) + B;<br />

©Texas Instruments Inc., June 2002 24

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!