nop.isa revision 12234:78ece221f9f5
11897Sstever@eecs.umich.edu// Copyright (c) 2006-2007 The Regents of The University of Michigan
24130Ssaidi@eecs.umich.edu// All rights reserved.
31897Sstever@eecs.umich.edu//
41897Sstever@eecs.umich.edu// Redistribution and use in source and binary forms, with or without
51897Sstever@eecs.umich.edu// modification, are permitted provided that the following conditions are
61897Sstever@eecs.umich.edu// met: redistributions of source code must retain the above copyright
71897Sstever@eecs.umich.edu// notice, this list of conditions and the following disclaimer;
81897Sstever@eecs.umich.edu// redistributions in binary form must reproduce the above copyright
91897Sstever@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the
101897Sstever@eecs.umich.edu// documentation and/or other materials provided with the distribution;
111897Sstever@eecs.umich.edu// neither the name of the copyright holders nor the names of its
121897Sstever@eecs.umich.edu// contributors may be used to endorse or promote products derived from
131897Sstever@eecs.umich.edu// this software without specific prior written permission.
141897Sstever@eecs.umich.edu//
151897Sstever@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
161897Sstever@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
171897Sstever@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
181897Sstever@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
191897Sstever@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
201897Sstever@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
211897Sstever@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
221897Sstever@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
231897Sstever@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
241897Sstever@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
251897Sstever@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
261897Sstever@eecs.umich.edu//
271897Sstever@eecs.umich.edu// Authors: Gabe Black
281897Sstever@eecs.umich.edu//          Steve Reinhardt
291897Sstever@eecs.umich.edu
301897Sstever@eecs.umich.edu////////////////////////////////////////////////////////////////////
311897Sstever@eecs.umich.edu//
321897Sstever@eecs.umich.edu// Nop instruction
331897Sstever@eecs.umich.edu//
344961Ssaidi@eecs.umich.edu
351897Sstever@eecs.umich.edu// Per-cpu-model nop execute method.
361897Sstever@eecs.umich.edudef template NopExec {{
371897Sstever@eecs.umich.edu
381897Sstever@eecs.umich.edu    Fault execute(ExecContext *xc, Trace::InstRecord *traceData) const
397047Snate@binkert.org    {
407047Snate@binkert.org        // Nothing to see here, move along
417047Snate@binkert.org        return NoFault;
427047Snate@binkert.org    }
437047Snate@binkert.org}};
447047Snate@binkert.org
457047Snate@binkert.orgoutput header {{
467047Snate@binkert.org        /**
477047Snate@binkert.org         * Nop class.
488127Sgblack@eecs.umich.edu         */
498127Sgblack@eecs.umich.edu        class Nop : public SparcStaticInst
508127Sgblack@eecs.umich.edu        {
518127Sgblack@eecs.umich.edu          public:
528127Sgblack@eecs.umich.edu            // Constructor
538127Sgblack@eecs.umich.edu            Nop(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
547047Snate@binkert.org                SparcStaticInst(mnem, _machInst, __opClass)
557047Snate@binkert.org            {
567047Snate@binkert.org                flags[IsNop] = true;
577047Snate@binkert.org            }
587047Snate@binkert.org
597047Snate@binkert.org            // All Nop instructions do the same thing, so this can be
607047Snate@binkert.org            // defined here. Nops can be defined directly, so there
617047Snate@binkert.org            // needs to be a default implementation.  Interpolate via
627047Snate@binkert.org            // template so i gets expanded to a set of
637047Snate@binkert.org            // cpu-model-specific functions.
647047Snate@binkert.org            %(NopExec)s
657047Snate@binkert.org
667047Snate@binkert.org            std::string generateDisassembly(Addr pc,
671897Sstever@eecs.umich.edu                    const SymbolTable *symtab) const;
681897Sstever@eecs.umich.edu        };
691897Sstever@eecs.umich.edu}};
701897Sstever@eecs.umich.edu
711897Sstever@eecs.umich.eduoutput decoder {{
721897Sstever@eecs.umich.edu        std::string Nop::generateDisassembly(Addr pc,
731897Sstever@eecs.umich.edu                const SymbolTable *symtab) const
741897Sstever@eecs.umich.edu        {
757047Snate@binkert.org            std::stringstream response;
767047Snate@binkert.org            printMnemonic(response, mnemonic);
771897Sstever@eecs.umich.edu            return response.str();
781897Sstever@eecs.umich.edu        }
794961Ssaidi@eecs.umich.edu}};
804961Ssaidi@eecs.umich.edu
814961Ssaidi@eecs.umich.edudef template NopExecute {{
824961Ssaidi@eecs.umich.edu        Fault %(class_name)s::execute(ExecContext *xc,
834961Ssaidi@eecs.umich.edu                Trace::InstRecord *traceData) const
844961Ssaidi@eecs.umich.edu        {
854961Ssaidi@eecs.umich.edu            // Nothing to see here, move along
864961Ssaidi@eecs.umich.edu            return NoFault;
874961Ssaidi@eecs.umich.edu        }
884961Ssaidi@eecs.umich.edu}};
894961Ssaidi@eecs.umich.edu
904961Ssaidi@eecs.umich.edu// Primary format for integer operate instructions:
914961Ssaidi@eecs.umich.edudef format Nop(code, *opt_flags) {{
924961Ssaidi@eecs.umich.edu        iop = InstObjParams(name, Name, 'Nop', code, opt_flags)
931897Sstever@eecs.umich.edu        header_output = BasicDeclare.subst(iop)
941897Sstever@eecs.umich.edu        decoder_output = BasicConstructor.subst(iop)
951897Sstever@eecs.umich.edu        decode_block = BasicDecode.subst(iop)
961897Sstever@eecs.umich.edu        exec_output = NopExecute.subst(iop)
971897Sstever@eecs.umich.edu}};
981897Sstever@eecs.umich.edu