uncond.isa revision 7191
17191Sgblack@eecs.umich.edu// Copyright (c) 2010 ARM Limited
27191Sgblack@eecs.umich.edu// All rights reserved
37191Sgblack@eecs.umich.edu//
47191Sgblack@eecs.umich.edu// The license below extends only to copyright in the software and shall
57191Sgblack@eecs.umich.edu// not be construed as granting a license to any other intellectual
67191Sgblack@eecs.umich.edu// property including but not limited to intellectual property relating
77191Sgblack@eecs.umich.edu// to a hardware implementation of the functionality of the software
87191Sgblack@eecs.umich.edu// licensed hereunder.  You may use the software subject to the license
97191Sgblack@eecs.umich.edu// terms below provided that you ensure that this notice is replicated
107191Sgblack@eecs.umich.edu// unmodified and in its entirety in all distributions of the software,
117191Sgblack@eecs.umich.edu// modified or unmodified, in source code or in binary form.
127191Sgblack@eecs.umich.edu//
137191Sgblack@eecs.umich.edu// Redistribution and use in source and binary forms, with or without
147191Sgblack@eecs.umich.edu// modification, are permitted provided that the following conditions are
157191Sgblack@eecs.umich.edu// met: redistributions of source code must retain the above copyright
167191Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer;
177191Sgblack@eecs.umich.edu// redistributions in binary form must reproduce the above copyright
187191Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the
197191Sgblack@eecs.umich.edu// documentation and/or other materials provided with the distribution;
207191Sgblack@eecs.umich.edu// neither the name of the copyright holders nor the names of its
217191Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from
227191Sgblack@eecs.umich.edu// this software without specific prior written permission.
237191Sgblack@eecs.umich.edu//
247191Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
257191Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
267191Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
277191Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
287191Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
297191Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
307191Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
317191Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
327191Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
337191Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
347191Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
357191Sgblack@eecs.umich.edu//
367191Sgblack@eecs.umich.edu// Authors: Gabe Black
377191Sgblack@eecs.umich.edu
387191Sgblack@eecs.umich.edudef format ArmUnconditional() {{
397191Sgblack@eecs.umich.edu    decode_block = '''
407191Sgblack@eecs.umich.edu    {
417191Sgblack@eecs.umich.edu        const IntRegIndex rn = (IntRegIndex)(uint32_t)bits(machInst, 19, 16);
427191Sgblack@eecs.umich.edu        const uint32_t op1 = bits(machInst, 27, 20);
437191Sgblack@eecs.umich.edu        if (bits(op1, 7) == 0) {
447191Sgblack@eecs.umich.edu            const uint32_t op2 = bits(machInst, 7, 4);
457191Sgblack@eecs.umich.edu            if (op1 == 0x10) {
467191Sgblack@eecs.umich.edu                if (bits((uint32_t)rn, 0) == 1 && op2 == 0) {
477191Sgblack@eecs.umich.edu                    return new WarnUnimplemented("setend", machInst);
487191Sgblack@eecs.umich.edu                } else if (bits((uint32_t)rn, 0) == 0 && bits(op2, 1) == 0) {
497191Sgblack@eecs.umich.edu                    return new WarnUnimplemented("cps", machInst);
507191Sgblack@eecs.umich.edu                }
517191Sgblack@eecs.umich.edu            } else if (bits(op1, 6, 5) == 0x1) {
527191Sgblack@eecs.umich.edu                return new WarnUnimplemented(
537191Sgblack@eecs.umich.edu                        "Advanced SIMD data-processing", machInst);
547191Sgblack@eecs.umich.edu            } else if (bits(op1, 6, 4) == 0x4) {
557191Sgblack@eecs.umich.edu                if (bits(op1, 0) == 0) {
567191Sgblack@eecs.umich.edu                    return new WarnUnimplemented(
577191Sgblack@eecs.umich.edu                            "Advanced SIMD element or structure load/store",
587191Sgblack@eecs.umich.edu                            machInst);
597191Sgblack@eecs.umich.edu                } else if (bits(op1, 2, 0) == 1) {
607191Sgblack@eecs.umich.edu                    // Unallocated memory hint
617191Sgblack@eecs.umich.edu                    return new WarnUnimplemented("nop", machInst);
627191Sgblack@eecs.umich.edu                } else if (bits(op1, 2, 0) == 5) {
637191Sgblack@eecs.umich.edu                    return new WarnUnimplemented("pli", machInst);
647191Sgblack@eecs.umich.edu                }
657191Sgblack@eecs.umich.edu            } else if (bits(op1, 6, 4) == 0x5) {
667191Sgblack@eecs.umich.edu                if (bits(op1, 1, 0) == 0x1) {
677191Sgblack@eecs.umich.edu                    return new WarnUnimplemented("pld", machInst);
687191Sgblack@eecs.umich.edu                } else if (op1 == 0x57) {
697191Sgblack@eecs.umich.edu                    switch (op2) {
707191Sgblack@eecs.umich.edu                      case 0x1:
717191Sgblack@eecs.umich.edu                        return new WarnUnimplemented("clrex", machInst);
727191Sgblack@eecs.umich.edu                      case 0x4:
737191Sgblack@eecs.umich.edu                        return new WarnUnimplemented("dsb", machInst);
747191Sgblack@eecs.umich.edu                      case 0x5:
757191Sgblack@eecs.umich.edu                        return new WarnUnimplemented("dmb", machInst);
767191Sgblack@eecs.umich.edu                      case 0x6:
777191Sgblack@eecs.umich.edu                        return new WarnUnimplemented("isb", machInst);
787191Sgblack@eecs.umich.edu                    }
797191Sgblack@eecs.umich.edu                }
807191Sgblack@eecs.umich.edu            } else if (bits(op2, 0) == 0) {
817191Sgblack@eecs.umich.edu                switch (op1 & 0xf7) {
827191Sgblack@eecs.umich.edu                  case 0x61:
837191Sgblack@eecs.umich.edu                    // Unallocated memory hint
847191Sgblack@eecs.umich.edu                    return new WarnUnimplemented("nop", machInst);
857191Sgblack@eecs.umich.edu                  case 0x65:
867191Sgblack@eecs.umich.edu                    return new WarnUnimplemented("pli", machInst);
877191Sgblack@eecs.umich.edu                  case 0x71:
887191Sgblack@eecs.umich.edu                    return new WarnUnimplemented("pld", machInst);
897191Sgblack@eecs.umich.edu                }
907191Sgblack@eecs.umich.edu            }
917191Sgblack@eecs.umich.edu        } else {
927191Sgblack@eecs.umich.edu            switch (bits(machInst, 26, 25)) {
937191Sgblack@eecs.umich.edu              case 0x0:
947191Sgblack@eecs.umich.edu                {
957191Sgblack@eecs.umich.edu                    const uint32_t val = ((machInst >> 20) & 0x5);
967191Sgblack@eecs.umich.edu                    if (val == 0x4) {
977191Sgblack@eecs.umich.edu                        return new WarnUnimplemented("srs", machInst);
987191Sgblack@eecs.umich.edu                    } else if (val == 0x1) {
997191Sgblack@eecs.umich.edu                        return new WarnUnimplemented("rfe", machInst);
1007191Sgblack@eecs.umich.edu                    }
1017191Sgblack@eecs.umich.edu                }
1027191Sgblack@eecs.umich.edu                break;
1037191Sgblack@eecs.umich.edu              case 0x1:
1047191Sgblack@eecs.umich.edu                {
1057191Sgblack@eecs.umich.edu                    const uint32_t imm =
1067191Sgblack@eecs.umich.edu                        (sext<26>(bits(machInst, 23, 0) << 2)) |
1077191Sgblack@eecs.umich.edu                        (bits(machInst, 24) << 1);
1087191Sgblack@eecs.umich.edu                    return new BlxImm(machInst, imm);
1097191Sgblack@eecs.umich.edu                }
1107191Sgblack@eecs.umich.edu              case 0x2:
1117191Sgblack@eecs.umich.edu                if (bits(op1, 0) == 1) {
1127191Sgblack@eecs.umich.edu                    if (rn == INTREG_PC) {
1137191Sgblack@eecs.umich.edu                        if (bits(op1, 4, 3) != 0x0) {
1147191Sgblack@eecs.umich.edu                            return new WarnUnimplemented(
1157191Sgblack@eecs.umich.edu                                    "ldc, ldc2 (literal)", machInst);
1167191Sgblack@eecs.umich.edu                        }
1177191Sgblack@eecs.umich.edu                    } else {
1187191Sgblack@eecs.umich.edu                        if (op1 == 0xC3 || op1 == 0xC7) {
1197191Sgblack@eecs.umich.edu                            return new WarnUnimplemented(
1207191Sgblack@eecs.umich.edu                                    "ldc, ldc2 (immediate)", machInst);
1217191Sgblack@eecs.umich.edu                        }
1227191Sgblack@eecs.umich.edu                    }
1237191Sgblack@eecs.umich.edu                    if (op1 == 0xC5) {
1247191Sgblack@eecs.umich.edu                        return new WarnUnimplemented("mrrc, mrrc2", machInst);
1257191Sgblack@eecs.umich.edu                    }
1267191Sgblack@eecs.umich.edu                } else {
1277191Sgblack@eecs.umich.edu                    if (bits(op1, 4, 3) != 0 || bits(op1, 1) == 1) {
1287191Sgblack@eecs.umich.edu                        return new WarnUnimplemented("stc, stc2", machInst);
1297191Sgblack@eecs.umich.edu                    } else if (op1 == 0xC4) {
1307191Sgblack@eecs.umich.edu                        return new WarnUnimplemented("mcrr, mcrrc", machInst);
1317191Sgblack@eecs.umich.edu                    }
1327191Sgblack@eecs.umich.edu                }
1337191Sgblack@eecs.umich.edu                break;
1347191Sgblack@eecs.umich.edu              case 0x3:
1357191Sgblack@eecs.umich.edu                {
1367191Sgblack@eecs.umich.edu                    const bool op = bits(machInst, 4);
1377191Sgblack@eecs.umich.edu                    if (op) {
1387191Sgblack@eecs.umich.edu                        if (bits(op1, 0)) {
1397191Sgblack@eecs.umich.edu                            return new WarnUnimplemented(
1407191Sgblack@eecs.umich.edu                                    "mrc, mrc2", machInst);
1417191Sgblack@eecs.umich.edu                        } else {
1427191Sgblack@eecs.umich.edu                            return new WarnUnimplemented(
1437191Sgblack@eecs.umich.edu                                    "mcr, mcr2", machInst);
1447191Sgblack@eecs.umich.edu                        }
1457191Sgblack@eecs.umich.edu                    } else {
1467191Sgblack@eecs.umich.edu                        return new WarnUnimplemented("cdp, cdp2", machInst);
1477191Sgblack@eecs.umich.edu                    }
1487191Sgblack@eecs.umich.edu                }
1497191Sgblack@eecs.umich.edu                break;
1507191Sgblack@eecs.umich.edu            }
1517191Sgblack@eecs.umich.edu        }
1527191Sgblack@eecs.umich.edu        return new Unknown(machInst);
1537191Sgblack@eecs.umich.edu    }
1547191Sgblack@eecs.umich.edu    '''
1557191Sgblack@eecs.umich.edu}};
156