basic.isa revision 12236
17087Snate@binkert.org// Copyright (c) 2007 The Hewlett-Packard Development Company 27087Snate@binkert.org// All rights reserved. 37087Snate@binkert.org// 47087Snate@binkert.org// The license below extends only to copyright in the software and shall 57087Snate@binkert.org// not be construed as granting a license to any other intellectual 67087Snate@binkert.org// property including but not limited to intellectual property relating 77087Snate@binkert.org// to a hardware implementation of the functionality of the software 87087Snate@binkert.org// licensed hereunder. You may use the software subject to the license 97087Snate@binkert.org// terms below provided that you ensure that this notice is replicated 107087Snate@binkert.org// unmodified and in its entirety in all distributions of the software, 117087Snate@binkert.org// modified or unmodified, in source code or in binary form. 127087Snate@binkert.org// 134158Sgblack@eecs.umich.edu// Copyright (c) 2007 The Regents of The University of Michigan 144158Sgblack@eecs.umich.edu// All rights reserved. 154158Sgblack@eecs.umich.edu// 164158Sgblack@eecs.umich.edu// Redistribution and use in source and binary forms, with or without 174158Sgblack@eecs.umich.edu// modification, are permitted provided that the following conditions are 184158Sgblack@eecs.umich.edu// met: redistributions of source code must retain the above copyright 194158Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer; 204158Sgblack@eecs.umich.edu// redistributions in binary form must reproduce the above copyright 214158Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the 224158Sgblack@eecs.umich.edu// documentation and/or other materials provided with the distribution; 234158Sgblack@eecs.umich.edu// neither the name of the copyright holders nor the names of its 244158Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from 254158Sgblack@eecs.umich.edu// this software without specific prior written permission. 264158Sgblack@eecs.umich.edu// 274158Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 284158Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 294158Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 304158Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 314158Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 324158Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 334158Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 344158Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 354158Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 364158Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 374158Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 384158Sgblack@eecs.umich.edu// 394158Sgblack@eecs.umich.edu// Authors: Gabe Black 404158Sgblack@eecs.umich.edu 414158Sgblack@eecs.umich.edu// Basic instruction class declaration template. 424158Sgblack@eecs.umich.edudef template BasicDeclare {{ 434158Sgblack@eecs.umich.edu /** 444158Sgblack@eecs.umich.edu * Static instruction class for "%(mnemonic)s". 454158Sgblack@eecs.umich.edu */ 464158Sgblack@eecs.umich.edu class %(class_name)s : public %(base_class)s 474158Sgblack@eecs.umich.edu { 484158Sgblack@eecs.umich.edu public: 494158Sgblack@eecs.umich.edu // Constructor. 504158Sgblack@eecs.umich.edu %(class_name)s(ExtMachInst machInst); 5112236Sgabeblack@google.com Fault execute(ExecContext *, Trace::InstRecord *) const; 524158Sgblack@eecs.umich.edu }; 534158Sgblack@eecs.umich.edu}}; 544158Sgblack@eecs.umich.edu 554158Sgblack@eecs.umich.edu// Basic instruction class constructor template. 564158Sgblack@eecs.umich.edudef template BasicConstructor {{ 5710184SCurtis.Dunham@arm.com %(class_name)s::%(class_name)s(ExtMachInst machInst) 584158Sgblack@eecs.umich.edu : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s) 594158Sgblack@eecs.umich.edu { 604158Sgblack@eecs.umich.edu %(constructor)s; 614158Sgblack@eecs.umich.edu } 624158Sgblack@eecs.umich.edu}}; 634158Sgblack@eecs.umich.edu 644158Sgblack@eecs.umich.edu// Basic instruction class execute method template. 654158Sgblack@eecs.umich.edudef template BasicExecute {{ 6612234Sgabeblack@google.com Fault %(class_name)s::execute(ExecContext *xc, 674158Sgblack@eecs.umich.edu Trace::InstRecord *traceData) const 684158Sgblack@eecs.umich.edu { 694158Sgblack@eecs.umich.edu Fault fault = NoFault; 704158Sgblack@eecs.umich.edu 714158Sgblack@eecs.umich.edu %(fp_enable_check)s; 724158Sgblack@eecs.umich.edu %(op_decl)s; 734158Sgblack@eecs.umich.edu %(op_rd)s; 744158Sgblack@eecs.umich.edu %(code)s; 754158Sgblack@eecs.umich.edu 764158Sgblack@eecs.umich.edu if(fault == NoFault) 774158Sgblack@eecs.umich.edu { 784158Sgblack@eecs.umich.edu %(op_wb)s; 794158Sgblack@eecs.umich.edu } 804158Sgblack@eecs.umich.edu return fault; 814158Sgblack@eecs.umich.edu } 824158Sgblack@eecs.umich.edu}}; 834158Sgblack@eecs.umich.edu 844158Sgblack@eecs.umich.edu// Basic decode template. 854158Sgblack@eecs.umich.edudef template BasicDecode {{ 864158Sgblack@eecs.umich.edu return new %(class_name)s(machInst); 874158Sgblack@eecs.umich.edu}}; 884158Sgblack@eecs.umich.edu 894158Sgblack@eecs.umich.edu// Basic decode template, passing mnemonic in as string arg to constructor. 904158Sgblack@eecs.umich.edudef template BasicDecodeWithMnemonic {{ 914158Sgblack@eecs.umich.edu return new %(class_name)s("%(mnemonic)s", machInst); 924158Sgblack@eecs.umich.edu}}; 935789Sgblack@eecs.umich.edu 945789Sgblack@eecs.umich.edudef format BasicOperate(code, *flags) {{ 955789Sgblack@eecs.umich.edu iop = InstObjParams(name, Name, 'X86ISA::X86StaticInst', code, flags) 965789Sgblack@eecs.umich.edu header_output = BasicDeclare.subst(iop) 975789Sgblack@eecs.umich.edu decoder_output = BasicConstructor.subst(iop) 985789Sgblack@eecs.umich.edu decode_block = BasicDecode.subst(iop) 995789Sgblack@eecs.umich.edu exec_output = BasicExecute.subst(iop) 1005789Sgblack@eecs.umich.edu}}; 101