2006-02-16 08:39:46 +01:00
|
|
|
// -*- mode:c++ -*-
|
|
|
|
|
2006-02-15 20:08:54 +01:00
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2006-02-16 08:39:46 +01:00
|
|
|
// Base class for MIPS instructions, and some support functions
|
2006-02-15 20:08:54 +01:00
|
|
|
//
|
|
|
|
|
2006-02-16 08:39:46 +01:00
|
|
|
//Outputs to decoder.hh
|
2006-02-15 20:08:54 +01:00
|
|
|
output header {{
|
|
|
|
/**
|
|
|
|
* Base class for all SPARC static instructions.
|
|
|
|
*/
|
2006-02-16 08:39:46 +01:00
|
|
|
class MipsStaticInst : public StaticInst<MIPSISA>
|
2006-02-15 20:08:54 +01:00
|
|
|
{
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// Constructor.
|
2006-02-16 08:39:46 +01:00
|
|
|
MipsStaticInst(const char *mnem, MachInst _machInst, OpClass __opClass)
|
2006-02-19 05:17:45 +01:00
|
|
|
: StaticInst<MIPSISA>(mnem, _machInst, __opClass)
|
2006-02-15 20:08:54 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
}};
|
|
|
|
|
2006-02-16 08:39:46 +01:00
|
|
|
//Ouputs to decoder.cc
|
2006-02-15 20:08:54 +01:00
|
|
|
output decoder {{
|
|
|
|
|
2006-02-16 08:39:46 +01:00
|
|
|
std::string MipsStaticInst::generateDisassembly(Addr pc, const SymbolTable *symtab) const
|
2006-02-15 20:08:54 +01:00
|
|
|
{
|
|
|
|
std::stringstream ss;
|
|
|
|
|
|
|
|
ccprintf(ss, "%-10s ", mnemonic);
|
|
|
|
|
|
|
|
// just print the first two source regs... if there's
|
|
|
|
// a third one, it's a read-modify-write dest (Rc),
|
|
|
|
// e.g. for CMOVxx
|
|
|
|
if(_numSrcRegs > 0)
|
|
|
|
{
|
|
|
|
printReg(ss, _srcRegIdx[0]);
|
|
|
|
}
|
|
|
|
if(_numSrcRegs > 1)
|
|
|
|
{
|
|
|
|
ss << ",";
|
|
|
|
printReg(ss, _srcRegIdx[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// just print the first dest... if there's a second one,
|
|
|
|
// it's generally implicit
|
|
|
|
if(_numDestRegs > 0)
|
|
|
|
{
|
|
|
|
if(_numSrcRegs > 0)
|
|
|
|
ss << ",";
|
|
|
|
printReg(ss, _destRegIdx[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ss.str();
|
|
|
|
}
|
|
|
|
|
|
|
|
}};
|
|
|
|
|