Texas Instruments TMS320C64X Manual do Utilizador Página 97

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 169
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 96
DSP_recip16
4-69 C64x+ DSPLIB Reference
16-Bit Reciprocal
DSP_recip16
Function void DSP_recip16 (short *x, short *rfrac, short *rexp, short nx)
Arguments x[nx] Pointer to Q.15 input data vector of size nx.
rfrac[nx] Pointer to Q.15 output data vector for fractional values.
rexp[nx] Pointer to output data vector for exponent values.
nx Number of elements of input and output vectors.
Description This routine returns the fractional and exponential portion of the reciprocal of
an array x[ ] of Q.15 numbers. The fractional portion rfrac is returned in Q.15
format. Since the reciprocal is always greater than 1, it returns an exponent
such that:
(rfrac[i] * 2rexp[i]) = true reciprocal
The output is accurate up to the least significant bit of rfrac, but note that this
bit could carry over and change rexp. For a reciprocal of 0, the procedure will
return a fractional part of 7FFFh and an exponent of 16.
Algorithm This is the C equivalent of the assembly code without restrictions. Note that
the assembly code is hand optimized and restrictions may apply.
void DSP_recip16(short *x, short *rfrac, short *rexp, short
nx)
{
int i,j,a,b;
short neg, normal;
for(i=nx; i>0; i−−)
{
a=*(x++);
if(a<0) /* take absolute value */
{
a=−a;
neg=1;
}
else neg=0;
normal=_norm(a); /* normalize number */
a=a<<normal;
Vista de página 96
1 2 ... 92 93 94 95 96 97 98 99 100 101 102 ... 168 169

Comentários a estes Manuais

Sem comentários