12686Sksewell@umich.edu// -*- mode:c++ -*-
22686Sksewell@umich.edu
35268Sksewell@umich.edu// Copyright (c) 2007 MIPS Technologies, Inc.
45268Sksewell@umich.edu// All rights reserved.
55268Sksewell@umich.edu//
65268Sksewell@umich.edu// Redistribution and use in source and binary forms, with or without
75268Sksewell@umich.edu// modification, are permitted provided that the following conditions are
85268Sksewell@umich.edu// met: redistributions of source code must retain the above copyright
95268Sksewell@umich.edu// notice, this list of conditions and the following disclaimer;
105268Sksewell@umich.edu// redistributions in binary form must reproduce the above copyright
115268Sksewell@umich.edu// notice, this list of conditions and the following disclaimer in the
125268Sksewell@umich.edu// documentation and/or other materials provided with the distribution;
135268Sksewell@umich.edu// neither the name of the copyright holders nor the names of its
145268Sksewell@umich.edu// contributors may be used to endorse or promote products derived from
155268Sksewell@umich.edu// this software without specific prior written permission.
165268Sksewell@umich.edu//
175268Sksewell@umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
185268Sksewell@umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
195268Sksewell@umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
205268Sksewell@umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
215268Sksewell@umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
225268Sksewell@umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
235268Sksewell@umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
245268Sksewell@umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
255268Sksewell@umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
265268Sksewell@umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
275268Sksewell@umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
285268Sksewell@umich.edu//
295268Sksewell@umich.edu// Authors: Korey Sewell
302706Sksewell@umich.edu
312038SN/A////////////////////////////////////////////////////////////////////
322038SN/A//
332038SN/A// TlbOp instructions
342038SN/A//
352038SN/A
362038SN/Aoutput header {{
372038SN/A        /**
382038SN/A         * Base class for integer operations.
392038SN/A         */
402038SN/A        class TlbOp : public MipsStaticInst
412038SN/A        {
422038SN/A                protected:
432038SN/A
442038SN/A                /// Constructor
452038SN/A                TlbOp(const char *mnem, MachInst _machInst, OpClass __opClass) : MipsStaticInst(mnem, _machInst, __opClass)
462038SN/A                {
472038SN/A                }
482038SN/A
4912616Sgabeblack@google.com                std::string generateDisassembly(
5012616Sgabeblack@google.com                        Addr pc, const SymbolTable *symtab) const override;
512038SN/A        };
522038SN/A}};
532038SN/A
542038SN/Aoutput decoder {{
552038SN/A        std::string TlbOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
562038SN/A        {
572038SN/A                return "Disassembly of integer instruction\n";
582038SN/A        }
592038SN/A}};
602038SN/A
612038SN/Adef template TlbOpExecute {{
6212234Sgabeblack@google.com        Fault %(class_name)s::execute(
6312234Sgabeblack@google.com            ExecContext *xc, Trace::InstRecord *traceData) const
642038SN/A        {
652038SN/A                //Write the resulting state to the execution context
662038SN/A                %(op_wb)s;
672038SN/A
682686Sksewell@umich.edu                //Call into the trap handler with the appropriate fault
692038SN/A                return No_Fault;
702038SN/A        }
712038SN/A}};
722038SN/A
732038SN/A// Primary format for integer operate instructions:
742038SN/Adef format TlbOp(code, *opt_flags) {{
754661Sksewell@umich.edu        orig_code = code
764661Sksewell@umich.edu        cblk = code
774661Sksewell@umich.edu        iop = InstObjParams(name, Name, 'MipsStaticInst', cblk, opt_flags)
782038SN/A        header_output = BasicDeclare.subst(iop)
792038SN/A        decoder_output = BasicConstructor.subst(iop)
802038SN/A        decode_block = BasicDecodeWithMnemonic.subst(iop)
812038SN/A        exec_output = TlbOpExecute.subst(iop)
822038SN/A}};
83