ldstop.isa (4601:38c989d15fef) ldstop.isa (4679:0b39fa8f5eb8)
1// Copyright (c) 2007 The Hewlett-Packard Development Company
2// All rights reserved.
3//
4// Redistribution and use of this software in source and binary forms,
5// with or without modification, are permitted provided that the
6// following conditions are met:
7//
8// The software must be used only for Non-Commercial Use which means any

--- 45 unchanged lines hidden (view full) ---

54// Authors: Gabe Black
55
56//////////////////////////////////////////////////////////////////////////
57//
58// LdStOp Microop templates
59//
60//////////////////////////////////////////////////////////////////////////
61
1// Copyright (c) 2007 The Hewlett-Packard Development Company
2// All rights reserved.
3//
4// Redistribution and use of this software in source and binary forms,
5// with or without modification, are permitted provided that the
6// following conditions are met:
7//
8// The software must be used only for Non-Commercial Use which means any

--- 45 unchanged lines hidden (view full) ---

54// Authors: Gabe Black
55
56//////////////////////////////////////////////////////////////////////////
57//
58// LdStOp Microop templates
59//
60//////////////////////////////////////////////////////////////////////////
61
62output header {{
63 /**
64 * Base class for load and store ops
65 */
66 class LdStOp : public X86MicroopBase
67 {
68 protected:
69 const uint8_t scale;
70 const RegIndex index;
71 const RegIndex base;
72 const uint64_t disp;
73 const uint8_t segment;
74 const RegIndex data;
75 const uint8_t dataSize;
76 const uint8_t addressSize;
77
78 //Constructor
79 LdStOp(ExtMachInst _machInst,
80 const char * mnem, const char * _instMnem,
81 bool isMicro, bool isDelayed, bool isFirst, bool isLast,
82 uint8_t _scale, RegIndex _index, RegIndex _base,
83 uint64_t _disp, uint8_t _segment,
84 RegIndex _data,
85 uint8_t _dataSize, uint8_t _addressSize,
86 OpClass __opClass) :
87 X86MicroopBase(machInst, mnem, _instMnem,
88 isMicro, isDelayed, isFirst, isLast, __opClass),
89 scale(_scale), index(_index), base(_base),
90 disp(_disp), segment(_segment),
91 data(_data),
92 dataSize(_dataSize), addressSize(_addressSize)
93 {}
94
95 std::string generateDisassembly(Addr pc,
96 const SymbolTable *symtab) const;
97 };
98}};
99
100output decoder {{
101 std::string LdStOp::generateDisassembly(Addr pc,
102 const SymbolTable *symtab) const
103 {
104 std::stringstream response;
105
106 printMnemonic(response, instMnem, mnemonic);
107 printReg(response, data);
108 response << ", ";
109 printSegment(response, segment);
110 ccprintf(response, ":[%d*", scale);
111 printReg(response, index);
112 response << " + ";
113 printReg(response, base);
114 ccprintf(response, " + %#x]", disp);
115 return response.str();
116 }
117}};
118
119// LEA template
120
121def template MicroLeaExecute {{
122 Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
123 Trace::InstRecord *traceData) const
124 {
125 Fault fault = NoFault;
126 Addr EA;

--- 292 unchanged lines hidden (view full) ---

419 global header_output
420 global decoder_output
421 global exec_output
422 global microopClasses
423 Name = mnemonic
424 name = mnemonic.lower()
425
426 # Build up the all register version of this micro op
62// LEA template
63
64def template MicroLeaExecute {{
65 Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
66 Trace::InstRecord *traceData) const
67 {
68 Fault fault = NoFault;
69 Addr EA;

--- 292 unchanged lines hidden (view full) ---

362 global header_output
363 global decoder_output
364 global exec_output
365 global microopClasses
366 Name = mnemonic
367 name = mnemonic.lower()
368
369 # Build up the all register version of this micro op
427 iop = InstObjParams(name, Name, 'LdStOp',
370 iop = InstObjParams(name, Name, 'X86ISA::LdStOp',
428 {"code": code, "ea_code": calculateEA})
429 header_output += MicroLdStOpDeclare.subst(iop)
430 decoder_output += MicroLdStOpConstructor.subst(iop)
431 exec_output += MicroLoadExecute.subst(iop)
432 exec_output += MicroLoadInitiateAcc.subst(iop)
433 exec_output += MicroLoadCompleteAcc.subst(iop)
434
435 class LoadOp(LdStOp):

--- 10 unchanged lines hidden (view full) ---

446 global header_output
447 global decoder_output
448 global exec_output
449 global microopClasses
450 Name = mnemonic
451 name = mnemonic.lower()
452
453 # Build up the all register version of this micro op
371 {"code": code, "ea_code": calculateEA})
372 header_output += MicroLdStOpDeclare.subst(iop)
373 decoder_output += MicroLdStOpConstructor.subst(iop)
374 exec_output += MicroLoadExecute.subst(iop)
375 exec_output += MicroLoadInitiateAcc.subst(iop)
376 exec_output += MicroLoadCompleteAcc.subst(iop)
377
378 class LoadOp(LdStOp):

--- 10 unchanged lines hidden (view full) ---

389 global header_output
390 global decoder_output
391 global exec_output
392 global microopClasses
393 Name = mnemonic
394 name = mnemonic.lower()
395
396 # Build up the all register version of this micro op
454 iop = InstObjParams(name, Name, 'LdStOp',
397 iop = InstObjParams(name, Name, 'X86ISA::LdStOp',
455 {"code": code, "ea_code": calculateEA})
456 header_output += MicroLdStOpDeclare.subst(iop)
457 decoder_output += MicroLdStOpConstructor.subst(iop)
458 exec_output += MicroStoreExecute.subst(iop)
459 exec_output += MicroStoreInitiateAcc.subst(iop)
460 exec_output += MicroStoreCompleteAcc.subst(iop)
461
462 class StoreOp(LdStOp):
463 def __init__(self, data, segment, addr, disp = 0):
464 super(LoadOp, self).__init__(data, segment, addr, disp)
465 self.className = Name
466 self.mnemonic = name
467
468 microopClasses[name] = StoreOp
469
470 defineMicroLoadOp('St', 'Mem = Data;')
471
398 {"code": code, "ea_code": calculateEA})
399 header_output += MicroLdStOpDeclare.subst(iop)
400 decoder_output += MicroLdStOpConstructor.subst(iop)
401 exec_output += MicroStoreExecute.subst(iop)
402 exec_output += MicroStoreInitiateAcc.subst(iop)
403 exec_output += MicroStoreCompleteAcc.subst(iop)
404
405 class StoreOp(LdStOp):
406 def __init__(self, data, segment, addr, disp = 0):
407 super(LoadOp, self).__init__(data, segment, addr, disp)
408 self.className = Name
409 self.mnemonic = name
410
411 microopClasses[name] = StoreOp
412
413 defineMicroLoadOp('St', 'Mem = Data;')
414
472 iop = InstObjParams("lea", "Lea", 'LdStOp',
415 iop = InstObjParams("lea", "Lea", 'X86ISA::LdStOp',
473 {"code": "Data = merge(Data, EA, dataSize);", "ea_code": calculateEA})
474 header_output += MicroLeaDeclare.subst(iop)
475 decoder_output += MicroLdStOpConstructor.subst(iop)
476 exec_output += MicroLeaExecute.subst(iop)
477
478 class LeaOp(LdStOp):
479 def __init__(self, data, segment, addr, disp = 0):
480 super(LeaOp, self).__init__(data, segment, addr, disp)
481 self.className = "Lea"
482 self.mnemonic = "lea"
483
484 microopClasses["lea"] = LeaOp
485}};
486
416 {"code": "Data = merge(Data, EA, dataSize);", "ea_code": calculateEA})
417 header_output += MicroLeaDeclare.subst(iop)
418 decoder_output += MicroLdStOpConstructor.subst(iop)
419 exec_output += MicroLeaExecute.subst(iop)
420
421 class LeaOp(LdStOp):
422 def __init__(self, data, segment, addr, disp = 0):
423 super(LeaOp, self).__init__(data, segment, addr, disp)
424 self.className = "Lea"
425 self.mnemonic = "lea"
426
427 microopClasses["lea"] = LeaOp
428}};
429