07.03.2014 Views

IQmath Library

IQmath Library

IQmath Library

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

IQNmpy<br />

IQ Multiplication(IQN*IQN)<br />

Description<br />

Declaration<br />

This “C” compiler intrinsic multiplies two IQ number. It does not perform<br />

saturation and rounding. In most cases, the multiplication of two IQ<br />

variables will not exceed the range of the IQ variable. This operation<br />

takes the least amount of cycles and code size and should be used most<br />

often.<br />

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

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

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

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

Input Format<br />

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

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

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

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

Output Format<br />

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

Result of multiplication in GLOBAL_Q format<br />

Q format specific IQ intrinsic (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 no<br />

rounding or saturation:<br />

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

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

Example 2:<br />

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

or saturation, assuming M, X, B are represented in IQ10 format:<br />

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

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

©Texas Instruments Inc., June 2002 23

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

Saved successfully!

Ooh no, something went wrong!