root / target-arm / nwfpe / fpsr.h @ afc7df11
History | View | Annotate | Download (3.8 kB)
1 | 00406dff | bellard | /*
|
---|---|---|---|
2 | 00406dff | bellard | NetWinder Floating Point Emulator
|
3 | 00406dff | bellard | (c) Rebel.com, 1998-1999
|
4 | 00406dff | bellard | |
5 | 00406dff | bellard | Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
|
6 | 00406dff | bellard | |
7 | 00406dff | bellard | This program is free software; you can redistribute it and/or modify
|
8 | 00406dff | bellard | it under the terms of the GNU General Public License as published by
|
9 | 00406dff | bellard | the Free Software Foundation; either version 2 of the License, or
|
10 | 00406dff | bellard | (at your option) any later version.
|
11 | 00406dff | bellard | |
12 | 00406dff | bellard | This program is distributed in the hope that it will be useful,
|
13 | 00406dff | bellard | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 | 00406dff | bellard | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 | 00406dff | bellard | GNU General Public License for more details.
|
16 | 00406dff | bellard | |
17 | 00406dff | bellard | You should have received a copy of the GNU General Public License
|
18 | 00406dff | bellard | along with this program; if not, write to the Free Software
|
19 | 00406dff | bellard | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
20 | 00406dff | bellard | */
|
21 | 00406dff | bellard | |
22 | 00406dff | bellard | #ifndef __FPSR_H__
|
23 | 00406dff | bellard | #define __FPSR_H__
|
24 | 00406dff | bellard | |
25 | 00406dff | bellard | /*
|
26 | 00406dff | bellard | The FPSR is a 32 bit register consisting of 4 parts, each exactly
|
27 | 00406dff | bellard | one byte.
|
28 | 00406dff | bellard | |
29 | 00406dff | bellard | SYSTEM ID
|
30 | 00406dff | bellard | EXCEPTION TRAP ENABLE BYTE
|
31 | 00406dff | bellard | SYSTEM CONTROL BYTE
|
32 | 00406dff | bellard | CUMULATIVE EXCEPTION FLAGS BYTE
|
33 | 00406dff | bellard |
|
34 | 00406dff | bellard | The FPCR is a 32 bit register consisting of bit flags.
|
35 | 00406dff | bellard | */
|
36 | 00406dff | bellard | |
37 | 00406dff | bellard | /* SYSTEM ID
|
38 | 00406dff | bellard | ------------
|
39 | 00406dff | bellard | Note: the system id byte is read only */
|
40 | 00406dff | bellard | |
41 | 00406dff | bellard | typedef unsigned int FPSR; /* type for floating point status register */ |
42 | 00406dff | bellard | typedef unsigned int FPCR; /* type for floating point control register */ |
43 | 00406dff | bellard | |
44 | 00406dff | bellard | #define MASK_SYSID 0xff000000 |
45 | 00406dff | bellard | #define BIT_HARDWARE 0x80000000 |
46 | 00406dff | bellard | #define FP_EMULATOR 0x01000000 /* System ID for emulator */ |
47 | 00406dff | bellard | #define FP_ACCELERATOR 0x81000000 /* System ID for FPA11 */ |
48 | 00406dff | bellard | |
49 | 00406dff | bellard | /* EXCEPTION TRAP ENABLE BYTE
|
50 | 00406dff | bellard | ----------------------------- */
|
51 | 00406dff | bellard | |
52 | 00406dff | bellard | #define MASK_TRAP_ENABLE 0x00ff0000 |
53 | 00406dff | bellard | #define MASK_TRAP_ENABLE_STRICT 0x001f0000 |
54 | 00406dff | bellard | #define BIT_IXE 0x00100000 /* inexact exception enable */ |
55 | 00406dff | bellard | #define BIT_UFE 0x00080000 /* underflow exception enable */ |
56 | 00406dff | bellard | #define BIT_OFE 0x00040000 /* overflow exception enable */ |
57 | 00406dff | bellard | #define BIT_DZE 0x00020000 /* divide by zero exception enable */ |
58 | 00406dff | bellard | #define BIT_IOE 0x00010000 /* invalid operation exception enable */ |
59 | 00406dff | bellard | |
60 | 00406dff | bellard | /* SYSTEM CONTROL BYTE
|
61 | 00406dff | bellard | ---------------------- */
|
62 | 00406dff | bellard | |
63 | 00406dff | bellard | #define MASK_SYSTEM_CONTROL 0x0000ff00 |
64 | 00406dff | bellard | #define MASK_TRAP_STRICT 0x00001f00 |
65 | 00406dff | bellard | |
66 | 00406dff | bellard | #define BIT_AC 0x00001000 /* use alternative C-flag definition |
67 | 00406dff | bellard | for compares */
|
68 | 00406dff | bellard | #define BIT_EP 0x00000800 /* use expanded packed decimal format */ |
69 | 00406dff | bellard | #define BIT_SO 0x00000400 /* select synchronous operation of FPA */ |
70 | 00406dff | bellard | #define BIT_NE 0x00000200 /* NaN exception bit */ |
71 | 00406dff | bellard | #define BIT_ND 0x00000100 /* no denormalized numbers bit */ |
72 | 00406dff | bellard | |
73 | 00406dff | bellard | /* CUMULATIVE EXCEPTION FLAGS BYTE
|
74 | 00406dff | bellard | ---------------------------------- */
|
75 | 00406dff | bellard | |
76 | 00406dff | bellard | #define MASK_EXCEPTION_FLAGS 0x000000ff |
77 | 00406dff | bellard | #define MASK_EXCEPTION_FLAGS_STRICT 0x0000001f |
78 | 00406dff | bellard | |
79 | 00406dff | bellard | #define BIT_IXC 0x00000010 /* inexact exception flag */ |
80 | 00406dff | bellard | #define BIT_UFC 0x00000008 /* underflow exception flag */ |
81 | 00406dff | bellard | #define BIT_OFC 0x00000004 /* overfloat exception flag */ |
82 | 00406dff | bellard | #define BIT_DZC 0x00000002 /* divide by zero exception flag */ |
83 | 00406dff | bellard | #define BIT_IOC 0x00000001 /* invalid operation exception flag */ |
84 | 00406dff | bellard | |
85 | 00406dff | bellard | /* Floating Point Control Register
|
86 | 00406dff | bellard | ----------------------------------*/
|
87 | 00406dff | bellard | |
88 | 00406dff | bellard | #define BIT_RU 0x80000000 /* rounded up bit */ |
89 | 00406dff | bellard | #define BIT_IE 0x10000000 /* inexact bit */ |
90 | 00406dff | bellard | #define BIT_MO 0x08000000 /* mantissa overflow bit */ |
91 | 00406dff | bellard | #define BIT_EO 0x04000000 /* exponent overflow bit */ |
92 | 00406dff | bellard | #define BIT_SB 0x00000800 /* store bounce */ |
93 | 00406dff | bellard | #define BIT_AB 0x00000400 /* arithmetic bounce */ |
94 | 00406dff | bellard | #define BIT_RE 0x00000200 /* rounding exception */ |
95 | 00406dff | bellard | #define BIT_DA 0x00000100 /* disable FPA */ |
96 | 00406dff | bellard | |
97 | 00406dff | bellard | #define MASK_OP 0x00f08010 /* AU operation code */ |
98 | 00406dff | bellard | #define MASK_PR 0x00080080 /* AU precision */ |
99 | 00406dff | bellard | #define MASK_S1 0x00070000 /* AU source register 1 */ |
100 | 00406dff | bellard | #define MASK_S2 0x00000007 /* AU source register 2 */ |
101 | 00406dff | bellard | #define MASK_DS 0x00007000 /* AU destination register */ |
102 | 00406dff | bellard | #define MASK_RM 0x00000060 /* AU rounding mode */ |
103 | 00406dff | bellard | #define MASK_ALU 0x9cfff2ff /* only ALU can write these bits */ |
104 | 00406dff | bellard | #define MASK_RESET 0x00000d00 /* bits set on reset, all others cleared */ |
105 | 00406dff | bellard | #define MASK_WFC MASK_RESET
|
106 | 00406dff | bellard | #define MASK_RFC ~MASK_RESET
|
107 | 00406dff | bellard | |
108 | 00406dff | bellard | #endif |