int.isa revision 2043
12SN/A////////////////////////////////////////////////////////////////////
21762SN/A//
32SN/A// Integer operate instructions
42SN/A//
52SN/A
62SN/Aoutput header {{
72SN/A        /**
82SN/A         * Base class for integer operations.
92SN/A         */
102SN/A        class IntOp : public MipsStaticInst
112SN/A        {
122SN/A                protected:
132SN/A
142SN/A                /// Constructor
152SN/A                IntegerOp(const char *mnem, MachInst _machInst, OpClass __opClass) : MipsStaticInst(mnem, _machInst, __opClass)
162SN/A                {
172SN/A                }
182SN/A
192SN/A                std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
202SN/A        };
212SN/A
222SN/A}};
232SN/A
242SN/Aoutput decoder {{
252SN/A        std::string IntOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
262SN/A        {
272665Ssaidi@eecs.umich.edu                return "Disassembly of integer instruction\n";
282665Ssaidi@eecs.umich.edu        }
292665Ssaidi@eecs.umich.edu
302665Ssaidi@eecs.umich.edu        std::string IntImmOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
312SN/A        {
322SN/A                return "Disassembly of integer immediate instruction\n";
332SN/A        }
342SN/A}};
352SN/A
362SN/Adef template IntExecute {{
3775SN/A        Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const
382SN/A        {
392439SN/A                //Attempt to execute the instruction
402439SN/A                try
41603SN/A                {
422986Sgblack@eecs.umich.edu                        %(op_decl)s;
43603SN/A                        %(op_rd)s;
442520SN/A                        %(code)s;
452378SN/A                }
462378SN/A                //If we have an exception for some reason,
47722SN/A                //deal with it
482521SN/A                catch(MipsException except)
492378SN/A                {
50312SN/A                        //Deal with exception
511634SN/A                        return No_Fault;
522680Sktlim@umich.edu                }
531634SN/A
542521SN/A                //Write the resulting state to the execution context
552378SN/A                %(op_wb)s;
562378SN/A
57803SN/A                return No_Fault;
582378SN/A        }
592SN/A}};
602378SN/A
612SN/A// Primary format for integer operate instructions:
622SN/Adef format IntOp(code, *opt_flags) {{
632SN/A        orig_code = code
64603SN/A        cblk = CodeBlock(code)
652901Ssaidi@eecs.umich.edu        iop = InstObjParams(name, Name, 'MipsStaticInst', cblk, opt_flags)
662901Ssaidi@eecs.umich.edu        header_output = BasicDeclare.subst(iop)
672901Ssaidi@eecs.umich.edu        decoder_output = BasicConstructor.subst(iop)
682901Ssaidi@eecs.umich.edu        decode_block = BasicDecodeWithMnemonic.subst(iop)
692901Ssaidi@eecs.umich.edu        exec_output = IntegerExecute.subst(iop)
702901Ssaidi@eecs.umich.edu}};
712902Ssaidi@eecs.umich.edu
722902Ssaidi@eecs.umich.edu