basic.isa revision 2686
1// -*- mode:c++ -*- 2 3// Declarations for execute() methods. 4def template BasicExecDeclare {{ 5 Fault execute(%(CPU_exec_context)s *, Trace::InstRecord *) const; 6}}; 7 8// Basic instruction class declaration template. 9def template BasicDeclare {{ 10 /** 11 * Static instruction class for "%(mnemonic)s". 12 */ 13 class %(class_name)s : public %(base_class)s 14 { 15 public: 16 /// Constructor. 17 %(class_name)s(MachInst machInst); 18 %(BasicExecDeclare)s 19 }; 20}}; 21 22// Basic instruction class constructor template. 23def template BasicConstructor {{ 24 inline %(class_name)s::%(class_name)s(MachInst machInst) : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s) 25 { 26 %(constructor)s; 27 } 28}}; 29 30 31// Basic instruction class execute method template. 32def template BasicExecute {{ 33 Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const 34 { 35 Fault fault = NoFault; 36 37 %(fp_enable_check)s; 38 %(op_decl)s; 39 %(op_rd)s; 40 %(code)s; 41 42 if(fault == NoFault) 43 { 44 %(op_wb)s; 45 } 46 return fault; 47 } 48}}; 49 50// Basic decode template. 51def template BasicDecode {{ 52 return new %(class_name)s(machInst); 53}}; 54 55// Basic decode template, passing mnemonic in as string arg to constructor. 56def template BasicDecodeWithMnemonic {{ 57 return new %(class_name)s("%(mnemonic)s", machInst); 58}}; 59 60// The most basic instruction format... used only for a few misc. insts 61def format BasicOp(code, *flags) {{ 62 iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags) 63 header_output = BasicDeclare.subst(iop) 64 decoder_output = BasicConstructor.subst(iop) 65 decode_block = BasicDecode.subst(iop) 66 exec_output = BasicExecute.subst(iop) 67}}; 68