summaryrefslogtreecommitdiff
path: root/src/arch/mips/isa/formats
diff options
context:
space:
mode:
authorChristopher Torng <clt67@cornell.edu>2013-12-29 19:29:45 -0600
committerChristopher Torng <clt67@cornell.edu>2013-12-29 19:29:45 -0600
commit903b442228efd27b8b7b49201eacc96c282714b5 (patch)
tree61c57d3b939fe12ba1b033efbc07c4eae18547b2 /src/arch/mips/isa/formats
parente6008b6bc149a8c9ecff5d364bea99b7c94d2f94 (diff)
downloadgem5-903b442228efd27b8b7b49201eacc96c282714b5.tar.xz
mips: Floating point convert bug fix
In mips architecture, floating point convert instructions use the FloatConvertOp format defined in src/arch/mips/isa/formats/fp.isa. The type of the operands in the ISA description file (_sw for signed word, or _sf for signed float, etc.) is used to create a type for the operand in C++. Then the operand is converted using the fpConvert() function in src/arch/mips/utility.cc. If we are converting from a word to a float, and we want to convert 0xffffffff, we expect -1 to be passed into fpConvert(). Instead, we see MAX_INT passed in. Then fpConvert() converts _val_ to MAX_INT in single-precision floating point, and we get the wrong value. To fix it, the signs of the convert operands are being changed from unsigned to signed in the MIPS ISA description. Then, the FloatConvertOp format is being changed to insert a int32_t into the C++ code instead of a uint32_t. Committed by: Nilay Vaish <nilay@cs.wisc.edu>
Diffstat (limited to 'src/arch/mips/isa/formats')
-rw-r--r--src/arch/mips/isa/formats/fp.isa8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/arch/mips/isa/formats/fp.isa b/src/arch/mips/isa/formats/fp.isa
index e6f0258a0..1b061bc63 100644
--- a/src/arch/mips/isa/formats/fp.isa
+++ b/src/arch/mips/isa/formats/fp.isa
@@ -268,11 +268,11 @@ def format FloatConvertOp(code, *flags) {{
elif '_df' in code:
code = 'double ' + code + '\n'
convert += 'DOUBLE_TO_'
- elif '_uw' in code:
- code = 'uint32_t ' + code + '\n'
+ elif '_sw' in code:
+ code = 'int32_t ' + code + '\n'
convert += 'WORD_TO_'
- elif '_ud' in code:
- code = 'uint64_t ' + code + '\n'
+ elif '_sd' in code:
+ code = 'int64_t ' + code + '\n'
convert += 'LONG_TO_'
else:
sys.exit("Error Determining Source Type for Conversion")