trap.isa revision 2022
17893SN/A////////////////////////////////////////////////////////////////////
27893SN/A//
37893SN/A// Trap instructions
49988Snilay@cs.wisc.edu//
58825Snilay@cs.wisc.edu
69988Snilay@cs.wisc.eduoutput header {{
77893SN/A        /**
87893SN/A         * Base class for integer operations.
97893SN/A         */
107893SN/A        class Trap : public SparcStaticInst
117893SN/A        {
127893SN/A                protected:
1310315Snilay@cs.wisc.edu
148825Snilay@cs.wisc.edu                /// Constructor
159885Sstever@gmail.com                Trap(const char *mnem, MachInst _machInst, OpClass __opClass) : SparcStaticInst(mnem, _machInst, __opClass)
169885Sstever@gmail.com                {
179988Snilay@cs.wisc.edu                }
188825Snilay@cs.wisc.edu
198825Snilay@cs.wisc.edu                std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
2010315Snilay@cs.wisc.edu        };
218825Snilay@cs.wisc.edu}};
2210242Ssteve.reinhardt@amd.com
239449SAli.Saidi@ARM.comoutput decoder {{
249449SAli.Saidi@ARM.com        std::string Trap::generateDisassembly(Addr pc, const SymbolTable *symtab) const
258464SN/A        {
268721SN/A                return "Disassembly of integer instruction\n";
278825Snilay@cs.wisc.edu        }
288825Snilay@cs.wisc.edu}};
297935SN/A
307935SN/Adef template TrapExecute {{
317935SN/A        Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const
327935SN/A        {
337935SN/A                //Call into the trap handler with the appropriate fault
347935SN/A                return No_Fault;
357935SN/A        }
368983Snate@binkert.org
377893SN/A                //Write the resulting state to the execution context
389885Sstever@gmail.com                %(op_wb)s;
399885Sstever@gmail.com
409885Sstever@gmail.com                return No_Fault;
4110315Snilay@cs.wisc.edu        }
429988Snilay@cs.wisc.edu}};
4310315Snilay@cs.wisc.edu
449885Sstever@gmail.com// Primary format for integer operate instructions:
459885Sstever@gmail.comdef format Trap(code, *opt_flags) {{
467893SN/A        orig_code = code
477893SN/A        cblk = CodeBlock(code)
489885Sstever@gmail.com        iop = InstObjParams(name, Name, 'SparcStaticInst', cblk, opt_flags)
497893SN/A        header_output = BasicDeclare.subst(iop)
507893SN/A        decoder_output = BasicConstructor.subst(iop)
518241SN/A        decode_block = BasicDecodeWithMnemonic.subst(iop)
528241SN/A        exec_output = TrapExecute.subst(iop)
537893SN/A}};
547893SN/A