nop.cc revision 12289
1955SN/A// Copyright (c) 2006-2007 The Regents of The University of Michigan
2955SN/A// All rights reserved.
37816Ssteve.reinhardt@amd.com//
45871Snate@binkert.org// Redistribution and use in source and binary forms, with or without
51762SN/A// modification, are permitted provided that the following conditions are
6955SN/A// met: redistributions of source code must retain the above copyright
7955SN/A// notice, this list of conditions and the following disclaimer;
8955SN/A// redistributions in binary form must reproduce the above copyright
9955SN/A// notice, this list of conditions and the following disclaimer in the
10955SN/A// documentation and/or other materials provided with the distribution;
11955SN/A// neither the name of the copyright holders nor the names of its
12955SN/A// contributors may be used to endorse or promote products derived from
13955SN/A// this software without specific prior written permission.
14955SN/A//
15955SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16955SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17955SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18955SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19955SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20955SN/A// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21955SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22955SN/A// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23955SN/A// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24955SN/A// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25955SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26955SN/A//
27955SN/A// Authors: Gabe Black
28955SN/A//          Steve Reinhardt
29955SN/A
302665Ssaidi@eecs.umich.edu////////////////////////////////////////////////////////////////////
312665Ssaidi@eecs.umich.edu//
325863Snate@binkert.org// Nop instruction
33955SN/A//
34955SN/A
35955SN/A// Per-cpu-model nop execute method.
36955SN/Adef template NopExec {{
37955SN/A}};
382632Sstever@eecs.umich.edu
392632Sstever@eecs.umich.eduoutput header {{
402632Sstever@eecs.umich.edu        /**
412632Sstever@eecs.umich.edu         * Nop class.
42955SN/A         */
432632Sstever@eecs.umich.edu        class Nop : public SparcStaticInst
442632Sstever@eecs.umich.edu        {
452761Sstever@eecs.umich.edu          public:
462632Sstever@eecs.umich.edu            // Constructor
472632Sstever@eecs.umich.edu            Nop(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
482632Sstever@eecs.umich.edu                SparcStaticInst(mnem, _machInst, __opClass)
492761Sstever@eecs.umich.edu            {
502761Sstever@eecs.umich.edu                flags[IsNop] = true;
512761Sstever@eecs.umich.edu            }
522632Sstever@eecs.umich.edu
532632Sstever@eecs.umich.edu            Fault
542761Sstever@eecs.umich.edu            execute(ExecContext *xc, Trace::InstRecord *traceData) const
552761Sstever@eecs.umich.edu            {
562761Sstever@eecs.umich.edu                return NoFault;
572761Sstever@eecs.umich.edu            }
582761Sstever@eecs.umich.edu
592632Sstever@eecs.umich.edu            std::string generateDisassembly(Addr pc,
602632Sstever@eecs.umich.edu                    const SymbolTable *symtab) const;
612632Sstever@eecs.umich.edu        };
622632Sstever@eecs.umich.edu}};
632632Sstever@eecs.umich.edu
642632Sstever@eecs.umich.eduoutput decoder {{
652632Sstever@eecs.umich.edu        std::string Nop::generateDisassembly(Addr pc,
66955SN/A                const SymbolTable *symtab) const
67955SN/A        {
68955SN/A            std::stringstream response;
695863Snate@binkert.org            printMnemonic(response, mnemonic);
705863Snate@binkert.org            return response.str();
715863Snate@binkert.org        }
725863Snate@binkert.org}};
735863Snate@binkert.org
745863Snate@binkert.orgdef template NopExecute {{
755863Snate@binkert.org        Fault %(class_name)s::execute(ExecContext *xc,
765863Snate@binkert.org                Trace::InstRecord *traceData) const
775863Snate@binkert.org        {
785863Snate@binkert.org            // Nothing to see here, move along
795863Snate@binkert.org            return NoFault;
805863Snate@binkert.org        }
815863Snate@binkert.org}};
825863Snate@binkert.org
835863Snate@binkert.org// Primary format for integer operate instructions:
845863Snate@binkert.orgdef format Nop(code, *opt_flags) {{
855863Snate@binkert.org        iop = InstObjParams(name, Name, 'Nop', code, opt_flags)
865863Snate@binkert.org        header_output = BasicDeclare.subst(iop)
875863Snate@binkert.org        decoder_output = BasicConstructor.subst(iop)
885863Snate@binkert.org        decode_block = BasicDecode.subst(iop)
895863Snate@binkert.org        exec_output = NopExecute.subst(iop)
905863Snate@binkert.org}};
915863Snate@binkert.org