basic.isa revision 12616
16019SN/A// -*- mode:c++ -*- 26019SN/A 310037SARM gem5 Developers// Copyright (c) 2011 ARM Limited 410037SARM gem5 Developers// All rights reserved 510037SARM gem5 Developers// 610037SARM gem5 Developers// The license below extends only to copyright in the software and shall 710037SARM gem5 Developers// not be construed as granting a license to any other intellectual 810037SARM gem5 Developers// property including but not limited to intellectual property relating 910037SARM gem5 Developers// to a hardware implementation of the functionality of the software 1010037SARM gem5 Developers// licensed hereunder. You may use the software subject to the license 1110037SARM gem5 Developers// terms below provided that you ensure that this notice is replicated 1210037SARM gem5 Developers// unmodified and in its entirety in all distributions of the software, 1310037SARM gem5 Developers// modified or unmodified, in source code or in binary form. 1410037SARM gem5 Developers// 156019SN/A// Copyright (c) 2007-2008 The Florida State University 166019SN/A// All rights reserved. 176019SN/A// 186019SN/A// Redistribution and use in source and binary forms, with or without 196019SN/A// modification, are permitted provided that the following conditions are 206019SN/A// met: redistributions of source code must retain the above copyright 216019SN/A// notice, this list of conditions and the following disclaimer; 226019SN/A// redistributions in binary form must reproduce the above copyright 236019SN/A// notice, this list of conditions and the following disclaimer in the 246019SN/A// documentation and/or other materials provided with the distribution; 256019SN/A// neither the name of the copyright holders nor the names of its 266019SN/A// contributors may be used to endorse or promote products derived from 276019SN/A// this software without specific prior written permission. 286019SN/A// 296019SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 306019SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 316019SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 326019SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 336019SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 346019SN/A// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 356019SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 366019SN/A// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 376019SN/A// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 386019SN/A// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 396019SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 406019SN/A// 416019SN/A// Authors: Stephen Hines 426019SN/A 436019SN/A// Basic instruction class declaration template. 446019SN/Adef template BasicDeclare {{ 456019SN/A /** 466019SN/A * Static instruction class for "%(mnemonic)s". 476019SN/A */ 486019SN/A class %(class_name)s : public %(base_class)s 496019SN/A { 506019SN/A public: 516019SN/A /// Constructor. 526250SN/A %(class_name)s(ExtMachInst machInst); 5312616Sgabeblack@google.com Fault execute(ExecContext *, 5412616Sgabeblack@google.com Trace::InstRecord *) const override; 556019SN/A }; 566019SN/A}}; 576019SN/A 586019SN/A// Basic instruction class constructor template. 596019SN/Adef template BasicConstructor {{ 608737Skoansin.tan@gmail.com %(class_name)s::%(class_name)s(ExtMachInst machInst) : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s) 616019SN/A { 626019SN/A %(constructor)s; 637848SAli.Saidi@ARM.com if (!(condCode == COND_AL || condCode == COND_UC)) { 647848SAli.Saidi@ARM.com for (int x = 0; x < _numDestRegs; x++) { 657848SAli.Saidi@ARM.com _srcRegIdx[_numSrcRegs++] = _destRegIdx[x]; 667848SAli.Saidi@ARM.com } 677848SAli.Saidi@ARM.com } 686019SN/A } 696019SN/A}}; 706019SN/A 7110037SARM gem5 Developersdef template BasicConstructor64 {{ 7210184SCurtis.Dunham@arm.com %(class_name)s::%(class_name)s(ExtMachInst machInst) : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s) 7310037SARM gem5 Developers { 7410037SARM gem5 Developers %(constructor)s; 7510037SARM gem5 Developers } 7610037SARM gem5 Developers}}; 7710037SARM gem5 Developers 786019SN/A 796019SN/A// Basic instruction class execute method template. 806019SN/Adef template BasicExecute {{ 8112234Sgabeblack@google.com Fault %(class_name)s::execute( 8212234Sgabeblack@google.com ExecContext *xc, Trace::InstRecord *traceData) const 836019SN/A { 846019SN/A Fault fault = NoFault; 856019SN/A 866019SN/A %(op_decl)s; 876019SN/A %(op_rd)s; 886019SN/A %(code)s; 896019SN/A 906019SN/A if (fault == NoFault) 916019SN/A { 926019SN/A %(op_wb)s; 936019SN/A } 946019SN/A return fault; 956019SN/A } 966019SN/A}}; 976019SN/A 986019SN/A// Basic decode template. 996019SN/Adef template BasicDecode {{ 1006019SN/A return new %(class_name)s(machInst); 1016019SN/A}}; 1026019SN/A 1036019SN/A// Basic decode template, passing mnemonic in as string arg to constructor. 1046019SN/Adef template BasicDecodeWithMnemonic {{ 1056019SN/A return new %(class_name)s("%(mnemonic)s", machInst); 1066019SN/A}}; 107