thumb.isa revision 7157
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 {
467141Sgblack@eecs.umich.edu        0x0, 0x1: Thumb16ShiftAddSubMoveCmp::thumb16ShiftAddMoveCmp();
477104SN/A        0x2: decode TOPCODE_12_10 {
487141Sgblack@eecs.umich.edu            0x0: Thumb16DataProcessing::thumb16DataProcessing();
497141Sgblack@eecs.umich.edu            0x1: Thumb16SpecDataAndBx::thumb16SpecDataAndBx();
507126Sgblack@eecs.umich.edu            0x2, 0x3: Thumb16MemLit::thumb16MemLit();
517124Sgblack@eecs.umich.edu            default: Thumb16MemReg::thumb16MemReg();
527104SN/A        }
537125Sgblack@eecs.umich.edu        0x3, 0x4: Thumb16MemImm::thumb16MemImm();
547104SN/A        0x5: decode TOPCODE_12_11 {
557141Sgblack@eecs.umich.edu            0x0: Thumb16Adr::thumb16Adr();
567141Sgblack@eecs.umich.edu            0x1: Thumb16AddSp::thumb16AddSp(); //sp, immediate
577141Sgblack@eecs.umich.edu            0x2, 0x3: Thumb16Misc::thumb16Misc();
587104SN/A        }
597104SN/A        0x6: decode TOPCODE_12_11 {
607135Sgblack@eecs.umich.edu            0x0, 0x1: Thumb16MacroMem::thumb16MacroMem();
617154Sgblack@eecs.umich.edu            0x2, 0x3: Thumb16CondBranchAndSvc::thumb16CondBranchAndSvc();
627104SN/A        }
637104SN/A        0x7: decode TOPCODE_12_11 {
647154Sgblack@eecs.umich.edu            0x0: Thumb16UncondBranch::thumb16UncondBranch();
657104SN/A        }
667104SN/A    }
677107SN/A
687107SN/A    // 32 bit thumb instructions.
697107SN/A    1: decode HTOPCODE_12_11 {
707107SN/A        0x1: decode HTOPCODE_10_9 {
717107SN/A            0x0: decode HTOPCODE_8_6 {
727107SN/A                0x0, 0x6: decode HTOPCODE_4 {
737107SN/A                    0x0: WarnUnimpl::srs();
747107SN/A                    0x1: WarnUnimpl::rfe();
757107SN/A                }
767107SN/A                0x1: decode HTOPCODE_5_4 {
777107SN/A                    0x0: WarnUnimpl::strex();
787107SN/A                    0x1: WarnUnimpl::ldrex();
797107SN/A                    0x2: WarnUnimpl::strd(); // immediate
807107SN/A                    0x3: decode HTRN {
817107SN/A                        0xf: WarnUnimpl::ldrd(); // literal
827107SN/A                        default: WarnUnimpl::ldrd(); // immediate
837107SN/A                    }
847107SN/A                }
857136Sgblack@eecs.umich.edu                // This uses the same encoding as regular ARM.
867136Sgblack@eecs.umich.edu                0x2: ArmMacroMem::armMacroMem();
877107SN/A                0x3: decode HTOPCODE_5_4 {
887107SN/A                    0x0: decode LTOPCODE_7_4 {
897107SN/A                        0x4: WarnUnimpl::strexb();
907107SN/A                        0x5: WarnUnimpl::strexh();
917107SN/A                        0x7: WarnUnimpl::strexd();
927107SN/A                    }
937107SN/A                    0x1: decode LTOPCODE_7_4 {
947107SN/A                        0x0: WarnUnimpl::tbb();
957107SN/A                        0x1: WarnUnimpl::tbh();
967107SN/A                        0x4: WarnUnimpl::ldrexb();
977107SN/A                        0x5: WarnUnimpl::ldrexh();
987107SN/A                        0x7: WarnUnimpl::ldrexd();
997107SN/A                    }
1007107SN/A                    0x2: WarnUnimpl::strd(); // immediate
1017107SN/A                    0x3: decode HTRN {
1027107SN/A                        0xf: WarnUnimpl::ldrd(); // literal
1037107SN/A                        default: WarnUnimpl::ldrd(); // immediate
1047107SN/A                    }
1057107SN/A                }
1067136Sgblack@eecs.umich.edu                // This uses the same encoding as regular ARM.
1077136Sgblack@eecs.umich.edu                0x4: ArmMacroMem::armMacroMem();
1087107SN/A                0x5, 0x7: decode HTOPCODE_4 {
1097107SN/A                    0x0: WarnUnimpl::strd(); // immediate
1107107SN/A                    0x1: decode HTRN {
1117107SN/A                        0xf: WarnUnimpl::ldrd(); // literal
1127107SN/A                        default: WarnUnimpl::ldrd(); // immediate
1137107SN/A                    }
1147107SN/A                }
1157107SN/A            }
1167141Sgblack@eecs.umich.edu            0x1: Thumb32DataProcShiftReg::thumb32DataProcShiftReg();
1177107SN/A            default: decode HTOPCODE_9_8 {
1187107SN/A                0x2: decode LTOPCODE_4 {
1197107SN/A                    0x0: decode LTCOPROC {
1207107SN/A                        0xa, 0xb: decode OPCODE_23_20 {
1217117Sgblack@eecs.umich.edu##include "vfp.isa"
1227107SN/A                        }
1237107SN/A                        default: WarnUnimpl::cdp(); // cdp2
1247107SN/A                    }
1257107SN/A                    0x1: decode LTCOPROC {
1267107SN/A                        0xa, 0xb: WarnUnimpl::Core_to_extension_transfer();
1277107SN/A                        default: decode HTOPCODE_4 {
1287107SN/A                            0x0: WarnUnimpl::mcr(); // mcr2
1297107SN/A                            0x1: WarnUnimpl::mrc(); // mrc2
1307107SN/A                        }
1317107SN/A                    }
1327107SN/A                }
1337107SN/A                0x3: WarnUnimpl::Advanced_SIMD();
1347107SN/A                default: decode LTCOPROC {
1357107SN/A                    0xa, 0xb: decode HTOPCODE_9_4 {
1367107SN/A                        0x00: WarnUnimpl::undefined();
1377107SN/A                        0x04: WarnUnimpl::mcrr(); // mcrr2
1387107SN/A                        0x05: WarnUnimpl::mrrc(); // mrrc2
1397107SN/A                        0x02, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10,
1407107SN/A                        0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e:
1417107SN/A                            WarnUnimpl::stc(); // stc2
1427107SN/A                        0x03, 0x07, 0x09, 0x0b, 0x0d, 0x0f, 0x11,
1437107SN/A                        0x13, 0x15, 0x17, 0x19, 0x1b, 0x1d, 0x1f:
1447107SN/A                            decode HTRN {
1457107SN/A                                0xf: WarnUnimpl::ldc(); // ldc2 (literal)
1467107SN/A                                default: WarnUnimpl::ldc(); // ldc2 (immediate)
1477107SN/A                            }
1487107SN/A                    }
1497107SN/A                    default: decode HTOPCODE_9_5 {
1507107SN/A                        0x00: WarnUnimpl::undefined();
1517107SN/A                        0x02: WarnUnimpl::SIMD_VFP_64_bit_core_extension_transfer();
1527107SN/A                        0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
1537107SN/A                        0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f:
1547107SN/A                            WarnUnimpl::Extension_register_load_store_instruction();
1557107SN/A                    }
1567107SN/A                }
1577107SN/A            }
1587107SN/A        }
1597107SN/A        0x2: decode LTOPCODE_15 {
1607107SN/A            0x0: decode HTOPCODE_9 {
1617141Sgblack@eecs.umich.edu                0x0: Thumb32DataProcModImm::thumb32DataProcModImm();
1627157Sgblack@eecs.umich.edu                0x1: Thumb32DataProcPlainBin::thumb32DataProcPlainBin();
1637107SN/A            }
1647155Sgblack@eecs.umich.edu            0x1: Thumb32BranchesAndMiscCtrl::thumb32BranchesAndMiscCtrl();
1657107SN/A        }
1667107SN/A        0x3: decode HTOPCODE_10_9 {
1677107SN/A            0x0: decode HTOPCODE_4 {
1687107SN/A                0x0: decode HTOPCODE_8 {
1697123Sgblack@eecs.umich.edu                    0x0: Thumb32StoreSingle::thumb32StoreSingle();
1707107SN/A                    0x1: WarnUnimpl::Advanced_SIMD_or_structure_load_store();
1717107SN/A                }
1727107SN/A                0x1: decode HTOPCODE_6_5 {
1737107SN/A                    0x0: WarnUnimpl::Load_byte_memory_hints();
1747107SN/A                    0x1: WarnUnimpl::Load_halfword_memory_hints();
1757121Sgblack@eecs.umich.edu                    0x2: Thumb32LoadWord::thumb32LoadWord();
1767107SN/A                    0x3: WarnUnimpl::undefined();
1777107SN/A                }
1787107SN/A            }
1797107SN/A            0x1: decode HTOPCODE_8_7 {
1807107SN/A                0x2: WarnUnimpl::Multiply_multiply_accumulate_and_absolute_difference();
1817107SN/A                0x3: WarnUnimpl::Long_multiply_long_multiply_accumulate_and_divide();
1827107SN/A                default: WarnUnimpl::Data_processing_register();
1837107SN/A            }
1847107SN/A            default: decode HTOPCODE_9_8 {
1857107SN/A                0x2: decode LTOPCODE_4 {
1867107SN/A                    0x0: decode LTCOPROC {
1877107SN/A                        0xa, 0xb: WarnUnimpl::VFP_Inst();
1887107SN/A                        default: WarnUnimpl::cdp(); // cdp2
1897107SN/A                    }
1907107SN/A                    0x1: decode LTCOPROC {
1917107SN/A                        0xa, 0xb: WarnUnimpl::Core_to_extension_transfer();
1927107SN/A                        default: decode HTOPCODE_4 {
1937107SN/A                            0x0: WarnUnimpl::mcr(); // mcr2
1947107SN/A                            0x1: WarnUnimpl::mrc(); // mrc2
1957107SN/A                        }
1967107SN/A                    }
1977107SN/A                }
1987107SN/A                0x3: WarnUnimpl::Advanced_SIMD();
1997107SN/A                default: decode LTCOPROC {
2007107SN/A                    0xa, 0xb: decode HTOPCODE_9_4 {
2017107SN/A                        0x00: WarnUnimpl::undefined();
2027107SN/A                        0x04: WarnUnimpl::mcrr(); // mcrr2
2037107SN/A                        0x05: WarnUnimpl::mrrc(); // mrrc2
2047107SN/A                        0x02, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10,
2057107SN/A                        0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e:
2067107SN/A                            WarnUnimpl::stc(); // stc2
2077107SN/A                        0x03, 0x07, 0x09, 0x0b, 0x0d, 0x0f, 0x11,
2087107SN/A                        0x13, 0x15, 0x17, 0x19, 0x1b, 0x1d, 0x1f:
2097107SN/A                            decode HTRN {
2107107SN/A                                0xf: WarnUnimpl::ldc(); // ldc2 (literal)
2117107SN/A                                default: WarnUnimpl::ldc(); // ldc2 (immediate)
2127107SN/A                            }
2137107SN/A                    }
2147107SN/A                    default: decode HTOPCODE_9_5 {
2157107SN/A                        0x00: WarnUnimpl::undefined();
2167107SN/A                        0x02: WarnUnimpl::SIMD_VFP_64_bit_core_extension_transfer();
2177107SN/A                        0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
2187107SN/A                        0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f:
2197107SN/A                            WarnUnimpl::Extension_register_load_store_instruction();
2207107SN/A                    }
2217107SN/A                }
2227107SN/A            }
2237107SN/A        }
2247107SN/A    }
2256268SN/A}
226