int.isa revision 2043
12131SN/A//////////////////////////////////////////////////////////////////// 25224Sksewell@umich.edu// 35224Sksewell@umich.edu// Integer operate instructions 42131SN/A// 55224Sksewell@umich.edu 65224Sksewell@umich.eduoutput header {{ 75224Sksewell@umich.edu /** 85224Sksewell@umich.edu * Base class for integer operations. 95224Sksewell@umich.edu */ 105224Sksewell@umich.edu class IntOp : public MipsStaticInst 115224Sksewell@umich.edu { 125224Sksewell@umich.edu protected: 135224Sksewell@umich.edu 145224Sksewell@umich.edu /// Constructor 152131SN/A IntegerOp(const char *mnem, MachInst _machInst, OpClass __opClass) : MipsStaticInst(mnem, _machInst, __opClass) 165224Sksewell@umich.edu { 175224Sksewell@umich.edu } 185224Sksewell@umich.edu 195224Sksewell@umich.edu std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const; 205224Sksewell@umich.edu }; 215224Sksewell@umich.edu 225224Sksewell@umich.edu}}; 235224Sksewell@umich.edu 245224Sksewell@umich.eduoutput decoder {{ 255224Sksewell@umich.edu std::string IntOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const 265224Sksewell@umich.edu { 272665Ssaidi@eecs.umich.edu return "Disassembly of integer instruction\n"; 285224Sksewell@umich.edu } 295224Sksewell@umich.edu 305222Sksewell@umich.edu std::string IntImmOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const 312131SN/A { 322131SN/A return "Disassembly of integer immediate instruction\n"; 332239SN/A } 342239SN/A}}; 352131SN/A 362131SN/Adef template IntExecute {{ 372447SN/A Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const 382447SN/A { 392447SN/A //Attempt to execute the instruction 402447SN/A try 412447SN/A { 422447SN/A %(op_decl)s; 432131SN/A %(op_rd)s; 442239SN/A %(code)s; 452131SN/A } 462447SN/A //If we have an exception for some reason, 472447SN/A //deal with it 482447SN/A catch(MipsException except) 492131SN/A { 505222Sksewell@umich.edu //Deal with exception 515222Sksewell@umich.edu return No_Fault; 525222Sksewell@umich.edu } 535222Sksewell@umich.edu 545222Sksewell@umich.edu //Write the resulting state to the execution context 552447SN/A %(op_wb)s; 565222Sksewell@umich.edu 575222Sksewell@umich.edu return No_Fault; 585222Sksewell@umich.edu } 592447SN/A}}; 602447SN/A 612447SN/A// Primary format for integer operate instructions: 622131SN/Adef format IntOp(code, *opt_flags) {{ 632131SN/A orig_code = code 642447SN/A cblk = CodeBlock(code) 652131SN/A iop = InstObjParams(name, Name, 'MipsStaticInst', cblk, opt_flags) 662447SN/A header_output = BasicDeclare.subst(iop) 672447SN/A decoder_output = BasicConstructor.subst(iop) 682447SN/A decode_block = BasicDecodeWithMnemonic.subst(iop) 692447SN/A exec_output = IntegerExecute.subst(iop) 702131SN/A}}; 714695Sgblack@eecs.umich.edu 722447SN/A