summaryrefslogtreecommitdiff
path: root/arch/mips/isa_traits.cc
diff options
context:
space:
mode:
authorKorey Sewell <ksewell@umich.edu>2006-05-10 16:52:27 -0400
committerKorey Sewell <ksewell@umich.edu>2006-05-10 16:52:27 -0400
commit6375b7aca9020147a77d69d1dc2ad45d2817cfd9 (patch)
tree5509b47737937893add266f34d8f7d546b9d999e /arch/mips/isa_traits.cc
parent5aa47cdbd916df34f943d6a3b072ee4eb4c96451 (diff)
downloadgem5-6375b7aca9020147a77d69d1dc2ad45d2817cfd9.tar.xz
revamping code to appropriately handle FP condition code and conversion ops.
There still needs to be a work around to handle the paired singles operations ... arch/mips/isa/decoder.isa: More revamping of the floating point ops in decoder.isa. Change all of the "convert and round" functions to fpConvert. Also, the utility functions roundFP, truncFP, and unorderedFP are in place everywhere. Things have been set up to appropriately use the FP condition codes in the decoder.isa The fp.isa format file and the isa_traits.cc file now needed to be updated to implement the appropriate "backend" operations/functionality... arch/mips/isa_traits.hh: Remove convert & round functions Add roundFP, truncFP,unorderedFP, and the get/setFPconditionCode functions arch/mips/isa_traits.cc: Add utility functions --HG-- extra : convert_revision : 3d6708388abae5b432467f528d52e6343afecd9c
Diffstat (limited to 'arch/mips/isa_traits.cc')
-rw-r--r--arch/mips/isa_traits.cc74
1 files changed, 74 insertions, 0 deletions
diff --git a/arch/mips/isa_traits.cc b/arch/mips/isa_traits.cc
index 2260cdc35..4eb14c66d 100644
--- a/arch/mips/isa_traits.cc
+++ b/arch/mips/isa_traits.cc
@@ -155,6 +155,80 @@ MipsISA::convert_and_round(double fp_val, ConvertType cvt_type, int rnd_mode)
}
}
+uint64_t
+MipsISA::fpConvert(double fp_val, ConvertType cvt_type)
+{
+
+ switch (cvt_type)
+ {
+ case SINGLE_TO_DOUBLE:
+ double sdouble_val = fp_val;
+ void *sdouble_ptr = &sdouble_val;
+ uint64_t sdp_bits = *(uint64_t *) sdouble_ptr;
+ return sdp_bits;
+
+ case SINGLE_TO_WORD:
+ int32_t sword_val = (int32_t) fp_val;
+ void *sword_ptr = &sword_val;
+ uint64_t sword_bits= *(uint32_t *) sword_ptr;
+ return sword_bits;
+
+ case WORD_TO_SINGLE:
+ float wfloat_val = fp_val;
+ void *wfloat_ptr = &wfloat_val;
+ uint64_t wfloat_bits = *(uint32_t *) wfloat_ptr;
+ return wfloat_bits;
+
+ case WORD_TO_DOUBLE:
+ double wdouble_val = fp_val;
+ void *wdouble_ptr = &wdouble_val;
+ uint64_t wdp_bits = *(uint64_t *) wdouble_ptr;
+ return wdp_bits;
+
+ default:
+ panic("Invalid Floating Point Conversion Type (%d). See \"types.hh\" for List of Conversions\n",cvt_type);
+ return 0;
+ }
+}
+
+double
+MipsISA::roundFP(double val)
+{
+ double trunc_val = trunc(val);
+ double fraction = val - trunc_val;
+
+ if (fraction < 0.5)
+ return val;
+ else
+ return val + 1;
+}
+
+inline double
+MipsISA::truncFP(double val)
+{
+ int trunc_val = (int) val;
+ return (double) trunc_val;
+}
+
+bool
+MipsISA::unorderedFP(uint32_t val)
+{
+}
+
+bool
+MipsISA::unorderedFP(uint64_t val)
+{
+}
+
+bool
+MipsISA::getConditionCode(int cc)
+{
+}
+
+void
+MipsISA::setConditionCode(int num, bool val)
+{
+}
#if FULL_SYSTEM