This source file includes following definitions.
- resetFPA11
- SetRoundingMode
- SetRoundingPrecision
- nwfpe_init_fpa
- EmulateAll
1
2
3
4
5
6
7
8
9
10
11 #include "fpa11.h"
12 #include "fpopcode.h"
13
14 #include "fpmodule.h"
15 #include "fpmodule.inl"
16
17 #include <linux/compiler.h>
18 #include <linux/string.h>
19
20
21 static void resetFPA11(void)
22 {
23 int i;
24 FPA11 *fpa11 = GET_FPA11();
25
26
27 for (i = 0; i <= 7; i++) {
28 fpa11->fType[i] = typeNone;
29 }
30
31
32 fpa11->fpsr = FP_EMULATOR | BIT_AC;
33 }
34
35 int8 SetRoundingMode(const unsigned int opcode)
36 {
37 switch (opcode & MASK_ROUNDING_MODE) {
38 default:
39 case ROUND_TO_NEAREST:
40 return float_round_nearest_even;
41
42 case ROUND_TO_PLUS_INFINITY:
43 return float_round_up;
44
45 case ROUND_TO_MINUS_INFINITY:
46 return float_round_down;
47
48 case ROUND_TO_ZERO:
49 return float_round_to_zero;
50 }
51 }
52
53 int8 SetRoundingPrecision(const unsigned int opcode)
54 {
55 #ifdef CONFIG_FPE_NWFPE_XP
56 switch (opcode & MASK_ROUNDING_PRECISION) {
57 case ROUND_SINGLE:
58 return 32;
59
60 case ROUND_DOUBLE:
61 return 64;
62
63 case ROUND_EXTENDED:
64 return 80;
65
66 default:
67 return 80;
68 }
69 #endif
70 return 80;
71 }
72
73 void nwfpe_init_fpa(union fp_state *fp)
74 {
75 FPA11 *fpa11 = (FPA11 *)fp;
76 #ifdef NWFPE_DEBUG
77 printk("NWFPE: setting up state.\n");
78 #endif
79 memset(fpa11, 0, sizeof(FPA11));
80 resetFPA11();
81 fpa11->initflag = 1;
82 }
83
84
85 unsigned int EmulateAll(unsigned int opcode)
86 {
87 unsigned int code;
88
89 #ifdef NWFPE_DEBUG
90 printk("NWFPE: emulating opcode %08x\n", opcode);
91 #endif
92 code = opcode & 0x00000f00;
93 if (code == 0x00000100 || code == 0x00000200) {
94
95 code = opcode & 0x0e000000;
96 if (code == 0x0e000000) {
97 if (opcode & 0x00000010) {
98
99
100
101 return EmulateCPRT(opcode);
102 } else {
103
104
105 return EmulateCPDO(opcode);
106 }
107 } else if (code == 0x0c000000) {
108
109
110 return EmulateCPDT(opcode);
111 }
112 }
113
114
115 return 0;
116 }