Declaration - Freescale Semiconductor DSP56800E User Manual

Mlib
Hide thumbs Also See for DSP56800E:
Table of Contents

Advertisement

MLIB_Mac4RndSat
The available versions of the
Function name
MLIB_Mac4Rnd_F16
frac16_t
MLIB_Mac4Rnd_F32
frac32_t

2.20.2 Declaration

The available
MLIB_Mac4Rnd
frac16_t MLIB_Mac4Rnd_F16(frac16_t
f16Add2Mult1,
frac16_t
frac32_t MLIB_Mac4Rnd_F32(frac32_t
f32Add2Mult1,
frac32_t
2.20.3 Function use
The use of the
MLIB_Mac4Rnd
#include "mlib.h"
static
frac16_t
f16Result, f16Add1Mult1, f16Add1Mult2, f16Add2Mult1, f16Add2Mult2;
void main(void)
{
f16Add1Mult1 = FRAC16(0.256);
f16Add1Mult2 = FRAC16(-0.724);
f16Add2Mult1 = FRAC16(0.365);
f16Add2Mult2 = FRAC16(-0.25);
/* f16Result = round(f16Add1Mult1 * f16Add1Mult2 + f16Add2Mult1 * f16Add2Mult2) */
f16Result = MLIB_Mac4Rnd_F16(f16Add1Mult1, f16Add1Mult2, f16Add2Mult1, f16Add2Mult2);
}
2.21 MLIB_Mac4RndSat
50
MLIB_Mac4Rnd
Table 2-20. Function versions
Input type
Product 1
Product 2
Mult. 1
Mult. 2
Mult. 1
frac16_t
frac16_t
frac32_t
frac32_t
functions have the following declarations:
f16Add1Mult1,
f16Add2Mult2)
f32Add1Mult1,
f32Add2Mult2)
function is shown in the following example:
/* f16Add1Mult1 = 0.256 */
/* f16Add1Mult2 = -0.724 */
/* f16Add2Mult1 = 0.365 */
/* f16Add2Mult2 = -0.25 */
MLIB User's Guide, Rev. 2, 10/2015
function are shown in the following table.
Result
type
Mult. 2
frac16_t
frac16_t
Addition of two 16-bit fractional products
(of two 16-bit fractional multiplicands),
rounded to the upper 16 bits. The output
is within the range <-1 ; 1).
frac32_t
frac32_t
Addition of two 32-bit fractional products
(of two 32-bit fractional multiplicands),
rounded to the upper 32 bits. The output
is within the range <-1 ; 1).
frac16_t
f16Add1Mult2,
frac32_t
f32Add1Mult2,
Description
frac16_t
frac32_t
Freescale Semiconductor, Inc.

Advertisement

Table of Contents
loading

Table of Contents