mem.isa revision 6243
16019Shines@cs.fsu.edu// -*- mode:c++ -*-
26019Shines@cs.fsu.edu
36019Shines@cs.fsu.edu// Copyright (c) 2007-2008 The Florida State University
46019Shines@cs.fsu.edu// All rights reserved.
56019Shines@cs.fsu.edu//
66019Shines@cs.fsu.edu// Redistribution and use in source and binary forms, with or without
76019Shines@cs.fsu.edu// modification, are permitted provided that the following conditions are
86019Shines@cs.fsu.edu// met: redistributions of source code must retain the above copyright
96019Shines@cs.fsu.edu// notice, this list of conditions and the following disclaimer;
106019Shines@cs.fsu.edu// redistributions in binary form must reproduce the above copyright
116019Shines@cs.fsu.edu// notice, this list of conditions and the following disclaimer in the
126019Shines@cs.fsu.edu// documentation and/or other materials provided with the distribution;
136019Shines@cs.fsu.edu// neither the name of the copyright holders nor the names of its
146019Shines@cs.fsu.edu// contributors may be used to endorse or promote products derived from
156019Shines@cs.fsu.edu// this software without specific prior written permission.
166019Shines@cs.fsu.edu//
176019Shines@cs.fsu.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
186019Shines@cs.fsu.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
196019Shines@cs.fsu.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
206019Shines@cs.fsu.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
216019Shines@cs.fsu.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
226019Shines@cs.fsu.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
236019Shines@cs.fsu.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
246019Shines@cs.fsu.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
256019Shines@cs.fsu.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
266019Shines@cs.fsu.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
276019Shines@cs.fsu.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
286019Shines@cs.fsu.edu//
296019Shines@cs.fsu.edu// Authors: Stephen Hines
306019Shines@cs.fsu.edu
316019Shines@cs.fsu.edu////////////////////////////////////////////////////////////////////
326019Shines@cs.fsu.edu//
336019Shines@cs.fsu.edu// Memory-format instructions
346019Shines@cs.fsu.edu//
356019Shines@cs.fsu.edu
366019Shines@cs.fsu.eduoutput header {{
376019Shines@cs.fsu.edu    /**
386019Shines@cs.fsu.edu     * Base class for general Arm memory-format instructions.
396019Shines@cs.fsu.edu     */
406019Shines@cs.fsu.edu    class Memory : public PredOp
416019Shines@cs.fsu.edu    {
426019Shines@cs.fsu.edu      protected:
436019Shines@cs.fsu.edu
446019Shines@cs.fsu.edu        /// Memory request flags.  See mem_req_base.hh.
456019Shines@cs.fsu.edu        unsigned memAccessFlags;
466019Shines@cs.fsu.edu        /// Pointer to EAComp object.
476019Shines@cs.fsu.edu        const StaticInstPtr eaCompPtr;
486019Shines@cs.fsu.edu        /// Pointer to MemAcc object.
496019Shines@cs.fsu.edu        const StaticInstPtr memAccPtr;
506019Shines@cs.fsu.edu
516019Shines@cs.fsu.edu        /// Displacement for EA calculation (signed).
526019Shines@cs.fsu.edu        int32_t disp;
536019Shines@cs.fsu.edu        int32_t disp8;
546019Shines@cs.fsu.edu        int32_t up;
556019Shines@cs.fsu.edu        int32_t hilo,
566019Shines@cs.fsu.edu                shift_size,
576019Shines@cs.fsu.edu                shift;
586019Shines@cs.fsu.edu
596019Shines@cs.fsu.edu        /// Constructor
606019Shines@cs.fsu.edu        Memory(const char *mnem, MachInst _machInst, OpClass __opClass,
616019Shines@cs.fsu.edu               StaticInstPtr _eaCompPtr = nullStaticInstPtr,
626019Shines@cs.fsu.edu               StaticInstPtr _memAccPtr = nullStaticInstPtr)
636019Shines@cs.fsu.edu            : PredOp(mnem, _machInst, __opClass),
646019Shines@cs.fsu.edu              memAccessFlags(0), eaCompPtr(_eaCompPtr), memAccPtr(_memAccPtr),
656019Shines@cs.fsu.edu              disp(IMMED_11_0), disp8(IMMED_7_0 << 2), up(UP),
666019Shines@cs.fsu.edu              hilo((IMMED_HI_11_8 << 4) | IMMED_LO_3_0),
676019Shines@cs.fsu.edu              shift_size(SHIFT_SIZE), shift(SHIFT)
686019Shines@cs.fsu.edu        {
696019Shines@cs.fsu.edu            // When Up is not set, then we must subtract by the displacement
706019Shines@cs.fsu.edu            if (!up)
716019Shines@cs.fsu.edu            {
726019Shines@cs.fsu.edu                disp = -disp;
736019Shines@cs.fsu.edu                disp8 = -disp8;
746019Shines@cs.fsu.edu                hilo = -hilo;
756019Shines@cs.fsu.edu            }
766019Shines@cs.fsu.edu        }
776019Shines@cs.fsu.edu
786019Shines@cs.fsu.edu        std::string
796019Shines@cs.fsu.edu        generateDisassembly(Addr pc, const SymbolTable *symtab) const;
806019Shines@cs.fsu.edu
816019Shines@cs.fsu.edu      public:
826019Shines@cs.fsu.edu
836019Shines@cs.fsu.edu        const StaticInstPtr &eaCompInst() const { return eaCompPtr; }
846019Shines@cs.fsu.edu        const StaticInstPtr &memAccInst() const { return memAccPtr; }
856019Shines@cs.fsu.edu    };
866019Shines@cs.fsu.edu
876019Shines@cs.fsu.edu     /**
886019Shines@cs.fsu.edu     * Base class for a few miscellaneous memory-format insts
896019Shines@cs.fsu.edu     * that don't interpret the disp field
906019Shines@cs.fsu.edu     */
916019Shines@cs.fsu.edu    class MemoryNoDisp : public Memory
926019Shines@cs.fsu.edu    {
936019Shines@cs.fsu.edu      protected:
946019Shines@cs.fsu.edu        /// Constructor
956019Shines@cs.fsu.edu        MemoryNoDisp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
966019Shines@cs.fsu.edu                     StaticInstPtr _eaCompPtr = nullStaticInstPtr,
976019Shines@cs.fsu.edu                     StaticInstPtr _memAccPtr = nullStaticInstPtr)
986019Shines@cs.fsu.edu            : Memory(mnem, _machInst, __opClass, _eaCompPtr, _memAccPtr)
996019Shines@cs.fsu.edu        {
1006019Shines@cs.fsu.edu        }
1016019Shines@cs.fsu.edu
1026019Shines@cs.fsu.edu        std::string
1036019Shines@cs.fsu.edu        generateDisassembly(Addr pc, const SymbolTable *symtab) const;
1046019Shines@cs.fsu.edu    };
1056019Shines@cs.fsu.edu}};
1066019Shines@cs.fsu.edu
1076019Shines@cs.fsu.edu
1086019Shines@cs.fsu.eduoutput decoder {{
1096019Shines@cs.fsu.edu    std::string
1106019Shines@cs.fsu.edu    Memory::generateDisassembly(Addr pc, const SymbolTable *symtab) const
1116019Shines@cs.fsu.edu    {
1126019Shines@cs.fsu.edu        return csprintf("%-10s", mnemonic);
1136019Shines@cs.fsu.edu    }
1146019Shines@cs.fsu.edu
1156019Shines@cs.fsu.edu    std::string
1166019Shines@cs.fsu.edu    MemoryNoDisp::generateDisassembly(Addr pc, const SymbolTable *symtab) const
1176019Shines@cs.fsu.edu    {
1186019Shines@cs.fsu.edu        return csprintf("%-10s", mnemonic);
1196019Shines@cs.fsu.edu    }
1206019Shines@cs.fsu.edu}};
1216019Shines@cs.fsu.edu
1226019Shines@cs.fsu.edudef template LoadStoreDeclare {{
1236019Shines@cs.fsu.edu    /**
1246019Shines@cs.fsu.edu     * Static instruction class for "%(mnemonic)s".
1256019Shines@cs.fsu.edu     */
1266019Shines@cs.fsu.edu    class %(class_name)s : public %(base_class)s
1276019Shines@cs.fsu.edu    {
1286019Shines@cs.fsu.edu      protected:
1296019Shines@cs.fsu.edu
1306019Shines@cs.fsu.edu        /**
1316019Shines@cs.fsu.edu         * "Fake" effective address computation class for "%(mnemonic)s".
1326019Shines@cs.fsu.edu         */
1336019Shines@cs.fsu.edu        class EAComp : public %(base_class)s
1346019Shines@cs.fsu.edu        {
1356019Shines@cs.fsu.edu          public:
1366019Shines@cs.fsu.edu            /// Constructor
1376019Shines@cs.fsu.edu            EAComp(MachInst machInst);
1386019Shines@cs.fsu.edu
1396019Shines@cs.fsu.edu            %(BasicExecDeclare)s
1406019Shines@cs.fsu.edu        };
1416019Shines@cs.fsu.edu
1426019Shines@cs.fsu.edu        /**
1436019Shines@cs.fsu.edu         * "Fake" memory access instruction class for "%(mnemonic)s".
1446019Shines@cs.fsu.edu         */
1456019Shines@cs.fsu.edu        class MemAcc : public %(base_class)s
1466019Shines@cs.fsu.edu        {
1476019Shines@cs.fsu.edu          public:
1486019Shines@cs.fsu.edu            /// Constructor
1496019Shines@cs.fsu.edu            MemAcc(MachInst machInst);
1506019Shines@cs.fsu.edu
1516019Shines@cs.fsu.edu            %(BasicExecDeclare)s
1526019Shines@cs.fsu.edu        };
1536019Shines@cs.fsu.edu
1546019Shines@cs.fsu.edu      public:
1556019Shines@cs.fsu.edu
1566019Shines@cs.fsu.edu        /// Constructor.
1576019Shines@cs.fsu.edu        %(class_name)s(MachInst machInst);
1586019Shines@cs.fsu.edu
1596019Shines@cs.fsu.edu        %(BasicExecDeclare)s
1606019Shines@cs.fsu.edu
1616019Shines@cs.fsu.edu        %(InitiateAccDeclare)s
1626019Shines@cs.fsu.edu
1636019Shines@cs.fsu.edu        %(CompleteAccDeclare)s
1646019Shines@cs.fsu.edu    };
1656019Shines@cs.fsu.edu}};
1666019Shines@cs.fsu.edu
1676019Shines@cs.fsu.edu
1686019Shines@cs.fsu.edudef template InitiateAccDeclare {{
1696019Shines@cs.fsu.edu    Fault initiateAcc(%(CPU_exec_context)s *, Trace::InstRecord *) const;
1706019Shines@cs.fsu.edu}};
1716019Shines@cs.fsu.edu
1726019Shines@cs.fsu.edu
1736019Shines@cs.fsu.edudef template CompleteAccDeclare {{
1746019Shines@cs.fsu.edu    Fault completeAcc(PacketPtr,  %(CPU_exec_context)s *, Trace::InstRecord *) const;
1756019Shines@cs.fsu.edu}};
1766019Shines@cs.fsu.edu
1776019Shines@cs.fsu.edu
1786019Shines@cs.fsu.edudef template EACompConstructor {{
1796019Shines@cs.fsu.edu    inline %(class_name)s::EAComp::EAComp(MachInst machInst)
1806019Shines@cs.fsu.edu        : %(base_class)s("%(mnemonic)s (EAComp)", machInst, IntAluOp)
1816019Shines@cs.fsu.edu    {
1826019Shines@cs.fsu.edu        %(constructor)s;
1836019Shines@cs.fsu.edu    }
1846019Shines@cs.fsu.edu}};
1856019Shines@cs.fsu.edu
1866019Shines@cs.fsu.edu
1876019Shines@cs.fsu.edudef template MemAccConstructor {{
1886019Shines@cs.fsu.edu    inline %(class_name)s::MemAcc::MemAcc(MachInst machInst)
1896019Shines@cs.fsu.edu        : %(base_class)s("%(mnemonic)s (MemAcc)", machInst, %(op_class)s)
1906019Shines@cs.fsu.edu    {
1916019Shines@cs.fsu.edu        %(constructor)s;
1926019Shines@cs.fsu.edu    }
1936019Shines@cs.fsu.edu}};
1946019Shines@cs.fsu.edu
1956019Shines@cs.fsu.edu
1966019Shines@cs.fsu.edudef template LoadStoreConstructor {{
1976019Shines@cs.fsu.edu    inline %(class_name)s::%(class_name)s(MachInst machInst)
1986019Shines@cs.fsu.edu         : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s,
1996019Shines@cs.fsu.edu                          new EAComp(machInst), new MemAcc(machInst))
2006019Shines@cs.fsu.edu    {
2016019Shines@cs.fsu.edu        %(constructor)s;
2026019Shines@cs.fsu.edu    }
2036019Shines@cs.fsu.edu}};
2046019Shines@cs.fsu.edu
2056019Shines@cs.fsu.edu
2066019Shines@cs.fsu.edudef template EACompExecute {{
2076019Shines@cs.fsu.edu    Fault
2086019Shines@cs.fsu.edu    %(class_name)s::EAComp::execute(%(CPU_exec_context)s *xc,
2096019Shines@cs.fsu.edu                                   Trace::InstRecord *traceData) const
2106019Shines@cs.fsu.edu    {
2116019Shines@cs.fsu.edu        Addr EA;
2126019Shines@cs.fsu.edu        Fault fault = NoFault;
2136019Shines@cs.fsu.edu
2146019Shines@cs.fsu.edu        %(fp_enable_check)s;
2156019Shines@cs.fsu.edu        %(op_decl)s;
2166019Shines@cs.fsu.edu        %(op_rd)s;
2176019Shines@cs.fsu.edu        %(ea_code)s;
2186019Shines@cs.fsu.edu
2196243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
2206019Shines@cs.fsu.edu        {
2216019Shines@cs.fsu.edu            if (fault == NoFault) {
2226019Shines@cs.fsu.edu                %(op_wb)s;
2236019Shines@cs.fsu.edu                xc->setEA(EA);
2246019Shines@cs.fsu.edu            }
2256019Shines@cs.fsu.edu        }
2266019Shines@cs.fsu.edu
2276019Shines@cs.fsu.edu        return fault;
2286019Shines@cs.fsu.edu    }
2296019Shines@cs.fsu.edu}};
2306019Shines@cs.fsu.edu
2316019Shines@cs.fsu.edudef template LoadMemAccExecute {{
2326019Shines@cs.fsu.edu    Fault
2336019Shines@cs.fsu.edu    %(class_name)s::MemAcc::execute(%(CPU_exec_context)s *xc,
2346019Shines@cs.fsu.edu                                   Trace::InstRecord *traceData) const
2356019Shines@cs.fsu.edu    {
2366019Shines@cs.fsu.edu        Addr EA;
2376019Shines@cs.fsu.edu        Fault fault = NoFault;
2386019Shines@cs.fsu.edu
2396019Shines@cs.fsu.edu        %(fp_enable_check)s;
2406019Shines@cs.fsu.edu        %(op_decl)s;
2416019Shines@cs.fsu.edu        %(op_rd)s;
2426019Shines@cs.fsu.edu        EA = xc->getEA();
2436019Shines@cs.fsu.edu
2446243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
2456019Shines@cs.fsu.edu        {
2466019Shines@cs.fsu.edu            if (fault == NoFault) {
2476019Shines@cs.fsu.edu                fault = xc->read(EA, (uint%(mem_acc_size)d_t&)Mem, memAccessFlags);
2486019Shines@cs.fsu.edu                %(memacc_code)s;
2496019Shines@cs.fsu.edu            }
2506019Shines@cs.fsu.edu
2516019Shines@cs.fsu.edu            if (fault == NoFault) {
2526019Shines@cs.fsu.edu                %(op_wb)s;
2536019Shines@cs.fsu.edu            }
2546019Shines@cs.fsu.edu        }
2556019Shines@cs.fsu.edu
2566019Shines@cs.fsu.edu        return fault;
2576019Shines@cs.fsu.edu    }
2586019Shines@cs.fsu.edu}};
2596019Shines@cs.fsu.edu
2606019Shines@cs.fsu.edu
2616019Shines@cs.fsu.edudef template LoadExecute {{
2626019Shines@cs.fsu.edu    Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
2636019Shines@cs.fsu.edu                                  Trace::InstRecord *traceData) const
2646019Shines@cs.fsu.edu    {
2656019Shines@cs.fsu.edu        Addr EA;
2666019Shines@cs.fsu.edu        Fault fault = NoFault;
2676019Shines@cs.fsu.edu
2686019Shines@cs.fsu.edu        %(fp_enable_check)s;
2696019Shines@cs.fsu.edu        %(op_decl)s;
2706019Shines@cs.fsu.edu        %(op_rd)s;
2716019Shines@cs.fsu.edu        %(ea_code)s;
2726019Shines@cs.fsu.edu
2736243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
2746019Shines@cs.fsu.edu        {
2756019Shines@cs.fsu.edu            if (fault == NoFault) {
2766019Shines@cs.fsu.edu                fault = xc->read(EA, (uint%(mem_acc_size)d_t&)Mem, memAccessFlags);
2776019Shines@cs.fsu.edu                %(memacc_code)s;
2786019Shines@cs.fsu.edu            }
2796019Shines@cs.fsu.edu
2806019Shines@cs.fsu.edu            if (fault == NoFault) {
2816019Shines@cs.fsu.edu                %(op_wb)s;
2826019Shines@cs.fsu.edu            }
2836019Shines@cs.fsu.edu        }
2846019Shines@cs.fsu.edu
2856019Shines@cs.fsu.edu        return fault;
2866019Shines@cs.fsu.edu    }
2876019Shines@cs.fsu.edu}};
2886019Shines@cs.fsu.edu
2896019Shines@cs.fsu.edu
2906019Shines@cs.fsu.edudef template LoadInitiateAcc {{
2916019Shines@cs.fsu.edu    Fault %(class_name)s::initiateAcc(%(CPU_exec_context)s *xc,
2926019Shines@cs.fsu.edu                                      Trace::InstRecord *traceData) const
2936019Shines@cs.fsu.edu    {
2946019Shines@cs.fsu.edu        Addr EA;
2956019Shines@cs.fsu.edu        Fault fault = NoFault;
2966019Shines@cs.fsu.edu
2976019Shines@cs.fsu.edu        %(fp_enable_check)s;
2986019Shines@cs.fsu.edu        %(op_src_decl)s;
2996019Shines@cs.fsu.edu        %(op_rd)s;
3006019Shines@cs.fsu.edu        %(ea_code)s;
3016019Shines@cs.fsu.edu
3026243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
3036019Shines@cs.fsu.edu        {
3046019Shines@cs.fsu.edu            if (fault == NoFault) {
3056019Shines@cs.fsu.edu                fault = xc->read(EA, (uint%(mem_acc_size)d_t &)Mem, memAccessFlags);
3066019Shines@cs.fsu.edu            }
3076019Shines@cs.fsu.edu        }
3086019Shines@cs.fsu.edu
3096019Shines@cs.fsu.edu        return fault;
3106019Shines@cs.fsu.edu    }
3116019Shines@cs.fsu.edu}};
3126019Shines@cs.fsu.edu
3136019Shines@cs.fsu.edu
3146019Shines@cs.fsu.edudef template LoadCompleteAcc {{
3156019Shines@cs.fsu.edu    Fault %(class_name)s::completeAcc(PacketPtr pkt,
3166019Shines@cs.fsu.edu                                      %(CPU_exec_context)s *xc,
3176019Shines@cs.fsu.edu                                      Trace::InstRecord *traceData) const
3186019Shines@cs.fsu.edu    {
3196019Shines@cs.fsu.edu        Fault fault = NoFault;
3206019Shines@cs.fsu.edu
3216019Shines@cs.fsu.edu        %(fp_enable_check)s;
3226019Shines@cs.fsu.edu        %(op_decl)s;
3236019Shines@cs.fsu.edu        %(op_rd)s;
3246019Shines@cs.fsu.edu
3256243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
3266019Shines@cs.fsu.edu        {
3276019Shines@cs.fsu.edu            // ARM instructions will not have a pkt if the predicate is false
3286019Shines@cs.fsu.edu            Mem = pkt->get<typeof(Mem)>();
3296019Shines@cs.fsu.edu
3306019Shines@cs.fsu.edu            if (fault == NoFault) {
3316019Shines@cs.fsu.edu                %(memacc_code)s;
3326019Shines@cs.fsu.edu            }
3336019Shines@cs.fsu.edu
3346019Shines@cs.fsu.edu            if (fault == NoFault) {
3356019Shines@cs.fsu.edu                %(op_wb)s;
3366019Shines@cs.fsu.edu            }
3376019Shines@cs.fsu.edu        }
3386019Shines@cs.fsu.edu
3396019Shines@cs.fsu.edu        return fault;
3406019Shines@cs.fsu.edu    }
3416019Shines@cs.fsu.edu}};
3426019Shines@cs.fsu.edu
3436019Shines@cs.fsu.edu
3446019Shines@cs.fsu.edudef template StoreMemAccExecute {{
3456019Shines@cs.fsu.edu    Fault
3466019Shines@cs.fsu.edu    %(class_name)s::MemAcc::execute(%(CPU_exec_context)s *xc,
3476019Shines@cs.fsu.edu                                   Trace::InstRecord *traceData) const
3486019Shines@cs.fsu.edu    {
3496019Shines@cs.fsu.edu        Addr EA;
3506019Shines@cs.fsu.edu        Fault fault = NoFault;
3516019Shines@cs.fsu.edu
3526019Shines@cs.fsu.edu        %(fp_enable_check)s;
3536019Shines@cs.fsu.edu        %(op_decl)s;
3546019Shines@cs.fsu.edu        %(op_rd)s;
3556019Shines@cs.fsu.edu
3566243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
3576019Shines@cs.fsu.edu        {
3586019Shines@cs.fsu.edu            EA = xc->getEA();
3596019Shines@cs.fsu.edu
3606019Shines@cs.fsu.edu            if (fault == NoFault) {
3616019Shines@cs.fsu.edu                fault = xc->write((uint%(mem_acc_size)d_t&)Mem, EA,
3626019Shines@cs.fsu.edu                                  memAccessFlags, NULL);
3636019Shines@cs.fsu.edu                if (traceData) { traceData->setData(Mem); }
3646019Shines@cs.fsu.edu            }
3656019Shines@cs.fsu.edu
3666019Shines@cs.fsu.edu            if (fault == NoFault) {
3676019Shines@cs.fsu.edu                %(op_wb)s;
3686019Shines@cs.fsu.edu            }
3696019Shines@cs.fsu.edu        }
3706019Shines@cs.fsu.edu
3716019Shines@cs.fsu.edu        return fault;
3726019Shines@cs.fsu.edu    }
3736019Shines@cs.fsu.edu}};
3746019Shines@cs.fsu.edu
3756019Shines@cs.fsu.edu
3766019Shines@cs.fsu.edudef template StoreExecute {{
3776019Shines@cs.fsu.edu    Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
3786019Shines@cs.fsu.edu                                  Trace::InstRecord *traceData) const
3796019Shines@cs.fsu.edu    {
3806019Shines@cs.fsu.edu        Addr EA;
3816019Shines@cs.fsu.edu        Fault fault = NoFault;
3826019Shines@cs.fsu.edu
3836019Shines@cs.fsu.edu        %(fp_enable_check)s;
3846019Shines@cs.fsu.edu        %(op_decl)s;
3856019Shines@cs.fsu.edu        %(op_rd)s;
3866019Shines@cs.fsu.edu        %(ea_code)s;
3876019Shines@cs.fsu.edu
3886243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
3896019Shines@cs.fsu.edu        {
3906019Shines@cs.fsu.edu            if (fault == NoFault) {
3916019Shines@cs.fsu.edu                %(memacc_code)s;
3926019Shines@cs.fsu.edu            }
3936019Shines@cs.fsu.edu
3946019Shines@cs.fsu.edu            if (fault == NoFault) {
3956019Shines@cs.fsu.edu                fault = xc->write((uint%(mem_acc_size)d_t&)Mem, EA,
3966019Shines@cs.fsu.edu                                  memAccessFlags, NULL);
3976019Shines@cs.fsu.edu                if (traceData) { traceData->setData(Mem); }
3986019Shines@cs.fsu.edu            }
3996019Shines@cs.fsu.edu
4006019Shines@cs.fsu.edu            if (fault == NoFault) {
4016019Shines@cs.fsu.edu                %(op_wb)s;
4026019Shines@cs.fsu.edu            }
4036019Shines@cs.fsu.edu        }
4046019Shines@cs.fsu.edu
4056019Shines@cs.fsu.edu        return fault;
4066019Shines@cs.fsu.edu    }
4076019Shines@cs.fsu.edu}};
4086019Shines@cs.fsu.edu
4096019Shines@cs.fsu.edudef template StoreInitiateAcc {{
4106019Shines@cs.fsu.edu    Fault %(class_name)s::initiateAcc(%(CPU_exec_context)s *xc,
4116019Shines@cs.fsu.edu                                      Trace::InstRecord *traceData) const
4126019Shines@cs.fsu.edu    {
4136019Shines@cs.fsu.edu        Addr EA;
4146019Shines@cs.fsu.edu        Fault fault = NoFault;
4156019Shines@cs.fsu.edu
4166019Shines@cs.fsu.edu        %(fp_enable_check)s;
4176019Shines@cs.fsu.edu        %(op_decl)s;
4186019Shines@cs.fsu.edu        %(op_rd)s;
4196019Shines@cs.fsu.edu        %(ea_code)s;
4206019Shines@cs.fsu.edu
4216243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
4226019Shines@cs.fsu.edu        {
4236019Shines@cs.fsu.edu            if (fault == NoFault) {
4246019Shines@cs.fsu.edu                %(memacc_code)s;
4256019Shines@cs.fsu.edu            }
4266019Shines@cs.fsu.edu
4276019Shines@cs.fsu.edu            if (fault == NoFault) {
4286019Shines@cs.fsu.edu                fault = xc->write((uint%(mem_acc_size)d_t&)Mem, EA,
4296019Shines@cs.fsu.edu                                  memAccessFlags, NULL);
4306019Shines@cs.fsu.edu                if (traceData) { traceData->setData(Mem); }
4316019Shines@cs.fsu.edu            }
4326019Shines@cs.fsu.edu
4336019Shines@cs.fsu.edu            // Need to write back any potential address register update
4346019Shines@cs.fsu.edu            if (fault == NoFault) {
4356019Shines@cs.fsu.edu                %(op_wb)s;
4366019Shines@cs.fsu.edu            }
4376019Shines@cs.fsu.edu        }
4386019Shines@cs.fsu.edu
4396019Shines@cs.fsu.edu        return fault;
4406019Shines@cs.fsu.edu    }
4416019Shines@cs.fsu.edu}};
4426019Shines@cs.fsu.edu
4436019Shines@cs.fsu.edu
4446019Shines@cs.fsu.edudef template StoreCompleteAcc {{
4456019Shines@cs.fsu.edu    Fault %(class_name)s::completeAcc(PacketPtr pkt,
4466019Shines@cs.fsu.edu                                      %(CPU_exec_context)s *xc,
4476019Shines@cs.fsu.edu                                      Trace::InstRecord *traceData) const
4486019Shines@cs.fsu.edu    {
4496019Shines@cs.fsu.edu        Fault fault = NoFault;
4506019Shines@cs.fsu.edu
4516019Shines@cs.fsu.edu        %(fp_enable_check)s;
4526019Shines@cs.fsu.edu        %(op_dest_decl)s;
4536019Shines@cs.fsu.edu
4546243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
4556019Shines@cs.fsu.edu        {
4566019Shines@cs.fsu.edu            if (fault == NoFault) {
4576019Shines@cs.fsu.edu                %(op_wb)s;
4586019Shines@cs.fsu.edu            }
4596019Shines@cs.fsu.edu        }
4606019Shines@cs.fsu.edu
4616019Shines@cs.fsu.edu        return fault;
4626019Shines@cs.fsu.edu    }
4636019Shines@cs.fsu.edu}};
4646019Shines@cs.fsu.edu
4656019Shines@cs.fsu.edudef template StoreCondCompleteAcc {{
4666019Shines@cs.fsu.edu    Fault %(class_name)s::completeAcc(PacketPtr pkt,
4676019Shines@cs.fsu.edu                                      %(CPU_exec_context)s *xc,
4686019Shines@cs.fsu.edu                                      Trace::InstRecord *traceData) const
4696019Shines@cs.fsu.edu    {
4706019Shines@cs.fsu.edu        Fault fault = NoFault;
4716019Shines@cs.fsu.edu
4726019Shines@cs.fsu.edu        %(fp_enable_check)s;
4736019Shines@cs.fsu.edu        %(op_dest_decl)s;
4746019Shines@cs.fsu.edu
4756243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
4766019Shines@cs.fsu.edu        {
4776019Shines@cs.fsu.edu            if (fault == NoFault) {
4786019Shines@cs.fsu.edu                %(op_wb)s;
4796019Shines@cs.fsu.edu            }
4806019Shines@cs.fsu.edu        }
4816019Shines@cs.fsu.edu
4826019Shines@cs.fsu.edu        return fault;
4836019Shines@cs.fsu.edu    }
4846019Shines@cs.fsu.edu}};
4856019Shines@cs.fsu.edu
4866019Shines@cs.fsu.edu
4876019Shines@cs.fsu.edudef template MiscMemAccExecute {{
4886019Shines@cs.fsu.edu    Fault %(class_name)s::MemAcc::execute(%(CPU_exec_context)s *xc,
4896019Shines@cs.fsu.edu                                          Trace::InstRecord *traceData) const
4906019Shines@cs.fsu.edu    {
4916019Shines@cs.fsu.edu        Addr EA;
4926019Shines@cs.fsu.edu        Fault fault = NoFault;
4936019Shines@cs.fsu.edu
4946019Shines@cs.fsu.edu        %(fp_enable_check)s;
4956019Shines@cs.fsu.edu        %(op_decl)s;
4966019Shines@cs.fsu.edu        %(op_rd)s;
4976019Shines@cs.fsu.edu
4986243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
4996019Shines@cs.fsu.edu        {
5006019Shines@cs.fsu.edu            EA = xc->getEA();
5016019Shines@cs.fsu.edu
5026019Shines@cs.fsu.edu            if (fault == NoFault) {
5036019Shines@cs.fsu.edu                %(memacc_code)s;
5046019Shines@cs.fsu.edu            }
5056019Shines@cs.fsu.edu        }
5066019Shines@cs.fsu.edu
5076019Shines@cs.fsu.edu        return NoFault;
5086019Shines@cs.fsu.edu    }
5096019Shines@cs.fsu.edu}};
5106019Shines@cs.fsu.edu
5116019Shines@cs.fsu.edudef template MiscExecute {{
5126019Shines@cs.fsu.edu    Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
5136019Shines@cs.fsu.edu                                  Trace::InstRecord *traceData) const
5146019Shines@cs.fsu.edu    {
5156019Shines@cs.fsu.edu        Addr EA;
5166019Shines@cs.fsu.edu        Fault fault = NoFault;
5176019Shines@cs.fsu.edu
5186019Shines@cs.fsu.edu        %(fp_enable_check)s;
5196019Shines@cs.fsu.edu        %(op_decl)s;
5206019Shines@cs.fsu.edu        %(op_rd)s;
5216019Shines@cs.fsu.edu        %(ea_code)s;
5226019Shines@cs.fsu.edu
5236243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
5246019Shines@cs.fsu.edu        {
5256019Shines@cs.fsu.edu            if (fault == NoFault) {
5266019Shines@cs.fsu.edu                %(memacc_code)s;
5276019Shines@cs.fsu.edu            }
5286019Shines@cs.fsu.edu        }
5296019Shines@cs.fsu.edu
5306019Shines@cs.fsu.edu        return NoFault;
5316019Shines@cs.fsu.edu    }
5326019Shines@cs.fsu.edu}};
5336019Shines@cs.fsu.edu
5346019Shines@cs.fsu.edudef template MiscInitiateAcc {{
5356019Shines@cs.fsu.edu    Fault %(class_name)s::initiateAcc(%(CPU_exec_context)s *xc,
5366019Shines@cs.fsu.edu                                      Trace::InstRecord *traceData) const
5376019Shines@cs.fsu.edu    {
5386019Shines@cs.fsu.edu        panic("Misc instruction does not support split access method!");
5396019Shines@cs.fsu.edu        return NoFault;
5406019Shines@cs.fsu.edu    }
5416019Shines@cs.fsu.edu}};
5426019Shines@cs.fsu.edu
5436019Shines@cs.fsu.edu
5446019Shines@cs.fsu.edudef template MiscCompleteAcc {{
5456019Shines@cs.fsu.edu    Fault %(class_name)s::completeAcc(PacketPtr pkt,
5466019Shines@cs.fsu.edu                                      %(CPU_exec_context)s *xc,
5476019Shines@cs.fsu.edu                                      Trace::InstRecord *traceData) const
5486019Shines@cs.fsu.edu    {
5496019Shines@cs.fsu.edu        panic("Misc instruction does not support split access method!");
5506019Shines@cs.fsu.edu
5516019Shines@cs.fsu.edu        return NoFault;
5526019Shines@cs.fsu.edu    }
5536019Shines@cs.fsu.edu}};
5546019Shines@cs.fsu.edu
5556019Shines@cs.fsu.edudef format ArmLoadMemory(memacc_code, ea_code = {{ EA = Rn + disp; }},
5566019Shines@cs.fsu.edu                     mem_flags = [], inst_flags = []) {{
5576019Shines@cs.fsu.edu    ea_code = ArmGenericCodeSubs(ea_code)
5586019Shines@cs.fsu.edu    memacc_code = ArmGenericCodeSubs(memacc_code)
5596019Shines@cs.fsu.edu    (header_output, decoder_output, decode_block, exec_output) = \
5606019Shines@cs.fsu.edu        LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags,
5616019Shines@cs.fsu.edu                      decode_template = BasicDecode,
5626019Shines@cs.fsu.edu                      exec_template_base = 'Load')
5636019Shines@cs.fsu.edu}};
5646019Shines@cs.fsu.edu
5656019Shines@cs.fsu.edudef format ArmStoreMemory(memacc_code, ea_code = {{ EA = Rn + disp; }},
5666019Shines@cs.fsu.edu                     mem_flags = [], inst_flags = []) {{
5676019Shines@cs.fsu.edu    ea_code = ArmGenericCodeSubs(ea_code)
5686019Shines@cs.fsu.edu    memacc_code = ArmGenericCodeSubs(memacc_code)
5696019Shines@cs.fsu.edu    (header_output, decoder_output, decode_block, exec_output) = \
5706019Shines@cs.fsu.edu        LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags,
5716019Shines@cs.fsu.edu                      exec_template_base = 'Store')
5726019Shines@cs.fsu.edu}};
5736019Shines@cs.fsu.edu
574