2006-01-29 23:25:54 +01:00
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Mem instructions
|
|
|
|
//
|
|
|
|
|
|
|
|
output header {{
|
|
|
|
/**
|
|
|
|
* Base class for integer operations.
|
|
|
|
*/
|
|
|
|
class Mem : public SparcStaticInst
|
|
|
|
{
|
2006-03-07 10:33:10 +01:00
|
|
|
protected:
|
2006-01-29 23:25:54 +01:00
|
|
|
|
2006-03-07 10:33:10 +01:00
|
|
|
// Constructor
|
2006-03-16 19:58:50 +01:00
|
|
|
Mem(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
|
2006-03-07 10:33:10 +01:00
|
|
|
SparcStaticInst(mnem, _machInst, __opClass)
|
|
|
|
{
|
|
|
|
}
|
2006-01-29 23:25:54 +01:00
|
|
|
|
2006-03-07 10:33:10 +01:00
|
|
|
std::string generateDisassembly(Addr pc,
|
|
|
|
const SymbolTable *symtab) const;
|
2006-01-29 23:25:54 +01:00
|
|
|
};
|
|
|
|
}};
|
|
|
|
|
|
|
|
output decoder {{
|
|
|
|
std::string Mem::generateDisassembly(Addr pc, const SymbolTable *symtab) const
|
|
|
|
{
|
2006-03-07 10:33:10 +01:00
|
|
|
return "Memory instruction\n";
|
2006-01-29 23:25:54 +01:00
|
|
|
}
|
|
|
|
}};
|
|
|
|
|
|
|
|
def template MemExecute {{
|
2006-03-07 10:33:10 +01:00
|
|
|
Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
|
|
|
|
Trace::InstRecord *traceData) const
|
2006-01-29 23:25:54 +01:00
|
|
|
{
|
2006-03-07 10:33:10 +01:00
|
|
|
Fault fault = NoFault;
|
2006-03-28 22:13:57 +02:00
|
|
|
Addr EA;
|
2006-03-07 10:33:10 +01:00
|
|
|
%(op_decl)s;
|
|
|
|
%(op_rd)s;
|
2006-03-28 22:13:57 +02:00
|
|
|
%(ea_code)s;
|
2006-03-07 10:33:10 +01:00
|
|
|
%(code)s;
|
2006-01-29 23:25:54 +01:00
|
|
|
|
2006-03-07 10:33:10 +01:00
|
|
|
if(fault == NoFault)
|
|
|
|
{
|
2006-01-29 23:25:54 +01:00
|
|
|
//Write the resulting state to the execution context
|
|
|
|
%(op_wb)s;
|
2006-03-07 10:33:10 +01:00
|
|
|
}
|
2006-01-29 23:25:54 +01:00
|
|
|
|
2006-03-07 10:33:10 +01:00
|
|
|
return fault;
|
2006-01-29 23:25:54 +01:00
|
|
|
}
|
|
|
|
}};
|
|
|
|
|
|
|
|
// Primary format for integer operate instructions:
|
|
|
|
def format Mem(code, *opt_flags) {{
|
2006-03-29 02:36:34 +02:00
|
|
|
addrCalc = 'EA = I ? (Rs1 + SIMM13) : Rs1 + Rs2;'
|
|
|
|
composite = code + '\n' + addrCalc
|
|
|
|
origCodeBlk = CodeBlock(code)
|
|
|
|
compositeBlk = CodeBlock(composite)
|
|
|
|
addrCalcBlk = CodeBlock(addrCalc)
|
|
|
|
iop = InstObjParams(name, Name, 'SparcStaticInst', compositeBlk, opt_flags)
|
|
|
|
iop.code = origCodeBlk.code
|
|
|
|
iop.orig_code = origCodeBlk.orig_code
|
|
|
|
iop.ea_code = addrCalcBlk.code
|
2006-01-29 23:25:54 +01:00
|
|
|
header_output = BasicDeclare.subst(iop)
|
|
|
|
decoder_output = BasicConstructor.subst(iop)
|
2006-03-16 19:58:50 +01:00
|
|
|
decode_block = BasicDecode.subst(iop)
|
2006-01-29 23:25:54 +01:00
|
|
|
exec_output = MemExecute.subst(iop)
|
|
|
|
}};
|