branch.isa revision 2469
12292SN/A////////////////////////////////////////////////////////////////////
22329SN/A//
32292SN/A// Branch instructions
42292SN/A//
52292SN/A
62292SN/Aoutput header {{
72292SN/A        /**
82292SN/A         * Base class for integer operations.
92292SN/A         */
102292SN/A        class Branch : public SparcStaticInst
112292SN/A        {
122292SN/A          protected:
132292SN/A            // Constructor
142292SN/A            Branch(const char *mnem, MachInst _machInst, OpClass __opClass) :
152292SN/A                SparcStaticInst(mnem, _machInst, __opClass)
162292SN/A            {
172292SN/A            }
182292SN/A
192292SN/A            std::string generateDisassembly(Addr pc,
202292SN/A                    const SymbolTable *symtab) const;
212292SN/A        };
222292SN/A}};
232292SN/A
242292SN/Aoutput decoder {{
252292SN/A        std::string Branch::generateDisassembly(Addr pc, const SymbolTable *symtab) const
262292SN/A        {
272689Sktlim@umich.edu                return "Branch instruction\n";
282689Sktlim@umich.edu        }
292689Sktlim@umich.edu}};
302292SN/A
312292SN/Adef template BranchExecute {{
322292SN/A        Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
332292SN/A                Trace::InstRecord *traceData) const
342292SN/A        {
352329SN/A            //Attempt to execute the instruction
364395Ssaidi@eecs.umich.edu            Fault fault = NoFault;
372292SN/A
382292SN/A            %(op_decl)s;
392292SN/A            %(op_rd)s;
402329SN/A            %(code)s;
413326Sktlim@umich.edu
422292SN/A            if(fault == NoFault)
435386Sstever@gmail.com            {
442292SN/A                //Write the resulting state to the execution context
452292SN/A                %(op_wb)s;
463348Sbinkertn@umich.edu            }
472669Sktlim@umich.edu
482292SN/A            return fault;
492292SN/A        }
502329SN/A}};
512329SN/A
522329SN/A// Primary format for integer operate instructions:
532329SN/Adef format Branch(code, *opt_flags) {{
542329SN/A        orig_code = code
552329SN/A        cblk = CodeBlock(code)
562329SN/A        iop = InstObjParams(name, Name, 'SparcStaticInst', cblk, opt_flags)
572329SN/A        header_output = BasicDeclare.subst(iop)
582329SN/A        decoder_output = BasicConstructor.subst(iop)
592329SN/A        decode_block = BasicDecode.subst(iop)
602292SN/A        exec_output = BranchExecute.subst(iop)
612292SN/A}};
622292SN/A