arm.isa revision 7129
16019SN/A// -*- mode:c++ -*-
26019SN/A
37102SN/A// Copyright (c) 2010 ARM Limited
47102SN/A// All rights reserved
57102SN/A//
67102SN/A// The license below extends only to copyright in the software and shall
77102SN/A// not be construed as granting a license to any other intellectual
87102SN/A// property including but not limited to intellectual property relating
97102SN/A// to a hardware implementation of the functionality of the software
107102SN/A// licensed hereunder.  You may use the software subject to the license
117102SN/A// terms below provided that you ensure that this notice is replicated
127102SN/A// unmodified and in its entirety in all distributions of the software,
137102SN/A// modified or unmodified, in source code or in binary form.
147102SN/A//
156019SN/A// Copyright (c) 2007-2008 The Florida State University
166019SN/A// All rights reserved.
176019SN/A//
186019SN/A// Redistribution and use in source and binary forms, with or without
196019SN/A// modification, are permitted provided that the following conditions are
206019SN/A// met: redistributions of source code must retain the above copyright
216019SN/A// notice, this list of conditions and the following disclaimer;
226019SN/A// redistributions in binary form must reproduce the above copyright
236019SN/A// notice, this list of conditions and the following disclaimer in the
246019SN/A// documentation and/or other materials provided with the distribution;
256019SN/A// neither the name of the copyright holders nor the names of its
266019SN/A// contributors may be used to endorse or promote products derived from
276019SN/A// this software without specific prior written permission.
286019SN/A//
296019SN/A// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
306019SN/A// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
316019SN/A// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
326019SN/A// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
336019SN/A// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
346019SN/A// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
356019SN/A// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
366019SN/A// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
376019SN/A// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
386019SN/A// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
396019SN/A// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
406019SN/A//
416019SN/A// Authors: Stephen Hines
426019SN/A
436019SN/A////////////////////////////////////////////////////////////////////
446019SN/A//
456019SN/A// The actual ARM ISA decoder
466019SN/A// --------------------------
476019SN/A// The following instructions are specified in the ARM ISA
486019SN/A// Specification. Decoding closely follows the style specified
496019SN/A// in the ARM ISA specification document starting with Table B.1 or 3-1
506019SN/A//
516019SN/A//
526310SN/A
537102SN/A0: decode ENCODING {
546268SN/Aformat DataOp {
556268SN/A    0x0: decode SEVEN_AND_FOUR {
566268SN/A        1: decode MISC_OPCODE {
576268SN/A            0x9: decode PREPOST {
586268SN/A                0: decode OPCODE {
596276SN/A                    0x0: mul({{ Rn = resTemp = Rm * Rs; }}, none);
606280SN/A                    0x1: mla({{ Rn = resTemp = (Rm * Rs) + Rd; }}, none);
616268SN/A                    0x2: WarnUnimpl::umall();
626268SN/A                    0x4: umull({{
636268SN/A                        resTemp = ((uint64_t)Rm)*((uint64_t)Rs);
646268SN/A                        Rd = (uint32_t)(resTemp & 0xffffffff);
656268SN/A                        Rn = (uint32_t)(resTemp >> 32);
666741SN/A                    }}, llbit);
677102SN/A                    0x5: smlal({{
687102SN/A                        resTemp = ((int64_t)Rm) * ((int64_t)Rs);
697102SN/A                        resTemp += (((uint64_t)Rn) << 32) | ((uint64_t)Rd);
706741SN/A                        Rd = (uint32_t)(resTemp & 0xffffffff);
716741SN/A                        Rn = (uint32_t)(resTemp >> 32);
726741SN/A                    }}, llbit);
736268SN/A                    0x6: smull({{
746272SN/A                        resTemp = ((int64_t)(int32_t)Rm)*
756272SN/A                                  ((int64_t)(int32_t)Rs);
766268SN/A                        Rd = (int32_t)(resTemp & 0xffffffff);
776268SN/A                        Rn = (int32_t)(resTemp >> 32);
786741SN/A                    }}, llbit);
796268SN/A                    0x7: umlal({{
806268SN/A                        resTemp = ((uint64_t)Rm)*((uint64_t)Rs);
816268SN/A                        resTemp += ((uint64_t)Rn << 32)+((uint64_t)Rd);
826268SN/A                        Rd = (uint32_t)(resTemp & 0xffffffff);
836268SN/A                        Rn = (uint32_t)(resTemp >> 32);
846741SN/A                    }}, llbit);
856019SN/A                }
866268SN/A                1: decode PUBWL {
876268SN/A                    0x10: WarnUnimpl::swp();
886268SN/A                    0x14: WarnUnimpl::swpb();
896268SN/A                    0x18: WarnUnimpl::strex();
906268SN/A                    0x19: WarnUnimpl::ldrex();
916019SN/A                }
926019SN/A            }
937129Sgblack@eecs.umich.edu            0xb, 0xd, 0xf: AddrMode3::addrMode3();
946019SN/A        }
956268SN/A        0: decode IS_MISC {
966268SN/A            0: decode OPCODE {
976273SN/A                0x0: and({{ Rd = resTemp = Rn & op2; }});
986273SN/A                0x1: eor({{ Rd = resTemp = Rn ^ op2; }});
996276SN/A                0x2: sub({{ Rd = resTemp = Rn - op2; }}, sub);
1006276SN/A                0x3: rsb({{ Rd = resTemp = op2 - Rn; }}, rsb);
1016276SN/A                0x4: add({{ Rd = resTemp = Rn + op2; }}, add);
1026724SN/A                0x5: adc({{ Rd = resTemp = Rn + op2 + CondCodes<29:>; }}, add);
1036724SN/A                0x6: sbc({{ Rd = resTemp = Rn - op2 - !CondCodes<29:>; }}, sub);
1046724SN/A                0x7: rsc({{ Rd = resTemp = op2 - Rn - !CondCodes<29:>; }}, rsb);
1056273SN/A                0x8: tst({{ resTemp = Rn & op2; }});
1066273SN/A                0x9: teq({{ resTemp = Rn ^ op2; }});
1076276SN/A                0xa: cmp({{ resTemp = Rn - op2; }}, sub);
1086276SN/A                0xb: cmn({{ resTemp = Rn + op2; }}, add);
1096273SN/A                0xc: orr({{ Rd = resTemp = Rn | op2; }});
1106273SN/A                0xd: mov({{ Rd = resTemp = op2; }});
1116273SN/A                0xe: bic({{ Rd = resTemp = Rn & ~op2; }});
1126273SN/A                0xf: mvn({{ Rd = resTemp = ~op2; }});
1136268SN/A            }
1146268SN/A            1: decode MISC_OPCODE {
1156268SN/A                0x0: decode OPCODE {
1166747SN/A                    0x8: PredOp::mrs_cpsr({{
1176747SN/A                        Rd = (Cpsr | CondCodes) & 0xF8FF03DF;
1186747SN/A                    }});
1196751SN/A                    0x9: decode USEIMM {
1206751SN/A                        // The mask field is the same as the RN index.
1216753SN/A                        0: PredOp::msr_cpsr_reg({{
1226753SN/A                            uint32_t newCpsr =
1236753SN/A                                cpsrWriteByInstr(Cpsr | CondCodes,
1246753SN/A                                                 Rm, RN, false);
1256753SN/A                            Cpsr = ~CondCodesMask & newCpsr;
1266753SN/A                            CondCodes = CondCodesMask & newCpsr;
1276753SN/A                        }});
1286753SN/A                        1: PredImmOp::msr_cpsr_imm({{
1296751SN/A                            uint32_t newCpsr =
1306751SN/A                                cpsrWriteByInstr(Cpsr | CondCodes,
1316751SN/A                                                 rotated_imm, RN, false);
1326751SN/A                            Cpsr = ~CondCodesMask & newCpsr;
1336751SN/A                            CondCodes = CondCodesMask & newCpsr;
1346751SN/A                        }});
1356751SN/A                    }
1366747SN/A                    0xa: PredOp::mrs_spsr({{ Rd = Spsr; }});
1376751SN/A                    0xb: decode USEIMM {
1386751SN/A                        // The mask field is the same as the RN index.
1396753SN/A                        0: PredOp::msr_spsr_reg({{
1406753SN/A                            Spsr = spsrWriteByInstr(Spsr, Rm, RN, false);
1416753SN/A                        }});
1426753SN/A                        1: PredImmOp::msr_spsr_imm({{
1436751SN/A                            Spsr = spsrWriteByInstr(Spsr, rotated_imm,
1446751SN/A                                                    RN, false);
1456751SN/A                        }});
1466751SN/A                    }
1476268SN/A                }
1486268SN/A                0x1: decode OPCODE {
1496268SN/A                    0x9: BranchExchange::bx({{ }});
1506268SN/A                    0xb: PredOp::clz({{
1516402SN/A                        Rd = ((Rm == 0) ? 32 : (31 - findMsbSet(Rm)));
1526268SN/A                    }});
1536268SN/A                }
1546268SN/A                0x2: decode OPCODE {
1556268SN/A                    0x9: WarnUnimpl::bxj();
1566268SN/A                }
1576268SN/A                0x3: decode OPCODE {
1586268SN/A                    0x9: BranchExchange::blx({{ }}, Link);
1596268SN/A                }
1606268SN/A                0x5: decode OPCODE {
1616268SN/A                    0x8: WarnUnimpl::qadd();
1626268SN/A                    0x9: WarnUnimpl::qsub();
1636268SN/A                    0xa: WarnUnimpl::qdadd();
1646268SN/A                    0xb: WarnUnimpl::qdsub();
1656268SN/A                }
1666268SN/A                0x8: decode OPCODE {
1676741SN/A                    0x8: smlabb({{ Rn = resTemp = sext<16>(Rm<15:0>) * sext<16>(Rs<15:0>) + Rd; }}, overflow);
1686268SN/A                    0x9: WarnUnimpl::smlalbb();
1696268SN/A                    0xa: WarnUnimpl::smlawb();
1706741SN/A                    0xb: smulbb({{ Rn = resTemp = sext<16>(Rm<15:0>) * sext<16>(Rs<15:0>); }}, none);
1716268SN/A                }
1726268SN/A                0xa: decode OPCODE {
1736741SN/A                    0x8: smlatb({{ Rn = resTemp = sext<16>(Rm<31:16>) * sext<16>(Rs<15:0>) + Rd; }}, overflow);
1747102SN/A                    0x9: smulwb({{
1757102SN/A                        Rn = resTemp = bits(sext<32>(Rm) * sext<16>(Rs<15:0>), 47, 16);
1766741SN/A                    }}, none);
1776268SN/A                    0xa: WarnUnimpl::smlaltb();
1786741SN/A                    0xb: smultb({{ Rn = resTemp = sext<16>(Rm<31:16>) * sext<16>(Rs<15:0>); }}, none);
1796268SN/A                }
1806268SN/A                0xc: decode OPCODE {
1816741SN/A                    0x8: smlabt({{ Rn = resTemp = sext<16>(Rm<15:0>) * sext<16>(Rs<31:16>) + Rd; }}, overflow);
1826268SN/A                    0x9: WarnUnimpl::smlawt();
1836268SN/A                    0xa: WarnUnimpl::smlalbt();
1846741SN/A                    0xb: smulbt({{ Rn = resTemp = sext<16>(Rm<15:0>) * sext<16>(Rs<31:16>); }}, none);
1856268SN/A                }
1866268SN/A                0xe: decode OPCODE {
1876741SN/A                    0x8: smlatt({{ Rn = resTemp = sext<16>(Rm<31:16>) * sext<16>(Rs<31:16>) + Rd; }}, overflow);
1887102SN/A                    0x9: smulwt({{
1897102SN/A                        Rn = resTemp = bits(sext<32>(Rm) * sext<16>(Rs<31:16>), 47, 16);
1906741SN/A                    }}, none);
1916268SN/A                    0xa: WarnUnimpl::smlaltt();
1926741SN/A                    0xb: smultt({{ Rn = resTemp = sext<16>(Rm<31:16>) * sext<16>(Rs<31:16>); }}, none);
1936268SN/A                }
1946268SN/A            }
1956268SN/A        }
1966268SN/A    }
1976268SN/A    0x1: decode IS_MISC {
1986270SN/A        0: decode OPCODE {
1996270SN/A            format DataImmOp {
2006273SN/A                0x0: andi({{ Rd = resTemp = Rn & rotated_imm; }});
2016273SN/A                0x1: eori({{ Rd = resTemp = Rn ^ rotated_imm; }});
2026276SN/A                0x2: subi({{ Rd = resTemp = Rn - rotated_imm; }}, sub);
2036276SN/A                0x3: rsbi({{ Rd = resTemp = rotated_imm - Rn; }}, rsb);
2046276SN/A                0x4: addi({{ Rd = resTemp = Rn + rotated_imm; }}, add);
2056724SN/A                0x5: adci({{
2066724SN/A                    Rd = resTemp = Rn + rotated_imm + CondCodes<29:>;
2076724SN/A                }}, add);
2086724SN/A                0x6: sbci({{
2096724SN/A                    Rd = resTemp = Rn -rotated_imm - !CondCodes<29:>;
2106724SN/A                }}, sub);
2116724SN/A                0x7: rsci({{
2126724SN/A                    Rd = resTemp = rotated_imm - Rn - !CondCodes<29:>;
2136724SN/A                }}, rsb);
2146273SN/A                0x8: tsti({{ resTemp = Rn & rotated_imm; }});
2156273SN/A                0x9: teqi({{ resTemp = Rn ^ rotated_imm; }});
2166276SN/A                0xa: cmpi({{ resTemp = Rn - rotated_imm; }}, sub);
2176276SN/A                0xb: cmni({{ resTemp = Rn + rotated_imm; }}, add);
2186273SN/A                0xc: orri({{ Rd = resTemp = Rn | rotated_imm; }});
2196273SN/A                0xd: movi({{ Rd = resTemp = rotated_imm; }});
2206273SN/A                0xe: bici({{ Rd = resTemp = Rn & ~rotated_imm; }});
2216273SN/A                0xf: mvni({{ Rd = resTemp = ~rotated_imm; }});
2226019SN/A            }
2236019SN/A        }
2246268SN/A        1: decode OPCODE {
2256268SN/A            // The following two instructions aren't supposed to be defined
2266741SN/A            0x8: DataOp::movw({{ Rd = IMMED_11_0 | (RN << 12) ; }});
2276756SN/A            0x9: decode RN {
2286756SN/A                0: decode IMM {
2296756SN/A                    0: PredImmOp::nop({{ ; }});
2306756SN/A                    1: WarnUnimpl::yield();
2316756SN/A                    2: WarnUnimpl::wfe();
2326756SN/A                    3: WarnUnimpl::wfi();
2336756SN/A                    4: WarnUnimpl::sev();
2346756SN/A                }
2356756SN/A                default: PredImmOp::msr_i_cpsr({{
2366756SN/A                            uint32_t newCpsr =
2376756SN/A                                cpsrWriteByInstr(Cpsr | CondCodes,
2386756SN/A                                                 rotated_imm, RN, false);
2396756SN/A                            Cpsr = ~CondCodesMask & newCpsr;
2406756SN/A                            CondCodes = CondCodesMask & newCpsr;
2416756SN/A                }});
2426756SN/A            }
2436756SN/A            0xa: PredOp::movt({{ Rd = IMMED_11_0 << 16 | RN << 28 | Rd<15:0>; }});
2446756SN/A            0xb: PredImmOp::msr_i_spsr({{
2457102SN/A                       Spsr = spsrWriteByInstr(Spsr, rotated_imm, RN, false);
2466741SN/A            }});
2476019SN/A        }
2486268SN/A    }
2497120Sgblack@eecs.umich.edu    0x2: AddrMode2::addrMode2(True);
2506268SN/A    0x3: decode OPCODE_4 {
2517120Sgblack@eecs.umich.edu        0: AddrMode2::addrMode2(False);
2526269SN/A        1: decode MEDIA_OPCODE {
2536269SN/A            0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7: WarnUnimpl::parallel_add_subtract_instructions();
2546269SN/A            0x8: decode MISC_OPCODE {
2556269SN/A                0x1, 0x9: WarnUnimpl::pkhbt();
2566269SN/A                0x7: WarnUnimpl::sxtab16();
2576269SN/A                0xb: WarnUnimpl::sel();
2586269SN/A                0x5, 0xd: WarnUnimpl::pkhtb();
2596269SN/A                0x3: WarnUnimpl::sign_zero_extend_add();
2606269SN/A            }
2616269SN/A            0xa, 0xb: decode SHIFT {
2626269SN/A                0x0, 0x2: WarnUnimpl::ssat();
2636269SN/A                0x1: WarnUnimpl::ssat16();
2646269SN/A            }
2656269SN/A            0xe, 0xf: decode SHIFT {
2666269SN/A                0x0, 0x2: WarnUnimpl::usat();
2676269SN/A                0x1: WarnUnimpl::usat16();
2686269SN/A            }
2696269SN/A            0x10: decode RN {
2706269SN/A                0xf: decode MISC_OPCODE {
2716269SN/A                    0x1: WarnUnimpl::smuad();
2726269SN/A                    0x3: WarnUnimpl::smuadx();
2736269SN/A                    0x5: WarnUnimpl::smusd();
2746269SN/A                    0x7: WarnUnimpl::smusdx();
2756269SN/A                }
2766269SN/A                default: decode MISC_OPCODE {
2776269SN/A                    0x1: WarnUnimpl::smlad();
2786269SN/A                    0x3: WarnUnimpl::smladx();
2796269SN/A                    0x5: WarnUnimpl::smlsd();
2806269SN/A                    0x7: WarnUnimpl::smlsdx();
2816269SN/A                }
2826269SN/A            }
2836269SN/A            0x14: decode MISC_OPCODE {
2846269SN/A                0x1: WarnUnimpl::smlald();
2856269SN/A                0x3: WarnUnimpl::smlaldx();
2866269SN/A                0x5: WarnUnimpl::smlsld();
2876269SN/A                0x7: WarnUnimpl::smlsldx();
2886269SN/A            }
2896269SN/A            0x15: decode RN {
2906269SN/A                0xf: decode MISC_OPCODE {
2916269SN/A                    0x1: WarnUnimpl::smmul();
2926269SN/A                    0x3: WarnUnimpl::smmulr();
2936269SN/A                }
2946269SN/A                default: decode MISC_OPCODE {
2956269SN/A                    0x1: WarnUnimpl::smmla();
2966269SN/A                    0x3: WarnUnimpl::smmlar();
2976269SN/A                    0xd: WarnUnimpl::smmls();
2986269SN/A                    0xf: WarnUnimpl::smmlsr();
2996269SN/A                }
3006269SN/A            }
3016269SN/A            0x18: decode RN {
3026269SN/A                0xf: WarnUnimpl::usada8();
3036269SN/A                default: WarnUnimpl::usad8();
3046269SN/A            }
3056269SN/A        }
3066268SN/A    }
3076268SN/A    0x4: decode PUSWL {
3086268SN/A        // Right now we only handle cases when S (PSRUSER) is not set
3096268SN/A        default: ArmMacroStore::ldmstm({{ }});
3106268SN/A    }
3116268SN/A    0x5: decode OPCODE_24 {
3126268SN/A        // Branch (and Link) Instructions
3136268SN/A        0: Branch::b({{ }});
3146268SN/A        1: Branch::bl({{ }}, Link);
3156268SN/A    }
3166268SN/A    0x6: decode CPNUM {
3176268SN/A        0x1: decode PUNWL {
3186268SN/A            0x02,0x0a: decode OPCODE_15 {
3196268SN/A                0: ArmStoreMemory::stfs_({{ Mem.sf = Fd.sf;
3206268SN/A                                            Rn = Rn + disp8; }},
3216268SN/A                    {{ EA = Rn; }});
3226268SN/A                1: ArmMacroFPAOp::stfd_({{ }});
3236268SN/A            }
3246268SN/A            0x03,0x0b: decode OPCODE_15 {
3256268SN/A                0: ArmLoadMemory::ldfs_({{ Fd.sf = Mem.sf;
3266268SN/A                                           Rn = Rn + disp8; }},
3276268SN/A                    {{ EA = Rn; }});
3286268SN/A                1: ArmMacroFPAOp::ldfd_({{ }});
3296268SN/A            }
3306268SN/A            0x06,0x0e: decode OPCODE_15 {
3316268SN/A                0: ArmMacroFPAOp::stfe_nw({{ }});
3326268SN/A            }
3336268SN/A            0x07,0x0f: decode OPCODE_15 {
3346268SN/A                0: ArmMacroFPAOp::ldfe_nw({{ }});
3356268SN/A            }
3366268SN/A            0x10,0x18: decode OPCODE_15 {
3376268SN/A                0: ArmStoreMemory::stfs_p({{ Mem.sf = Fd.sf; }},
3386268SN/A                    {{ EA = Rn + disp8; }});
3396268SN/A                1: ArmMacroFPAOp::stfd_p({{ }});
3406268SN/A            }
3416268SN/A            0x11,0x19: decode OPCODE_15 {
3426268SN/A                0: ArmLoadMemory::ldfs_p({{ Fd.sf = Mem.sf; }},
3436268SN/A                    {{ EA = Rn + disp8; }});
3446268SN/A                1: ArmMacroFPAOp::ldfd_p({{ }});
3456268SN/A            }
3466268SN/A            0x12,0x1a: decode OPCODE_15 {
3476268SN/A                0: ArmStoreMemory::stfs_pw({{ Mem.sf = Fd.sf;
3486268SN/A                                              Rn = Rn + disp8; }},
3496268SN/A                    {{ EA = Rn + disp8; }});
3506268SN/A                1: ArmMacroFPAOp::stfd_pw({{ }});
3516268SN/A            }
3526268SN/A            0x13,0x1b: decode OPCODE_15 {
3536268SN/A                0: ArmLoadMemory::ldfs_pw({{ Fd.sf = Mem.sf;
3546268SN/A                                             Rn = Rn + disp8; }},
3556268SN/A                    {{ EA = Rn + disp8; }});
3566268SN/A                1: ArmMacroFPAOp::ldfd_pw({{ }});
3576268SN/A            }
3586268SN/A            0x14,0x1c: decode OPCODE_15 {
3596268SN/A                0: ArmMacroFPAOp::stfe_pn({{ }});
3606268SN/A            }
3616268SN/A            0x15,0x1d: decode OPCODE_15 {
3626268SN/A                0: ArmMacroFPAOp::ldfe_pn({{ }});
3636268SN/A            }
3646268SN/A            0x16,0x1e: decode OPCODE_15 {
3656268SN/A                0: ArmMacroFPAOp::stfe_pnw({{ }});
3666268SN/A            }
3676268SN/A            0x17,0x1f: decode OPCODE_15 {
3686268SN/A                0: ArmMacroFPAOp::ldfe_pnw({{ }});
3696019SN/A            }
3706019SN/A        }
3716268SN/A        0x2: decode PUNWL {
3726268SN/A            // could really just decode as a single instruction
3736268SN/A            0x00,0x04,0x08,0x0c: ArmMacroFMOp::sfm_({{ }});
3746268SN/A            0x01,0x05,0x09,0x0d: ArmMacroFMOp::lfm_({{ }});
3756268SN/A            0x02,0x06,0x0a,0x0e: ArmMacroFMOp::sfm_w({{ }});
3766268SN/A            0x03,0x07,0x0b,0x0f: ArmMacroFMOp::lfm_w({{ }});
3776268SN/A            0x10,0x14,0x18,0x1c: ArmMacroFMOp::sfm_p({{ }});
3786268SN/A            0x11,0x15,0x19,0x1d: ArmMacroFMOp::lfm_p({{ }});
3796268SN/A            0x12,0x16,0x1a,0x1e: ArmMacroFMOp::sfm_pw({{ }});
3806268SN/A            0x13,0x17,0x1b,0x1f: ArmMacroFMOp::lfm_pw({{ }});
3816019SN/A        }
3826412SN/A        0xb: decode LOADOP {
3836412SN/A            0x0: WarnUnimpl::fstmx();
3846412SN/A            0x1: WarnUnimpl::fldmx();
3856412SN/A        }
3866268SN/A    }
3876268SN/A    0x7: decode OPCODE_24 {
3886743SN/A        0: decode OPCODE_4 {
3896743SN/A            0: decode CPNUM {
3907105SN/A                0xa, 0xb: decode OPCODE_23_20 {
3917117Sgblack@eecs.umich.edu##include "vfp.isa"
3927105SN/A                }
3936743SN/A            } // CPNUM
3946743SN/A            1: decode CPNUM { // 27-24=1110,4 ==1
3956743SN/A                1: decode OPCODE_15_12 {
3966743SN/A                    format FloatOp {
3976268SN/A                        0xf: decode OPCODE_23_21 {
3986268SN/A                            format FloatCmp {
3996268SN/A                                0x4: cmf({{ Fn.df }}, {{ Fm.df }});
4006268SN/A                                0x5: cnf({{ Fn.df }}, {{ -Fm.df }});
4016268SN/A                                0x6: cmfe({{ Fn.df }}, {{ Fm.df}});
4026268SN/A                                0x7: cnfe({{ Fn.df }}, {{ -Fm.df}});
4036019SN/A                            }
4046019SN/A                        }
4056268SN/A                        default: decode OPCODE_23_20 {
4066268SN/A                            0x0: decode OPCODE_7 {
4076268SN/A                                0: flts({{ Fn.sf = (float) Rd.sw; }});
4086268SN/A                                1: fltd({{ Fn.df = (double) Rd.sw; }});
4096019SN/A                            }
4106268SN/A                            0x1: decode OPCODE_7 {
4116268SN/A                                0: fixs({{ Rd = (uint32_t) Fm.sf; }});
4126268SN/A                                1: fixd({{ Rd = (uint32_t) Fm.df; }});
4136019SN/A                            }
4146268SN/A                            0x2: wfs({{ Fpsr = Rd; }});
4156268SN/A                            0x3: rfs({{ Rd = Fpsr; }});
4166268SN/A                            0x4: FailUnimpl::wfc();
4176268SN/A                            0x5: FailUnimpl::rfc();
4186019SN/A                        }
4196743SN/A                    } // format FloatOp
4206019SN/A                }
4216743SN/A                0xa: decode MISC_OPCODE {
4226743SN/A                    0x1: decode MEDIA_OPCODE {
4236743SN/A                        0xf: decode RN {
4246743SN/A                            0x0: FloatOp::fmrx_fpsid({{ Rd = Fpsid; }});
4256743SN/A                            0x1: FloatOp::fmrx_fpscr({{ Rd = Fpscr; }});
4266743SN/A                            0x8: FloatOp::fmrx_fpexc({{ Rd = Fpexc; }});
4276743SN/A                        }
4286743SN/A                        0xe: decode RN {
4296743SN/A                            0x0: FloatOp::fmxr_fpsid({{ Fpsid = Rd; }});
4306743SN/A                            0x1: FloatOp::fmxr_fpscr({{ Fpscr = Rd; }});
4316743SN/A                            0x8: FloatOp::fmxr_fpexc({{ Fpexc = Rd; }});
4326743SN/A                        }
4336743SN/A                    } // MEDIA_OPCODE (MISC_OPCODE 0x1)
4346743SN/A                } // MISC_OPCODE (CPNUM 0xA)
4356759SN/A                0xf: decode RN {
4366759SN/A                    // Barrriers, Cache Maintence, NOPS
4376759SN/A                    7: decode OPCODE_23_21 {
4386759SN/A                        0: decode RM {
4396759SN/A                            0: decode OPC2 {
4406759SN/A                                4: decode OPCODE_20 {
4416759SN/A                                    0: PredOp::mcr_cp15_nop1({{ }}); // was wfi
4426759SN/A                                }
4436759SN/A                            }
4446759SN/A                            1: WarnUnimpl::cp15_cache_maint();
4456759SN/A                            4: WarnUnimpl::cp15_par();
4466759SN/A                            5: decode OPC2 {
4476759SN/A                                0,1: WarnUnimpl::cp15_cache_maint2();
4486759SN/A                                4: PredOp::cp15_isb({{ ; }}, IsMemBarrier, IsSerializeBefore);
4496759SN/A                                6,7: WarnUnimpl::cp15_bp_maint();
4506759SN/A                            }
4516759SN/A                            6: WarnUnimpl::cp15_cache_maint3();
4526759SN/A                            8: WarnUnimpl::cp15_va_to_pa();
4536759SN/A                            10: decode OPC2 {
4546759SN/A                                1,2: WarnUnimpl::cp15_cache_maint3();
4556759SN/A                                4: PredOp::cp15_dsb({{ ; }}, IsMemBarrier, IsSerializeBefore);
4566759SN/A                                5: PredOp::cp15_dmb({{ ; }}, IsMemBarrier, IsSerializeBefore);
4576759SN/A                            }
4586759SN/A                            11: WarnUnimpl::cp15_cache_maint4();
4596759SN/A                            13: decode OPC2 {
4606759SN/A                                1: decode OPCODE_20 {
4616759SN/A                                    0: PredOp::mcr_cp15_nop2({{ }}); // was prefetch
4626759SN/A                                }
4636759SN/A                            }
4646759SN/A                            14: WarnUnimpl::cp15_cache_maint5();
4656759SN/A                        } // RM
4666759SN/A                    } // OPCODE_23_21 CR
4677102SN/A
4686759SN/A                    // Thread ID and context ID registers
4696759SN/A                    // Thread ID register needs cheaper access than miscreg
4707102SN/A                    13: WarnUnimpl::mcr_mrc_cp15_c7();
4716759SN/A
4726759SN/A                    // All the rest
4736759SN/A                    default: decode OPCODE_20 {
4747102SN/A                        0: PredOp::mcr_cp15({{
4757102SN/A                               fault = setCp15Register(Rd, RN, OPCODE_23_21, RM, OPC2);
4766759SN/A                        }});
4777102SN/A                        1: PredOp::mrc_cp15({{
4787102SN/A                               fault = readCp15Register(Rd, RN, OPCODE_23_21, RM, OPC2);
4796759SN/A                        }});
4806759SN/A                    }
4817102SN/A                }  // RN
4826743SN/A            } // CPNUM  (OP4 == 1)
4836743SN/A        } //OPCODE_4
4846743SN/A
4856743SN/A#if FULL_SYSTEM
4867102SN/A        1: PredOp::swi({{ fault = new SupervisorCall; }}, IsSerializeAfter, IsNonSpeculative, IsSyscall);
4876743SN/A#else
4886743SN/A        1: PredOp::swi({{ if (testPredicate(CondCodes, condCode))
4896743SN/A            {
4906743SN/A                if (IMMED_23_0)
4916743SN/A                    xc->syscall(IMMED_23_0);
4926743SN/A                else
4936743SN/A                    xc->syscall(R7);
4946019SN/A            }
4956743SN/A        }});
4966743SN/A#endif // FULL_SYSTEM
4976743SN/A    } // OPCODE_24
4986743SN/A
4996268SN/A}
5006268SN/A}
5016019SN/A
502