📄 basic_op.h
字号:
/* purposes is prohibited. */
/* */
/*-------------------------------------------------------------------*/
/* */
/* Grant of license Motorola Inc. grants a free, irrevocable license */
/* to 3GPP2 and its organizational partners to incorporate Motorola- */
/* supplied text or other copyrightable material contained in the */
/* contribution and any modifications thereof in the creation of */
/* 3GPP2 publications, to copyright and sell in organizational */
/* partners name any organizational partners standards publications */
/* even though it may include portions of the contribution; and at */
/* the organizational partners sole discretion to permit others */
/* to reproduce in whole or in part such contributions or the */
/* resulting organizational partners standards publication. Motorola */
/* is also willing to grant licenses under such Motorola copyrights */
/* to third parties on reasonable, non-discriminatory terms and */
/* conditions, as appropriate. */
/* */
/* Notice: */
/* This document has been prepared by Motorola Inc. to assist the */
/* 3GPP2 standards committee. This document is offered to the */
/* committee as a basis for discussion and should not be considered */
/* as a binding proposal on Motorola Inc. or any other company. */
/* Specifically, Motorola Inc. reserves the right to modify, amend, */
/* or withdraw the statement contained herein. Permission is granted */
/* to 3GPP2 and its organizational partners to copy any portion of */
/* this document for the legitimate purposes of the 3GPP2. Copying */
/* this document for monetary gain or other non-3GPP2 purpose is */
/* prohibited. Motorola Inc. may hold one or more patents of */
/* copyrights that cover information contained in this contribution, */
/* and agrees that a license under those rights will be made */
/* available on reasonable and non-discriminatory terms and */
/* conditions, subject to receiving a reciprocal license in return. */
/* Nothing contained herein shall be construed as conferring by */
/* implication, estoppel, or otherwise any license or right under */
/* any patent, whether or not the use of information herein */
/* necessarily employs an invention of any existing or later issued */
/* patent, or copyright. */
/* */
/* Notice */
/* Permission is granted to 3GPP2 participants to copy any portion of*/
/* this contribution for the legitimate purpose of the 3GPP2. */
/* Copying this contribution for monetary gain or other non-3GPP2 */
/* purpose is prohibited. */
/* */
/*-------------------------------------------------------------------*/
/***********************************************************************
*
* FILE : basic_op.h (essentially identical to mathevrc.h)
*
* PURPOSE:
*
* Modified TIA basic operations. Bit-exact simulation of a
* generic 32 bit accumulator DSP chip (fractional math). This
* version has a latching overflow bit (giOverflow) and
* non-compound MAC's (One where initial mult does not saturate)
*
***********************************************************************/
#ifndef __MATHTIA
#define __MATHTIA
#include "typedef_fx.h"
#define MAX_32 (Word32)0x7fffffffL
#define MIN_32 (Word32)0x80000000L
#define MAX_16 (Word16)0x7fff
#define MIN_16 (Word16)0x8000
/*_________________________________________________________________________
| |
| Function Prototypes |
|_________________________________________________________________________|
*/
/* addition */
/************/
Word16 add(Word16 var1, Word16 var2); /* 1 ops */
Word16 sub(Word16 var1, Word16 var2); /* 1 ops */
Word32 L_add(Word32 L_var1, Word32 L_var2); /* 2 ops */
Word32 L_sub(Word32 L_var1, Word32 L_var2); /* 2 ops */
/* multiplication */
/******************/
Word16 mult(Word16 var1, Word16 var2); /* 1 ops */
Word32 L_mult(Word16 var1, Word16 var2); /* 1 ops */
Word16 mult_r(Word16 var1, Word16 var2); /* 2 ops */
/* arithmetic shifts */
/*********************/
Word16 shr(Word16 var1, Word16 var2); /* 1 ops */
Word16 shl(Word16 var1, Word16 var2); /* 1 ops */
Word32 L_shr(Word32 L_var1, Word16 var2); /* 2 ops */
Word32 L_shl(Word32 L_var1, Word16 var2); /* 2 ops */
Word16 shift_r(Word16 var, Word16 var2); /* 2 ops */
Word32 L_shift_r(Word32 L_var, Word16 var2); /* 3 ops */
/* absolute value */
/*******************/
Word16 abs_s(Word16 var1); /* 1 ops */
Word32 L_abs(Word32 var1); /* 3 ops */
/* multiply accumulate */
/************************/
Word32 L_mac(Word32 L_var3,
Word16 var1, Word16 var2); /* 1 op */
Word16 mac_r(Word32 L_var3,
Word16 var1, Word16 var2); /* 2 op */
Word32 L_msu(Word32 L_var3,
Word16 var1, Word16 var2); /* 1 op */
Word16 msu_r(Word32 L_var3,
Word16 var1, Word16 var2); /* 2 op */
/* negation */
/*************/
Word16 negate(Word16 var1); /* 1 ops */
Word32 L_negate(Word32 L_var1); /* 2 ops */
/* Accumulator manipulation */
/****************************/
Word32 L_deposit_l(Word16 var1); /* 1 ops */
Word32 L_deposit_h(Word16 var1); /* 1 ops */
Word16 extract_l(Word32 L_var1); /* 1 ops */
Word16 extract_h(Word32 L_var1); /* 1 ops */
/* Round */
/*********/
Word16 round32(Word32 L_var1); /* 1 ops */
/* Normalization */
/*****************/
Word16 norm_l(Word32 L_var1); /* 30 ops */
Word16 norm_s(Word16 var1); /* 15 ops */
/* Division */
/************/
Word16 divide_s(Word16 var1, Word16 var2); /* 18 ops */
/* Saturation manipulation routines */
/************************************/
int clearOverflow(void);
int isOverflow(void);
int popOverflow(void);
int setOverflow(void);
/* Non-saturating instructions */
/*******************************/
Word32 L_add_c(Word32 L_Var1, Word32 L_Var2); /* 2 ops */
Word32 L_sub_c(Word32 L_Var1, Word32 L_Var2); /* 2 ops */
Word32 L_macNs(Word32 L_var3,
Word16 var1, Word16 var2); /* 1 ops */
Word32 L_msuNs(Word32 L_var3,
Word16 var1, Word16 var2); /* 1 ops */
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -