mem.isa revision 8442
12810SN/A// -*- mode:c++ -*- 29614Srene.dejong@arm.com 38856Sandreas.hansson@arm.com// Copyright (c) 2007 MIPS Technologies, Inc. 48856Sandreas.hansson@arm.com// All rights reserved. 58856Sandreas.hansson@arm.com// 68856Sandreas.hansson@arm.com// Redistribution and use in source and binary forms, with or without 78856Sandreas.hansson@arm.com// modification, are permitted provided that the following conditions are 88856Sandreas.hansson@arm.com// met: redistributions of source code must retain the above copyright 98856Sandreas.hansson@arm.com// notice, this list of conditions and the following disclaimer; 108856Sandreas.hansson@arm.com// redistributions in binary form must reproduce the above copyright 118856Sandreas.hansson@arm.com// notice, this list of conditions and the following disclaimer in the 128856Sandreas.hansson@arm.com// documentation and/or other materials provided with the distribution; 138856Sandreas.hansson@arm.com// neither the name of the copyright holders nor the names of its 142810SN/A// contributors may be used to endorse or promote products derived from 152810SN/A// this software without specific prior written permission. 162810SN/A// 172810SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 182810SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 192810SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 202810SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 212810SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 222810SN/A// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 232810SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 242810SN/A// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 252810SN/A// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 262810SN/A// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 272810SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 282810SN/A// 292810SN/A// Authors: Steve Reinhardt 302810SN/A// Korey Sewell 312810SN/A 322810SN/A//////////////////////////////////////////////////////////////////// 332810SN/A// 342810SN/A// Memory-format instructions 352810SN/A// 362810SN/A 372810SN/Aoutput header {{ 382810SN/A /** 392810SN/A * Base class for general Mips memory-format instructions. 402810SN/A */ 412810SN/A class Memory : public MipsStaticInst 422810SN/A { 432810SN/A protected: 442810SN/A /// Memory request flags. See mem_req_base.hh. 452810SN/A Request::Flags memAccessFlags; 462810SN/A 472810SN/A /// Displacement for EA calculation (signed). 4811486Snikos.nikoleris@arm.com int32_t disp; 4911486Snikos.nikoleris@arm.com 508232Snate@binkert.org /// Constructor 519152Satgutier@umich.edu Memory(const char *mnem, MachInst _machInst, OpClass __opClass) 5211486Snikos.nikoleris@arm.com : MipsStaticInst(mnem, _machInst, __opClass), 5311486Snikos.nikoleris@arm.com disp(sext<16>(OFFSET)) 549795Sandreas.hansson@arm.com { 559795Sandreas.hansson@arm.com } 5610263Satgutier@umich.edu 578786Sgblack@eecs.umich.edu std::string 582810SN/A generateDisassembly(Addr pc, const SymbolTable *symtab) const; 592810SN/A }; 602810SN/A 618856Sandreas.hansson@arm.com /** 628856Sandreas.hansson@arm.com * Base class for a few miscellaneous memory-format insts 638856Sandreas.hansson@arm.com * that don't interpret the disp field 648922Swilliam.wang@arm.com */ 658914Sandreas.hansson@arm.com class MemoryNoDisp : public Memory 668856Sandreas.hansson@arm.com { 678856Sandreas.hansson@arm.com protected: 684475SN/A /// Constructor 6911053Sandreas.hansson@arm.com MemoryNoDisp(const char *mnem, ExtMachInst _machInst, OpClass __opClass) 705034SN/A : Memory(mnem, _machInst, __opClass) 7110360Sandreas.hansson@arm.com { 7211377Sandreas.hansson@arm.com } 7311377Sandreas.hansson@arm.com 7411053Sandreas.hansson@arm.com std::string 7511722Ssophiane.senni@gmail.com generateDisassembly(Addr pc, const SymbolTable *symtab) const; 7611722Ssophiane.senni@gmail.com }; 7711722Ssophiane.senni@gmail.com}}; 7811722Ssophiane.senni@gmail.com 799263Smrinmoy.ghosh@arm.com 805034SN/Aoutput decoder {{ 8111331Sandreas.hansson@arm.com std::string 8210884Sandreas.hansson@arm.com Memory::generateDisassembly(Addr pc, const SymbolTable *symtab) const 834626SN/A { 8410360Sandreas.hansson@arm.com return csprintf("%-10s %c%d, %d(r%d)", mnemonic, 8511484Snikos.nikoleris@arm.com flags[IsFloating] ? 'f' : 'r', RT, disp, RS); 865034SN/A } 878883SAli.Saidi@ARM.com 888833Sdam.sunwoo@arm.com std::string 894458SN/A MemoryNoDisp::generateDisassembly(Addr pc, const SymbolTable *symtab) const 9011377Sandreas.hansson@arm.com { 9111377Sandreas.hansson@arm.com return csprintf("%-10s %c%d, r%d(r%d)", mnemonic, 9211377Sandreas.hansson@arm.com flags[IsFloating] ? 'f' : 'r', 9311377Sandreas.hansson@arm.com flags[IsFloating] ? FD : RD, 9411377Sandreas.hansson@arm.com RS, RT); 9511377Sandreas.hansson@arm.com } 9611331Sandreas.hansson@arm.com 9711331Sandreas.hansson@arm.com}}; 982810SN/A 992810SN/Aoutput exec {{ 1003013SN/A /** return data in cases where there the size of data is only 1018856Sandreas.hansson@arm.com known in the packet 1022810SN/A */ 1033013SN/A uint64_t getMemData(%(CPU_exec_context)s *xc, Packet *packet) { 10410714Sandreas.hansson@arm.com switch (packet->getSize()) 1052810SN/A { 1069614Srene.dejong@arm.com case 1: 1079614Srene.dejong@arm.com return packet->get<uint8_t>(); 1089614Srene.dejong@arm.com 10910345SCurtis.Dunham@arm.com case 2: 11010714Sandreas.hansson@arm.com return packet->get<uint16_t>(); 11110345SCurtis.Dunham@arm.com 1129614Srene.dejong@arm.com case 4: 1132810SN/A return packet->get<uint32_t>(); 1142810SN/A 1152810SN/A case 8: 1168856Sandreas.hansson@arm.com return packet->get<uint64_t>(); 1172810SN/A 1183013SN/A default: 11910714Sandreas.hansson@arm.com std::cerr << "bad store data size = " << packet->getSize() << std::endl; 1203013SN/A 1218856Sandreas.hansson@arm.com assert(0); 12210714Sandreas.hansson@arm.com return 0; 1238922Swilliam.wang@arm.com } 1242897SN/A } 1252810SN/A 1262810SN/A 12710344Sandreas.hansson@arm.com}}; 12810344Sandreas.hansson@arm.com 12910344Sandreas.hansson@arm.comdef template LoadStoreDeclare {{ 13010714Sandreas.hansson@arm.com /** 13110344Sandreas.hansson@arm.com * Static instruction class for "%(mnemonic)s". 13210344Sandreas.hansson@arm.com */ 13310344Sandreas.hansson@arm.com class %(class_name)s : public %(base_class)s 13410713Sandreas.hansson@arm.com { 13510344Sandreas.hansson@arm.com public: 1362844SN/A 1372810SN/A /// Constructor. 1382858SN/A %(class_name)s(ExtMachInst machInst); 1392858SN/A 1408856Sandreas.hansson@arm.com %(BasicExecDeclare)s 1418922Swilliam.wang@arm.com 1428711Sandreas.hansson@arm.com %(EACompDeclare)s 14311331Sandreas.hansson@arm.com 1442858SN/A %(InitiateAccDeclare)s 1452858SN/A 1469294Sandreas.hansson@arm.com %(CompleteAccDeclare)s 1479294Sandreas.hansson@arm.com }; 1488922Swilliam.wang@arm.com}}; 1498922Swilliam.wang@arm.com 1508922Swilliam.wang@arm.comdef template EACompDeclare {{ 1518922Swilliam.wang@arm.com Fault eaComp(%(CPU_exec_context)s *, Trace::InstRecord *) const; 1528922Swilliam.wang@arm.com}}; 1538922Swilliam.wang@arm.com 1548922Swilliam.wang@arm.comdef template InitiateAccDeclare {{ 1558922Swilliam.wang@arm.com Fault initiateAcc(%(CPU_exec_context)s *, Trace::InstRecord *) const; 1569294Sandreas.hansson@arm.com}}; 1579294Sandreas.hansson@arm.com 1588922Swilliam.wang@arm.com 1598922Swilliam.wang@arm.comdef template CompleteAccDeclare {{ 1608922Swilliam.wang@arm.com Fault completeAcc(Packet *, %(CPU_exec_context)s *, Trace::InstRecord *) const; 1618922Swilliam.wang@arm.com}}; 1628922Swilliam.wang@arm.com 1638922Swilliam.wang@arm.comdef template LoadStoreConstructor {{ 1648922Swilliam.wang@arm.com inline %(class_name)s::%(class_name)s(ExtMachInst machInst) 1654628SN/A : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s) 16610821Sandreas.hansson@arm.com { 16710821Sandreas.hansson@arm.com %(constructor)s; 16810821Sandreas.hansson@arm.com } 16910821Sandreas.hansson@arm.com}}; 17010821Sandreas.hansson@arm.com 17110821Sandreas.hansson@arm.com 17210821Sandreas.hansson@arm.comdef template EACompExecute {{ 17310821Sandreas.hansson@arm.com Fault 17410821Sandreas.hansson@arm.com %(class_name)s::eaComp(%(CPU_exec_context)s *xc, 17510821Sandreas.hansson@arm.com Trace::InstRecord *traceData) const 17610821Sandreas.hansson@arm.com { 1772858SN/A Addr EA; 1782810SN/A Fault fault = NoFault; 1792810SN/A 18011522Sstephan.diestelhorst@arm.com if (this->isFloating()) { 18111522Sstephan.diestelhorst@arm.com %(fp_enable_check)s; 1822810SN/A 1832810SN/A if(fault != NoFault) 1842810SN/A return fault; 1854022SN/A } 1864022SN/A 1874022SN/A %(op_decl)s; 1882810SN/A %(op_rd)s; 1892810SN/A %(ea_code)s; 1908833Sdam.sunwoo@arm.com 1912810SN/A // NOTE: Trace Data is written using execute or completeAcc templates 1922810SN/A if (fault == NoFault) { 1932810SN/A xc->setEA(EA); 1942810SN/A } 1958833Sdam.sunwoo@arm.com 1968833Sdam.sunwoo@arm.com return fault; 1978833Sdam.sunwoo@arm.com } 1982810SN/A}}; 1992810SN/A 2004871SN/Adef template LoadExecute {{ 2014871SN/A Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, 2024871SN/A Trace::InstRecord *traceData) const 2034871SN/A { 20411455Sandreas.hansson@arm.com Addr EA; 20510885Sandreas.hansson@arm.com Fault fault = NoFault; 2064871SN/A 2074871SN/A if (this->isFloating()) { 2084871SN/A %(fp_enable_check)s; 2094871SN/A 2104871SN/A if(fault != NoFault) 2112810SN/A return fault; 2122810SN/A } 2132810SN/A 2148833Sdam.sunwoo@arm.com %(op_decl)s; 2152810SN/A %(op_rd)s; 2164871SN/A %(ea_code)s; 2178833Sdam.sunwoo@arm.com 2188833Sdam.sunwoo@arm.com if (fault == NoFault) { 2198833Sdam.sunwoo@arm.com fault = readMemAtomic(xc, traceData, EA, Mem, memAccessFlags); 2202810SN/A %(memacc_code)s; 2212810SN/A } 2222810SN/A 2232810SN/A if (fault == NoFault) { 2248833Sdam.sunwoo@arm.com %(op_wb)s; 2252810SN/A } 2264871SN/A 2278833Sdam.sunwoo@arm.com return fault; 2288833Sdam.sunwoo@arm.com } 2298833Sdam.sunwoo@arm.com}}; 2302810SN/A 2312810SN/A 2324022SN/Adef template LoadInitiateAcc {{ 2334022SN/A Fault %(class_name)s::initiateAcc(%(CPU_exec_context)s *xc, 2344022SN/A Trace::InstRecord *traceData) const 2352810SN/A { 2362810SN/A Addr EA; 2378833Sdam.sunwoo@arm.com Fault fault = NoFault; 2382810SN/A 2392810SN/A if (this->isFloating()) { 2402810SN/A %(fp_enable_check)s; 2412810SN/A 2428833Sdam.sunwoo@arm.com if(fault != NoFault) 2438833Sdam.sunwoo@arm.com return fault; 2448833Sdam.sunwoo@arm.com } 2452810SN/A 2462810SN/A %(op_src_decl)s; 2472810SN/A %(op_rd)s; 2482810SN/A %(ea_code)s; 2492810SN/A 2508833Sdam.sunwoo@arm.com if (fault == NoFault) { 2512810SN/A fault = readMemTiming(xc, traceData, EA, Mem, memAccessFlags); 2524871SN/A } 2538833Sdam.sunwoo@arm.com 2548833Sdam.sunwoo@arm.com return fault; 2558833Sdam.sunwoo@arm.com } 2562810SN/A}}; 2572810SN/A 2582810SN/Adef template LoadCompleteAcc {{ 2592810SN/A Fault %(class_name)s::completeAcc(Packet *pkt, 2608833Sdam.sunwoo@arm.com %(CPU_exec_context)s *xc, 2612810SN/A Trace::InstRecord *traceData) const 2624871SN/A { 2638833Sdam.sunwoo@arm.com Fault fault = NoFault; 2648833Sdam.sunwoo@arm.com 2658833Sdam.sunwoo@arm.com if (this->isFloating()) { 2662810SN/A %(fp_enable_check)s; 2672810SN/A 2684022SN/A if(fault != NoFault) 2694022SN/A return fault; 2704022SN/A } 2712810SN/A 2722810SN/A %(op_decl)s; 2738833Sdam.sunwoo@arm.com %(op_rd)s; 2742810SN/A 2752810SN/A getMem(pkt, Mem, traceData); 2762810SN/A 2772810SN/A if (fault == NoFault) { 2788833Sdam.sunwoo@arm.com %(memacc_code)s; 2798833Sdam.sunwoo@arm.com } 2808833Sdam.sunwoo@arm.com 2812810SN/A if (fault == NoFault) { 2822810SN/A %(op_wb)s; 2832810SN/A } 2842810SN/A 2852810SN/A return fault; 2868833Sdam.sunwoo@arm.com } 2872810SN/A}}; 2884871SN/A 2898833Sdam.sunwoo@arm.comdef template StoreExecute {{ 2908833Sdam.sunwoo@arm.com Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, 2918833Sdam.sunwoo@arm.com Trace::InstRecord *traceData) const 2922810SN/A { 2932810SN/A Addr EA; 2942810SN/A Fault fault = NoFault; 2952810SN/A 2968833Sdam.sunwoo@arm.com %(fp_enable_check)s; 2972810SN/A %(op_decl)s; 2984871SN/A %(op_rd)s; 2998833Sdam.sunwoo@arm.com %(ea_code)s; 3008833Sdam.sunwoo@arm.com 3018833Sdam.sunwoo@arm.com if (fault == NoFault) { 3022810SN/A %(memacc_code)s; 3032810SN/A } 3044022SN/A 3054022SN/A if (fault == NoFault) { 3064022SN/A fault = writeMemAtomic(xc, traceData, Mem, EA, memAccessFlags, 3072810SN/A NULL); 3082810SN/A } 3092810SN/A 3102810SN/A if (fault == NoFault) { 3112810SN/A %(postacc_code)s; 3122810SN/A } 3138833Sdam.sunwoo@arm.com 3142810SN/A if (fault == NoFault) { 3158833Sdam.sunwoo@arm.com %(op_wb)s; 3168833Sdam.sunwoo@arm.com } 3178833Sdam.sunwoo@arm.com 3182810SN/A return fault; 3192810SN/A } 3202810SN/A}}; 3212810SN/A 3222810SN/A 3238833Sdam.sunwoo@arm.comdef template StoreFPExecute {{ 3242810SN/A Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, 3252810SN/A Trace::InstRecord *traceData) const 3268833Sdam.sunwoo@arm.com { 3278833Sdam.sunwoo@arm.com Addr EA; 3288833Sdam.sunwoo@arm.com Fault fault = NoFault; 3292810SN/A 3302810SN/A %(fp_enable_check)s; 3312810SN/A if(fault != NoFault) 3322810SN/A return fault; 3338833Sdam.sunwoo@arm.com %(op_decl)s; 3342810SN/A %(op_rd)s; 3352810SN/A %(ea_code)s; 3368833Sdam.sunwoo@arm.com 3378833Sdam.sunwoo@arm.com if (fault == NoFault) { 3388833Sdam.sunwoo@arm.com %(memacc_code)s; 3392810SN/A } 3402810SN/A 3414022SN/A if (fault == NoFault) { 3424022SN/A fault = writeMemAtomic(xc, traceData, Mem, EA, memAccessFlags, 3434022SN/A NULL); 3442810SN/A } 3452810SN/A 3462810SN/A if (fault == NoFault) { 3472810SN/A %(postacc_code)s; 3482810SN/A } 3492810SN/A 3508833Sdam.sunwoo@arm.com if (fault == NoFault) { 3512810SN/A %(op_wb)s; 3528833Sdam.sunwoo@arm.com } 3538833Sdam.sunwoo@arm.com 3548833Sdam.sunwoo@arm.com return fault; 3552810SN/A } 3562810SN/A}}; 3572810SN/A 3582810SN/Adef template StoreCondExecute {{ 3592810SN/A Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, 3608833Sdam.sunwoo@arm.com Trace::InstRecord *traceData) const 3612810SN/A { 3622810SN/A Addr EA; 3638833Sdam.sunwoo@arm.com Fault fault = NoFault; 3648833Sdam.sunwoo@arm.com uint64_t write_result = 0; 3658833Sdam.sunwoo@arm.com 3662810SN/A %(fp_enable_check)s; 3672810SN/A %(op_decl)s; 3682810SN/A %(op_rd)s; 3692810SN/A %(ea_code)s; 3708833Sdam.sunwoo@arm.com 3712810SN/A if (fault == NoFault) { 3722810SN/A %(memacc_code)s; 3738833Sdam.sunwoo@arm.com } 3748833Sdam.sunwoo@arm.com 3758833Sdam.sunwoo@arm.com if (fault == NoFault) { 3762810SN/A fault = writeMemAtomic(xc, traceData, Mem, EA, memAccessFlags, 3772810SN/A &write_result); 3784022SN/A } 3794022SN/A 3804022SN/A if (fault == NoFault) { 3812810SN/A %(postacc_code)s; 3822810SN/A } 3832810SN/A 3842810SN/A if (fault == NoFault) { 3852810SN/A %(op_wb)s; 3862810SN/A } 3872810SN/A 3882810SN/A return fault; 3898833Sdam.sunwoo@arm.com } 3908833Sdam.sunwoo@arm.com}}; 3918833Sdam.sunwoo@arm.com 3928833Sdam.sunwoo@arm.comdef template StoreInitiateAcc {{ 3932810SN/A Fault %(class_name)s::initiateAcc(%(CPU_exec_context)s *xc, 3942810SN/A Trace::InstRecord *traceData) const 3952810SN/A { 3962810SN/A Addr EA; 3972810SN/A Fault fault = NoFault; 3988833Sdam.sunwoo@arm.com 3992810SN/A %(fp_enable_check)s; 4002810SN/A %(op_decl)s; 4018833Sdam.sunwoo@arm.com %(op_rd)s; 4028833Sdam.sunwoo@arm.com %(ea_code)s; 4038833Sdam.sunwoo@arm.com 4042810SN/A if (fault == NoFault) { 4052810SN/A %(memacc_code)s; 4062810SN/A } 4072810SN/A 4088833Sdam.sunwoo@arm.com if (fault == NoFault) { 4092810SN/A fault = writeMemTiming(xc, traceData, Mem, EA, memAccessFlags, 4102810SN/A NULL); 4118833Sdam.sunwoo@arm.com } 4128833Sdam.sunwoo@arm.com 4138833Sdam.sunwoo@arm.com return fault; 4142810SN/A } 4152810SN/A}}; 4162810SN/A 4172810SN/A 4182810SN/Adef template StoreCompleteAcc {{ 4192810SN/A Fault %(class_name)s::completeAcc(Packet *pkt, 4202810SN/A %(CPU_exec_context)s *xc, 4212810SN/A Trace::InstRecord *traceData) const 4222810SN/A { 4232810SN/A return NoFault; 4242810SN/A } 4252810SN/A}}; 4262810SN/A 4272810SN/Adef template StoreCondCompleteAcc {{ 4282810SN/A Fault %(class_name)s::completeAcc(Packet *pkt, 4292810SN/A %(CPU_exec_context)s *xc, 4302810SN/A Trace::InstRecord *traceData) const 4312810SN/A { 4322810SN/A Fault fault = NoFault; 4332810SN/A 4342810SN/A %(fp_enable_check)s; 4352810SN/A %(op_dest_decl)s; 4362810SN/A 4372810SN/A uint64_t write_result = pkt->req->getExtraData(); 4382810SN/A 4392810SN/A if (fault == NoFault) { 4402810SN/A %(postacc_code)s; 44111436SRekai.GonzalezAlberquilla@arm.com } 44211436SRekai.GonzalezAlberquilla@arm.com 44311436SRekai.GonzalezAlberquilla@arm.com if (fault == NoFault) { 44411436SRekai.GonzalezAlberquilla@arm.com %(op_wb)s; 44511436SRekai.GonzalezAlberquilla@arm.com } 44611436SRekai.GonzalezAlberquilla@arm.com 4474626SN/A return fault; 4488833Sdam.sunwoo@arm.com } 4494626SN/A}}; 4504626SN/A 4518833Sdam.sunwoo@arm.comdef template MiscExecute {{ 4524626SN/A Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, 4538833Sdam.sunwoo@arm.com Trace::InstRecord *traceData) const 4548833Sdam.sunwoo@arm.com { 4558833Sdam.sunwoo@arm.com Addr EA M5_VAR_USED = 0; 4564626SN/A Fault fault = NoFault; 4574626SN/A 4584626SN/A %(fp_enable_check)s; 4594626SN/A %(op_decl)s; 4604626SN/A %(op_rd)s; 4614626SN/A %(ea_code)s; 4624626SN/A 4634626SN/A if (fault == NoFault) { 4648833Sdam.sunwoo@arm.com %(memacc_code)s; 4654626SN/A } 4664626SN/A 4674626SN/A return NoFault; 4684626SN/A } 4698833Sdam.sunwoo@arm.com}}; 4708833Sdam.sunwoo@arm.com 4718833Sdam.sunwoo@arm.comdef template MiscInitiateAcc {{ 4724626SN/A Fault %(class_name)s::initiateAcc(%(CPU_exec_context)s *xc, 4734626SN/A Trace::InstRecord *traceData) const 4744626SN/A { 4754626SN/A panic("Misc instruction does not support split access method!"); 4764626SN/A return NoFault; 4778833Sdam.sunwoo@arm.com } 4784626SN/A}}; 4794871SN/A 4808833Sdam.sunwoo@arm.com 4818833Sdam.sunwoo@arm.comdef template MiscCompleteAcc {{ 4828833Sdam.sunwoo@arm.com Fault %(class_name)s::completeAcc(Packet *pkt, 4834626SN/A %(CPU_exec_context)s *xc, 4844626SN/A Trace::InstRecord *traceData) const 4854626SN/A { 4864626SN/A panic("Misc instruction does not support split access method!"); 4878833Sdam.sunwoo@arm.com 4884626SN/A return NoFault; 4894871SN/A } 4908833Sdam.sunwoo@arm.com}}; 4918833Sdam.sunwoo@arm.com 4928833Sdam.sunwoo@arm.comdef format LoadMemory(memacc_code, ea_code = {{ EA = Rs + disp; }}, 4934626SN/A mem_flags = [], inst_flags = []) {{ 4944626SN/A (header_output, decoder_output, decode_block, exec_output) = \ 4954626SN/A LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags, 4964626SN/A decode_template = ImmNopCheckDecode, 4974626SN/A exec_template_base = 'Load') 4984626SN/A}}; 4994626SN/A 5008833Sdam.sunwoo@arm.com 5014626SN/Adef format StoreMemory(memacc_code, ea_code = {{ EA = Rs + disp; }}, 5024626SN/A mem_flags = [], inst_flags = []) {{ 5034626SN/A (header_output, decoder_output, decode_block, exec_output) = \ 5044626SN/A LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags, 5058833Sdam.sunwoo@arm.com exec_template_base = 'Store') 5068833Sdam.sunwoo@arm.com}}; 5078833Sdam.sunwoo@arm.com 5084626SN/Adef format LoadIndexedMemory(memacc_code, ea_code = {{ EA = Rs + Rt; }}, 5094626SN/A mem_flags = [], inst_flags = []) {{ 5104626SN/A inst_flags += ['IsIndexed'] 5114626SN/A (header_output, decoder_output, decode_block, exec_output) = \ 5124626SN/A LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags, 5138833Sdam.sunwoo@arm.com decode_template = ImmNopCheckDecode, 5144626SN/A exec_template_base = 'Load') 5154871SN/A}}; 5168833Sdam.sunwoo@arm.com 5178833Sdam.sunwoo@arm.comdef format StoreIndexedMemory(memacc_code, ea_code = {{ EA = Rs + Rt; }}, 5188833Sdam.sunwoo@arm.com mem_flags = [], inst_flags = []) {{ 5194626SN/A inst_flags += ['IsIndexed'] 5204626SN/A (header_output, decoder_output, decode_block, exec_output) = \ 5214626SN/A LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags, 5224626SN/A exec_template_base = 'Store') 5238833Sdam.sunwoo@arm.com}}; 5244626SN/A 5254871SN/Adef format LoadFPIndexedMemory(memacc_code, ea_code = {{ EA = Rs + Rt; }}, 5268833Sdam.sunwoo@arm.com mem_flags = [], inst_flags = []) {{ 5278833Sdam.sunwoo@arm.com inst_flags += ['IsIndexed', 'IsFloating'] 5288833Sdam.sunwoo@arm.com (header_output, decoder_output, decode_block, exec_output) = \ 5294626SN/A LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags, 5304626SN/A decode_template = ImmNopCheckDecode, 5314626SN/A exec_template_base = 'Load') 5324626SN/A}}; 5334626SN/A 5344626SN/Adef format StoreFPIndexedMemory(memacc_code, ea_code = {{ EA = Rs + Rt; }}, 5354626SN/A mem_flags = [], inst_flags = []) {{ 5368833Sdam.sunwoo@arm.com inst_flags += ['IsIndexed', 'IsFloating'] 5374626SN/A (header_output, decoder_output, decode_block, exec_output) = \ 5384626SN/A LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags, 5394626SN/A exec_template_base = 'Store') 5404626SN/A}}; 5418833Sdam.sunwoo@arm.com 5428833Sdam.sunwoo@arm.com 5438833Sdam.sunwoo@arm.comdef format LoadUnalignedMemory(memacc_code, ea_code = {{ EA = (Rs + disp) & ~3; }}, 5444626SN/A mem_flags = [], inst_flags = []) {{ 5454626SN/A decl_code = 'uint32_t mem_word = Mem.uw;\n' 5464626SN/A decl_code += 'uint32_t unalign_addr = Rs + disp;\n' 5474626SN/A decl_code += 'uint32_t byte_offset = unalign_addr & 3;\n' 5484626SN/A decl_code += '#if BYTE_ORDER == BIG_ENDIAN\n' 5498833Sdam.sunwoo@arm.com decl_code += '\tbyte_offset ^= 3;\n' 5504626SN/A decl_code += '#endif\n' 5514871SN/A 5528833Sdam.sunwoo@arm.com memacc_code = decl_code + memacc_code 5538833Sdam.sunwoo@arm.com 5548833Sdam.sunwoo@arm.com (header_output, decoder_output, decode_block, exec_output) = \ 5554626SN/A LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags, 5564626SN/A decode_template = ImmNopCheckDecode, 5574626SN/A exec_template_base = 'Load') 5584626SN/A}}; 5598833Sdam.sunwoo@arm.com 5604626SN/Adef format StoreUnalignedMemory(memacc_code, ea_code = {{ EA = (Rs + disp) & ~3; }}, 5614871SN/A mem_flags = [], inst_flags = []) {{ 5624871SN/A decl_code = ''' 5638833Sdam.sunwoo@arm.com uint32_t mem_word = 0; 5648833Sdam.sunwoo@arm.com uint32_t unaligned_addr = Rs + disp; 5658833Sdam.sunwoo@arm.com uint32_t byte_offset = unaligned_addr & 3; 5664626SN/A #if BYTE_ORDER == BIG_ENDIAN 5674626SN/A byte_offset ^= 3; 5684626SN/A #endif 5694626SN/A fault = readMemAtomic(xc, traceData, EA, mem_word, memAccessFlags); 5704626SN/A ''' 5714626SN/A memacc_code = decl_code + memacc_code + '\nMem = mem_word;\n' 5724626SN/A 5738833Sdam.sunwoo@arm.com (header_output, decoder_output, decode_block, exec_output) = \ 5744626SN/A LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags, 5754626SN/A exec_template_base = 'Store') 5764626SN/A}}; 5774626SN/A 5788833Sdam.sunwoo@arm.comdef format Prefetch(ea_code = {{ EA = Rs + disp; }}, 5798833Sdam.sunwoo@arm.com mem_flags = [], pf_flags = [], inst_flags = []) {{ 5808833Sdam.sunwoo@arm.com pf_mem_flags = mem_flags + pf_flags + ['PREFETCH'] 5814626SN/A pf_inst_flags = inst_flags 5824626SN/A 5834626SN/A (header_output, decoder_output, decode_block, exec_output) = \ 5844626SN/A LoadStoreBase(name, Name, ea_code, 5854626SN/A 'warn_once("Prefetching not implemented for MIPS\\n");', 5868833Sdam.sunwoo@arm.com pf_mem_flags, pf_inst_flags, exec_template_base = 'Misc') 5874626SN/A 5884871SN/A}}; 5894871SN/A 5908833Sdam.sunwoo@arm.comdef format StoreCond(memacc_code, postacc_code, 5918833Sdam.sunwoo@arm.com ea_code = {{ EA = Rs + disp; }}, 5928833Sdam.sunwoo@arm.com mem_flags = [], inst_flags = []) {{ 5934626SN/A (header_output, decoder_output, decode_block, exec_output) = \ 5944626SN/A LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags, 5954626SN/A postacc_code, exec_template_base = 'StoreCond') 5964626SN/A}}; 5974626SN/A