trap.isa revision 2516
1////////////////////////////////////////////////////////////////////
2//
3// Trap instructions
4//
5
6output header {{
7        /**
8         * Base class for trap instructions,
9         * or instructions that always fault.
10         */
11        class Trap : public SparcStaticInst
12        {
13          protected:
14
15            // Constructor
16            Trap(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
17                SparcStaticInst(mnem, _machInst, __opClass)
18            {
19            }
20
21            std::string generateDisassembly(Addr pc,
22                    const SymbolTable *symtab) const;
23        };
24}};
25
26output decoder {{
27        std::string Trap::generateDisassembly(Addr pc,
28                const SymbolTable *symtab) const
29        {
30            return "Trap instruction";
31        }
32}};
33
34def template TrapExecute {{
35        Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
36                Trace::InstRecord *traceData) const
37        {
38            Fault fault = NoFault;
39            %(op_decl)s;
40            %(op_rd)s;
41            %(code)s
42            return fault;
43        }
44}};
45
46def format Trap(code, *opt_flags) {{
47        orig_code = code
48        cblk = CodeBlock(code)
49        iop = InstObjParams(name, Name, 'Trap', cblk, opt_flags)
50        header_output = BasicDeclare.subst(iop)
51        decoder_output = BasicConstructor.subst(iop)
52        decode_block = BasicDecode.subst(iop)
53        exec_output = TrapExecute.subst(iop)
54}};
55