misc.isa revision 7203
17199Sgblack@eecs.umich.edu// -*- mode:c++ -*- 27199Sgblack@eecs.umich.edu 37199Sgblack@eecs.umich.edu// Copyright (c) 2010 ARM Limited 47199Sgblack@eecs.umich.edu// All rights reserved 57199Sgblack@eecs.umich.edu// 67199Sgblack@eecs.umich.edu// The license below extends only to copyright in the software and shall 77199Sgblack@eecs.umich.edu// not be construed as granting a license to any other intellectual 87199Sgblack@eecs.umich.edu// property including but not limited to intellectual property relating 97199Sgblack@eecs.umich.edu// to a hardware implementation of the functionality of the software 107199Sgblack@eecs.umich.edu// licensed hereunder. You may use the software subject to the license 117199Sgblack@eecs.umich.edu// terms below provided that you ensure that this notice is replicated 127199Sgblack@eecs.umich.edu// unmodified and in its entirety in all distributions of the software, 137199Sgblack@eecs.umich.edu// modified or unmodified, in source code or in binary form. 147199Sgblack@eecs.umich.edu// 157199Sgblack@eecs.umich.edu// Redistribution and use in source and binary forms, with or without 167199Sgblack@eecs.umich.edu// modification, are permitted provided that the following conditions are 177199Sgblack@eecs.umich.edu// met: redistributions of source code must retain the above copyright 187199Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer; 197199Sgblack@eecs.umich.edu// redistributions in binary form must reproduce the above copyright 207199Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the 217199Sgblack@eecs.umich.edu// documentation and/or other materials provided with the distribution; 227199Sgblack@eecs.umich.edu// neither the name of the copyright holders nor the names of its 237199Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from 247199Sgblack@eecs.umich.edu// this software without specific prior written permission. 257199Sgblack@eecs.umich.edu// 267199Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 277199Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 287199Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 297199Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 307199Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 317199Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 327199Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 337199Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 347199Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 357199Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 367199Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 377199Sgblack@eecs.umich.edu// 387199Sgblack@eecs.umich.edu// Authors: Gabe Black 397199Sgblack@eecs.umich.edu 407199Sgblack@eecs.umich.edudef format Svc() {{ 417199Sgblack@eecs.umich.edu decode_block = "return new Svc(machInst);" 427199Sgblack@eecs.umich.edu}}; 437203Sgblack@eecs.umich.edu 447203Sgblack@eecs.umich.edudef format ArmMsrMrs() {{ 457203Sgblack@eecs.umich.edu decode_block = ''' 467203Sgblack@eecs.umich.edu { 477203Sgblack@eecs.umich.edu const uint8_t byteMask = bits(machInst, 19, 16); 487203Sgblack@eecs.umich.edu const IntRegIndex rn = (IntRegIndex)(uint32_t)bits(machInst, 3, 0); 497203Sgblack@eecs.umich.edu const IntRegIndex rd = (IntRegIndex)(uint32_t)bits(machInst, 15, 12); 507203Sgblack@eecs.umich.edu const uint32_t opcode = bits(machInst, 24, 21); 517203Sgblack@eecs.umich.edu const bool useImm = bits(machInst, 25); 527203Sgblack@eecs.umich.edu 537203Sgblack@eecs.umich.edu const uint32_t unrotated = bits(machInst, 7, 0); 547203Sgblack@eecs.umich.edu const uint32_t rotation = (bits(machInst, 11, 8) << 1); 557203Sgblack@eecs.umich.edu const uint32_t imm = rotate_imm(unrotated, rotation); 567203Sgblack@eecs.umich.edu 577203Sgblack@eecs.umich.edu switch (opcode) { 587203Sgblack@eecs.umich.edu case 0x8: 597203Sgblack@eecs.umich.edu return new MrsCpsr(machInst, rd); 607203Sgblack@eecs.umich.edu case 0x9: 617203Sgblack@eecs.umich.edu if (useImm) { 627203Sgblack@eecs.umich.edu return new MsrCpsrImm(machInst, imm, byteMask); 637203Sgblack@eecs.umich.edu } else { 647203Sgblack@eecs.umich.edu return new MsrCpsrReg(machInst, rn, byteMask); 657203Sgblack@eecs.umich.edu } 667203Sgblack@eecs.umich.edu case 0xa: 677203Sgblack@eecs.umich.edu return new MrsSpsr(machInst, rd); 687203Sgblack@eecs.umich.edu case 0xb: 697203Sgblack@eecs.umich.edu if (useImm) { 707203Sgblack@eecs.umich.edu return new MsrSpsrImm(machInst, imm, byteMask); 717203Sgblack@eecs.umich.edu } else { 727203Sgblack@eecs.umich.edu return new MsrSpsrReg(machInst, rn, byteMask); 737203Sgblack@eecs.umich.edu } 747203Sgblack@eecs.umich.edu default: 757203Sgblack@eecs.umich.edu return new Unknown(machInst); 767203Sgblack@eecs.umich.edu } 777203Sgblack@eecs.umich.edu } 787203Sgblack@eecs.umich.edu ''' 797203Sgblack@eecs.umich.edu}}; 80