fp.isa revision 2135
12135SN/A// -*- mode:c++ -*-
22135SN/A
32706Sksewell@umich.edu////////////////////////////////////////////////////////////////////
42706Sksewell@umich.edu//
52706Sksewell@umich.edu// Floating Point operate instructions
62706Sksewell@umich.edu//
72706Sksewell@umich.edu
82706Sksewell@umich.eduoutput header {{
92706Sksewell@umich.edu        /**
102706Sksewell@umich.edu         * Base class for FP operations.
112706Sksewell@umich.edu         */
122706Sksewell@umich.edu        class FPOp : public MipsStaticInst
132706Sksewell@umich.edu        {
142706Sksewell@umich.edu                protected:
152706Sksewell@umich.edu
162706Sksewell@umich.edu                /// Constructor
172706Sksewell@umich.edu                FPOp(const char *mnem, MachInst _machInst, OpClass __opClass) : MipsStaticInst(mnem, _machInst, __opClass)
182706Sksewell@umich.edu                {
192706Sksewell@umich.edu                }
202706Sksewell@umich.edu
212706Sksewell@umich.edu                std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const;
222706Sksewell@umich.edu        };
232706Sksewell@umich.edu}};
242706Sksewell@umich.edu
252706Sksewell@umich.eduoutput decoder {{
262706Sksewell@umich.edu        std::string FPOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
272706Sksewell@umich.edu        {
282706Sksewell@umich.edu                return "Disassembly of integer instruction\n";
292706Sksewell@umich.edu        }
302706Sksewell@umich.edu}};
312038SN/A
322038SN/Adef template FloatingPointExecute {{
332038SN/A        Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const
342038SN/A        {
352038SN/A                //These are set to constants when the execute method
362038SN/A                //is generated
372038SN/A                bool useCc = ;
382135SN/A                bool checkPriv = ;
392038SN/A
402038SN/A                //Attempt to execute the instruction
412038SN/A                try
422038SN/A                {
432038SN/A                        checkPriv;
442038SN/A
452038SN/A                        %(op_decl)s;
462038SN/A                        %(op_rd)s;
472038SN/A                        %(code)s;
482038SN/A                }
492686Sksewell@umich.edu                //If we have an exception for some reason,
502686Sksewell@umich.edu                //deal with it
512686Sksewell@umich.edu                catch(MipsException except)
522686Sksewell@umich.edu                {
532686Sksewell@umich.edu                        //Deal with exception
542686Sksewell@umich.edu                        return No_Fault;
552686Sksewell@umich.edu                }
562686Sksewell@umich.edu
572686Sksewell@umich.edu                //Write the resulting state to the execution context
582686Sksewell@umich.edu                %(op_wb)s;
592686Sksewell@umich.edu                if(useCc)
602686Sksewell@umich.edu                {
612686Sksewell@umich.edu                        xc->regs.miscRegFile.ccrFields.iccFields.n = Rd & (1 << 63);
622686Sksewell@umich.edu                        xc->regs.miscRegFile.ccrFields.iccFields.z = (Rd == 0);
632038SN/A                        xc->regs.miscRegFile.ccrFields.iccFields.v = ivValue;
642038SN/A                        xc->regs.miscRegFile.ccrFields.iccFields.c = icValue;
652038SN/A                        xc->regs.miscRegFile.ccrFields.xccFields.n = Rd & (1 << 31);
662038SN/A                        xc->regs.miscRegFile.ccrFields.xccFields.z = ((Rd & 0xFFFFFFFF) == 0);
672686Sksewell@umich.edu                        xc->regs.miscRegFile.ccrFields.xccFields.v = xvValue;
682038SN/A                        xc->regs.miscRegFile.ccrFields.xccFields.c = xcValue;
692686Sksewell@umich.edu                }
702686Sksewell@umich.edu                return No_Fault;
712686Sksewell@umich.edu        }
722686Sksewell@umich.edu}};
732686Sksewell@umich.edu
742686Sksewell@umich.edu// Primary format for integer operate instructions:
752686Sksewell@umich.edudef format FloatOp(code, *flags) {{
762686Sksewell@umich.edu        iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
772686Sksewell@umich.edu        header_output = BasicDeclare.subst(iop)
782686Sksewell@umich.edu        decoder_output = BasicConstructor.subst(iop)
792686Sksewell@umich.edu        decode_block = BasicDecode.subst(iop)
802686Sksewell@umich.edu        exec_output = BasicExecute.subst(iop)
812686Sksewell@umich.edu}};
822686Sksewell@umich.edu
832686Sksewell@umich.edu// Primary format for integer operate instructions:
842686Sksewell@umich.edudef format Float64Op(code, *flags) {{
852686Sksewell@umich.edu        iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags)
862038SN/A        header_output = BasicDeclare.subst(iop)
872038SN/A        decoder_output = BasicConstructor.subst(iop)
882038SN/A        decode_block = BasicDecode.subst(iop)
892686Sksewell@umich.edu        exec_output = BasicExecute.subst(iop)
902038SN/A}};
912686Sksewell@umich.edu