thumb.isa revision 7363
16145Snate@binkert.org// -*- mode:c++ -*-
26145Snate@binkert.org
36145Snate@binkert.org// Copyright (c) 2010 ARM Limited
46145Snate@binkert.org// All rights reserved
56145Snate@binkert.org//
66145Snate@binkert.org// The license below extends only to copyright in the software and shall
76145Snate@binkert.org// not be construed as granting a license to any other intellectual
86145Snate@binkert.org// property including but not limited to intellectual property relating
96145Snate@binkert.org// to a hardware implementation of the functionality of the software
106145Snate@binkert.org// licensed hereunder.  You may use the software subject to the license
116145Snate@binkert.org// terms below provided that you ensure that this notice is replicated
126145Snate@binkert.org// unmodified and in its entirety in all distributions of the software,
136145Snate@binkert.org// modified or unmodified, in source code or in binary form.
146145Snate@binkert.org//
156145Snate@binkert.org// Copyright (c) 2009 The Regents of The University of Michigan
166145Snate@binkert.org// All rights reserved.
176145Snate@binkert.org//
186145Snate@binkert.org// Redistribution and use in source and binary forms, with or without
196145Snate@binkert.org// modification, are permitted provided that the following conditions are
206145Snate@binkert.org// met: redistributions of source code must retain the above copyright
216145Snate@binkert.org// notice, this list of conditions and the following disclaimer;
226145Snate@binkert.org// redistributions in binary form must reproduce the above copyright
236145Snate@binkert.org// notice, this list of conditions and the following disclaimer in the
246145Snate@binkert.org// documentation and/or other materials provided with the distribution;
256145Snate@binkert.org// neither the name of the copyright holders nor the names of its
266145Snate@binkert.org// contributors may be used to endorse or promote products derived from
276145Snate@binkert.org// this software without specific prior written permission.
286145Snate@binkert.org//
296154Snate@binkert.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3011108Sdavid.hashe@amd.com// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3111108Sdavid.hashe@amd.com// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
328091Snilay@cs.wisc.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3311025Snilay@cs.wisc.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3411025Snilay@cs.wisc.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
358091Snilay@cs.wisc.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3611025Snilay@cs.wisc.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3711025Snilay@cs.wisc.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3811025Snilay@cs.wisc.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3911025Snilay@cs.wisc.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4011025Snilay@cs.wisc.edu//
4111025Snilay@cs.wisc.edu// Authors: Gabe Black
4211025Snilay@cs.wisc.edu
4311025Snilay@cs.wisc.edu1: decode BIGTHUMB {
4411025Snilay@cs.wisc.edu    // 16 bit thumb instructions.
4511025Snilay@cs.wisc.edu    0: decode TOPCODE_15_13 {
468091Snilay@cs.wisc.edu        0x0, 0x1: Thumb16ShiftAddSubMoveCmp::thumb16ShiftAddMoveCmp();
478091Snilay@cs.wisc.edu        0x2: decode TOPCODE_12_10 {
4811025Snilay@cs.wisc.edu            0x0: Thumb16DataProcessing::thumb16DataProcessing();
4911025Snilay@cs.wisc.edu            0x1: Thumb16SpecDataAndBx::thumb16SpecDataAndBx();
508091Snilay@cs.wisc.edu            0x2, 0x3: Thumb16MemLit::thumb16MemLit();
5111025Snilay@cs.wisc.edu            default: Thumb16MemReg::thumb16MemReg();
5211025Snilay@cs.wisc.edu        }
5311025Snilay@cs.wisc.edu        0x3, 0x4: Thumb16MemImm::thumb16MemImm();
5411025Snilay@cs.wisc.edu        0x5: decode TOPCODE_12_11 {
5511025Snilay@cs.wisc.edu            0x0: Thumb16Adr::thumb16Adr();
5611025Snilay@cs.wisc.edu            0x1: Thumb16AddSp::thumb16AddSp(); //sp, immediate
5711025Snilay@cs.wisc.edu            0x2, 0x3: Thumb16Misc::thumb16Misc();
5811025Snilay@cs.wisc.edu        }
5911025Snilay@cs.wisc.edu        0x6: decode TOPCODE_12_11 {
6011025Snilay@cs.wisc.edu            0x0, 0x1: Thumb16MacroMem::thumb16MacroMem();
6111025Snilay@cs.wisc.edu            0x2, 0x3: Thumb16CondBranchAndSvc::thumb16CondBranchAndSvc();
6211025Snilay@cs.wisc.edu        }
6311025Snilay@cs.wisc.edu        0x7: decode TOPCODE_12_11 {
6411025Snilay@cs.wisc.edu            0x0: Thumb16UncondBranch::thumb16UncondBranch();
6511025Snilay@cs.wisc.edu        }
6611025Snilay@cs.wisc.edu    }
6711025Snilay@cs.wisc.edu
6811025Snilay@cs.wisc.edu    // 32 bit thumb instructions.
6911025Snilay@cs.wisc.edu    1: decode HTOPCODE_12_11 {
7011025Snilay@cs.wisc.edu        0x1: decode HTOPCODE_10_9 {
718091Snilay@cs.wisc.edu            0x0: decode HTOPCODE_6 {
728091Snilay@cs.wisc.edu                0x0: decode HTOPCODE_8_7 {
7311025Snilay@cs.wisc.edu                    0x0, 0x3: Thumb32SrsRfe::thumb32SrsRfe();
7411025Snilay@cs.wisc.edu                    // This uses the same encoding as regular ARM.
758091Snilay@cs.wisc.edu                    default: ArmMacroMem::armMacroMem();
7611025Snilay@cs.wisc.edu                }
7711025Snilay@cs.wisc.edu                0x1: Thumb32LdrStrDExTbh::thumb32LdrStrDExTbh();
7811025Snilay@cs.wisc.edu            }
7911025Snilay@cs.wisc.edu            0x1: Thumb32DataProcShiftReg::thumb32DataProcShiftReg();
8011025Snilay@cs.wisc.edu            default: decode HTOPCODE_9_8 {
8111025Snilay@cs.wisc.edu                0x2: decode LTOPCODE_4 {
8211025Snilay@cs.wisc.edu                    0x0: decode LTCOPROC {
8311025Snilay@cs.wisc.edu                        0xa, 0xb: VfpData::vfpData();
8411025Snilay@cs.wisc.edu                        default: WarnUnimpl::cdp(); // cdp2
8511025Snilay@cs.wisc.edu                    }
8611025Snilay@cs.wisc.edu                    0x1: decode LTCOPROC {
8711025Snilay@cs.wisc.edu                        0xa, 0xb: ShortFpTransfer::shortFpTransfer();
8811025Snilay@cs.wisc.edu                        0xf: McrMrc15::mcrMrc15();
8911025Snilay@cs.wisc.edu                    }
9011025Snilay@cs.wisc.edu                }
9111025Snilay@cs.wisc.edu                0x3: WarnUnimpl::Advanced_SIMD();
9211025Snilay@cs.wisc.edu                default: decode LTCOPROC {
9311025Snilay@cs.wisc.edu                    0xa, 0xb: ExtensionRegLoadStore::extensionRegLoadStre();
9411025Snilay@cs.wisc.edu                    0xf: decode HTOPCODE_9_4 {
9511025Snilay@cs.wisc.edu                        0x00: Unknown::undefined();
9611025Snilay@cs.wisc.edu                        0x04: WarnUnimpl::mcrr(); // mcrr2
9711025Snilay@cs.wisc.edu                        0x05: WarnUnimpl::mrrc(); // mrrc2
9811025Snilay@cs.wisc.edu                        0x02, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10,
9911025Snilay@cs.wisc.edu                        0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e:
10011025Snilay@cs.wisc.edu                            WarnUnimpl::stc(); // stc2
10111025Snilay@cs.wisc.edu                        0x03, 0x07, 0x09, 0x0b, 0x0d, 0x0f, 0x11,
10211025Snilay@cs.wisc.edu                        0x13, 0x15, 0x17, 0x19, 0x1b, 0x1d, 0x1f:
10311025Snilay@cs.wisc.edu                            decode HTRN {
10411025Snilay@cs.wisc.edu                                0xf: WarnUnimpl::ldc(); // ldc2 (literal)
10511025Snilay@cs.wisc.edu                                default: WarnUnimpl::ldc(); // ldc2 (immediate)
10611025Snilay@cs.wisc.edu                            }
10711025Snilay@cs.wisc.edu                    }
10811025Snilay@cs.wisc.edu                }
10911025Snilay@cs.wisc.edu            }
11011025Snilay@cs.wisc.edu        }
11111025Snilay@cs.wisc.edu        0x2: decode LTOPCODE_15 {
11211025Snilay@cs.wisc.edu            0x0: decode HTOPCODE_9 {
11311025Snilay@cs.wisc.edu                0x0: Thumb32DataProcModImm::thumb32DataProcModImm();
11411025Snilay@cs.wisc.edu                0x1: Thumb32DataProcPlainBin::thumb32DataProcPlainBin();
1158091Snilay@cs.wisc.edu            }
1168091Snilay@cs.wisc.edu            0x1: Thumb32BranchesAndMiscCtrl::thumb32BranchesAndMiscCtrl();
1178091Snilay@cs.wisc.edu        }
11811025Snilay@cs.wisc.edu        0x3: decode HTOPCODE_10_9 {
11911025Snilay@cs.wisc.edu            0x0: decode HTOPCODE_4 {
1208091Snilay@cs.wisc.edu                0x0: decode HTOPCODE_8 {
12111025Snilay@cs.wisc.edu                    0x0: Thumb32StoreSingle::thumb32StoreSingle();
12211025Snilay@cs.wisc.edu                    0x1: WarnUnimpl::Advanced_SIMD_or_structure_load_store();
1238091Snilay@cs.wisc.edu                }
12411118Snilay@cs.wisc.edu                0x1: decode HTOPCODE_6_5 {
12511118Snilay@cs.wisc.edu                    0x0: LoadByteMemoryHints::loadByteMemoryHints();
12611118Snilay@cs.wisc.edu                    0x1: LoadHalfwordMemoryHints::loadHalfwordMemoryHints();
12711118Snilay@cs.wisc.edu                    0x2: Thumb32LoadWord::thumb32LoadWord();
12811118Snilay@cs.wisc.edu                    0x3: Unknown::undefined();
12911118Snilay@cs.wisc.edu                }
13011118Snilay@cs.wisc.edu            }
13111118Snilay@cs.wisc.edu            0x1: decode HTOPCODE_8_7 {
13211118Snilay@cs.wisc.edu                0x2: Thumb32MulMulAccAndAbsDiff::thumb32MulMulAccAndAbsDiff();
13311118Snilay@cs.wisc.edu                0x3: Thumb32LongMulMulAccAndDiv::thumb32LongMulMulAccAndDiv();
134                default: Thumb32DataProcReg::thumb32DataProcReg();
135            }
136            default: decode HTOPCODE_9_8 {
137                0x2: decode LTOPCODE_4 {
138                    0x0: decode LTCOPROC {
139                        0xa, 0xb: VfpData::vfpData();
140                        default: WarnUnimpl::cdp(); // cdp2
141                    }
142                    0x1: decode LTCOPROC {
143                        0xa, 0xb: ShortFpTransfer::shortFpTransfer();
144                        0xf: McrMrc15::mcrMrc15();
145                    }
146                }
147                0x3: WarnUnimpl::Advanced_SIMD();
148                default: decode LTCOPROC {
149                    0xa, 0xb: ExtensionRegLoadStore::extensionRegLoadStre();
150                    0xf: decode HTOPCODE_9_4 {
151                        0x00: Unknown::undefined();
152                        0x04: WarnUnimpl::mcrr(); // mcrr2
153                        0x05: WarnUnimpl::mrrc(); // mrrc2
154                        0x02, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10,
155                        0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e:
156                            WarnUnimpl::stc(); // stc2
157                        0x03, 0x07, 0x09, 0x0b, 0x0d, 0x0f, 0x11,
158                        0x13, 0x15, 0x17, 0x19, 0x1b, 0x1d, 0x1f:
159                            decode HTRN {
160                                0xf: WarnUnimpl::ldc(); // ldc2 (literal)
161                                default: WarnUnimpl::ldc(); // ldc2 (immediate)
162                            }
163                    }
164                }
165            }
166        }
167    }
168}
169