1// Copyright (c) 2007 The Hewlett-Packard Development Company 2// Copyright (c) 2012-2013 Mark D. Hill and David A. Wood 3// All rights reserved. 4// 5// The license below extends only to copyright in the software and shall 6// not be construed as granting a license to any other intellectual 7// property including but not limited to intellectual property relating 8// to a hardware implementation of the functionality of the software --- 43 unchanged lines hidden (view full) --- 52 DPRINTF(X86, "The data size is %d\n", dataSize); 53 %(op_decl)s; 54 %(op_rd)s; 55 56 if(%(cond_check)s) 57 { 58 %(code)s; 59 %(flag_code)s; |
60 %(tag_code)s; |
61 %(top_code)s; 62 } 63 else 64 { 65 %(else_code)s; 66 } 67 68 //Write the resulting state to the execution context --- 55 unchanged lines hidden (view full) --- 124 if flag_code is not "" or cond_check is not "true": 125 self.buildCppClasses(name, Name, suffix, 126 code, "", "true", else_code, op_class) 127 suffix = "Flags" + suffix 128 129 base = "X86ISA::FpOp" 130 131 # Get everything ready for the substitution |
132 iop_tag = InstObjParams(name, Name + suffix + "TopTag", base, 133 {"code" : code, 134 "flag_code" : flag_code, 135 "cond_check" : cond_check, 136 "else_code" : else_code, 137 "tag_code" : "FTW = genX87Tags(FTW, TOP, spm);", 138 "top_code" : "TOP = (TOP + spm + 8) % 8;", 139 "op_class" : op_class}) |
140 iop_top = InstObjParams(name, Name + suffix + "Top", base, 141 {"code" : code, 142 "flag_code" : flag_code, 143 "cond_check" : cond_check, 144 "else_code" : else_code, |
145 "tag_code" : ";", |
146 "top_code" : "TOP = (TOP + spm + 8) % 8;", 147 "op_class" : op_class}) 148 iop = InstObjParams(name, Name + suffix, base, 149 {"code" : code, 150 "flag_code" : flag_code, 151 "cond_check" : cond_check, 152 "else_code" : else_code, |
153 "tag_code" : ";", |
154 "top_code" : ";", 155 "op_class" : op_class}) 156 157 # Generate the actual code (finally!) |
158 header_output += MicroFpOpDeclare.subst(iop_tag) 159 decoder_output += MicroFpOpConstructor.subst(iop_tag) 160 exec_output += MicroFpOpExecute.subst(iop_tag) |
161 header_output += MicroFpOpDeclare.subst(iop_top) 162 decoder_output += MicroFpOpConstructor.subst(iop_top) 163 exec_output += MicroFpOpExecute.subst(iop_top) 164 header_output += MicroFpOpDeclare.subst(iop) 165 decoder_output += MicroFpOpConstructor.subst(iop) 166 exec_output += MicroFpOpExecute.subst(iop) 167 168 --- 31 unchanged lines hidden (view full) --- 200 201 # Default template parameter values 202 flag_code = "" 203 cond_check = "true" 204 else_code = ";" 205 op_class = "FloatAddOp" 206 207 def __init__(self, dest, src1, spm=0, \ |
208 SetStatus=False, UpdateFTW=True, dataSize="env.dataSize"): |
209 self.dest = dest 210 self.src1 = src1 211 self.src2 = "InstRegIndex(0)" 212 self.spm = spm 213 self.dataSize = dataSize 214 if SetStatus: 215 self.className += "Flags" 216 if spm: 217 self.className += "Top" |
218 if spm and UpdateFTW: 219 self.className += "Tag" |
220 221 def getAllocator(self, microFlags): 222 return '''new %(class_name)s(machInst, macrocodeBlock, 223 %(flags)s, %(src1)s, %(src2)s, %(dest)s, 224 %(dataSize)s, %(spm)d)''' % { 225 "class_name" : self.className, 226 "flags" : self.microFlagsText(microFlags), 227 "src1" : self.src1, "src2" : self.src2, --- 8 unchanged lines hidden (view full) --- 236 237 # Default template parameter values 238 flag_code = "" 239 cond_check = "true" 240 else_code = ";" 241 op_class = "FloatAddOp" 242 243 def __init__(self, dest, src1, src2, spm=0, \ |
244 SetStatus=False, UpdateFTW=True, dataSize="env.dataSize"): |
245 self.dest = dest 246 self.src1 = src1 247 self.src2 = src2 248 self.spm = spm 249 self.dataSize = dataSize 250 if SetStatus: 251 self.className += "Flags" 252 if spm: 253 self.className += "Top" |
254 if spm and UpdateFTW: 255 self.className += "Tag" |
256 257 def getAllocator(self, microFlags): 258 return '''new %(class_name)s(machInst, macrocodeBlock, 259 %(flags)s, %(src1)s, %(src2)s, %(dest)s, 260 %(dataSize)s, %(spm)d)''' % { 261 "class_name" : self.className, 262 "flags" : self.microFlagsText(microFlags), 263 "src1" : self.src1, "src2" : self.src2, --- 108 unchanged lines hidden (view full) --- 372 DPRINTF(X86, "src1: %lf, src2: %lf, dest: %lf, FSW: 0x%x\\n", 373 FpSrcReg1, FpSrcReg2, FpDestReg, new_fsw); 374 ''' 375 op_class = 'FloatDivOp' 376 377 flag_code = 'FSW = new_fsw;' 378 379 class Compfp(FpBinaryOp): |
380 def __init__(self, src1, src2, spm=0, setStatus=False, updateFTW=True, \ |
381 dataSize="env.dataSize"): 382 super(Compfp, self).__init__("InstRegIndex(FLOATREG_MICROFP0)", \ |
383 src1, src2, spm, setStatus, updateFTW, dataSize) |
384 # This class sets the condition codes in rflags according to the 385 # rules for comparing floating point. 386 code = ''' 387 // ZF PF CF 388 // Unordered 1 1 1 389 // Greater than 0 0 0 390 // Less than 0 0 1 391 // Equal 1 0 0 --- 23 unchanged lines hidden --- |