branch.isa revision 2224
1//////////////////////////////////////////////////////////////////// 2// 3// Branch instructions 4// 5 6output header {{ 7 /** 8 * Base class for integer operations. 9 */ 10 class Branch : public SparcStaticInst 11 { 12 protected: 13 // Constructor 14 Branch(const char *mnem, MachInst _machInst, OpClass __opClass) : 15 SparcStaticInst(mnem, _machInst, __opClass) 16 { 17 } 18 19 std::string generateDisassembly(Addr pc, 20 const SymbolTable *symtab) const; 21 }; 22}}; 23 24output decoder {{ 25 std::string Branch::generateDisassembly(Addr pc, const SymbolTable *symtab) const 26 { 27 return "Branch instruction\n"; 28 } 29}}; 30 31def template BranchExecute {{ 32 Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, 33 Trace::InstRecord *traceData) const 34 { 35 //Attempt to execute the instruction 36 Fault fault = NoFault; 37 checkPriv; 38 39 %(op_decl)s; 40 %(op_rd)s; 41 %(code)s; 42 43 if(fault == NoFault) 44 { 45 //Write the resulting state to the execution context 46 %(op_wb)s; 47 } 48 49 return fault; 50 } 51}}; 52 53// Primary format for integer operate instructions: 54def format Branch(code, *opt_flags) {{ 55 orig_code = code 56 cblk = CodeBlock(code) 57 iop = InstObjParams(name, Name, 'SparcStaticInst', cblk, opt_flags) 58 header_output = BasicDeclare.subst(iop) 59 decoder_output = BasicConstructor.subst(iop) 60 decode_block = BasicDecodeWithMnemonic.subst(iop) 61 exec_output = BranchExecute.subst(iop) 62}}; 63