Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / legion / src / procs / sunsparc / include / fpsim_support.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: fpsim_support.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_SUPPORT_H
#define _INCLUDED_FPSIM_SUPPORT_H
/*===================================================================*
* fpsim_support.h : include file for FPSIM library source
*
* (c) Copyright 2006 Sun Microsystems, Inc.
*
*===================================================================*/
/*********************************************************************
* 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.
********************************************************************/
/*tab length=4*/
typedef unsigned int uint;
typedef long long int64;
typedef unsigned long long uint64;
#ifdef __cplusplus
extern "C" {
#endif
extern int asm_faddd( const double* op1, const double* op2, double* rslt,
int rnd, int* tmp );
extern int asm_fsubd( const double* op1, const double* op2, double* rslt,
int rnd, int* tmp );
extern int asm_fmuld( const double* op1, const double* op2, double* rslt,
int rnd, int* tmp );
extern int asm_fdivd( const double* op1, const double* op2, double* rslt,
int rnd, int* tmp );
extern int asm_fsqrtd( const double* op2, double* rslt, int rnd, int* tmp );
extern int asm_fadds( const float* op1, const float* op2, float* rslt,
int rnd, int* tmp );
extern int asm_fsubs( const float* op1, const float* op2, float* rslt,
int rnd, int* tmp );
extern int asm_fmuls( const float* op1, const float* op2, float* rslt,
int rnd, int* tmp );
extern int asm_fdivs( const float* op1, const float* op2, float* rslt,
int rnd, int* tmp );
extern int asm_fsqrts( const float* op2, float* rslt, int rnd, int* tmp );
extern int asm_fsmuld( const float* op1, const float* op2, double* rslt,
int* tmp );
extern int asm_fstod( const float* op2, double* rslt, int rnd, int* tmp );
extern int asm_fdtos( const double* op2, float* rslt, int rnd, int* tmp );
extern int asm_fstox( const float* op2, uint64* rslt, int rnd, int* tmp );
extern int asm_fdtox( const double* op2, uint64* rslt, int rnd, int* tmp );
extern int asm_fstoi( const float* op2, uint* rslt, int rnd, int* tmp );
extern int asm_fdtoi( const double* op2, uint* rslt, int rnd, int* tmp );
extern int asm_fxtos( const uint64* op2, float* rslt, int rnd, int* tmp );
extern int asm_fxtod( const uint64* op2, double* rslt, int rnd, int* tmp );
extern int asm_fitos( const uint* op2, float* rslt, int rnd, int* tmp );
extern void asm_fitod( const uint* op2, double* rslt );
extern int asm_addc( uint64 op1, uint64 op2, uint64* res );
extern int asm_subc( uint64 op1, uint64 op2, uint64* res );
#ifdef __cplusplus
}
#endif
// FP number classes
enum fp_classes {
fp_zero=0, fp_subnormal, fp_normal, fp_infinity, fp_quiet, fp_signaling
};
// FP rounding modes
enum fp_round {
FP_RN=0, FP_RZ, FP_RP, FP_RM
};
// structures for easy examination of all parts of a FP number
typedef struct fpdouble {
union {
double num;
uint64 inte;
} fp;
uint64 frac;
int exp;
int sign;
} fpdouble;
typedef struct fpsingle {
union {
float num;
uint inte;
} fp;
uint frac;
int exp;
int sign;
} fpsingle;
#define EBIAS_S 127
#define EBIAS_D 1023
#define TRAP_ILLEGAL_INST 0x10
#define TRAP_IEEE_754 0x21
#define TRAP_FPX_OTHER 0x22
#ifndef NULL
#define NULL 0
#endif
#endif /* _INCLUDED_FPSIM_SUPPORT_H */