summaryrefslogtreecommitdiff
path: root/src/arch/sparc/isa/formats/basic.isa
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2007-02-06 18:47:42 -0500
committerAli Saidi <saidi@eecs.umich.edu>2007-02-06 18:47:42 -0500
commit8ffd12e807bd05a57bbe8857dbff0ecaf217fe64 (patch)
tree6515ebc54b8b0647259f06ed0aa836d5424042c3 /src/arch/sparc/isa/formats/basic.isa
parent310d8f0992637d69e270cac727ba0ff968cdb6ea (diff)
parentc7a1fdacd6f378dcd1245aab289d497f801398f6 (diff)
downloadgem5-8ffd12e807bd05a57bbe8857dbff0ecaf217fe64.tar.xz
merge my index fix and lisa's fix
--HG-- extra : convert_revision : 5f2c7d46c96fa061bbfb66edf188d405ca600020
Diffstat (limited to 'src/arch/sparc/isa/formats/basic.isa')
-rw-r--r--src/arch/sparc/isa/formats/basic.isa43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/arch/sparc/isa/formats/basic.isa b/src/arch/sparc/isa/formats/basic.isa
index e8762a205..017f43780 100644
--- a/src/arch/sparc/isa/formats/basic.isa
+++ b/src/arch/sparc/isa/formats/basic.isa
@@ -103,3 +103,46 @@ def format BasicOperate(code, *flags) {{
decode_block = BasicDecode.subst(iop)
exec_output = BasicExecute.subst(iop)
}};
+
+def format FpBasic(code, *flags) {{
+ fp_code = """
+ Fsr |= bits(Fsr,4,0) << 5;
+ Fsr = insertBits(Fsr,4,0,0);
+#if defined(__sun) || defined (__OpenBSD__)
+ fp_rnd newrnd = FP_RN;
+ switch (Fsr<31:30>) {
+ case 0: newrnd = FP_RN; break;
+ case 1: newrnd = FP_RZ; break;
+ case 2: newrnd = FP_RP; break;
+ case 3: newrnd = FP_RM; break;
+ }
+ fp_rnd oldrnd = fpsetround(newrnd);
+#else
+ int newrnd = FE_TONEAREST;
+ switch (Fsr<31:30>) {
+ case 0: newrnd = FE_TONEAREST; break;
+ case 1: newrnd = FE_TOWARDZERO; break;
+ case 2: newrnd = FE_UPWARD; break;
+ case 3: newrnd = FE_DOWNWARD; break;
+ }
+ int oldrnd = fegetround();
+ fesetround(newrnd);
+#endif
+"""
+
+ fp_code += code
+
+
+ fp_code += """
+#if defined(__sun) || defined (__OpenBSD__)
+ fpsetround(oldrnd);
+#else
+ fesetround(oldrnd);
+#endif
+"""
+ iop = InstObjParams(name, Name, 'SparcStaticInst', fp_code, flags)
+ header_output = BasicDeclare.subst(iop)
+ decoder_output = BasicConstructor.subst(iop)
+ decode_block = BasicDecode.subst(iop)
+ exec_output = BasicExecute.subst(iop)
+}};