arm.isa revision 7120
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            }
936301SN/A            format AddrMode3 {
946301SN/A                0xb: strh_ldrh(store, {{ Mem.uh = Rd; }},
956301SN/A                               load,  {{ Rd = Mem.uh; }});
966301SN/A                0xd: ldrd_ldrsb(load, {{ Rde = bits(Mem.ud, 31, 0);
976301SN/A                                         Rdo = bits(Mem.ud, 63, 32); }},
986301SN/A                                load, {{ Rd = Mem.sb; }});
996301SN/A                0xf: strd_ldrsh(store, {{ Mem.ud = (Rde.ud & mask(32)) |
1006301SN/A                                                   (Rdo.ud << 32); }},
1016301SN/A                                load,  {{ Rd = Mem.sh; }});
1026019SN/A            }
1036019SN/A        }
1046268SN/A        0: decode IS_MISC {
1056268SN/A            0: decode OPCODE {
1066273SN/A                0x0: and({{ Rd = resTemp = Rn & op2; }});
1076273SN/A                0x1: eor({{ Rd = resTemp = Rn ^ op2; }});
1086276SN/A                0x2: sub({{ Rd = resTemp = Rn - op2; }}, sub);
1096276SN/A                0x3: rsb({{ Rd = resTemp = op2 - Rn; }}, rsb);
1106276SN/A                0x4: add({{ Rd = resTemp = Rn + op2; }}, add);
1116724SN/A                0x5: adc({{ Rd = resTemp = Rn + op2 + CondCodes<29:>; }}, add);
1126724SN/A                0x6: sbc({{ Rd = resTemp = Rn - op2 - !CondCodes<29:>; }}, sub);
1136724SN/A                0x7: rsc({{ Rd = resTemp = op2 - Rn - !CondCodes<29:>; }}, rsb);
1146273SN/A                0x8: tst({{ resTemp = Rn & op2; }});
1156273SN/A                0x9: teq({{ resTemp = Rn ^ op2; }});
1166276SN/A                0xa: cmp({{ resTemp = Rn - op2; }}, sub);
1176276SN/A                0xb: cmn({{ resTemp = Rn + op2; }}, add);
1186273SN/A                0xc: orr({{ Rd = resTemp = Rn | op2; }});
1196273SN/A                0xd: mov({{ Rd = resTemp = op2; }});
1206273SN/A                0xe: bic({{ Rd = resTemp = Rn & ~op2; }});
1216273SN/A                0xf: mvn({{ Rd = resTemp = ~op2; }});
1226268SN/A            }
1236268SN/A            1: decode MISC_OPCODE {
1246268SN/A                0x0: decode OPCODE {
1256747SN/A                    0x8: PredOp::mrs_cpsr({{
1266747SN/A                        Rd = (Cpsr | CondCodes) & 0xF8FF03DF;
1276747SN/A                    }});
1286751SN/A                    0x9: decode USEIMM {
1296751SN/A                        // The mask field is the same as the RN index.
1306753SN/A                        0: PredOp::msr_cpsr_reg({{
1316753SN/A                            uint32_t newCpsr =
1326753SN/A                                cpsrWriteByInstr(Cpsr | CondCodes,
1336753SN/A                                                 Rm, RN, false);
1346753SN/A                            Cpsr = ~CondCodesMask & newCpsr;
1356753SN/A                            CondCodes = CondCodesMask & newCpsr;
1366753SN/A                        }});
1376753SN/A                        1: PredImmOp::msr_cpsr_imm({{
1386751SN/A                            uint32_t newCpsr =
1396751SN/A                                cpsrWriteByInstr(Cpsr | CondCodes,
1406751SN/A                                                 rotated_imm, RN, false);
1416751SN/A                            Cpsr = ~CondCodesMask & newCpsr;
1426751SN/A                            CondCodes = CondCodesMask & newCpsr;
1436751SN/A                        }});
1446751SN/A                    }
1456747SN/A                    0xa: PredOp::mrs_spsr({{ Rd = Spsr; }});
1466751SN/A                    0xb: decode USEIMM {
1476751SN/A                        // The mask field is the same as the RN index.
1486753SN/A                        0: PredOp::msr_spsr_reg({{
1496753SN/A                            Spsr = spsrWriteByInstr(Spsr, Rm, RN, false);
1506753SN/A                        }});
1516753SN/A                        1: PredImmOp::msr_spsr_imm({{
1526751SN/A                            Spsr = spsrWriteByInstr(Spsr, rotated_imm,
1536751SN/A                                                    RN, false);
1546751SN/A                        }});
1556751SN/A                    }
1566268SN/A                }
1576268SN/A                0x1: decode OPCODE {
1586268SN/A                    0x9: BranchExchange::bx({{ }});
1596268SN/A                    0xb: PredOp::clz({{
1606402SN/A                        Rd = ((Rm == 0) ? 32 : (31 - findMsbSet(Rm)));
1616268SN/A                    }});
1626268SN/A                }
1636268SN/A                0x2: decode OPCODE {
1646268SN/A                    0x9: WarnUnimpl::bxj();
1656268SN/A                }
1666268SN/A                0x3: decode OPCODE {
1676268SN/A                    0x9: BranchExchange::blx({{ }}, Link);
1686268SN/A                }
1696268SN/A                0x5: decode OPCODE {
1706268SN/A                    0x8: WarnUnimpl::qadd();
1716268SN/A                    0x9: WarnUnimpl::qsub();
1726268SN/A                    0xa: WarnUnimpl::qdadd();
1736268SN/A                    0xb: WarnUnimpl::qdsub();
1746268SN/A                }
1756268SN/A                0x8: decode OPCODE {
1766741SN/A                    0x8: smlabb({{ Rn = resTemp = sext<16>(Rm<15:0>) * sext<16>(Rs<15:0>) + Rd; }}, overflow);
1776268SN/A                    0x9: WarnUnimpl::smlalbb();
1786268SN/A                    0xa: WarnUnimpl::smlawb();
1796741SN/A                    0xb: smulbb({{ Rn = resTemp = sext<16>(Rm<15:0>) * sext<16>(Rs<15:0>); }}, none);
1806268SN/A                }
1816268SN/A                0xa: decode OPCODE {
1826741SN/A                    0x8: smlatb({{ Rn = resTemp = sext<16>(Rm<31:16>) * sext<16>(Rs<15:0>) + Rd; }}, overflow);
1837102SN/A                    0x9: smulwb({{
1847102SN/A                        Rn = resTemp = bits(sext<32>(Rm) * sext<16>(Rs<15:0>), 47, 16);
1856741SN/A                    }}, none);
1866268SN/A                    0xa: WarnUnimpl::smlaltb();
1876741SN/A                    0xb: smultb({{ Rn = resTemp = sext<16>(Rm<31:16>) * sext<16>(Rs<15:0>); }}, none);
1886268SN/A                }
1896268SN/A                0xc: decode OPCODE {
1906741SN/A                    0x8: smlabt({{ Rn = resTemp = sext<16>(Rm<15:0>) * sext<16>(Rs<31:16>) + Rd; }}, overflow);
1916268SN/A                    0x9: WarnUnimpl::smlawt();
1926268SN/A                    0xa: WarnUnimpl::smlalbt();
1936741SN/A                    0xb: smulbt({{ Rn = resTemp = sext<16>(Rm<15:0>) * sext<16>(Rs<31:16>); }}, none);
1946268SN/A                }
1956268SN/A                0xe: decode OPCODE {
1966741SN/A                    0x8: smlatt({{ Rn = resTemp = sext<16>(Rm<31:16>) * sext<16>(Rs<31:16>) + Rd; }}, overflow);
1977102SN/A                    0x9: smulwt({{
1987102SN/A                        Rn = resTemp = bits(sext<32>(Rm) * sext<16>(Rs<31:16>), 47, 16);
1996741SN/A                    }}, none);
2006268SN/A                    0xa: WarnUnimpl::smlaltt();
2016741SN/A                    0xb: smultt({{ Rn = resTemp = sext<16>(Rm<31:16>) * sext<16>(Rs<31:16>); }}, none);
2026268SN/A                }
2036268SN/A            }
2046268SN/A        }
2056268SN/A    }
2066268SN/A    0x1: decode IS_MISC {
2076270SN/A        0: decode OPCODE {
2086270SN/A            format DataImmOp {
2096273SN/A                0x0: andi({{ Rd = resTemp = Rn & rotated_imm; }});
2106273SN/A                0x1: eori({{ Rd = resTemp = Rn ^ rotated_imm; }});
2116276SN/A                0x2: subi({{ Rd = resTemp = Rn - rotated_imm; }}, sub);
2126276SN/A                0x3: rsbi({{ Rd = resTemp = rotated_imm - Rn; }}, rsb);
2136276SN/A                0x4: addi({{ Rd = resTemp = Rn + rotated_imm; }}, add);
2146724SN/A                0x5: adci({{
2156724SN/A                    Rd = resTemp = Rn + rotated_imm + CondCodes<29:>;
2166724SN/A                }}, add);
2176724SN/A                0x6: sbci({{
2186724SN/A                    Rd = resTemp = Rn -rotated_imm - !CondCodes<29:>;
2196724SN/A                }}, sub);
2206724SN/A                0x7: rsci({{
2216724SN/A                    Rd = resTemp = rotated_imm - Rn - !CondCodes<29:>;
2226724SN/A                }}, rsb);
2236273SN/A                0x8: tsti({{ resTemp = Rn & rotated_imm; }});
2246273SN/A                0x9: teqi({{ resTemp = Rn ^ rotated_imm; }});
2256276SN/A                0xa: cmpi({{ resTemp = Rn - rotated_imm; }}, sub);
2266276SN/A                0xb: cmni({{ resTemp = Rn + rotated_imm; }}, add);
2276273SN/A                0xc: orri({{ Rd = resTemp = Rn | rotated_imm; }});
2286273SN/A                0xd: movi({{ Rd = resTemp = rotated_imm; }});
2296273SN/A                0xe: bici({{ Rd = resTemp = Rn & ~rotated_imm; }});
2306273SN/A                0xf: mvni({{ Rd = resTemp = ~rotated_imm; }});
2316019SN/A            }
2326019SN/A        }
2336268SN/A        1: decode OPCODE {
2346268SN/A            // The following two instructions aren't supposed to be defined
2356741SN/A            0x8: DataOp::movw({{ Rd = IMMED_11_0 | (RN << 12) ; }});
2366756SN/A            0x9: decode RN {
2376756SN/A                0: decode IMM {
2386756SN/A                    0: PredImmOp::nop({{ ; }});
2396756SN/A                    1: WarnUnimpl::yield();
2406756SN/A                    2: WarnUnimpl::wfe();
2416756SN/A                    3: WarnUnimpl::wfi();
2426756SN/A                    4: WarnUnimpl::sev();
2436756SN/A                }
2446756SN/A                default: PredImmOp::msr_i_cpsr({{
2456756SN/A                            uint32_t newCpsr =
2466756SN/A                                cpsrWriteByInstr(Cpsr | CondCodes,
2476756SN/A                                                 rotated_imm, RN, false);
2486756SN/A                            Cpsr = ~CondCodesMask & newCpsr;
2496756SN/A                            CondCodes = CondCodesMask & newCpsr;
2506756SN/A                }});
2516756SN/A            }
2526756SN/A            0xa: PredOp::movt({{ Rd = IMMED_11_0 << 16 | RN << 28 | Rd<15:0>; }});
2536756SN/A            0xb: PredImmOp::msr_i_spsr({{
2547102SN/A                       Spsr = spsrWriteByInstr(Spsr, rotated_imm, RN, false);
2556741SN/A            }});
2566019SN/A        }
2576268SN/A    }
2587120Sgblack@eecs.umich.edu    0x2: AddrMode2::addrMode2(True);
2596268SN/A    0x3: decode OPCODE_4 {
2607120Sgblack@eecs.umich.edu        0: AddrMode2::addrMode2(False);
2616269SN/A        1: decode MEDIA_OPCODE {
2626269SN/A            0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7: WarnUnimpl::parallel_add_subtract_instructions();
2636269SN/A            0x8: decode MISC_OPCODE {
2646269SN/A                0x1, 0x9: WarnUnimpl::pkhbt();
2656269SN/A                0x7: WarnUnimpl::sxtab16();
2666269SN/A                0xb: WarnUnimpl::sel();
2676269SN/A                0x5, 0xd: WarnUnimpl::pkhtb();
2686269SN/A                0x3: WarnUnimpl::sign_zero_extend_add();
2696269SN/A            }
2706269SN/A            0xa, 0xb: decode SHIFT {
2716269SN/A                0x0, 0x2: WarnUnimpl::ssat();
2726269SN/A                0x1: WarnUnimpl::ssat16();
2736269SN/A            }
2746269SN/A            0xe, 0xf: decode SHIFT {
2756269SN/A                0x0, 0x2: WarnUnimpl::usat();
2766269SN/A                0x1: WarnUnimpl::usat16();
2776269SN/A            }
2786269SN/A            0x10: decode RN {
2796269SN/A                0xf: decode MISC_OPCODE {
2806269SN/A                    0x1: WarnUnimpl::smuad();
2816269SN/A                    0x3: WarnUnimpl::smuadx();
2826269SN/A                    0x5: WarnUnimpl::smusd();
2836269SN/A                    0x7: WarnUnimpl::smusdx();
2846269SN/A                }
2856269SN/A                default: decode MISC_OPCODE {
2866269SN/A                    0x1: WarnUnimpl::smlad();
2876269SN/A                    0x3: WarnUnimpl::smladx();
2886269SN/A                    0x5: WarnUnimpl::smlsd();
2896269SN/A                    0x7: WarnUnimpl::smlsdx();
2906269SN/A                }
2916269SN/A            }
2926269SN/A            0x14: decode MISC_OPCODE {
2936269SN/A                0x1: WarnUnimpl::smlald();
2946269SN/A                0x3: WarnUnimpl::smlaldx();
2956269SN/A                0x5: WarnUnimpl::smlsld();
2966269SN/A                0x7: WarnUnimpl::smlsldx();
2976269SN/A            }
2986269SN/A            0x15: decode RN {
2996269SN/A                0xf: decode MISC_OPCODE {
3006269SN/A                    0x1: WarnUnimpl::smmul();
3016269SN/A                    0x3: WarnUnimpl::smmulr();
3026269SN/A                }
3036269SN/A                default: decode MISC_OPCODE {
3046269SN/A                    0x1: WarnUnimpl::smmla();
3056269SN/A                    0x3: WarnUnimpl::smmlar();
3066269SN/A                    0xd: WarnUnimpl::smmls();
3076269SN/A                    0xf: WarnUnimpl::smmlsr();
3086269SN/A                }
3096269SN/A            }
3106269SN/A            0x18: decode RN {
3116269SN/A                0xf: WarnUnimpl::usada8();
3126269SN/A                default: WarnUnimpl::usad8();
3136269SN/A            }
3146269SN/A        }
3156268SN/A    }
3166268SN/A    0x4: decode PUSWL {
3176268SN/A        // Right now we only handle cases when S (PSRUSER) is not set
3186268SN/A        default: ArmMacroStore::ldmstm({{ }});
3196268SN/A    }
3206268SN/A    0x5: decode OPCODE_24 {
3216268SN/A        // Branch (and Link) Instructions
3226268SN/A        0: Branch::b({{ }});
3236268SN/A        1: Branch::bl({{ }}, Link);
3246268SN/A    }
3256268SN/A    0x6: decode CPNUM {
3266268SN/A        0x1: decode PUNWL {
3276268SN/A            0x02,0x0a: decode OPCODE_15 {
3286268SN/A                0: ArmStoreMemory::stfs_({{ Mem.sf = Fd.sf;
3296268SN/A                                            Rn = Rn + disp8; }},
3306268SN/A                    {{ EA = Rn; }});
3316268SN/A                1: ArmMacroFPAOp::stfd_({{ }});
3326268SN/A            }
3336268SN/A            0x03,0x0b: decode OPCODE_15 {
3346268SN/A                0: ArmLoadMemory::ldfs_({{ Fd.sf = Mem.sf;
3356268SN/A                                           Rn = Rn + disp8; }},
3366268SN/A                    {{ EA = Rn; }});
3376268SN/A                1: ArmMacroFPAOp::ldfd_({{ }});
3386268SN/A            }
3396268SN/A            0x06,0x0e: decode OPCODE_15 {
3406268SN/A                0: ArmMacroFPAOp::stfe_nw({{ }});
3416268SN/A            }
3426268SN/A            0x07,0x0f: decode OPCODE_15 {
3436268SN/A                0: ArmMacroFPAOp::ldfe_nw({{ }});
3446268SN/A            }
3456268SN/A            0x10,0x18: decode OPCODE_15 {
3466268SN/A                0: ArmStoreMemory::stfs_p({{ Mem.sf = Fd.sf; }},
3476268SN/A                    {{ EA = Rn + disp8; }});
3486268SN/A                1: ArmMacroFPAOp::stfd_p({{ }});
3496268SN/A            }
3506268SN/A            0x11,0x19: decode OPCODE_15 {
3516268SN/A                0: ArmLoadMemory::ldfs_p({{ Fd.sf = Mem.sf; }},
3526268SN/A                    {{ EA = Rn + disp8; }});
3536268SN/A                1: ArmMacroFPAOp::ldfd_p({{ }});
3546268SN/A            }
3556268SN/A            0x12,0x1a: decode OPCODE_15 {
3566268SN/A                0: ArmStoreMemory::stfs_pw({{ Mem.sf = Fd.sf;
3576268SN/A                                              Rn = Rn + disp8; }},
3586268SN/A                    {{ EA = Rn + disp8; }});
3596268SN/A                1: ArmMacroFPAOp::stfd_pw({{ }});
3606268SN/A            }
3616268SN/A            0x13,0x1b: decode OPCODE_15 {
3626268SN/A                0: ArmLoadMemory::ldfs_pw({{ Fd.sf = Mem.sf;
3636268SN/A                                             Rn = Rn + disp8; }},
3646268SN/A                    {{ EA = Rn + disp8; }});
3656268SN/A                1: ArmMacroFPAOp::ldfd_pw({{ }});
3666268SN/A            }
3676268SN/A            0x14,0x1c: decode OPCODE_15 {
3686268SN/A                0: ArmMacroFPAOp::stfe_pn({{ }});
3696268SN/A            }
3706268SN/A            0x15,0x1d: decode OPCODE_15 {
3716268SN/A                0: ArmMacroFPAOp::ldfe_pn({{ }});
3726268SN/A            }
3736268SN/A            0x16,0x1e: decode OPCODE_15 {
3746268SN/A                0: ArmMacroFPAOp::stfe_pnw({{ }});
3756268SN/A            }
3766268SN/A            0x17,0x1f: decode OPCODE_15 {
3776268SN/A                0: ArmMacroFPAOp::ldfe_pnw({{ }});
3786019SN/A            }
3796019SN/A        }
3806268SN/A        0x2: decode PUNWL {
3816268SN/A            // could really just decode as a single instruction
3826268SN/A            0x00,0x04,0x08,0x0c: ArmMacroFMOp::sfm_({{ }});
3836268SN/A            0x01,0x05,0x09,0x0d: ArmMacroFMOp::lfm_({{ }});
3846268SN/A            0x02,0x06,0x0a,0x0e: ArmMacroFMOp::sfm_w({{ }});
3856268SN/A            0x03,0x07,0x0b,0x0f: ArmMacroFMOp::lfm_w({{ }});
3866268SN/A            0x10,0x14,0x18,0x1c: ArmMacroFMOp::sfm_p({{ }});
3876268SN/A            0x11,0x15,0x19,0x1d: ArmMacroFMOp::lfm_p({{ }});
3886268SN/A            0x12,0x16,0x1a,0x1e: ArmMacroFMOp::sfm_pw({{ }});
3896268SN/A            0x13,0x17,0x1b,0x1f: ArmMacroFMOp::lfm_pw({{ }});
3906019SN/A        }
3916412SN/A        0xb: decode LOADOP {
3926412SN/A            0x0: WarnUnimpl::fstmx();
3936412SN/A            0x1: WarnUnimpl::fldmx();
3946412SN/A        }
3956268SN/A    }
3966268SN/A    0x7: decode OPCODE_24 {
3976743SN/A        0: decode OPCODE_4 {
3986743SN/A            0: decode CPNUM {
3997105SN/A                0xa, 0xb: decode OPCODE_23_20 {
4007117Sgblack@eecs.umich.edu##include "vfp.isa"
4017105SN/A                }
4026743SN/A            } // CPNUM
4036743SN/A            1: decode CPNUM { // 27-24=1110,4 ==1
4046743SN/A                1: decode OPCODE_15_12 {
4056743SN/A                    format FloatOp {
4066268SN/A                        0xf: decode OPCODE_23_21 {
4076268SN/A                            format FloatCmp {
4086268SN/A                                0x4: cmf({{ Fn.df }}, {{ Fm.df }});
4096268SN/A                                0x5: cnf({{ Fn.df }}, {{ -Fm.df }});
4106268SN/A                                0x6: cmfe({{ Fn.df }}, {{ Fm.df}});
4116268SN/A                                0x7: cnfe({{ Fn.df }}, {{ -Fm.df}});
4126019SN/A                            }
4136019SN/A                        }
4146268SN/A                        default: decode OPCODE_23_20 {
4156268SN/A                            0x0: decode OPCODE_7 {
4166268SN/A                                0: flts({{ Fn.sf = (float) Rd.sw; }});
4176268SN/A                                1: fltd({{ Fn.df = (double) Rd.sw; }});
4186019SN/A                            }
4196268SN/A                            0x1: decode OPCODE_7 {
4206268SN/A                                0: fixs({{ Rd = (uint32_t) Fm.sf; }});
4216268SN/A                                1: fixd({{ Rd = (uint32_t) Fm.df; }});
4226019SN/A                            }
4236268SN/A                            0x2: wfs({{ Fpsr = Rd; }});
4246268SN/A                            0x3: rfs({{ Rd = Fpsr; }});
4256268SN/A                            0x4: FailUnimpl::wfc();
4266268SN/A                            0x5: FailUnimpl::rfc();
4276019SN/A                        }
4286743SN/A                    } // format FloatOp
4296019SN/A                }
4306743SN/A                0xa: decode MISC_OPCODE {
4316743SN/A                    0x1: decode MEDIA_OPCODE {
4326743SN/A                        0xf: decode RN {
4336743SN/A                            0x0: FloatOp::fmrx_fpsid({{ Rd = Fpsid; }});
4346743SN/A                            0x1: FloatOp::fmrx_fpscr({{ Rd = Fpscr; }});
4356743SN/A                            0x8: FloatOp::fmrx_fpexc({{ Rd = Fpexc; }});
4366743SN/A                        }
4376743SN/A                        0xe: decode RN {
4386743SN/A                            0x0: FloatOp::fmxr_fpsid({{ Fpsid = Rd; }});
4396743SN/A                            0x1: FloatOp::fmxr_fpscr({{ Fpscr = Rd; }});
4406743SN/A                            0x8: FloatOp::fmxr_fpexc({{ Fpexc = Rd; }});
4416743SN/A                        }
4426743SN/A                    } // MEDIA_OPCODE (MISC_OPCODE 0x1)
4436743SN/A                } // MISC_OPCODE (CPNUM 0xA)
4446759SN/A                0xf: decode RN {
4456759SN/A                    // Barrriers, Cache Maintence, NOPS
4466759SN/A                    7: decode OPCODE_23_21 {
4476759SN/A                        0: decode RM {
4486759SN/A                            0: decode OPC2 {
4496759SN/A                                4: decode OPCODE_20 {
4506759SN/A                                    0: PredOp::mcr_cp15_nop1({{ }}); // was wfi
4516759SN/A                                }
4526759SN/A                            }
4536759SN/A                            1: WarnUnimpl::cp15_cache_maint();
4546759SN/A                            4: WarnUnimpl::cp15_par();
4556759SN/A                            5: decode OPC2 {
4566759SN/A                                0,1: WarnUnimpl::cp15_cache_maint2();
4576759SN/A                                4: PredOp::cp15_isb({{ ; }}, IsMemBarrier, IsSerializeBefore);
4586759SN/A                                6,7: WarnUnimpl::cp15_bp_maint();
4596759SN/A                            }
4606759SN/A                            6: WarnUnimpl::cp15_cache_maint3();
4616759SN/A                            8: WarnUnimpl::cp15_va_to_pa();
4626759SN/A                            10: decode OPC2 {
4636759SN/A                                1,2: WarnUnimpl::cp15_cache_maint3();
4646759SN/A                                4: PredOp::cp15_dsb({{ ; }}, IsMemBarrier, IsSerializeBefore);
4656759SN/A                                5: PredOp::cp15_dmb({{ ; }}, IsMemBarrier, IsSerializeBefore);
4666759SN/A                            }
4676759SN/A                            11: WarnUnimpl::cp15_cache_maint4();
4686759SN/A                            13: decode OPC2 {
4696759SN/A                                1: decode OPCODE_20 {
4706759SN/A                                    0: PredOp::mcr_cp15_nop2({{ }}); // was prefetch
4716759SN/A                                }
4726759SN/A                            }
4736759SN/A                            14: WarnUnimpl::cp15_cache_maint5();
4746759SN/A                        } // RM
4756759SN/A                    } // OPCODE_23_21 CR
4767102SN/A
4776759SN/A                    // Thread ID and context ID registers
4786759SN/A                    // Thread ID register needs cheaper access than miscreg
4797102SN/A                    13: WarnUnimpl::mcr_mrc_cp15_c7();
4806759SN/A
4816759SN/A                    // All the rest
4826759SN/A                    default: decode OPCODE_20 {
4837102SN/A                        0: PredOp::mcr_cp15({{
4847102SN/A                               fault = setCp15Register(Rd, RN, OPCODE_23_21, RM, OPC2);
4856759SN/A                        }});
4867102SN/A                        1: PredOp::mrc_cp15({{
4877102SN/A                               fault = readCp15Register(Rd, RN, OPCODE_23_21, RM, OPC2);
4886759SN/A                        }});
4896759SN/A                    }
4907102SN/A                }  // RN
4916743SN/A            } // CPNUM  (OP4 == 1)
4926743SN/A        } //OPCODE_4
4936743SN/A
4946743SN/A#if FULL_SYSTEM
4957102SN/A        1: PredOp::swi({{ fault = new SupervisorCall; }}, IsSerializeAfter, IsNonSpeculative, IsSyscall);
4966743SN/A#else
4976743SN/A        1: PredOp::swi({{ if (testPredicate(CondCodes, condCode))
4986743SN/A            {
4996743SN/A                if (IMMED_23_0)
5006743SN/A                    xc->syscall(IMMED_23_0);
5016743SN/A                else
5026743SN/A                    xc->syscall(R7);
5036019SN/A            }
5046743SN/A        }});
5056743SN/A#endif // FULL_SYSTEM
5066743SN/A    } // OPCODE_24
5076743SN/A
5086268SN/A}
5096268SN/A}
5106019SN/A
511