fpop.isa (9761:f2102d45a753) | fpop.isa (9765:da0e0df0ba97) |
---|---|
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; | 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; |
|
60 %(top_code)s; 61 } 62 else 63 { 64 %(else_code)s; 65 } 66 67 //Write the resulting state to the execution context --- 55 unchanged lines hidden (view full) --- 123 if flag_code is not "" or cond_check is not "true": 124 self.buildCppClasses(name, Name, suffix, 125 code, "", "true", else_code, op_class) 126 suffix = "Flags" + suffix 127 128 base = "X86ISA::FpOp" 129 130 # Get everything ready for the substitution | 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}) |
|
131 iop_top = InstObjParams(name, Name + suffix + "Top", base, 132 {"code" : code, 133 "flag_code" : flag_code, 134 "cond_check" : cond_check, 135 "else_code" : else_code, | 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" : ";", |
|
136 "top_code" : "TOP = (TOP + spm + 8) % 8;", 137 "op_class" : op_class}) 138 iop = InstObjParams(name, Name + suffix, base, 139 {"code" : code, 140 "flag_code" : flag_code, 141 "cond_check" : cond_check, 142 "else_code" : else_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" : ";", |
|
143 "top_code" : ";", 144 "op_class" : op_class}) 145 146 # Generate the actual code (finally!) | 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) |
|
147 header_output += MicroFpOpDeclare.subst(iop_top) 148 decoder_output += MicroFpOpConstructor.subst(iop_top) 149 exec_output += MicroFpOpExecute.subst(iop_top) 150 header_output += MicroFpOpDeclare.subst(iop) 151 decoder_output += MicroFpOpConstructor.subst(iop) 152 exec_output += MicroFpOpExecute.subst(iop) 153 154 --- 31 unchanged lines hidden (view full) --- 186 187 # Default template parameter values 188 flag_code = "" 189 cond_check = "true" 190 else_code = ";" 191 op_class = "FloatAddOp" 192 193 def __init__(self, dest, src1, spm=0, \ | 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, \ |
194 SetStatus=False, dataSize="env.dataSize"): | 208 SetStatus=False, UpdateFTW=True, dataSize="env.dataSize"): |
195 self.dest = dest 196 self.src1 = src1 197 self.src2 = "InstRegIndex(0)" 198 self.spm = spm 199 self.dataSize = dataSize 200 if SetStatus: 201 self.className += "Flags" 202 if spm: 203 self.className += "Top" | 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" |
|
204 205 def getAllocator(self, microFlags): 206 return '''new %(class_name)s(machInst, macrocodeBlock, 207 %(flags)s, %(src1)s, %(src2)s, %(dest)s, 208 %(dataSize)s, %(spm)d)''' % { 209 "class_name" : self.className, 210 "flags" : self.microFlagsText(microFlags), 211 "src1" : self.src1, "src2" : self.src2, --- 8 unchanged lines hidden (view full) --- 220 221 # Default template parameter values 222 flag_code = "" 223 cond_check = "true" 224 else_code = ";" 225 op_class = "FloatAddOp" 226 227 def __init__(self, dest, src1, src2, spm=0, \ | 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, \ |
228 SetStatus=False, dataSize="env.dataSize"): | 244 SetStatus=False, UpdateFTW=True, dataSize="env.dataSize"): |
229 self.dest = dest 230 self.src1 = src1 231 self.src2 = src2 232 self.spm = spm 233 self.dataSize = dataSize 234 if SetStatus: 235 self.className += "Flags" 236 if spm: 237 self.className += "Top" | 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" |
|
238 239 def getAllocator(self, microFlags): 240 return '''new %(class_name)s(machInst, macrocodeBlock, 241 %(flags)s, %(src1)s, %(src2)s, %(dest)s, 242 %(dataSize)s, %(spm)d)''' % { 243 "class_name" : self.className, 244 "flags" : self.microFlagsText(microFlags), 245 "src1" : self.src1, "src2" : self.src2, --- 108 unchanged lines hidden (view full) --- 354 DPRINTF(X86, "src1: %lf, src2: %lf, dest: %lf, FSW: 0x%x\\n", 355 FpSrcReg1, FpSrcReg2, FpDestReg, new_fsw); 356 ''' 357 op_class = 'FloatDivOp' 358 359 flag_code = 'FSW = new_fsw;' 360 361 class Compfp(FpBinaryOp): | 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): |
362 def __init__(self, src1, src2, spm=0, setStatus=False, \ | 380 def __init__(self, src1, src2, spm=0, setStatus=False, updateFTW=True, \ |
363 dataSize="env.dataSize"): 364 super(Compfp, self).__init__("InstRegIndex(FLOATREG_MICROFP0)", \ | 381 dataSize="env.dataSize"): 382 super(Compfp, self).__init__("InstRegIndex(FLOATREG_MICROFP0)", \ |
365 src1, src2, spm, setStatus, dataSize) | 383 src1, src2, spm, setStatus, updateFTW, dataSize) |
366 # This class sets the condition codes in rflags according to the 367 # rules for comparing floating point. 368 code = ''' 369 // ZF PF CF 370 // Unordered 1 1 1 371 // Greater than 0 0 0 372 // Less than 0 0 1 373 // Equal 1 0 0 --- 23 unchanged lines hidden --- | 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 --- |