mem.isa revision 6307
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.edudef template LoadStoreDeclare {{
376019Shines@cs.fsu.edu    /**
386019Shines@cs.fsu.edu     * Static instruction class for "%(mnemonic)s".
396019Shines@cs.fsu.edu     */
406019Shines@cs.fsu.edu    class %(class_name)s : public %(base_class)s
416019Shines@cs.fsu.edu    {
426019Shines@cs.fsu.edu      public:
436019Shines@cs.fsu.edu
446019Shines@cs.fsu.edu        /// Constructor.
456250Sgblack@eecs.umich.edu        %(class_name)s(ExtMachInst machInst);
466019Shines@cs.fsu.edu
476019Shines@cs.fsu.edu        %(BasicExecDeclare)s
486019Shines@cs.fsu.edu
496019Shines@cs.fsu.edu        %(InitiateAccDeclare)s
506019Shines@cs.fsu.edu
516019Shines@cs.fsu.edu        %(CompleteAccDeclare)s
526019Shines@cs.fsu.edu    };
536019Shines@cs.fsu.edu}};
546019Shines@cs.fsu.edu
556019Shines@cs.fsu.edu
566019Shines@cs.fsu.edudef template InitiateAccDeclare {{
576019Shines@cs.fsu.edu    Fault initiateAcc(%(CPU_exec_context)s *, Trace::InstRecord *) const;
586019Shines@cs.fsu.edu}};
596019Shines@cs.fsu.edu
606019Shines@cs.fsu.edu
616019Shines@cs.fsu.edudef template CompleteAccDeclare {{
626019Shines@cs.fsu.edu    Fault completeAcc(PacketPtr,  %(CPU_exec_context)s *, Trace::InstRecord *) const;
636019Shines@cs.fsu.edu}};
646019Shines@cs.fsu.edu
656019Shines@cs.fsu.edu
666305Sgblack@eecs.umich.edudef template LoadStoreConstructor {{
676305Sgblack@eecs.umich.edu    inline %(class_name)s::%(class_name)s(ExtMachInst machInst)
686305Sgblack@eecs.umich.edu         : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s)
696019Shines@cs.fsu.edu    {
706019Shines@cs.fsu.edu        %(constructor)s;
716019Shines@cs.fsu.edu    }
726019Shines@cs.fsu.edu}};
736019Shines@cs.fsu.edu
746019Shines@cs.fsu.edu
756019Shines@cs.fsu.edudef template LoadExecute {{
766019Shines@cs.fsu.edu    Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
776019Shines@cs.fsu.edu                                  Trace::InstRecord *traceData) const
786019Shines@cs.fsu.edu    {
796019Shines@cs.fsu.edu        Addr EA;
806019Shines@cs.fsu.edu        Fault fault = NoFault;
816019Shines@cs.fsu.edu
826019Shines@cs.fsu.edu        %(op_decl)s;
836019Shines@cs.fsu.edu        %(op_rd)s;
846019Shines@cs.fsu.edu        %(ea_code)s;
856019Shines@cs.fsu.edu
866243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
876019Shines@cs.fsu.edu        {
886019Shines@cs.fsu.edu            if (fault == NoFault) {
896019Shines@cs.fsu.edu                fault = xc->read(EA, (uint%(mem_acc_size)d_t&)Mem, memAccessFlags);
906019Shines@cs.fsu.edu                %(memacc_code)s;
916019Shines@cs.fsu.edu            }
926019Shines@cs.fsu.edu
936019Shines@cs.fsu.edu            if (fault == NoFault) {
946019Shines@cs.fsu.edu                %(op_wb)s;
956019Shines@cs.fsu.edu            }
966019Shines@cs.fsu.edu        }
976019Shines@cs.fsu.edu
986019Shines@cs.fsu.edu        return fault;
996019Shines@cs.fsu.edu    }
1006019Shines@cs.fsu.edu}};
1016019Shines@cs.fsu.edu
1026019Shines@cs.fsu.edu
1036019Shines@cs.fsu.edudef template LoadInitiateAcc {{
1046019Shines@cs.fsu.edu    Fault %(class_name)s::initiateAcc(%(CPU_exec_context)s *xc,
1056019Shines@cs.fsu.edu                                      Trace::InstRecord *traceData) const
1066019Shines@cs.fsu.edu    {
1076019Shines@cs.fsu.edu        Addr EA;
1086019Shines@cs.fsu.edu        Fault fault = NoFault;
1096019Shines@cs.fsu.edu
1106019Shines@cs.fsu.edu        %(op_src_decl)s;
1116019Shines@cs.fsu.edu        %(op_rd)s;
1126019Shines@cs.fsu.edu        %(ea_code)s;
1136019Shines@cs.fsu.edu
1146243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
1156019Shines@cs.fsu.edu        {
1166019Shines@cs.fsu.edu            if (fault == NoFault) {
1176019Shines@cs.fsu.edu                fault = xc->read(EA, (uint%(mem_acc_size)d_t &)Mem, memAccessFlags);
1186019Shines@cs.fsu.edu            }
1196019Shines@cs.fsu.edu        }
1206019Shines@cs.fsu.edu
1216019Shines@cs.fsu.edu        return fault;
1226019Shines@cs.fsu.edu    }
1236019Shines@cs.fsu.edu}};
1246019Shines@cs.fsu.edu
1256019Shines@cs.fsu.edu
1266019Shines@cs.fsu.edudef template LoadCompleteAcc {{
1276019Shines@cs.fsu.edu    Fault %(class_name)s::completeAcc(PacketPtr pkt,
1286019Shines@cs.fsu.edu                                      %(CPU_exec_context)s *xc,
1296019Shines@cs.fsu.edu                                      Trace::InstRecord *traceData) const
1306019Shines@cs.fsu.edu    {
1316019Shines@cs.fsu.edu        Fault fault = NoFault;
1326019Shines@cs.fsu.edu
1336019Shines@cs.fsu.edu        %(op_decl)s;
1346019Shines@cs.fsu.edu        %(op_rd)s;
1356019Shines@cs.fsu.edu
1366243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
1376019Shines@cs.fsu.edu        {
1386019Shines@cs.fsu.edu            // ARM instructions will not have a pkt if the predicate is false
1396019Shines@cs.fsu.edu            Mem = pkt->get<typeof(Mem)>();
1406019Shines@cs.fsu.edu
1416019Shines@cs.fsu.edu            if (fault == NoFault) {
1426019Shines@cs.fsu.edu                %(memacc_code)s;
1436019Shines@cs.fsu.edu            }
1446019Shines@cs.fsu.edu
1456019Shines@cs.fsu.edu            if (fault == NoFault) {
1466019Shines@cs.fsu.edu                %(op_wb)s;
1476019Shines@cs.fsu.edu            }
1486019Shines@cs.fsu.edu        }
1496019Shines@cs.fsu.edu
1506019Shines@cs.fsu.edu        return fault;
1516019Shines@cs.fsu.edu    }
1526019Shines@cs.fsu.edu}};
1536019Shines@cs.fsu.edu
1546019Shines@cs.fsu.edu
1556019Shines@cs.fsu.edudef template StoreExecute {{
1566019Shines@cs.fsu.edu    Fault %(class_name)s::execute(%(CPU_exec_context)s *xc,
1576019Shines@cs.fsu.edu                                  Trace::InstRecord *traceData) const
1586019Shines@cs.fsu.edu    {
1596019Shines@cs.fsu.edu        Addr EA;
1606019Shines@cs.fsu.edu        Fault fault = NoFault;
1616019Shines@cs.fsu.edu
1626019Shines@cs.fsu.edu        %(op_decl)s;
1636019Shines@cs.fsu.edu        %(op_rd)s;
1646019Shines@cs.fsu.edu        %(ea_code)s;
1656019Shines@cs.fsu.edu
1666243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
1676019Shines@cs.fsu.edu        {
1686019Shines@cs.fsu.edu            if (fault == NoFault) {
1696019Shines@cs.fsu.edu                %(memacc_code)s;
1706019Shines@cs.fsu.edu            }
1716019Shines@cs.fsu.edu
1726019Shines@cs.fsu.edu            if (fault == NoFault) {
1736019Shines@cs.fsu.edu                fault = xc->write((uint%(mem_acc_size)d_t&)Mem, EA,
1746019Shines@cs.fsu.edu                                  memAccessFlags, NULL);
1756019Shines@cs.fsu.edu                if (traceData) { traceData->setData(Mem); }
1766019Shines@cs.fsu.edu            }
1776019Shines@cs.fsu.edu
1786019Shines@cs.fsu.edu            if (fault == NoFault) {
1796019Shines@cs.fsu.edu                %(op_wb)s;
1806019Shines@cs.fsu.edu            }
1816019Shines@cs.fsu.edu        }
1826019Shines@cs.fsu.edu
1836019Shines@cs.fsu.edu        return fault;
1846019Shines@cs.fsu.edu    }
1856019Shines@cs.fsu.edu}};
1866019Shines@cs.fsu.edu
1876019Shines@cs.fsu.edudef template StoreInitiateAcc {{
1886019Shines@cs.fsu.edu    Fault %(class_name)s::initiateAcc(%(CPU_exec_context)s *xc,
1896019Shines@cs.fsu.edu                                      Trace::InstRecord *traceData) const
1906019Shines@cs.fsu.edu    {
1916019Shines@cs.fsu.edu        Addr EA;
1926019Shines@cs.fsu.edu        Fault fault = NoFault;
1936019Shines@cs.fsu.edu
1946019Shines@cs.fsu.edu        %(op_decl)s;
1956019Shines@cs.fsu.edu        %(op_rd)s;
1966019Shines@cs.fsu.edu        %(ea_code)s;
1976019Shines@cs.fsu.edu
1986243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
1996019Shines@cs.fsu.edu        {
2006019Shines@cs.fsu.edu            if (fault == NoFault) {
2016019Shines@cs.fsu.edu                %(memacc_code)s;
2026019Shines@cs.fsu.edu            }
2036019Shines@cs.fsu.edu
2046019Shines@cs.fsu.edu            if (fault == NoFault) {
2056019Shines@cs.fsu.edu                fault = xc->write((uint%(mem_acc_size)d_t&)Mem, EA,
2066019Shines@cs.fsu.edu                                  memAccessFlags, NULL);
2076019Shines@cs.fsu.edu                if (traceData) { traceData->setData(Mem); }
2086019Shines@cs.fsu.edu            }
2096019Shines@cs.fsu.edu
2106019Shines@cs.fsu.edu            // Need to write back any potential address register update
2116019Shines@cs.fsu.edu            if (fault == NoFault) {
2126019Shines@cs.fsu.edu                %(op_wb)s;
2136019Shines@cs.fsu.edu            }
2146019Shines@cs.fsu.edu        }
2156019Shines@cs.fsu.edu
2166019Shines@cs.fsu.edu        return fault;
2176019Shines@cs.fsu.edu    }
2186019Shines@cs.fsu.edu}};
2196019Shines@cs.fsu.edu
2206019Shines@cs.fsu.edu
2216019Shines@cs.fsu.edudef template StoreCompleteAcc {{
2226019Shines@cs.fsu.edu    Fault %(class_name)s::completeAcc(PacketPtr pkt,
2236019Shines@cs.fsu.edu                                      %(CPU_exec_context)s *xc,
2246019Shines@cs.fsu.edu                                      Trace::InstRecord *traceData) const
2256019Shines@cs.fsu.edu    {
2266019Shines@cs.fsu.edu        Fault fault = NoFault;
2276019Shines@cs.fsu.edu
2286302Sgblack@eecs.umich.edu        %(op_decl)s;
2296302Sgblack@eecs.umich.edu        %(op_rd)s;
2306019Shines@cs.fsu.edu
2316243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
2326019Shines@cs.fsu.edu        {
2336019Shines@cs.fsu.edu            if (fault == NoFault) {
2346019Shines@cs.fsu.edu                %(op_wb)s;
2356019Shines@cs.fsu.edu            }
2366019Shines@cs.fsu.edu        }
2376019Shines@cs.fsu.edu
2386019Shines@cs.fsu.edu        return fault;
2396019Shines@cs.fsu.edu    }
2406019Shines@cs.fsu.edu}};
2416019Shines@cs.fsu.edu
2426019Shines@cs.fsu.edudef template StoreCondCompleteAcc {{
2436019Shines@cs.fsu.edu    Fault %(class_name)s::completeAcc(PacketPtr pkt,
2446019Shines@cs.fsu.edu                                      %(CPU_exec_context)s *xc,
2456019Shines@cs.fsu.edu                                      Trace::InstRecord *traceData) const
2466019Shines@cs.fsu.edu    {
2476019Shines@cs.fsu.edu        Fault fault = NoFault;
2486019Shines@cs.fsu.edu
2496019Shines@cs.fsu.edu        %(op_dest_decl)s;
2506019Shines@cs.fsu.edu
2516243Sgblack@eecs.umich.edu        if (%(predicate_test)s)
2526019Shines@cs.fsu.edu        {
2536019Shines@cs.fsu.edu            if (fault == NoFault) {
2546019Shines@cs.fsu.edu                %(op_wb)s;
2556019Shines@cs.fsu.edu            }
2566019Shines@cs.fsu.edu        }
2576019Shines@cs.fsu.edu
2586019Shines@cs.fsu.edu        return fault;
2596019Shines@cs.fsu.edu    }
2606019Shines@cs.fsu.edu}};
2616019Shines@cs.fsu.edu
2626301Sgblack@eecs.umich.edulet {{
2636301Sgblack@eecs.umich.edu    def buildPUBWLCase(p, u, b, w, l):
2646301Sgblack@eecs.umich.edu        return (p << 4) + (u << 3) + (b << 2) + (w << 1) + (l << 0)
2656301Sgblack@eecs.umich.edu
2666303Sgblack@eecs.umich.edu    def buildMode2Inst(p, u, b, w, l, suffix, offset):
2676303Sgblack@eecs.umich.edu        mnem = ("str", "ldr")[l]
2686303Sgblack@eecs.umich.edu        op = ("-", "+")[u]
2696303Sgblack@eecs.umich.edu        offset = op + ArmGenericCodeSubs(offset);
2706303Sgblack@eecs.umich.edu        mem = ("Mem", "Mem.ub")[b]
2716303Sgblack@eecs.umich.edu        code = ("%s = Rd;", "Rd = %s;")[l] % mem
2726303Sgblack@eecs.umich.edu        ea_code = "EA = Rn %s;" % ("", offset)[p]
2736303Sgblack@eecs.umich.edu        if p == 0 or w == 1:
2746303Sgblack@eecs.umich.edu            code += "Rn = Rn %s;" % offset
2756303Sgblack@eecs.umich.edu        if p == 0 and w == 0:
2766303Sgblack@eecs.umich.edu            # Here's where we'll tack on a flag to make this a usermode access.
2776303Sgblack@eecs.umich.edu            mnem += "t"
2786303Sgblack@eecs.umich.edu        type = ("Store", "Load")[l]
2796307Sgblack@eecs.umich.edu        newSuffix = "_%s_P%dU%dB%dW%d" % (suffix, p, u, b, w)
2806303Sgblack@eecs.umich.edu        if b == 1:
2816303Sgblack@eecs.umich.edu            mnem += "b"
2826307Sgblack@eecs.umich.edu        return LoadStoreBase(mnem, mnem.capitalize() + newSuffix,
2836303Sgblack@eecs.umich.edu                ea_code, code, mem_flags = [], inst_flags = [],
2846307Sgblack@eecs.umich.edu                base_class = 'Memory' + suffix,
2856303Sgblack@eecs.umich.edu                exec_template_base = type.capitalize())
2866303Sgblack@eecs.umich.edu
2876301Sgblack@eecs.umich.edu    def buildMode3Inst(p, u, i, w, type, code, mnem):
2886301Sgblack@eecs.umich.edu        op = ("-", "+")[u]
2896301Sgblack@eecs.umich.edu        offset = ("%s Rm", "%s hilo")[i] % op
2906301Sgblack@eecs.umich.edu        ea_code = "EA = Rn %s;" % ("", offset)[p]
2916301Sgblack@eecs.umich.edu        if p == 0 or w == 1:
2926301Sgblack@eecs.umich.edu            code += "Rn = Rn %s;" % offset
2936307Sgblack@eecs.umich.edu        newSuffix = "_P%dU%dI%dW%d" % (p, u, i, w)
2946307Sgblack@eecs.umich.edu        suffix = ("Reg", "Hilo")[i]
2956307Sgblack@eecs.umich.edu        return LoadStoreBase(mnem, mnem.capitalize() + newSuffix,
2966301Sgblack@eecs.umich.edu                ea_code, code, mem_flags = [], inst_flags = [],
2976307Sgblack@eecs.umich.edu                base_class = 'Memory' + suffix,
2986301Sgblack@eecs.umich.edu                exec_template_base = type.capitalize())
2996301Sgblack@eecs.umich.edu}};
3006301Sgblack@eecs.umich.edu
3016303Sgblack@eecs.umich.edudef format AddrMode2(suffix, offset) {{
3026303Sgblack@eecs.umich.edu    header_output = decoder_output = exec_output = ""
3036303Sgblack@eecs.umich.edu    decode_block = "switch(PUBWL) {\n"
3046303Sgblack@eecs.umich.edu
3056303Sgblack@eecs.umich.edu    # Loop over all the values of p, u, b, w and l and build instructions and
3066303Sgblack@eecs.umich.edu    # a decode block for them.
3076303Sgblack@eecs.umich.edu    for p in (0, 1):
3086303Sgblack@eecs.umich.edu        for u in (0, 1):
3096303Sgblack@eecs.umich.edu            for b in (0, 1):
3106303Sgblack@eecs.umich.edu                for w in (0, 1):
3116303Sgblack@eecs.umich.edu                    for l in (0, 1):
3126303Sgblack@eecs.umich.edu                        (new_header_output,
3136303Sgblack@eecs.umich.edu                         new_decoder_output,
3146303Sgblack@eecs.umich.edu                         new_decode_block,
3156303Sgblack@eecs.umich.edu                         new_exec_output) = buildMode2Inst(p, u, b, w, l,
3166303Sgblack@eecs.umich.edu                                                           suffix, offset)
3176303Sgblack@eecs.umich.edu                        header_output += new_header_output
3186303Sgblack@eecs.umich.edu                        decoder_output += new_decoder_output
3196303Sgblack@eecs.umich.edu                        exec_output += new_exec_output
3206303Sgblack@eecs.umich.edu                        decode_block += '''
3216303Sgblack@eecs.umich.edu                            case %#x:
3226303Sgblack@eecs.umich.edu                              {%s}
3236303Sgblack@eecs.umich.edu                              break;
3246303Sgblack@eecs.umich.edu                        ''' % (buildPUBWLCase(p,u,b,w,l), new_decode_block)
3256303Sgblack@eecs.umich.edu    decode_block += '''
3266303Sgblack@eecs.umich.edu        default:
3276303Sgblack@eecs.umich.edu          return new Unknown(machInst);
3286303Sgblack@eecs.umich.edu        break;
3296303Sgblack@eecs.umich.edu    }'''
3306303Sgblack@eecs.umich.edu}};
3316303Sgblack@eecs.umich.edu
3326301Sgblack@eecs.umich.edudef format AddrMode3(l0Type, l0Code, l1Type, l1Code) {{
3336301Sgblack@eecs.umich.edu    l0Code = ArmGenericCodeSubs(l0Code);
3346301Sgblack@eecs.umich.edu    l1Code = ArmGenericCodeSubs(l1Code);
3356301Sgblack@eecs.umich.edu
3366301Sgblack@eecs.umich.edu    header_output = decoder_output = exec_output = ""
3376301Sgblack@eecs.umich.edu    decode_block = "switch(PUBWL) {\n"
3386301Sgblack@eecs.umich.edu    (l0Mnem, l1Mnem) = name.split("_");
3396301Sgblack@eecs.umich.edu
3406301Sgblack@eecs.umich.edu    # Loop over all the values of p, u, i, w and l and build instructions and
3416301Sgblack@eecs.umich.edu    # a decode block for them.
3426301Sgblack@eecs.umich.edu    for (l, type, code, mnem) in ((0, l0Type, l0Code, l0Mnem),
3436301Sgblack@eecs.umich.edu                                  (1, l1Type, l1Code, l1Mnem)):
3446301Sgblack@eecs.umich.edu        for p in (0, 1):
3456301Sgblack@eecs.umich.edu            wset = (0, 1)
3466301Sgblack@eecs.umich.edu            if (p == 0):
3476301Sgblack@eecs.umich.edu                wset = (0,)
3486301Sgblack@eecs.umich.edu            for u in (0, 1):
3496301Sgblack@eecs.umich.edu                for i in (0, 1):
3506301Sgblack@eecs.umich.edu                    for w in wset:
3516301Sgblack@eecs.umich.edu                        (new_header_output,
3526301Sgblack@eecs.umich.edu                         new_decoder_output,
3536301Sgblack@eecs.umich.edu                         new_decode_block,
3546301Sgblack@eecs.umich.edu                         new_exec_output) = buildMode3Inst(p, u, i, w,
3556301Sgblack@eecs.umich.edu                                                           type, code, mnem)
3566301Sgblack@eecs.umich.edu                        header_output += new_header_output
3576301Sgblack@eecs.umich.edu                        decoder_output += new_decoder_output
3586301Sgblack@eecs.umich.edu                        exec_output += new_exec_output
3596301Sgblack@eecs.umich.edu                        decode_block += '''
3606301Sgblack@eecs.umich.edu                            case %#x:
3616301Sgblack@eecs.umich.edu                              {%s}
3626301Sgblack@eecs.umich.edu                              break;
3636301Sgblack@eecs.umich.edu                        ''' % (buildPUBWLCase(p,u,i,w,l), new_decode_block)
3646301Sgblack@eecs.umich.edu
3656301Sgblack@eecs.umich.edu    decode_block += '''
3666301Sgblack@eecs.umich.edu        default:
3676301Sgblack@eecs.umich.edu          return new Unknown(machInst);
3686301Sgblack@eecs.umich.edu        break;
3696301Sgblack@eecs.umich.edu    }'''
3706301Sgblack@eecs.umich.edu}};
3716301Sgblack@eecs.umich.edu
3726019Shines@cs.fsu.edudef format ArmLoadMemory(memacc_code, ea_code = {{ EA = Rn + disp; }},
3736019Shines@cs.fsu.edu                     mem_flags = [], inst_flags = []) {{
3746019Shines@cs.fsu.edu    ea_code = ArmGenericCodeSubs(ea_code)
3756019Shines@cs.fsu.edu    memacc_code = ArmGenericCodeSubs(memacc_code)
3766019Shines@cs.fsu.edu    (header_output, decoder_output, decode_block, exec_output) = \
3776019Shines@cs.fsu.edu        LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags,
3786019Shines@cs.fsu.edu                      decode_template = BasicDecode,
3796019Shines@cs.fsu.edu                      exec_template_base = 'Load')
3806019Shines@cs.fsu.edu}};
3816019Shines@cs.fsu.edu
3826019Shines@cs.fsu.edudef format ArmStoreMemory(memacc_code, ea_code = {{ EA = Rn + disp; }},
3836019Shines@cs.fsu.edu                     mem_flags = [], inst_flags = []) {{
3846019Shines@cs.fsu.edu    ea_code = ArmGenericCodeSubs(ea_code)
3856019Shines@cs.fsu.edu    memacc_code = ArmGenericCodeSubs(memacc_code)
3866019Shines@cs.fsu.edu    (header_output, decoder_output, decode_block, exec_output) = \
3876019Shines@cs.fsu.edu        LoadStoreBase(name, Name, ea_code, memacc_code, mem_flags, inst_flags,
3886019Shines@cs.fsu.edu                      exec_template_base = 'Store')
3896019Shines@cs.fsu.edu}};
3906019Shines@cs.fsu.edu
391