integer.hh revision 12295
12968SN/A/* 22968SN/A * Copyright (c) 2006-2007 The Regents of The University of Michigan 32968SN/A * All rights reserved. 49988Snilay@cs.wisc.edu * 58835SAli.Saidi@ARM.com * Redistribution and use in source and binary forms, with or without 69988Snilay@cs.wisc.edu * modification, are permitted provided that the following conditions are 77935SN/A * met: redistributions of source code must retain the above copyright 87935SN/A * notice, this list of conditions and the following disclaimer; 97935SN/A * redistributions in binary form must reproduce the above copyright 102968SN/A * notice, this list of conditions and the following disclaimer in the 112968SN/A * documentation and/or other materials provided with the distribution; 122968SN/A * neither the name of the copyright holders nor the names of its 139885Sstever@gmail.com * contributors may be used to endorse or promote products derived from 144463SN/A * this software without specific prior written permission. 152968SN/A * 169885Sstever@gmail.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 179885Sstever@gmail.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1810036SAli.Saidi@ARM.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 199988Snilay@cs.wisc.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202968SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2110036SAli.Saidi@ARM.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 227670SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232968SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 249481Snilay@cs.wisc.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 258721SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 268721SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2710036SAli.Saidi@ARM.com * 283006SN/A * Authors: Ali Saidi 293140SN/A * Gabe Black 302968SN/A * Steve Reinhardt 312968SN/A */ 327935SN/A 337935SN/A#ifndef __ARCH_SPARC_INSTS_INTEGER_HH__ 347935SN/A#define __ARCH_SPARC_INSTS_INTEGER_HH__ 357935SN/A 367935SN/A#include "arch/sparc/insts/static_inst.hh" 377935SN/A 387935SN/Anamespace SparcISA 398983Snate@binkert.org{ 402968SN/A 412968SN/A//////////////////////////////////////////////////////////////////// 422968SN/A// 439885Sstever@gmail.com// Integer operate instructions 444463SN/A// 459988Snilay@cs.wisc.edu 468721SN/A/** 478721SN/A * Base class for integer operations. 488721SN/A */ 498983Snate@binkert.orgclass IntOp : public SparcStaticInst 508983Snate@binkert.org{ 512968SN/A protected: 529885Sstever@gmail.com using SparcStaticInst::SparcStaticInst; 539885Sstever@gmail.com 549885Sstever@gmail.com std::string generateDisassembly( 559988Snilay@cs.wisc.edu Addr pc, const SymbolTable *symtab) const override; 569885Sstever@gmail.com 579885Sstever@gmail.com virtual bool printPseudoOps(std::ostream &os, Addr pc, 582968SN/A const SymbolTable *symtab) const; 592968SN/A}; 609481Snilay@cs.wisc.edu 615876SN/A/** 629885Sstever@gmail.com * Base class for immediate integer operations. 633171SN/A */ 643638SN/Aclass IntOpImm : public IntOp 653638SN/A{ 663638SN/A protected: 672968SN/A // Constructor 689988Snilay@cs.wisc.edu IntOpImm(const char *mnem, ExtMachInst _machInst, 698983Snate@binkert.org OpClass __opClass, int64_t _imm) : 702968SN/A IntOp(mnem, _machInst, __opClass), imm(_imm) 712968SN/A {} 725723SN/A 739481Snilay@cs.wisc.edu int64_t imm; 742968SN/A 752968SN/A std::string generateDisassembly( 762968SN/A Addr pc, const SymbolTable *symtab) const override; 772968SN/A 782968SN/A bool printPseudoOps(std::ostream &os, Addr pc, 795575SN/A const SymbolTable *symtab) const override; 802968SN/A}; 813140SN/A 829885Sstever@gmail.com/** 839885Sstever@gmail.com * Base class for 10 bit immediate integer operations. 849885Sstever@gmail.com */ 859885Sstever@gmail.comclass IntOpImm10 : public IntOpImm 865509SN/A{ 875509SN/A protected: 889481Snilay@cs.wisc.edu // Constructor 892968SN/A IntOpImm10(const char *mnem, ExtMachInst _machInst, OpClass __opClass) : 904938SN/A IntOpImm(mnem, _machInst, __opClass, sext<10>(bits(_machInst, 9, 0))) 912968SN/A {} 928835SAli.Saidi@ARM.com}; 934463SN/A 944463SN/A/** 954463SN/A * Base class for 11 bit immediate integer operations. 964463SN/A */ 974463SN/Aclass IntOpImm11 : public IntOpImm 989885Sstever@gmail.com{ 998983Snate@binkert.org protected: 1004463SN/A IntOpImm11(const char *mnem, ExtMachInst _machInst, OpClass __opClass) : 1019885Sstever@gmail.com IntOpImm(mnem, _machInst, __opClass, sext<10>(bits(_machInst, 10, 0))) 1029988Snilay@cs.wisc.edu {} 1036123SN/A}; 1049481Snilay@cs.wisc.edu 1058241SN/A/** 1064463SN/A * Base class for 13 bit immediate integer operations. 1074463SN/A */ 1085876SN/Aclass IntOpImm13 : public IntOpImm 1098835SAli.Saidi@ARM.com{ 1109481Snilay@cs.wisc.edu protected: 11110036SAli.Saidi@ARM.com IntOpImm13(const char *mnem, ExtMachInst _machInst, OpClass __opClass) : 1124463SN/A IntOpImm(mnem, _machInst, __opClass, sext<13>(bits(_machInst, 12, 0))) 1138835SAli.Saidi@ARM.com {} 1149885Sstever@gmail.com}; 1159481Snilay@cs.wisc.edu 1164463SN/A/** 1174463SN/A * Base class for sethi. 1184463SN/A */ 1199481Snilay@cs.wisc.educlass SetHi : public IntOpImm 1204463SN/A{ 1219885Sstever@gmail.com protected: 1229885Sstever@gmail.com // Constructor 1239885Sstever@gmail.com SetHi(const char *mnem, ExtMachInst _machInst, OpClass __opClass) : 1249885Sstever@gmail.com IntOpImm(mnem, _machInst, __opClass, bits(_machInst, 21, 0) << 10) 1259885Sstever@gmail.com {} 1269988Snilay@cs.wisc.edu 1279885Sstever@gmail.com std::string generateDisassembly( 12810036SAli.Saidi@ARM.com Addr pc, const SymbolTable *symtab) const override; 1299885Sstever@gmail.com}; 1309885Sstever@gmail.com 1312968SN/A} 1326024SN/A 1339988Snilay@cs.wisc.edu#endif // __ARCH_SPARCH_INSTS_INTEGER_HH__ 1342968SN/A