mem.isa revision 2022
112855Sgabeblack@google.com//////////////////////////////////////////////////////////////////// 212855Sgabeblack@google.com// 312855Sgabeblack@google.com// Mem instructions 412855Sgabeblack@google.com// 512855Sgabeblack@google.com 612855Sgabeblack@google.comoutput header {{ 712855Sgabeblack@google.com /** 812855Sgabeblack@google.com * Base class for integer operations. 912855Sgabeblack@google.com */ 1012855Sgabeblack@google.com class Mem : public SparcStaticInst 1112855Sgabeblack@google.com { 1212855Sgabeblack@google.com protected: 1312855Sgabeblack@google.com 1412855Sgabeblack@google.com /// Constructor 1512855Sgabeblack@google.com Mem(const char *mnem, MachInst _machInst, OpClass __opClass) : SparcStaticInst(mnem, _machInst, __opClass) 1612855Sgabeblack@google.com { 1712855Sgabeblack@google.com } 1812855Sgabeblack@google.com 1912855Sgabeblack@google.com std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const; 2012855Sgabeblack@google.com }; 2112855Sgabeblack@google.com}}; 2212855Sgabeblack@google.com 2312855Sgabeblack@google.comoutput decoder {{ 2412855Sgabeblack@google.com std::string Mem::generateDisassembly(Addr pc, const SymbolTable *symtab) const 2512855Sgabeblack@google.com { 2612855Sgabeblack@google.com return "Disassembly of integer instruction\n"; 2712855Sgabeblack@google.com } 2812855Sgabeblack@google.com}}; 2912855Sgabeblack@google.com 3012855Sgabeblack@google.comdef template MemExecute {{ 3112855Sgabeblack@google.com Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const 3212855Sgabeblack@google.com { 3312855Sgabeblack@google.com //Attempt to execute the instruction 3412855Sgabeblack@google.com try 3512855Sgabeblack@google.com { 3612855Sgabeblack@google.com 3712855Sgabeblack@google.com %(op_decl)s; 3812855Sgabeblack@google.com %(op_rd)s; 3912855Sgabeblack@google.com ea_code 4012855Sgabeblack@google.com %(code)s; 4112855Sgabeblack@google.com } 4212855Sgabeblack@google.com //If we have an exception for some reason, 4312855Sgabeblack@google.com //deal with it 4412855Sgabeblack@google.com catch(SparcException except) 4512855Sgabeblack@google.com { 4612855Sgabeblack@google.com //Deal with exception 4712855Sgabeblack@google.com return No_Fault; 4812855Sgabeblack@google.com } 4912855Sgabeblack@google.com 5012855Sgabeblack@google.com //Write the resulting state to the execution context 5112855Sgabeblack@google.com %(op_wb)s; 5212855Sgabeblack@google.com 5312855Sgabeblack@google.com return No_Fault; 5412855Sgabeblack@google.com } 5512855Sgabeblack@google.com}}; 5612855Sgabeblack@google.com 5712855Sgabeblack@google.com// Primary format for integer operate instructions: 5812855Sgabeblack@google.comdef format Mem(code, *opt_flags) {{ 5912855Sgabeblack@google.com orig_code = code 6012855Sgabeblack@google.com cblk = CodeBlock(code) 6112855Sgabeblack@google.com iop = InstObjParams(name, Name, 'SparcStaticInst', cblk, opt_flags) 6212855Sgabeblack@google.com header_output = BasicDeclare.subst(iop) 6312855Sgabeblack@google.com decoder_output = BasicConstructor.subst(iop) 6412855Sgabeblack@google.com decode_block = BasicDecodeWithMnemonic.subst(iop) 6512855Sgabeblack@google.com exec_output = MemExecute.subst(iop) 6612855Sgabeblack@google.com exec_output.replace('ea_code', 'EA = I ? (R1 + SIMM13) : R1 + R2;'); 6712855Sgabeblack@google.com}}; 6812855Sgabeblack@google.com 6912855Sgabeblack@google.comdef format Cas(code, *opt_flags) {{ 7012855Sgabeblack@google.com orig_code = code 7112855Sgabeblack@google.com cblk = CodeBlock(code) 7212855Sgabeblack@google.com iop = InstObjParams(name, Name, 'SparcStaticInst', cblk, opt_flags) 7312855Sgabeblack@google.com header_output = BasicDeclare.subst(iop) 7412855Sgabeblack@google.com decoder_output = BasicConstructor.subst(iop) 7512855Sgabeblack@google.com decode_block = BasicDecodeWithMnemonic.subst(iop) 7612855Sgabeblack@google.com exec_output = MemExecute.subst(iop) 7712855Sgabeblack@google.com exec_output.replace('ea_code', 'EA = R1;'); 7812855Sgabeblack@google.com}}; 7912855Sgabeblack@google.com