fpu.h
2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
* 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 */