⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 custom_defs.h

📁 用于TM1300/PNX1300系列DSP(主要用于视频处理)的所用到的头文件
💻 H
📖 第 1 页 / 共 2 页
字号:
#ifndef _CUSTOM_DEFS_H_#define _CUSTOM_DEFS_H_/**************************************************************************** * * custom_defs.h * @(#)custom_defs.h  1.26  10/06/99 * * * This file is the interface between an application programmer and the * implementation of custom_ops.    All a programmer needs to do  * to use custom_ops defined in this file is to include this file * in the source.  As a convention, a programmer does not use custom_ops * directly, but uses the all uppercase macros as defined in this file. * This ensures the portability of the code between generations and phases. * * This file contains most (if not all) of the machine operations * which are likely to be used directly by a programmer, that is, the  * operations which are not likely to be generated by a compiler. *  * Any of the machine operations which is not included in this file can * be used directly by declaring it as a custom_op in the same way custom_ops * are declared in custom_ops.h.  (please refer to the Trimedia C Language * chapter of the TriMedia Programmer's Reference Manual) * * Precise definition of each custom operator may be found in * the TM-1 Operations section of the TriMedia Data Book. * * Comments on tmccom compilation and other compilers compilation: *    tmccom's target is the .t format.    Even if it can be simulated *    by tmtsim and tmsim, it is slow compared to native machine object *    run.    So, until we have the TM-1 chip running, we will want *    to use other compilers (gcc or acc) for development purpose. *    When we use some other compiler, custom_op declaration is no longer valid. *    But by including this file and using all uppercase macros by *    convention, the source program should compile and run transparently. *    (We just have to link in custom_ops.o, ops.o, and fops.o in order to *    emulate the missing features on some other host platform). * ****************************************************************************/#include <ops/custom_ops.h>/**************************************************************************** * Compiler dependent part.   Real custom_ops. ****************************************************************************//* *  the macros below are upper case versions *  of the operation names as defined in the *  machine description file.  Please refer to *  the TriMedia Data Book for precise definition *  of the various TM-1 operations. * *  the organization is as follows: * *	1.	Load/Store Operations * *		basic load operations *		load with displacement operations *		load with index operations *		load with scaled index operations *		basic store operations *		store with displacement operations * *	2.	Compute Operations * *		arithmetic operations *		signed comparison operations *		unsigned comparison operations *		logical operations *		sign extension operations * *	3.	Immediate Operations * *		immediate operations *		logical operations *		arithmetic operations *		signed comparison operations *		unsigned comparison operations * *	4.	Special Compute Operations * *		clipped arithmetic operations *		carry and borrow operations *		special multiply operations *		dual arithmetic operations *		byte packing operations *		byte select operations *		sum of products operations *		sum of differences operations *		special byte shift operations *		clip operations *		quad arithmetic operations *		various special compute operations * *	5.	Special Register Operations * *		PCSW operations *		CCCOUNT operations *		DPC and SPC operations * *      6.	Floating Point Operations * *		arithmetic operations *		comparison operations *		single argument operations *		float to integer conversions *		integer to float conversions * *      7.      Cache Operations * *              data-cache copyback and invalidate operations *              data-cache tag and status operations *              instruction-cache operations *              data-cache prefetch operations *              data-cache allocate operations * *	8.	Control Flow Operations * *		jumps *		interruptable jumps * *      9.      Special Compiler Custom_ops * *              data-cache copyback and invalidate commands * */#if defined(__TCS__)/* *    TriMedia compiler driver tmcc defines __TCS__ *    the custom_op prototypes are found in custom_ops.h. *//* *	1.	Load/Store Operations * *	these operations do not have macros *	since they are expressible directly in C. * *		basic load operations *		load with displacement operations *		load with index operations *		load with scaled index operations *		basic store operations *		store with displacement operations * *	2.	Compute Operations * *	the operations which are not directly *	expressible in C have macro defines below: * *		arithmetic operations */#define	IMAX(a,b)	(imax((a),(b)))#define	IMIN(a,b)	(imin((a),(b)))#define UMIN(a,b)       (umin((a),(b)))#define	IABS(a)         (iabs(a))#define	INEG(a)		(ineg(a))/* *		signed comparison operations *		unsigned comparison operations *		logical operations */#define	BITANDINV(a,b)	(bitandinv((a),(b)))#define	ROL(a,b)	(rol((a),(b)))/* *		sign extension operations */#define	SEX8(a)		(sex8(a))#define	SEX16(a)	(sex16(a))#define	ZEX8(a)		(zex8(a))#define	ZEX16(a)	(zex16(a))/* *	3.	Immediate Operations * *	the operations which are not directly *	expressible in C have macro defines below: * *		immediate operations *		logical operations * * note: the shift parameters below must be *       an integer constant. */#define	ASLI(shift,a)	(asli((shift),(a)))#define	ROLI(shift,a)	(roli((shift),(a)))#define	ASRI(shift,a)	(asri((shift),(a)))#define	LSRI(shift,a)	(lsri((shift),(a)))#define	LSLI(shift,a)	(lsli((shift),(a)))/* *		arithmetic operations * * note: the imm parameters below must be *       an integer constant. */#define	IADDI(imm,a)	(iaddi((imm),(a)))#define	ISUBI(imm,a)	(isubi((imm),(a)))/* *		signed comparison operations * * note: the imm parameters below must be *       an integer constant. */#define	IGTRI(imm,a)	(igtri((imm),(a)))#define	IGEQI(imm,a)	(igeqi((imm),(a)))#define	IEQLI(imm,a)	(ieqli((imm),(a)))#define	INEQI(imm,a)	(ineqi((imm),(a)))#define	ILESI(imm,a)	(ilesi((imm),(a)))#define	ILEQI(imm,a)	(ileqi((imm),(a)))/* *		unsigned comparison operations * * note: the imm parameters below must be *       an integer constant. */#define	UGTRI(imm,a)	(ugtri((imm),(a)))#define	UGEQI(imm,a)	(ugeqi((imm),(a)))#define	UEQLI(imm,a)	(ueqli((imm),(a)))#define	UNEQI(imm,a)	(uneqi((imm),(a)))#define	ULESI(imm,a)	(ulesi((imm),(a)))#define	ULEQI(imm,a)	(uleqi((imm),(a)))/* * *	4.	Special Compute Operations * *		clipped arithmetic operations */#define	DSPIADD(a,b)	(dspiadd((a),(b)))#define	DSPISUB(a,b)	(dspisub((a),(b)))#define	DSPUADD(a,b)	(dspuadd((a),(b)))#define	DSPUSUB(a,b)	(dspusub((a),(b)))#define	DSPIMUL(a,b)	(dspimul((a),(b)))#define	DSPUMUL(a,b)	(dspumul((a),(b)))#define	DSPIABS(a)	(dspiabs(a))/* *		carry and borrow operations */#define	CARRY(a,b)	(carry((a),(b)))#define	BORROW(a,b)	(borrow((a),(b)))/* *		special multiply operations */#define	IMULM(a,b)	(imulm((a),(b)))#define	UMULM(a,b)	(umulm((a),(b)))/* *		dual arithmetic operations */#define	DSPIDUALABS(a)	 (dspidualabs(a))#define	DSPIDUALADD(a,b) (dspidualadd((a),(b)))#define	DSPIDUALSUB(a,b) (dspidualsub((a),(b)))#define	DSPIDUALMUL(a,b) (dspidualmul((a),(b)))/* #if defined(__TCS_tm1100__) *//* *		dual shifting operations */#define	DUALASR(a,b)	(dualasr((a),(b)))/* *		dual clipping operations */#define	DUALICLIPI(a,b)	(dualiclipi((a),(b)))#define	DUALUCLIPI(a,b)	(dualuclipi((a),(b)))/* #endif defined(__TCS_tm1100__) *//* *		byte packing operations */#define	PACKBYTES(a,b)	(packbytes((a),(b)))#define	MERGEMSB(a,b)	(mergemsb((a),(b)))#define	MERGELSB(a,b)	(mergelsb((a),(b)))#define	PACK16MSB(a,b)	(pack16msb((a),(b)))#define	PACK16LSB(a,b)	(pack16lsb((a),(b)))/* #if defined(__TCS_tm1100__) */#define	MERGEDUAL16LSB(a,b) (mergedual16lsb((a), (b)))/* #endif defined(__TCS_tm1100__) *//* *		byte select operations */#define	UBYTESEL(a,sel)	(ubytesel((a),(sel)))#define	IBYTESEL(a,sel)	(ibytesel((a),(sel)))/* *		sum of products operations */#define	UFIR8UU(a,b)	(ufir8uu((a),(b)))#define	IFIR8UI(a,b)	(ifir8ui((a),(b)))#define	IFIR8IU(a,b)	(ifir8ui((b),(a)))#define	IFIR8II(a,b)	(ifir8ii((a),(b)))#define	IFIR16(a,b)	(ifir16((a),(b)))#define	UFIR16(a,b)	(ufir16((a),(b)))/* *		sum of differences operations */#define	UME8II(a,b)	(ume8ii((a),(b)))#define	UME8UU(a,b)	(ume8uu((a),(b)))/* *		special byte shift operations */#define	FUNSHIFT1(a,b)	(funshift1((a),(b)))#define	FUNSHIFT2(a,b)	(funshift2((a),(b)))#define	FUNSHIFT3(a,b)	(funshift3((a),(b)))/* *		clip operations */#define	ICLIPI(a,b)	(iclipi((a),(b)))#define	UCLIPI(a,b)	(uclipi((a),(b)))#define	UCLIPU(a,b)	(uclipu((a),(b)))/* *		quad arithmetic operations */#define	QUADUMULMSB(a,b)    (quadumulmsb((a),(b)))#define	QUADAVG(a,b)	    (quadavg((a),(b)))#define DSPUQUADADDUI(a,b)  (dspuquadaddui((a),(b)))/* #if defined(__TCS_tm1100__) */#define	QUADUMAX(a,b)	    (quadumax((a),(b)))#define	QUADUMIN(a,b)	    (quadumin((a),(b)))/* #endif defined(__TCS_tm1100__) *//* *		various special compute operations */#define	IZERO(a,b)	(izero((a),(b)))#define	INONZERO(a,b)	(inonzero((a),(b)))#define	IAVGONEP(a,b)	(iavgonep((a),(b)))#define	IFLIP(a,b)	(iflip((a),(b)))/* * *	5.	Special Register Operations * *		PCSW operations */#define	READPCSW()		(readpcsw())#define	WRITEPCSW(val,mask)	(writepcsw((val),(mask)))/* *		CCCOUNT operations */#define	CYCLES()	(cycles())#define	HICYCLES()	(hicycles())/* *		DPC and SPC operations */#define	READDPC()	(readdpc())#define	WRITEDPC(val)	(writedpc(val))#define	READSPC()	(readspc())#define	WRITESPC(val)	(writespc(val))/* * *	6.	Floating Point Operations * *	the operations which are not directly *	expressible in C have macro defines below. * *	special note: the xxxflags operations are *	meant to be used by the compiler and are *	therefore not supported here. * *		arithmetic operations *		comparison operations *		single argument operations */#define	FSQRT(f)	(fsqrt(f))#define	FABSVAL(f)	(fabsval(f))#define	FSIGN(f)	(fsign(f))/* *		float to integer conversions */#define	IFIXIEEE(f)	(ifixieee(f))#define	UFIXIEEE(f)	(ufixieee(f))/* *		integer to float conversions */#define IFLOATRZ(a)     (ifloatrz(a))#define UFLOATRZ(a)     (ufloatrz(a))/* *		fzero and fnonzero analogous to izero/inonzero */#define FZERO(a,b)	(fzero((a), (b)))#define FNONZERO(a,b)	(fnonzero((a), (b)))/* *		dirty tricks to calculate fmin and fmax   *		analogous to imin and imax *  *		DO NOT WORK WHEN BOTH FLOATS ARE NEGATIVE *  *		DO NOT SET APPROPRIATE IEEE FLAGS !! *			 *//************ READ COMMENT *************/#define FMIN(a,b)	(fmin((a), (b)))#define FMAX(a,b)	(fmax((a), (b)))/************ READ COMMENT *************//* * *      7.      Cache Operations * *              data-cache copyback and invalidate operations *              data-cache tag and status operations *              instruction-cache operations *              data-cache prefetch operations * *	8.	Control Flow Operations * *	though these operations are not easily *	expressible in C, they are unsafe to *	expose to the programmer and therefore

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -