basicmem.isa revision 2469
1//////////////////////////////////////////////////////////////////// 2// 3// Mem instructions 4// 5 6output header {{ 7 /** 8 * Base class for integer operations. 9 */ 10 class Mem : public SparcStaticInst 11 { 12 protected: 13 14 // Constructor 15 Mem(const char *mnem, ExtMachInst _machInst, OpClass __opClass) : 16 SparcStaticInst(mnem, _machInst, __opClass) 17 { 18 } 19 20 std::string generateDisassembly(Addr pc, 21 const SymbolTable *symtab) const; 22 }; 23}}; 24 25output decoder {{ 26 std::string Mem::generateDisassembly(Addr pc, const SymbolTable *symtab) const 27 { 28 return "Memory instruction\n"; 29 } 30}}; 31 32def template MemExecute {{ 33 Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, 34 Trace::InstRecord *traceData) const 35 { 36 Fault fault = NoFault; 37 %(op_decl)s; 38 %(op_rd)s; 39 ea_code 40 %(code)s; 41 42 if(fault == NoFault) 43 { 44 //Write the resulting state to the execution context 45 %(op_wb)s; 46 } 47 48 return fault; 49 } 50}}; 51 52// Primary format for integer operate instructions: 53def format Mem(code, *opt_flags) {{ 54 orig_code = code 55 cblk = CodeBlock(code) 56 iop = InstObjParams(name, Name, 'SparcStaticInst', cblk, opt_flags) 57 header_output = BasicDeclare.subst(iop) 58 decoder_output = BasicConstructor.subst(iop) 59 decode_block = BasicDecode.subst(iop) 60 exec_output = MemExecute.subst(iop) 61 exec_output.replace('ea_code', 'EA = I ? (R1 + SIMM13) : R1 + R2;'); 62}}; 63