base.isa revision 2089
1// -*- mode:c++ -*- 2 3//////////////////////////////////////////////////////////////////// 4// 5// Base class for MIPS instructions, and some support functions 6// 7 8//Outputs to decoder.hh 9output header {{ 10 /** 11 * Base class for all SPARC static instructions. 12 */ 13 class MipsStaticInst : public StaticInst<MIPSISA> 14 { 15 protected: 16 17 // Constructor. 18 MipsStaticInst(const char *mnem, MachInst _machInst, OpClass __opClass) 19 : StaticInst<SPARCISA>(mnem, _machInst, __opClass) 20 { 21 } 22 23 std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const; 24 }; 25 26}}; 27 28//Ouputs to decoder.cc 29output decoder {{ 30 31 std::string MipsStaticInst::generateDisassembly(Addr pc, const SymbolTable *symtab) const 32 { 33 std::stringstream ss; 34 35 ccprintf(ss, "%-10s ", mnemonic); 36 37 // just print the first two source regs... if there's 38 // a third one, it's a read-modify-write dest (Rc), 39 // e.g. for CMOVxx 40 if(_numSrcRegs > 0) 41 { 42 printReg(ss, _srcRegIdx[0]); 43 } 44 if(_numSrcRegs > 1) 45 { 46 ss << ","; 47 printReg(ss, _srcRegIdx[1]); 48 } 49 50 // just print the first dest... if there's a second one, 51 // it's generally implicit 52 if(_numDestRegs > 0) 53 { 54 if(_numSrcRegs > 0) 55 ss << ","; 56 printReg(ss, _destRegIdx[0]); 57 } 58 59 return ss.str(); 60 } 61 62}}; 63 64