2006-01-29 23:25:54 +01:00
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Branch instructions
|
|
|
|
//
|
|
|
|
|
|
|
|
output header {{
|
|
|
|
/**
|
|
|
|
* Base class for integer operations.
|
|
|
|
*/
|
|
|
|
class Branch : public SparcStaticInst
|
|
|
|
{
|
2006-03-07 10:33:10 +01:00
|
|
|
protected:
|
|
|
|
// Constructor
|
|
|
|
Branch(const char *mnem, MachInst _machInst, OpClass __opClass) :
|
|
|
|
SparcStaticInst(mnem, _machInst, __opClass)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string generateDisassembly(Addr pc,
|
|
|
|
const SymbolTable *symtab) const;
|
2006-01-29 23:25:54 +01:00
|
|
|
};
|
|
|
|
}};
|
|
|
|
|
|
|
|
output decoder {{
|
|
|
|
std::string Branch::generateDisassembly(Addr pc, const SymbolTable *symtab) const
|
|
|
|
{
|
2006-03-07 10:33:10 +01:00
|
|
|
return "Branch instruction\n";
|
2006-01-29 23:25:54 +01:00
|
|
|
}
|
|
|
|
}};
|
|
|
|
|
|
|
|
def template BranchExecute {{
|
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
|
|
|
//Attempt to execute the instruction
|
|
|
|
Fault fault = NoFault;
|
2006-01-29 23:25:54 +01:00
|
|
|
|
2006-03-07 10:33:10 +01:00
|
|
|
%(op_decl)s;
|
|
|
|
%(op_rd)s;
|
|
|
|
%(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 Branch(code, *opt_flags) {{
|
|
|
|
orig_code = code
|
|
|
|
cblk = CodeBlock(code)
|
|
|
|
iop = InstObjParams(name, Name, 'SparcStaticInst', cblk, opt_flags)
|
|
|
|
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 = BranchExecute.subst(iop)
|
|
|
|
}};
|