fp.isa revision 2135
15245Sgblack@eecs.umich.edu// -*- mode:c++ -*- 28948Sandreas.hansson@arm.com 38948Sandreas.hansson@arm.com//////////////////////////////////////////////////////////////////// 48948Sandreas.hansson@arm.com// 58948Sandreas.hansson@arm.com// Floating Point operate instructions 68948Sandreas.hansson@arm.com// 78948Sandreas.hansson@arm.com 88948Sandreas.hansson@arm.comoutput header {{ 98948Sandreas.hansson@arm.com /** 108948Sandreas.hansson@arm.com * Base class for FP operations. 118948Sandreas.hansson@arm.com */ 128948Sandreas.hansson@arm.com class FPOp : public MipsStaticInst 138948Sandreas.hansson@arm.com { 145245Sgblack@eecs.umich.edu protected: 155245Sgblack@eecs.umich.edu 165245Sgblack@eecs.umich.edu /// Constructor 177087Snate@binkert.org FPOp(const char *mnem, MachInst _machInst, OpClass __opClass) : MipsStaticInst(mnem, _machInst, __opClass) 187087Snate@binkert.org { 197087Snate@binkert.org } 207087Snate@binkert.org 217087Snate@binkert.org std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const; 227087Snate@binkert.org }; 237087Snate@binkert.org}}; 247087Snate@binkert.org 255245Sgblack@eecs.umich.eduoutput decoder {{ 267087Snate@binkert.org std::string FPOp::generateDisassembly(Addr pc, const SymbolTable *symtab) const 277087Snate@binkert.org { 287087Snate@binkert.org return "Disassembly of integer instruction\n"; 297087Snate@binkert.org } 307087Snate@binkert.org}}; 317087Snate@binkert.org 327087Snate@binkert.orgdef template FloatingPointExecute {{ 337087Snate@binkert.org Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const 345245Sgblack@eecs.umich.edu { 357087Snate@binkert.org //These are set to constants when the execute method 365245Sgblack@eecs.umich.edu //is generated 375245Sgblack@eecs.umich.edu bool useCc = ; 385245Sgblack@eecs.umich.edu bool checkPriv = ; 395245Sgblack@eecs.umich.edu 405245Sgblack@eecs.umich.edu //Attempt to execute the instruction 415245Sgblack@eecs.umich.edu try 425245Sgblack@eecs.umich.edu { 435245Sgblack@eecs.umich.edu checkPriv; 445245Sgblack@eecs.umich.edu 455245Sgblack@eecs.umich.edu %(op_decl)s; 465245Sgblack@eecs.umich.edu %(op_rd)s; 475245Sgblack@eecs.umich.edu %(code)s; 485245Sgblack@eecs.umich.edu } 495245Sgblack@eecs.umich.edu //If we have an exception for some reason, 505245Sgblack@eecs.umich.edu //deal with it 515245Sgblack@eecs.umich.edu catch(MipsException except) 5210474Sandreas.hansson@arm.com { 5310474Sandreas.hansson@arm.com //Deal with exception 545245Sgblack@eecs.umich.edu return No_Fault; 555245Sgblack@eecs.umich.edu } 565245Sgblack@eecs.umich.edu 577912Shestness@cs.utexas.edu //Write the resulting state to the execution context 585245Sgblack@eecs.umich.edu %(op_wb)s; 598953Sgblack@eecs.umich.edu if(useCc) 608229Snate@binkert.org { 615245Sgblack@eecs.umich.edu xc->regs.miscRegFile.ccrFields.iccFields.n = Rd & (1 << 63); 628232Snate@binkert.org xc->regs.miscRegFile.ccrFields.iccFields.z = (Rd == 0); 635245Sgblack@eecs.umich.edu xc->regs.miscRegFile.ccrFields.iccFields.v = ivValue; 645245Sgblack@eecs.umich.edu xc->regs.miscRegFile.ccrFields.iccFields.c = icValue; 655245Sgblack@eecs.umich.edu xc->regs.miscRegFile.ccrFields.xccFields.n = Rd & (1 << 31); 665245Sgblack@eecs.umich.edu xc->regs.miscRegFile.ccrFields.xccFields.z = ((Rd & 0xFFFFFFFF) == 0); 675245Sgblack@eecs.umich.edu xc->regs.miscRegFile.ccrFields.xccFields.v = xvValue; 685895Sgblack@eecs.umich.edu xc->regs.miscRegFile.ccrFields.xccFields.c = xcValue; 697912Shestness@cs.utexas.edu } 707912Shestness@cs.utexas.edu return No_Fault; 715245Sgblack@eecs.umich.edu } 727912Shestness@cs.utexas.edu}}; 737912Shestness@cs.utexas.edu 747912Shestness@cs.utexas.edu// Primary format for integer operate instructions: 757912Shestness@cs.utexas.edudef format FloatOp(code, *flags) {{ 769524SAndreas.Sandberg@ARM.com iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags) 777912Shestness@cs.utexas.edu header_output = BasicDeclare.subst(iop) 787912Shestness@cs.utexas.edu decoder_output = BasicConstructor.subst(iop) 797912Shestness@cs.utexas.edu decode_block = BasicDecode.subst(iop) 807912Shestness@cs.utexas.edu exec_output = BasicExecute.subst(iop) 817912Shestness@cs.utexas.edu}}; 827912Shestness@cs.utexas.edu 837912Shestness@cs.utexas.edu// Primary format for integer operate instructions: 847912Shestness@cs.utexas.edudef format Float64Op(code, *flags) {{ 857912Shestness@cs.utexas.edu iop = InstObjParams(name, Name, 'MipsStaticInst', CodeBlock(code), flags) 867912Shestness@cs.utexas.edu header_output = BasicDeclare.subst(iop) 877912Shestness@cs.utexas.edu decoder_output = BasicConstructor.subst(iop) 885895Sgblack@eecs.umich.edu decode_block = BasicDecode.subst(iop) 897912Shestness@cs.utexas.edu exec_output = BasicExecute.subst(iop) 905245Sgblack@eecs.umich.edu}}; 915245Sgblack@eecs.umich.edu