thumb.isa revision 7141
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();
617104SN/A            default: decode TOPCODE_11_8 {
627104SN/A                0xe: WarnUnimpl::undefined(); // permanently undefined
637104SN/A                0xf: WarnUnimpl::svc(); // formerly swi
647104SN/A                default: WarnUnimpl::b(); // conditional
657104SN/A            }
667104SN/A        }
677104SN/A        0x7: decode TOPCODE_12_11 {
687104SN/A            0x0: WarnUnimpl::b(); // unconditional
697104SN/A        }
707104SN/A    }
717107SN/A
727107SN/A    // 32 bit thumb instructions.
737107SN/A    1: decode HTOPCODE_12_11 {
747107SN/A        0x1: decode HTOPCODE_10_9 {
757107SN/A            0x0: decode HTOPCODE_8_6 {
767107SN/A                0x0, 0x6: decode HTOPCODE_4 {
777107SN/A                    0x0: WarnUnimpl::srs();
787107SN/A                    0x1: WarnUnimpl::rfe();
797107SN/A                }
807107SN/A                0x1: decode HTOPCODE_5_4 {
817107SN/A                    0x0: WarnUnimpl::strex();
827107SN/A                    0x1: WarnUnimpl::ldrex();
837107SN/A                    0x2: WarnUnimpl::strd(); // immediate
847107SN/A                    0x3: decode HTRN {
857107SN/A                        0xf: WarnUnimpl::ldrd(); // literal
867107SN/A                        default: WarnUnimpl::ldrd(); // immediate
877107SN/A                    }
887107SN/A                }
897136Sgblack@eecs.umich.edu                // This uses the same encoding as regular ARM.
907136Sgblack@eecs.umich.edu                0x2: ArmMacroMem::armMacroMem();
917107SN/A                0x3: decode HTOPCODE_5_4 {
927107SN/A                    0x0: decode LTOPCODE_7_4 {
937107SN/A                        0x4: WarnUnimpl::strexb();
947107SN/A                        0x5: WarnUnimpl::strexh();
957107SN/A                        0x7: WarnUnimpl::strexd();
967107SN/A                    }
977107SN/A                    0x1: decode LTOPCODE_7_4 {
987107SN/A                        0x0: WarnUnimpl::tbb();
997107SN/A                        0x1: WarnUnimpl::tbh();
1007107SN/A                        0x4: WarnUnimpl::ldrexb();
1017107SN/A                        0x5: WarnUnimpl::ldrexh();
1027107SN/A                        0x7: WarnUnimpl::ldrexd();
1037107SN/A                    }
1047107SN/A                    0x2: WarnUnimpl::strd(); // immediate
1057107SN/A                    0x3: decode HTRN {
1067107SN/A                        0xf: WarnUnimpl::ldrd(); // literal
1077107SN/A                        default: WarnUnimpl::ldrd(); // immediate
1087107SN/A                    }
1097107SN/A                }
1107136Sgblack@eecs.umich.edu                // This uses the same encoding as regular ARM.
1117136Sgblack@eecs.umich.edu                0x4: ArmMacroMem::armMacroMem();
1127107SN/A                0x5, 0x7: decode HTOPCODE_4 {
1137107SN/A                    0x0: WarnUnimpl::strd(); // immediate
1147107SN/A                    0x1: decode HTRN {
1157107SN/A                        0xf: WarnUnimpl::ldrd(); // literal
1167107SN/A                        default: WarnUnimpl::ldrd(); // immediate
1177107SN/A                    }
1187107SN/A                }
1197107SN/A            }
1207141Sgblack@eecs.umich.edu            0x1: Thumb32DataProcShiftReg::thumb32DataProcShiftReg();
1217107SN/A            default: decode HTOPCODE_9_8 {
1227107SN/A                0x2: decode LTOPCODE_4 {
1237107SN/A                    0x0: decode LTCOPROC {
1247107SN/A                        0xa, 0xb: decode OPCODE_23_20 {
1257117Sgblack@eecs.umich.edu##include "vfp.isa"
1267107SN/A                        }
1277107SN/A                        default: WarnUnimpl::cdp(); // cdp2
1287107SN/A                    }
1297107SN/A                    0x1: decode LTCOPROC {
1307107SN/A                        0xa, 0xb: WarnUnimpl::Core_to_extension_transfer();
1317107SN/A                        default: decode HTOPCODE_4 {
1327107SN/A                            0x0: WarnUnimpl::mcr(); // mcr2
1337107SN/A                            0x1: WarnUnimpl::mrc(); // mrc2
1347107SN/A                        }
1357107SN/A                    }
1367107SN/A                }
1377107SN/A                0x3: WarnUnimpl::Advanced_SIMD();
1387107SN/A                default: decode LTCOPROC {
1397107SN/A                    0xa, 0xb: decode HTOPCODE_9_4 {
1407107SN/A                        0x00: WarnUnimpl::undefined();
1417107SN/A                        0x04: WarnUnimpl::mcrr(); // mcrr2
1427107SN/A                        0x05: WarnUnimpl::mrrc(); // mrrc2
1437107SN/A                        0x02, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10,
1447107SN/A                        0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e:
1457107SN/A                            WarnUnimpl::stc(); // stc2
1467107SN/A                        0x03, 0x07, 0x09, 0x0b, 0x0d, 0x0f, 0x11,
1477107SN/A                        0x13, 0x15, 0x17, 0x19, 0x1b, 0x1d, 0x1f:
1487107SN/A                            decode HTRN {
1497107SN/A                                0xf: WarnUnimpl::ldc(); // ldc2 (literal)
1507107SN/A                                default: WarnUnimpl::ldc(); // ldc2 (immediate)
1517107SN/A                            }
1527107SN/A                    }
1537107SN/A                    default: decode HTOPCODE_9_5 {
1547107SN/A                        0x00: WarnUnimpl::undefined();
1557107SN/A                        0x02: WarnUnimpl::SIMD_VFP_64_bit_core_extension_transfer();
1567107SN/A                        0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
1577107SN/A                        0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f:
1587107SN/A                            WarnUnimpl::Extension_register_load_store_instruction();
1597107SN/A                    }
1607107SN/A                }
1617107SN/A            }
1627107SN/A        }
1637107SN/A        0x2: decode LTOPCODE_15 {
1647107SN/A            0x0: decode HTOPCODE_9 {
1657141Sgblack@eecs.umich.edu                0x0: Thumb32DataProcModImm::thumb32DataProcModImm();
1667107SN/A                0x1: WarnUnimpl::Data_processing_plain_binary_immediate();
1677107SN/A            }
1687107SN/A            0x1: WarnUnimpl::Branches_and_miscellaneous_control();
1697107SN/A        }
1707107SN/A        0x3: decode HTOPCODE_10_9 {
1717107SN/A            0x0: decode HTOPCODE_4 {
1727107SN/A                0x0: decode HTOPCODE_8 {
1737123Sgblack@eecs.umich.edu                    0x0: Thumb32StoreSingle::thumb32StoreSingle();
1747107SN/A                    0x1: WarnUnimpl::Advanced_SIMD_or_structure_load_store();
1757107SN/A                }
1767107SN/A                0x1: decode HTOPCODE_6_5 {
1777107SN/A                    0x0: WarnUnimpl::Load_byte_memory_hints();
1787107SN/A                    0x1: WarnUnimpl::Load_halfword_memory_hints();
1797121Sgblack@eecs.umich.edu                    0x2: Thumb32LoadWord::thumb32LoadWord();
1807107SN/A                    0x3: WarnUnimpl::undefined();
1817107SN/A                }
1827107SN/A            }
1837107SN/A            0x1: decode HTOPCODE_8_7 {
1847107SN/A                0x2: WarnUnimpl::Multiply_multiply_accumulate_and_absolute_difference();
1857107SN/A                0x3: WarnUnimpl::Long_multiply_long_multiply_accumulate_and_divide();
1867107SN/A                default: WarnUnimpl::Data_processing_register();
1877107SN/A            }
1887107SN/A            default: decode HTOPCODE_9_8 {
1897107SN/A                0x2: decode LTOPCODE_4 {
1907107SN/A                    0x0: decode LTCOPROC {
1917107SN/A                        0xa, 0xb: WarnUnimpl::VFP_Inst();
1927107SN/A                        default: WarnUnimpl::cdp(); // cdp2
1937107SN/A                    }
1947107SN/A                    0x1: decode LTCOPROC {
1957107SN/A                        0xa, 0xb: WarnUnimpl::Core_to_extension_transfer();
1967107SN/A                        default: decode HTOPCODE_4 {
1977107SN/A                            0x0: WarnUnimpl::mcr(); // mcr2
1987107SN/A                            0x1: WarnUnimpl::mrc(); // mrc2
1997107SN/A                        }
2007107SN/A                    }
2017107SN/A                }
2027107SN/A                0x3: WarnUnimpl::Advanced_SIMD();
2037107SN/A                default: decode LTCOPROC {
2047107SN/A                    0xa, 0xb: decode HTOPCODE_9_4 {
2057107SN/A                        0x00: WarnUnimpl::undefined();
2067107SN/A                        0x04: WarnUnimpl::mcrr(); // mcrr2
2077107SN/A                        0x05: WarnUnimpl::mrrc(); // mrrc2
2087107SN/A                        0x02, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10,
2097107SN/A                        0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e:
2107107SN/A                            WarnUnimpl::stc(); // stc2
2117107SN/A                        0x03, 0x07, 0x09, 0x0b, 0x0d, 0x0f, 0x11,
2127107SN/A                        0x13, 0x15, 0x17, 0x19, 0x1b, 0x1d, 0x1f:
2137107SN/A                            decode HTRN {
2147107SN/A                                0xf: WarnUnimpl::ldc(); // ldc2 (literal)
2157107SN/A                                default: WarnUnimpl::ldc(); // ldc2 (immediate)
2167107SN/A                            }
2177107SN/A                    }
2187107SN/A                    default: decode HTOPCODE_9_5 {
2197107SN/A                        0x00: WarnUnimpl::undefined();
2207107SN/A                        0x02: WarnUnimpl::SIMD_VFP_64_bit_core_extension_transfer();
2217107SN/A                        0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
2227107SN/A                        0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f:
2237107SN/A                            WarnUnimpl::Extension_register_load_store_instruction();
2247107SN/A                    }
2257107SN/A                }
2267107SN/A            }
2277107SN/A        }
2287107SN/A    }
2296268SN/A}
230