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