limmop.isa revision 4581:23166f771fa4
110326Smitch.hayenga@arm.com// Copyright (c) 2007 The Hewlett-Packard Development Company 210326Smitch.hayenga@arm.com// All rights reserved. 310326Smitch.hayenga@arm.com// 410326Smitch.hayenga@arm.com// Redistribution and use of this software in source and binary forms, 510326Smitch.hayenga@arm.com// with or without modification, are permitted provided that the 610326Smitch.hayenga@arm.com// following conditions are met: 710326Smitch.hayenga@arm.com// 810326Smitch.hayenga@arm.com// The software must be used only for Non-Commercial Use which means any 910326Smitch.hayenga@arm.com// use which is NOT directed to receiving any direct monetary 1010326Smitch.hayenga@arm.com// compensation for, or commercial advantage from such use. Illustrative 1110326Smitch.hayenga@arm.com// examples of non-commercial use are academic research, personal study, 1210326Smitch.hayenga@arm.com// teaching, education and corporate research & development. 131761SN/A// Illustrative examples of commercial use are distributing products for 149920Syasuko.eckert@amd.com// commercial advantage and providing services using the software for 152SN/A// commercial advantage. 162SN/A// 172SN/A// If you wish to use this software or functionality therein that may be 182SN/A// covered by patents for commercial use, please contact: 192SN/A// Director of Intellectual Property Licensing 202SN/A// Office of Strategy and Technology 212SN/A// Hewlett-Packard Company 222SN/A// 1501 Page Mill Road 232SN/A// Palo Alto, California 94304 242SN/A// 252SN/A// Redistributions of source code must retain the above copyright notice, 262SN/A// this list of conditions and the following disclaimer. Redistributions 272SN/A// in binary form must reproduce the above copyright notice, this list of 282SN/A// conditions and the following disclaimer in the documentation and/or 292SN/A// other materials provided with the distribution. Neither the name of 302SN/A// the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its 312SN/A// contributors may be used to endorse or promote products derived from 322SN/A// this software without specific prior written permission. No right of 332SN/A// sublicense is granted herewith. Derivatives of the software and 342SN/A// output created using the software may be prepared, but only for 352SN/A// Non-Commercial Uses. Derivatives of the software may be shared with 362SN/A// others provided: (i) the others agree to abide by the list of 372SN/A// conditions herein which includes the Non-Commercial Use restrictions; 382SN/A// and (ii) such Derivatives of the software include the above copyright 392665Ssaidi@eecs.umich.edu// notice to acknowledge the contribution from this software where 402665Ssaidi@eecs.umich.edu// applicable, this list of conditions and the disclaimer below. 412SN/A// 4210196SCurtis.Dunham@arm.com// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 432SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 442SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 452SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 462SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 476986Snate@binkert.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 482SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 492SN/A// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 502SN/A// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 516661Snate@binkert.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 522SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 536987Snate@binkert.org// 546987Snate@binkert.org// Authors: Gabe Black 556984Snate@binkert.org 566984Snate@binkert.org////////////////////////////////////////////////////////////////////////// 572SN/A// 586984Snate@binkert.org// LIMMOp Microop templates 596984Snate@binkert.org// 606984Snate@binkert.org////////////////////////////////////////////////////////////////////////// 616984Snate@binkert.org 626984Snate@binkert.orgdef template MicroLimmOpExecute {{ 636984Snate@binkert.org Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, 646984Snate@binkert.org Trace::InstRecord *traceData) const 656661Snate@binkert.org { 666984Snate@binkert.org %(op_decl)s; 676984Snate@binkert.org %(op_rd)s; 686984Snate@binkert.org %(code)s; 696984Snate@binkert.org %(op_wb)s; 706984Snate@binkert.org return NoFault; 716984Snate@binkert.org } 726984Snate@binkert.org}}; 736984Snate@binkert.org 746984Snate@binkert.orgdef template MicroLimmOpDeclare {{ 756984Snate@binkert.org class %(class_name)s : public X86MicroopBase 766984Snate@binkert.org { 776984Snate@binkert.org protected: 786984Snate@binkert.org const RegIndex dest; 796984Snate@binkert.org const uint64_t imm; 806984Snate@binkert.org void buildMe(); 816984Snate@binkert.org 826661Snate@binkert.org std::string generateDisassembly(Addr pc, 836984Snate@binkert.org const SymbolTable *symtab) const; 846984Snate@binkert.org 856984Snate@binkert.org public: 866984Snate@binkert.org %(class_name)s(ExtMachInst _machInst, 876984Snate@binkert.org const char * instMnem, 886984Snate@binkert.org bool isMicro, bool isDelayed, bool isFirst, bool isLast, 896661Snate@binkert.org RegIndex _dest, uint64_t _imm); 906986Snate@binkert.org 916986Snate@binkert.org %(class_name)s(ExtMachInst _machInst, 926986Snate@binkert.org const char * instMnem, 936986Snate@binkert.org RegIndex _dest, uint64_t _imm); 946986Snate@binkert.org 956986Snate@binkert.org %(BasicExecDeclare)s 966986Snate@binkert.org }; 976986Snate@binkert.org}}; 986986Snate@binkert.org 996986Snate@binkert.orgdef template MicroLimmOpDisassembly {{ 1006986Snate@binkert.org std::string %(class_name)s::generateDisassembly(Addr pc, 1016986Snate@binkert.org const SymbolTable *symtab) const 1026987Snate@binkert.org { 1036986Snate@binkert.org std::stringstream response; 1046986Snate@binkert.org 1056986Snate@binkert.org printMnemonic(response, instMnem, mnemonic); 1066986Snate@binkert.org printReg(response, dest); 1076986Snate@binkert.org response << ", "; 1086986Snate@binkert.org ccprintf(response, "%#x", imm); 1096986Snate@binkert.org return response.str(); 1106986Snate@binkert.org } 1116986Snate@binkert.org}}; 1126986Snate@binkert.org 1136986Snate@binkert.orgdef template MicroLimmOpConstructor {{ 1146986Snate@binkert.org 1156986Snate@binkert.org inline void %(class_name)s::buildMe() 1166986Snate@binkert.org { 1176986Snate@binkert.org %(constructor)s; 1186986Snate@binkert.org } 1196986Snate@binkert.org 1206986Snate@binkert.org inline %(class_name)s::%(class_name)s( 1216986Snate@binkert.org ExtMachInst machInst, const char * instMnem, 1226986Snate@binkert.org RegIndex _dest, uint64_t _imm) : 1236987Snate@binkert.org %(base_class)s(machInst, "%(mnemonic)s", instMnem, 1246986Snate@binkert.org false, false, false, false, %(op_class)s), 1256986Snate@binkert.org dest(_dest), imm(_imm) 1266986Snate@binkert.org { 1276986Snate@binkert.org buildMe(); 1286986Snate@binkert.org } 1296986Snate@binkert.org 1306661Snate@binkert.org inline %(class_name)s::%(class_name)s( 1316984Snate@binkert.org ExtMachInst machInst, const char * instMnem, 1326984Snate@binkert.org bool isMicro, bool isDelayed, bool isFirst, bool isLast, 1336984Snate@binkert.org RegIndex _dest, uint64_t _imm) : 1346984Snate@binkert.org %(base_class)s(machInst, "%(mnemonic)s", instMnem, 1356984Snate@binkert.org isMicro, isDelayed, isFirst, isLast, %(op_class)s), 1366661Snate@binkert.org dest(_dest), imm(_imm) 1376984Snate@binkert.org { 1386661Snate@binkert.org buildMe(); 1396984Snate@binkert.org } 1406991Snate@binkert.org}}; 1416991Snate@binkert.org 1426984Snate@binkert.orglet {{ 1436661Snate@binkert.org class LimmOp(X86Microop): 1446984Snate@binkert.org def __init__(self, dest, imm): 1456984Snate@binkert.org self.className = "Limm" 1466661Snate@binkert.org self.mnemonic = "limm" 1476984Snate@binkert.org self.dest = dest 1486984Snate@binkert.org self.imm = imm 1496991Snate@binkert.org 1506984Snate@binkert.org def getAllocator(self, *microFlags): 1516991Snate@binkert.org allocator = '''new %(class_name)s(machInst, mnemonic 1526661Snate@binkert.org %(flags)s, %(dest)s, %(imm)s)''' % { 1536984Snate@binkert.org "class_name" : self.className, 1546984Snate@binkert.org "mnemonic" : self.mnemonic, 1556984Snate@binkert.org "flags" : self.microFlagsText(microFlags), 1566991Snate@binkert.org "dest" : self.dest, "imm" : self.imm } 1572SN/A return allocator 1586984Snate@binkert.org 1596984Snate@binkert.org microopClasses["limm"] = LimmOp 1606984Snate@binkert.org}}; 1616984Snate@binkert.org 1626984Snate@binkert.orglet {{ 1636984Snate@binkert.org # Build up the all register version of this micro op 1642SN/A iop = InstObjParams("limm", "Limm", 'X86MicroopBase', 1656984Snate@binkert.org {"code" : "DestReg = imm;"}) 1666984Snate@binkert.org header_output += MicroLimmOpDeclare.subst(iop) 1676984Snate@binkert.org decoder_output += MicroLimmOpConstructor.subst(iop) 1686984Snate@binkert.org decoder_output += MicroLimmOpDisassembly.subst(iop) 1696984Snate@binkert.org exec_output += MicroLimmOpExecute.subst(iop) 1702SN/A}}; 1716984Snate@binkert.org