basic.isa (4362:95e5f28ce484) basic.isa (4394:dbaff14bb974)
1// Copyright (c) 2006-2007 The Regents of The University of Michigan
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met: redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer;
8// redistributions in binary form must reproduce the above copyright

--- 95 unchanged lines hidden (view full) ---

104 decode_block = BasicDecode.subst(iop)
105 exec_output = BasicExecute.subst(iop)
106}};
107
108def format FpBasic(code, *flags) {{
109 fp_code = """
110 Fsr |= bits(Fsr,4,0) << 5;
111 Fsr = insertBits(Fsr,4,0,0);
1// Copyright (c) 2006-2007 The Regents of The University of Michigan
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met: redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer;
8// redistributions in binary form must reproduce the above copyright

--- 95 unchanged lines hidden (view full) ---

104 decode_block = BasicDecode.subst(iop)
105 exec_output = BasicExecute.subst(iop)
106}};
107
108def format FpBasic(code, *flags) {{
109 fp_code = """
110 Fsr |= bits(Fsr,4,0) << 5;
111 Fsr = insertBits(Fsr,4,0,0);
112#if defined(__sun) || defined (__OpenBSD__)
113 fp_rnd newrnd = FP_RN;
112 int newrnd = M5_FE_TONEAREST;
114 switch (Fsr<31:30>) {
113 switch (Fsr<31:30>) {
115 case 0: newrnd = FP_RN; break;
116 case 1: newrnd = FP_RZ; break;
117 case 2: newrnd = FP_RP; break;
118 case 3: newrnd = FP_RM; break;
114 case 0: newrnd = M5_FE_TONEAREST; break;
115 case 1: newrnd = M5_FE_TOWARDZERO; break;
116 case 2: newrnd = M5_FE_UPWARD; break;
117 case 3: newrnd = M5_FE_DOWNWARD; break;
119 }
118 }
120 fp_rnd oldrnd = fpsetround(newrnd);
121#else
122 int newrnd = FE_TONEAREST;
123 switch (Fsr<31:30>) {
124 case 0: newrnd = FE_TONEAREST; break;
125 case 1: newrnd = FE_TOWARDZERO; break;
126 case 2: newrnd = FE_UPWARD; break;
127 case 3: newrnd = FE_DOWNWARD; break;
128 }
129 int oldrnd = fegetround();
130 fesetround(newrnd);
131#endif
119 int oldrnd = m5_fegetround();
120 m5_fesetround(newrnd);
132"""
133
134 fp_code += code
135
136
137 fp_code += """
121"""
122
123 fp_code += code
124
125
126 fp_code += """
138#if defined(__sun) || defined (__OpenBSD__)
139 fpsetround(oldrnd);
140#else
141 fesetround(oldrnd);
142#endif
127 m5_fesetround(oldrnd);
143"""
144 fp_code = filterDoubles(fp_code)
145 iop = InstObjParams(name, Name, 'SparcStaticInst', fp_code, flags)
146 header_output = BasicDeclare.subst(iop)
147 decoder_output = BasicConstructor.subst(iop)
148 decode_block = BasicDecode.subst(iop)
149 exec_output = BasicExecute.subst(iop)
150}};
128"""
129 fp_code = filterDoubles(fp_code)
130 iop = InstObjParams(name, Name, 'SparcStaticInst', fp_code, flags)
131 header_output = BasicDeclare.subst(iop)
132 decoder_output = BasicConstructor.subst(iop)
133 decode_block = BasicDecode.subst(iop)
134 exec_output = BasicExecute.subst(iop)
135}};