fpu.h 2.58 KB
/*
 * Copyright (C) 1996-1998 by the Board of Trustees
 *    of Leland Stanford Junior University.
 * 
 * This file is part of the SimOS distribution. 
 * See LICENSE file for terms of the license. 
 *
 */

/*****************************************************************
 * fpu.h
 *
 * $Author: blythe $
 * $Date: 2002/05/29 01:09:10 $
 *****************************************************************/

#ifndef MIPSY_FPU_H
#define MIPSY_FPU_H

/* Global FPU Functions */
extern void   MipsyInitFPU(void);
extern void   MipsyExitFPU(void);
extern int    ExecuteC1Instruction(CPUState *, Inst);

/* Return values from executing */
#define C1_SUCCESS  SUCCESS
#define C1_CONTINUE FAILURE

#if defined(SIM_MIPS32)
#define _NFRB     0x1
#else
#define _NFRB     (P->notFRbit)
#endif

#ifdef HOST_BIG_ENDIAN
#define IntReg(r1)        (P->fpReg[(r1)&~_NFRB].fgrInt[((r1) & _NFRB) ^ 0x00000001])
#define FloatReg(r1)      (P->fpReg[(r1)&~_NFRB].fgr[((r1) & _NFRB) ^ 0x00000001])
#define DoubleReg(r1)     (P->fpReg[(r1)&~_NFRB].fpr)
#define LongLongReg(r1)   (P->fpReg[(r1)].fgrLL)
#endif
#ifdef HOST_LITTLE_ENDIAN
#define IntReg(r1)        (P->fpReg[(r1)&~_NFRB].fgrInt[((r1) & _NFRB)])
#define FloatReg(r1)      (P->fpReg[(r1)&~_NFRB].fgr[((r1) & _NFRB)])
#define DoubleReg(r1)     (P->fpReg[(r1)&~_NFRB].fpr)
#define LongLongReg(r1)   (P->fpReg[(r1)].fgrLL)
#endif

#define SP_NEAR_ONE     0.999999
#define DP_NEAR_ONE     0.9999999999999
#define CONDBIT         0x00800000

/* Floating Point format field decoding (Page B-8) */
#define FMT_S       0x10 /* Single - binary floating pt. */
#define FMT_D       0x11 /* Double - binary floating pt. */
#define FMT_W       0x14 /* Single - binary fixed pt. */
#define FMT_L       0x15 /* Double - binary fixed pt. */

#define FMT_Sx      0x0 /* Single - binary floating pt. */
#define FMT_Dx      0x1 /* Double - binary floating pt. */
#define FMT_Wx      0x4 /* Single - binary fixed pt. */
#define FMT_Lx      0x5 /* Double - binary fixed pt. */

/* Shifted floating point formats used in decoding */
#define F_SSINGLE  (FMT_S << 8)
#define F_SDOUBLE  (FMT_D << 8)
#define F_W        (FMT_W << 8)
#define F_L        (FMT_L << 8)

/* Floating Point instructions and operations (Page B-8) */

#define F_C_OBF   0x30
#define F_C_UN    0x31
#define F_C_EQ    0x32
#define F_C_UEQ   0x33
#define F_C_OLT   0x34
#define F_C_ULT   0x35
#define F_C_OLE   0x36
#define F_C_ULE   0x37
#define F_C_SF    0x38
#define F_C_NGLE  0x39
#define F_C_SEQ   0x3a
#define F_C_NGL   0x3b
#define F_C_LT    0x3c
#define F_C_NGE   0x3d
#define F_C_LE    0x3e
#define F_C_NGT   0x3f

#endif /* MIPSY_FPU_H */