int.isa revision 2043
1//////////////////////////////////////////////////////////////////// 2// 3// Integer operate instructions 4// 5 6output header {{ 7 /** 8 * Base class for integer operations. 9 */ 10 class IntOp : public MipsStaticInst 11 { 12 protected: 13 14 /// Constructor 15 IntegerOp(const char *mnem, MachInst _machInst, OpClass __opClass) : MipsStaticInst(mnem, _machInst, __opClass) 16 { 17 } 18 19 std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const; 20 }; 21 22}}; 23 24output decoder {{ 25 std::string IntOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const 26 { 27 return "Disassembly of integer instruction\n"; 28 } 29 30 std::string IntImmOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const 31 { 32 return "Disassembly of integer immediate instruction\n"; 33 } 34}}; 35 36def template IntExecute {{ 37 Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const 38 { 39 //Attempt to execute the instruction 40 try 41 { 42 %(op_decl)s; 43 %(op_rd)s; 44 %(code)s; 45 } 46 //If we have an exception for some reason, 47 //deal with it 48 catch(MipsException except) 49 { 50 //Deal with exception 51 return No_Fault; 52 } 53 54 //Write the resulting state to the execution context 55 %(op_wb)s; 56 57 return No_Fault; 58 } 59}}; 60 61// Primary format for integer operate instructions: 62def format IntOp(code, *opt_flags) {{ 63 orig_code = code 64 cblk = CodeBlock(code) 65 iop = InstObjParams(name, Name, 'MipsStaticInst', cblk, opt_flags) 66 header_output = BasicDeclare.subst(iop) 67 decoder_output = BasicConstructor.subst(iop) 68 decode_block = BasicDecodeWithMnemonic.subst(iop) 69 exec_output = IntegerExecute.subst(iop) 70}}; 71 72