2006-02-16 08:39:46 +01:00
|
|
|
// -*- mode:c++ -*-
|
2006-01-10 20:57:37 +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
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/// Constructor.
|
|
|
|
%(class_name)s(MachInst machInst);
|
|
|
|
%(BasicExecDeclare)s
|
|
|
|
};
|
|
|
|
}};
|
|
|
|
|
|
|
|
// Basic instruction class constructor template.
|
|
|
|
def template BasicConstructor {{
|
|
|
|
inline %(class_name)s::%(class_name)s(MachInst machInst) : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s)
|
|
|
|
{
|
|
|
|
%(constructor)s;
|
|
|
|
}
|
|
|
|
}};
|
|
|
|
|
|
|
|
// Basic instruction class execute method template.
|
|
|
|
def template BasicExecute {{
|
|
|
|
Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const
|
|
|
|
{
|
2006-03-08 08:05:38 +01:00
|
|
|
Fault fault = NoFault;
|
2006-01-10 20:57:37 +01:00
|
|
|
|
|
|
|
%(fp_enable_check)s;
|
|
|
|
%(op_decl)s;
|
|
|
|
%(op_rd)s;
|
|
|
|
%(code)s;
|
|
|
|
|
2006-03-08 08:05:38 +01:00
|
|
|
if(fault == NoFault)
|
2006-01-10 20:57:37 +01:00
|
|
|
{
|
2006-02-19 05:17:45 +01:00
|
|
|
%(op_wb)s;
|
2006-01-10 20:57:37 +01:00
|
|
|
}
|
|
|
|
return fault;
|
|
|
|
}
|
|
|
|
}};
|
|
|
|
|
|
|
|
// 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
|
2006-02-15 03:26:01 +01:00
|
|
|
def format BasicOp(code, *flags) {{
|
2006-01-26 22:19:44 +01:00
|
|
|
iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
|
2006-01-10 20:57:37 +01:00
|
|
|
header_output = BasicDeclare.subst(iop)
|
|
|
|
decoder_output = BasicConstructor.subst(iop)
|
|
|
|
decode_block = BasicDecode.subst(iop)
|
|
|
|
exec_output = BasicExecute.subst(iop)
|
|
|
|
}};
|