nop.isa revision 2516
1////////////////////////////////////////////////////////////////////
2//
3// Nop instruction
4//
5
6output header {{
7        /**
8         * Nop class.
9         */
10        class Nop : public SparcStaticInst
11        {
12          public:
13            // Constructor
14            Nop(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
15                SparcStaticInst(mnem, _machInst, __opClass)
16            {
17            }
18
19            // All Nop instructions do the same thing, so this can be
20            // defined here. Nops can be defined directly, so there needs
21            // to be a default implementation
22            Fault execute(%(CPU_exec_context)s *xc,
23                Trace::InstRecord *traceData) const
24            {
25                //Nothing to see here, move along
26                return NoFault;
27            }
28
29            std::string generateDisassembly(Addr pc,
30                    const SymbolTable *symtab) const;
31        };
32}};
33
34output decoder {{
35        std::string Nop::generateDisassembly(Addr pc,
36                const SymbolTable *symtab) const
37        {
38            std::stringstream response;
39            printMnemonic(response, mnemonic);
40            return response.str();
41        }
42}};
43
44def template NopExecute {{
45        Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
46                Trace::InstRecord *traceData) const
47        {
48            //Nothing to see here, move along
49            return NoFault;
50        }
51}};
52
53// Primary format for integer operate instructions:
54def format Nop(code, *opt_flags) {{
55        orig_code = code
56        cblk = CodeBlock(code)
57        iop = InstObjParams(name, Name, 'Nop', cblk, opt_flags)
58        header_output = BasicDeclare.subst(iop)
59        decoder_output = BasicConstructor.subst(iop)
60        decode_block = BasicDecode.subst(iop)
61        exec_output = NopExecute.subst(iop)
62}};
63