thumb.isa revision 7281:e67b0c646268
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//
157102SN/A// Copyright (c) 2009 The Regents of The University of Michigan
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//
417102SN/A// Authors: Gabe Black
426019SN/A
437102SN/A1: decode BIGTHUMB {
447104SN/A    // 16 bit thumb instructions.
457104SN/A    0: decode TOPCODE_15_13 {
467104SN/A        0x0, 0x1: Thumb16ShiftAddSubMoveCmp::thumb16ShiftAddMoveCmp();
477104SN/A        0x2: decode TOPCODE_12_10 {
487104SN/A            0x0: Thumb16DataProcessing::thumb16DataProcessing();
497104SN/A            0x1: Thumb16SpecDataAndBx::thumb16SpecDataAndBx();
507104SN/A            0x2, 0x3: Thumb16MemLit::thumb16MemLit();
517104SN/A            default: Thumb16MemReg::thumb16MemReg();
527104SN/A        }
537104SN/A        0x3, 0x4: Thumb16MemImm::thumb16MemImm();
547104SN/A        0x5: decode TOPCODE_12_11 {
557104SN/A            0x0: Thumb16Adr::thumb16Adr();
567104SN/A            0x1: Thumb16AddSp::thumb16AddSp(); //sp, immediate
577104SN/A            0x2, 0x3: Thumb16Misc::thumb16Misc();
587104SN/A        }
597104SN/A        0x6: decode TOPCODE_12_11 {
607104SN/A            0x0, 0x1: Thumb16MacroMem::thumb16MacroMem();
617104SN/A            0x2, 0x3: Thumb16CondBranchAndSvc::thumb16CondBranchAndSvc();
627104SN/A        }
637104SN/A        0x7: decode TOPCODE_12_11 {
647104SN/A            0x0: Thumb16UncondBranch::thumb16UncondBranch();
657104SN/A        }
667104SN/A    }
677104SN/A
687104SN/A    // 32 bit thumb instructions.
697104SN/A    1: decode HTOPCODE_12_11 {
707104SN/A        0x1: decode HTOPCODE_10_9 {
717104SN/A            0x0: decode HTOPCODE_6 {
727104SN/A                0x0: decode HTOPCODE_8_7 {
737104SN/A                    0x0, 0x3: decode HTOPCODE_4 {
747104SN/A                        0x0: WarnUnimpl::srs();
757104SN/A                        0x1: WarnUnimpl::rfe();
767104SN/A                    }
777104SN/A                    // This uses the same encoding as regular ARM.
787104SN/A                    default: ArmMacroMem::armMacroMem();
797104SN/A                }
807104SN/A                0x1: Thumb32LdrStrDExTbh::thumb32LdrStrDExTbh();
817104SN/A            }
827104SN/A            0x1: Thumb32DataProcShiftReg::thumb32DataProcShiftReg();
837104SN/A            default: decode HTOPCODE_9_8 {
847104SN/A                0x2: decode LTOPCODE_4 {
857104SN/A                    0x0: decode LTCOPROC {
867104SN/A                        0xa, 0xb: decode OPCODE_23_20 {
877104SN/A##include "vfp.isa"
887104SN/A                        }
897104SN/A                        default: WarnUnimpl::cdp(); // cdp2
907104SN/A                    }
917104SN/A                    0x1: decode LTCOPROC {
927104SN/A                        0xa, 0xb: WarnUnimpl::Core_to_extension_transfer();
937104SN/A                        default: decode CPNUM {
947104SN/A                            15: McrMrc15::mcrMrc15();
957104SN/A                            default: decode HTOPCODE_4 {
967104SN/A                                0x0: WarnUnimpl::mcr();
977104SN/A                                0x1: WarnUnimpl::mrc();
987104SN/A                            }
997104SN/A                        }
1007104SN/A                    }
1017104SN/A                }
1027104SN/A                0x3: WarnUnimpl::Advanced_SIMD();
1037104SN/A                default: decode LTCOPROC {
1047104SN/A                    0xa, 0xb: decode HTOPCODE_9_4 {
1057104SN/A                        0x00: Unknown::undefined();
1067104SN/A                        0x04: WarnUnimpl::mcrr(); // mcrr2
1077104SN/A                        0x05: WarnUnimpl::mrrc(); // mrrc2
1087104SN/A                        0x02, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10,
1097104SN/A                        0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e:
1107104SN/A                            WarnUnimpl::stc(); // stc2
1117104SN/A                        0x03, 0x07, 0x09, 0x0b, 0x0d, 0x0f, 0x11,
1127104SN/A                        0x13, 0x15, 0x17, 0x19, 0x1b, 0x1d, 0x1f:
1137104SN/A                            decode HTRN {
1147104SN/A                                0xf: WarnUnimpl::ldc(); // ldc2 (literal)
1157104SN/A                                default: WarnUnimpl::ldc(); // ldc2 (immediate)
1167104SN/A                            }
1177104SN/A                    }
1187104SN/A                    default: decode HTOPCODE_9_5 {
1197104SN/A                        0x00: Unknown::undefined();
1207104SN/A                        0x02: WarnUnimpl::SIMD_VFP_64_bit_core_extension_transfer();
1217104SN/A                        0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
1227104SN/A                        0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f:
1237104SN/A                            WarnUnimpl::Extension_register_load_store_instruction();
1247104SN/A                    }
1257104SN/A                }
1267104SN/A            }
1277104SN/A        }
1287104SN/A        0x2: decode LTOPCODE_15 {
1297104SN/A            0x0: decode HTOPCODE_9 {
1307104SN/A                0x0: Thumb32DataProcModImm::thumb32DataProcModImm();
1317104SN/A                0x1: Thumb32DataProcPlainBin::thumb32DataProcPlainBin();
1327104SN/A            }
1337104SN/A            0x1: Thumb32BranchesAndMiscCtrl::thumb32BranchesAndMiscCtrl();
1347104SN/A        }
1357104SN/A        0x3: decode HTOPCODE_10_9 {
1367104SN/A            0x0: decode HTOPCODE_4 {
1377104SN/A                0x0: decode HTOPCODE_8 {
1387104SN/A                    0x0: Thumb32StoreSingle::thumb32StoreSingle();
1397104SN/A                    0x1: WarnUnimpl::Advanced_SIMD_or_structure_load_store();
1407104SN/A                }
1417104SN/A                0x1: decode HTOPCODE_6_5 {
1427104SN/A                    0x0: LoadByteMemoryHints::loadByteMemoryHints();
1437104SN/A                    0x1: LoadHalfwordMemoryHints::loadHalfwordMemoryHints();
1447104SN/A                    0x2: Thumb32LoadWord::thumb32LoadWord();
1457104SN/A                    0x3: Unknown::undefined();
1467104SN/A                }
1477104SN/A            }
1487104SN/A            0x1: decode HTOPCODE_8_7 {
1497104SN/A                0x2: Thumb32MulMulAccAndAbsDiff::thumb32MulMulAccAndAbsDiff();
1507104SN/A                0x3: Thumb32LongMulMulAccAndDiv::thumb32LongMulMulAccAndDiv();
1517104SN/A                default: Thumb32DataProcReg::thumb32DataProcReg();
1527104SN/A            }
1537104SN/A            default: decode HTOPCODE_9_8 {
1547104SN/A                0x2: decode LTOPCODE_4 {
1557104SN/A                    0x0: decode LTCOPROC {
1567104SN/A                        0xa, 0xb: WarnUnimpl::VFP_Inst();
1577104SN/A                        default: WarnUnimpl::cdp(); // cdp2
1587104SN/A                    }
1597104SN/A                    0x1: decode LTCOPROC {
1607104SN/A                        0xa, 0xb: WarnUnimpl::Core_to_extension_transfer();
1617104SN/A                        default: decode CPNUM {
1627104SN/A                            15: McrMrc15::mcr2Mrc215();
1637104SN/A                            default: decode HTOPCODE_4 {
1647104SN/A                                0x0: WarnUnimpl::mcr2();
1657104SN/A                                0x1: WarnUnimpl::mrc2();
1667104SN/A                            }
1677104SN/A                        }
1687104SN/A                    }
1697104SN/A                }
1707104SN/A                0x3: WarnUnimpl::Advanced_SIMD();
1717104SN/A                default: decode LTCOPROC {
1727107SN/A                    0xa, 0xb: decode HTOPCODE_9_4 {
1737107SN/A                        0x00: Unknown::undefined();
1747107SN/A                        0x04: WarnUnimpl::mcrr(); // mcrr2
1757107SN/A                        0x05: WarnUnimpl::mrrc(); // mrrc2
1767107SN/A                        0x02, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10,
1777107SN/A                        0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e:
1787107SN/A                            WarnUnimpl::stc(); // stc2
1797107SN/A                        0x03, 0x07, 0x09, 0x0b, 0x0d, 0x0f, 0x11,
1807107SN/A                        0x13, 0x15, 0x17, 0x19, 0x1b, 0x1d, 0x1f:
1817107SN/A                            decode HTRN {
1827107SN/A                                0xf: WarnUnimpl::ldc(); // ldc2 (literal)
1837107SN/A                                default: WarnUnimpl::ldc(); // ldc2 (immediate)
1847107SN/A                            }
1857107SN/A                    }
1867107SN/A                    default: decode HTOPCODE_9_5 {
1877107SN/A                        0x00: Unknown::undefined();
1887107SN/A                        0x02: WarnUnimpl::SIMD_VFP_64_bit_core_extension_transfer();
1897107SN/A                        0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
1907107SN/A                        0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f:
1917107SN/A                            WarnUnimpl::Extension_register_load_store_instruction();
1927107SN/A                    }
1937107SN/A                }
1947107SN/A            }
1957107SN/A        }
1967107SN/A    }
1977107SN/A}
1987107SN/A