2006-01-29 23:25:54 +01:00
|
|
|
|
|
|
|
// Declarations for execute() methods.
|
|
|
|
def template BasicExecDeclare {{
|
|
|
|
Fault execute(%(CPU_exec_context)s *, Trace::InstRecord *) const;
|
|
|
|
}};
|
|
|
|
|
|
|
|
// Basic instruction class declaration template.
|
|
|
|
def template BasicDeclare {{
|
|
|
|
/**
|
|
|
|
* Static instruction class for "%(mnemonic)s".
|
|
|
|
*/
|
|
|
|
class %(class_name)s : public %(base_class)s
|
|
|
|
{
|
2006-03-07 10:33:10 +01:00
|
|
|
public:
|
|
|
|
// Constructor.
|
|
|
|
%(class_name)s(MachInst machInst);
|
|
|
|
%(BasicExecDeclare)s
|
|
|
|
};
|
2006-01-29 23:25:54 +01:00
|
|
|
}};
|
|
|
|
|
|
|
|
// Basic instruction class constructor template.
|
|
|
|
def template BasicConstructor {{
|
2006-03-07 10:33:10 +01:00
|
|
|
inline %(class_name)s::%(class_name)s(MachInst machInst)
|
|
|
|
: %(base_class)s("%(mnemonic)s", machInst, %(op_class)s)
|
2006-01-29 23:25:54 +01:00
|
|
|
{
|
|
|
|
%(constructor)s;
|
|
|
|
}
|
|
|
|
}};
|
|
|
|
|
|
|
|
// Basic instruction class execute method template.
|
|
|
|
def template BasicExecute {{
|
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-01-29 23:25:54 +01:00
|
|
|
|
2006-03-07 10:33:10 +01:00
|
|
|
%(fp_enable_check)s;
|
|
|
|
%(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)
|
|
|
|
{
|
|
|
|
%(op_wb)s;
|
|
|
|
}
|
|
|
|
return fault;
|
2006-01-29 23:25:54 +01:00
|
|
|
}
|
|
|
|
}};
|
|
|
|
|
|
|
|
// Basic decode template.
|
|
|
|
def template BasicDecode {{
|
|
|
|
return new %(class_name)s(machInst);
|
|
|
|
}};
|
|
|
|
|
|
|
|
// Basic decode template, passing mnemonic in as string arg to constructor.
|
|
|
|
def template BasicDecodeWithMnemonic {{
|
|
|
|
return new %(class_name)s("%(mnemonic)s", machInst);
|
|
|
|
}};
|
|
|
|
|
|
|
|
// The most basic instruction format... used only for a few misc. insts
|
|
|
|
def format BasicOperate(code, *flags) {{
|
2006-03-07 10:33:10 +01:00
|
|
|
iop = InstObjParams(name, Name, 'SparcStaticInst',
|
|
|
|
CodeBlock(code), flags)
|
2006-01-29 23:25:54 +01:00
|
|
|
header_output = BasicDeclare.subst(iop)
|
|
|
|
decoder_output = BasicConstructor.subst(iop)
|
|
|
|
decode_block = BasicDecode.subst(iop)
|
|
|
|
exec_output = BasicExecute.subst(iop)
|
|
|
|
}};
|