* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: fpsim.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
* The above named program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
* ========== Copyright Header End ============================================
#ifndef _INCLUDED_FPSIM_H
#define _INCLUDED_FPSIM_H
/*=============================================================
Floating-Point Simulation Library Interfaces
Author: Robert Rethemeyer, Sun Microsystems, Inc.
$Id: fpsim.h,v 1.3 2006/12/07 21:55:14 bobsmail Exp $
COPYRIGHT 2005-2006 Sun Microsystems, Inc.
Sun Confidential: Sun SSG Only
*============================================================*/
/*********************************************************************
* ATTENTION: This code is part of a library shared by multiple
* projects. DO NOT MAKE CHANGES TO THIS CODE WITHIN YOUR PROJECT.
* Instead, contact the owner/maintainer of the library, currently:
* Robert.Rethemeyer@Sun.COM +1-408-616-5717 (x45717)
* Systems Group: TVT: FrontEnd Technologies
* The CVS source code repository for the library is at:
* /import/ftap-blimp1/cvs/fpsim
* DO NOT COMMIT CHANGES TO THAT REPOSITORY: contact the maintainer.
********************************************************************/
/* Exception bits returned by most functions */
#define FPX_NV 0x10 /* not-valid */
#define FPX_OF 0x08 /* overflow */
#define FPX_UF 0x04 /* underflow */
#define FPX_DZ 0x02 /* div-by-zero */
#define FPX_NX 0x01 /* not-exact */
#define FPX_AXCX 0x400 /* extension: both aexc (9:5) & cexc (4:0) (FMAu) */
#define FPX_TRAP 0x800 /* extension: force trap (7:0) */
#define FPX_ILL 0x810 /* extension: illegal_instr trap */
#define FPX_UN 0x802 /* extension: FPother-unfinished trap */
#define FPX_UIMP 0x803 /* extension: FPother-unimplemented trap */
/* Multiply-add instruction subtype codes */
typedef enum fpsim_fma_subtype
{
FMA_ADD_POS
= 0, // fmadd,fumadd
FMA_SUB_POS
= 1, // fmsub,fumsub
FMA_ADD_NEG
= 2, // fnmadd,fnumadd
FMA_SUB_NEG
= 3 // fnmsub,fnumsub
/* Half-add instruction subtype codes */
typedef enum fpsim_fha_subtype
{
FHA_ADD_NEG
= 2 // fnhadd
/*------------------ Library function prototypes ----------------------*/
extern int fpsim_update_fsr( int exc
, unsigned long long* fsr
);
extern unsigned long long fpsim_gsr_mask(void);
extern int fpsim_faddd( const double* op1
, const double* op2
, double* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fsubd( const double* op1
, const double* op2
, double* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fmuld( const double* op1
, const double* op2
, double* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fdivd( const double* op1
, const double* op2
, double* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fsqrtd(const double* op2
, double* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fadds( const float* op1
, const float* op2
, float* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fsubs( const float* op1
, const float* op2
, float* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fmuls( const float* op1
, const float* op2
, float* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fsmuld(const float* op1
, const float* op2
, double* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fdivs( const float* op1
, const float* op2
, float* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fsqrts(const float* op2
, float* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fstod( const float* op2
, double* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fdtos( const double* op2
, float* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fstox( const float* op2
, unsigned long long* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fdtox( const double* op2
, unsigned long long* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fstoi( const float* op2
, unsigned int* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fdtoi( const double* op2
, unsigned int* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fxtos( const unsigned long long* op2
, float* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fxtod( const unsigned long long* op2
, double* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fitos( const unsigned int* op2
, float* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fitod( const unsigned int* op2
,double* res
);
/* negated-add,multiply (Rock only) */
extern int fpsim_fnaddd( const double* op1
, const double* op2
, double* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fnadds( const float* op1
, const float* op2
, float* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fnmuld( const double* op1
, const double* op2
, double* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fnmuls( const float* op1
, const float* op2
, float* res
,
unsigned long long fsr
, unsigned long long gsr
);
extern int fpsim_fnsmuld(const float* op1
, const float* op2
, double* res
,
unsigned long long fsr
, unsigned long long gsr
);
/* half-add,subtract 3 subtypes each (Rock only) */
extern int fpsim_fhaddd( const double* op1
, const double* op2
, double* res
,
unsigned long long fsr
, unsigned long long gsr
,
fpsim_fha_subtype subtype
);
extern int fpsim_fhadds( const float* op1
, const float* op2
, float* res
,
unsigned long long fsr
, unsigned long long gsr
,
fpsim_fha_subtype subtype
);
/* fused multiply-add 4 subtypes each (Rock only) */
extern int fpsim_fmaddd(const double* op1
, const double* op2
, const double* op3
,
double* res
, unsigned long long fsr
,
unsigned long long gsr
, fpsim_fma_subtype subtype
);
extern int fpsim_fmadds(const float* op1
, const float* op2
, const float* op3
,
float* res
, unsigned long long fsr
,
unsigned long long gsr
, fpsim_fma_subtype subtype
);
/* unfused multiply-add 4 subtypes each (Rock only) */
extern int fpsim_fumaddd(const double* op1
, const double* op2
, const double* op3
,
double* res
, unsigned long long fsr
,
unsigned long long gsr
, fpsim_fma_subtype subtype
);
extern int fpsim_fumadds(const float* op1
, const float* op2
, const float* op3
,
float* res
, unsigned long long fsr
,
unsigned long long gsr
, fpsim_fma_subtype subtype
);
/*------------------ Library function pointers ----------------------*/
int (*update_fsr
)( int exc
, unsigned long long* fsr
);
unsigned long long (*gsr_mask
)(void);
int (*faddd
)( const double* op1
,const double* op2
,double* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fsubd
)( const double* op1
,const double* op2
,double* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fmuld
)( const double* op1
,const double* op2
,double* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fdivd
)( const double* op1
,const double* op2
,double* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fsqrtd
)(const double* op2
,double* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fadds
)( const float* op1
,const float* op2
,float* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fsubs
)( const float* op1
,const float* op2
,float* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fmuls
)( const float* op1
,const float* op2
,float* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fdivs
)( const float* op1
,const float* op2
,float* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fsqrts
)(const float* op2
,float* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fsmuld
)(const float* op1
,const float* op2
,double* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fstod
)( const float* op2
,double* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fdtos
)( const double* op2
,float* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fstox
)( const float* op2
,unsigned long long* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fdtox
)( const double* op2
,unsigned long long* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fstoi
)( const float* op2
,unsigned int* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fdtoi
)( const double* op2
,unsigned int* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fxtos
)( const unsigned long long* op2
,float* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fxtod
)( const unsigned long long* op2
,double* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fitos
)( const unsigned int* op2
,float* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fitod
)( const unsigned int* op2
,double* res
);
int (*fnaddd
)( const double* op1
,const double* op2
,double* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fnadds
)( const float* op1
,const float* op2
,float* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fnmuld
)( const double* op1
,const double* op2
,double* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fnmuls
)( const float* op1
,const float* op2
,float* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fnsmuld
)(const float* op1
,const float* op2
,double* res
,
unsigned long long fsr
,unsigned long long gsr
);
int (*fhaddd
)( const double* op1
, const double* op2
, double* res
,
unsigned long long fsr
, unsigned long long gsr
,
fpsim_fha_subtype subtype
);
int (*fhadds
)( const float* op1
, const float* op2
, float* res
,
unsigned long long fsr
, unsigned long long gsr
,
fpsim_fha_subtype subtype
);
int (*fmaddd
)(const double* op1
,const double* op2
,const double* op3
,
double* res
, unsigned long long fsr
,
unsigned long long gsr
, fpsim_fma_subtype subtype
);
int (*fmadds
)(const float* op1
,const float* op2
,const float* op3
,
float* res
, unsigned long long fsr
,
unsigned long long gsr
, fpsim_fma_subtype subtype
);
int (*fumaddd
)(const double* op1
, const double* op2
, const double* op3
,
double* res
, unsigned long long fsr
,
unsigned long long gsr
, fpsim_fma_subtype subtype
);
int (*fumadds
)(const float* op1
, const float* op2
, const float* op3
,
float* res
, unsigned long long fsr
,
unsigned long long gsr
, fpsim_fma_subtype subtype
);
#endif /*_INCLUDED_FPSIM_H*/