decoder.isa revision 2336
14519Sgblack@eecs.umich.edu// -*- mode:c++ -*- 24519Sgblack@eecs.umich.edu 34519Sgblack@eecs.umich.edu// Copyright (c) 2003-2006 The Regents of The University of Michigan 44519Sgblack@eecs.umich.edu// All rights reserved. 54519Sgblack@eecs.umich.edu// 64519Sgblack@eecs.umich.edu// Redistribution and use in source and binary forms, with or without 74519Sgblack@eecs.umich.edu// modification, are permitted provided that the following conditions are 84519Sgblack@eecs.umich.edu// met: redistributions of source code must retain the above copyright 94519Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer; 104519Sgblack@eecs.umich.edu// redistributions in binary form must reproduce the above copyright 114519Sgblack@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the 124519Sgblack@eecs.umich.edu// documentation and/or other materials provided with the distribution; 134519Sgblack@eecs.umich.edu// neither the name of the copyright holders nor the names of its 144519Sgblack@eecs.umich.edu// contributors may be used to endorse or promote products derived from 154519Sgblack@eecs.umich.edu// this software without specific prior written permission. 164519Sgblack@eecs.umich.edu// 174519Sgblack@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 184519Sgblack@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 194519Sgblack@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 204519Sgblack@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 214519Sgblack@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 224519Sgblack@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 234519Sgblack@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 244519Sgblack@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 254519Sgblack@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 264519Sgblack@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 274519Sgblack@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 284519Sgblack@eecs.umich.edu 294519Sgblack@eecs.umich.edudecode OPCODE default Unknown::unknown() { 304519Sgblack@eecs.umich.edu 314519Sgblack@eecs.umich.edu format LoadAddress { 324519Sgblack@eecs.umich.edu 0x08: lda({{ Ra = Rb + disp; }}); 334519Sgblack@eecs.umich.edu 0x09: ldah({{ Ra = Rb + (disp << 16); }}); 344519Sgblack@eecs.umich.edu } 354519Sgblack@eecs.umich.edu 364519Sgblack@eecs.umich.edu format LoadOrNop { 374519Sgblack@eecs.umich.edu 0x0a: ldbu({{ Ra.uq = Mem.ub; }}); 384519Sgblack@eecs.umich.edu 0x0c: ldwu({{ Ra.uq = Mem.uw; }}); 394519Sgblack@eecs.umich.edu 0x0b: ldq_u({{ Ra = Mem.uq; }}, ea_code = {{ EA = (Rb + disp) & ~7; }}); 404519Sgblack@eecs.umich.edu 0x23: ldt({{ Fa = Mem.df; }}); 414519Sgblack@eecs.umich.edu 0x2a: ldl_l({{ Ra.sl = Mem.sl; }}, mem_flags = LOCKED); 424519Sgblack@eecs.umich.edu 0x2b: ldq_l({{ Ra.uq = Mem.uq; }}, mem_flags = LOCKED); 434519Sgblack@eecs.umich.edu 0x20: MiscPrefetch::copy_load({{ EA = Ra; }}, 444519Sgblack@eecs.umich.edu {{ fault = xc->copySrcTranslate(EA); }}, 454519Sgblack@eecs.umich.edu inst_flags = [IsMemRef, IsLoad, IsCopy]); 464519Sgblack@eecs.umich.edu } 474519Sgblack@eecs.umich.edu 484519Sgblack@eecs.umich.edu format LoadOrPrefetch { 494519Sgblack@eecs.umich.edu 0x28: ldl({{ Ra.sl = Mem.sl; }}); 504519Sgblack@eecs.umich.edu 0x29: ldq({{ Ra.uq = Mem.uq; }}, pf_flags = EVICT_NEXT); 514519Sgblack@eecs.umich.edu // IsFloating flag on lds gets the prefetch to disassemble 524519Sgblack@eecs.umich.edu // using f31 instead of r31... funcitonally it's unnecessary 534519Sgblack@eecs.umich.edu 0x22: lds({{ Fa.uq = s_to_t(Mem.ul); }}, 544519Sgblack@eecs.umich.edu pf_flags = PF_EXCLUSIVE, inst_flags = IsFloating); 554519Sgblack@eecs.umich.edu } 564519Sgblack@eecs.umich.edu 574519Sgblack@eecs.umich.edu format Store { 584519Sgblack@eecs.umich.edu 0x0e: stb({{ Mem.ub = Ra<7:0>; }}); 594519Sgblack@eecs.umich.edu 0x0d: stw({{ Mem.uw = Ra<15:0>; }}); 604519Sgblack@eecs.umich.edu 0x2c: stl({{ Mem.ul = Ra<31:0>; }}); 614519Sgblack@eecs.umich.edu 0x2d: stq({{ Mem.uq = Ra.uq; }}); 624519Sgblack@eecs.umich.edu 0x0f: stq_u({{ Mem.uq = Ra.uq; }}, {{ EA = (Rb + disp) & ~7; }}); 634519Sgblack@eecs.umich.edu 0x26: sts({{ Mem.ul = t_to_s(Fa.uq); }}); 644519Sgblack@eecs.umich.edu 0x27: stt({{ Mem.df = Fa; }}); 654519Sgblack@eecs.umich.edu 0x24: MiscPrefetch::copy_store({{ EA = Rb; }}, 664519Sgblack@eecs.umich.edu {{ fault = xc->copy(EA); }}, 674519Sgblack@eecs.umich.edu inst_flags = [IsMemRef, IsStore, IsCopy]); 684519Sgblack@eecs.umich.edu } 694519Sgblack@eecs.umich.edu 704688Sgblack@eecs.umich.edu format StoreCond { 714688Sgblack@eecs.umich.edu 0x2e: stl_c({{ Mem.ul = Ra<31:0>; }}, 724688Sgblack@eecs.umich.edu {{ 734688Sgblack@eecs.umich.edu uint64_t tmp = write_result; 744688Sgblack@eecs.umich.edu // see stq_c 754688Sgblack@eecs.umich.edu Ra = (tmp == 0 || tmp == 1) ? tmp : Ra; 764708Sgblack@eecs.umich.edu }}, mem_flags = LOCKED, inst_flags = IsStoreConditional); 774708Sgblack@eecs.umich.edu 0x2f: stq_c({{ Mem.uq = Ra; }}, 784708Sgblack@eecs.umich.edu {{ 794708Sgblack@eecs.umich.edu uint64_t tmp = write_result; 804519Sgblack@eecs.umich.edu // If the write operation returns 0 or 1, then 814519Sgblack@eecs.umich.edu // this was a conventional store conditional, 824519Sgblack@eecs.umich.edu // and the value indicates the success/failure 834519Sgblack@eecs.umich.edu // of the operation. If another value is 844519Sgblack@eecs.umich.edu // returned, then this was a Turbolaser 854519Sgblack@eecs.umich.edu // mailbox access, and we don't update the 864519Sgblack@eecs.umich.edu // result register at all. 874519Sgblack@eecs.umich.edu Ra = (tmp == 0 || tmp == 1) ? tmp : Ra; 884519Sgblack@eecs.umich.edu }}, mem_flags = LOCKED, inst_flags = IsStoreConditional); 894519Sgblack@eecs.umich.edu } 904519Sgblack@eecs.umich.edu 914519Sgblack@eecs.umich.edu format IntegerOperate { 924519Sgblack@eecs.umich.edu 934519Sgblack@eecs.umich.edu 0x10: decode INTFUNC { // integer arithmetic operations 944519Sgblack@eecs.umich.edu 954519Sgblack@eecs.umich.edu 0x00: addl({{ Rc.sl = Ra.sl + Rb_or_imm.sl; }}); 964519Sgblack@eecs.umich.edu 0x40: addlv({{ 974519Sgblack@eecs.umich.edu uint32_t tmp = Ra.sl + Rb_or_imm.sl; 984688Sgblack@eecs.umich.edu // signed overflow occurs when operands have same sign 994688Sgblack@eecs.umich.edu // and sign of result does not match. 1004688Sgblack@eecs.umich.edu if (Ra.sl<31:> == Rb_or_imm.sl<31:> && tmp<31:> != Ra.sl<31:>) 1014688Sgblack@eecs.umich.edu fault = new IntegerOverflowFault; 1024688Sgblack@eecs.umich.edu Rc.sl = tmp; 1034688Sgblack@eecs.umich.edu }}); 1044708Sgblack@eecs.umich.edu 0x02: s4addl({{ Rc.sl = (Ra.sl << 2) + Rb_or_imm.sl; }}); 1054708Sgblack@eecs.umich.edu 0x12: s8addl({{ Rc.sl = (Ra.sl << 3) + Rb_or_imm.sl; }}); 1064708Sgblack@eecs.umich.edu 1074708Sgblack@eecs.umich.edu 0x20: addq({{ Rc = Ra + Rb_or_imm; }}); 1084519Sgblack@eecs.umich.edu 0x60: addqv({{ 1094519Sgblack@eecs.umich.edu uint64_t tmp = Ra + Rb_or_imm; 1104519Sgblack@eecs.umich.edu // signed overflow occurs when operands have same sign 1114519Sgblack@eecs.umich.edu // and sign of result does not match. 1124519Sgblack@eecs.umich.edu if (Ra<63:> == Rb_or_imm<63:> && tmp<63:> != Ra<63:>) 1134519Sgblack@eecs.umich.edu fault = new IntegerOverflowFault; 1144519Sgblack@eecs.umich.edu Rc = tmp; 1154519Sgblack@eecs.umich.edu }}); 1164519Sgblack@eecs.umich.edu 0x22: s4addq({{ Rc = (Ra << 2) + Rb_or_imm; }}); 1174519Sgblack@eecs.umich.edu 0x32: s8addq({{ Rc = (Ra << 3) + Rb_or_imm; }}); 1184519Sgblack@eecs.umich.edu 1194519Sgblack@eecs.umich.edu 0x09: subl({{ Rc.sl = Ra.sl - Rb_or_imm.sl; }}); 1204519Sgblack@eecs.umich.edu 0x49: sublv({{ 1214519Sgblack@eecs.umich.edu uint32_t tmp = Ra.sl - Rb_or_imm.sl; 1224519Sgblack@eecs.umich.edu // signed overflow detection is same as for add, 1234519Sgblack@eecs.umich.edu // except we need to look at the *complemented* 1244519Sgblack@eecs.umich.edu // sign bit of the subtrahend (Rb), i.e., if the initial 1254519Sgblack@eecs.umich.edu // signs are the *same* then no overflow can occur 1264519Sgblack@eecs.umich.edu if (Ra.sl<31:> != Rb_or_imm.sl<31:> && tmp<31:> != Ra.sl<31:>) 1274519Sgblack@eecs.umich.edu fault = new IntegerOverflowFault; 1284519Sgblack@eecs.umich.edu Rc.sl = tmp; 1294712Sgblack@eecs.umich.edu }}); 1304519Sgblack@eecs.umich.edu 0x0b: s4subl({{ Rc.sl = (Ra.sl << 2) - Rb_or_imm.sl; }}); 1314519Sgblack@eecs.umich.edu 0x1b: s8subl({{ Rc.sl = (Ra.sl << 3) - Rb_or_imm.sl; }}); 1324519Sgblack@eecs.umich.edu 1334519Sgblack@eecs.umich.edu 0x29: subq({{ Rc = Ra - Rb_or_imm; }}); 1344712Sgblack@eecs.umich.edu 0x69: subqv({{ 1354519Sgblack@eecs.umich.edu uint64_t tmp = Ra - Rb_or_imm; 1364519Sgblack@eecs.umich.edu // signed overflow detection is same as for add, 1374519Sgblack@eecs.umich.edu // except we need to look at the *complemented* 1384519Sgblack@eecs.umich.edu // sign bit of the subtrahend (Rb), i.e., if the initial 1394519Sgblack@eecs.umich.edu // signs are the *same* then no overflow can occur 1404519Sgblack@eecs.umich.edu if (Ra<63:> != Rb_or_imm<63:> && tmp<63:> != Ra<63:>) 1414519Sgblack@eecs.umich.edu fault = new IntegerOverflowFault; 1424519Sgblack@eecs.umich.edu Rc = tmp; 1434519Sgblack@eecs.umich.edu }}); 1444519Sgblack@eecs.umich.edu 0x2b: s4subq({{ Rc = (Ra << 2) - Rb_or_imm; }}); 1454519Sgblack@eecs.umich.edu 0x3b: s8subq({{ Rc = (Ra << 3) - Rb_or_imm; }}); 1464519Sgblack@eecs.umich.edu 1474519Sgblack@eecs.umich.edu 0x2d: cmpeq({{ Rc = (Ra == Rb_or_imm); }}); 1484519Sgblack@eecs.umich.edu 0x6d: cmple({{ Rc = (Ra.sq <= Rb_or_imm.sq); }}); 1494519Sgblack@eecs.umich.edu 0x4d: cmplt({{ Rc = (Ra.sq < Rb_or_imm.sq); }}); 1504519Sgblack@eecs.umich.edu 0x3d: cmpule({{ Rc = (Ra.uq <= Rb_or_imm.uq); }}); 1514519Sgblack@eecs.umich.edu 0x1d: cmpult({{ Rc = (Ra.uq < Rb_or_imm.uq); }}); 1524712Sgblack@eecs.umich.edu 1534519Sgblack@eecs.umich.edu 0x0f: cmpbge({{ 1544519Sgblack@eecs.umich.edu int hi = 7; 1554519Sgblack@eecs.umich.edu int lo = 0; 1564519Sgblack@eecs.umich.edu uint64_t tmp = 0; 1574712Sgblack@eecs.umich.edu for (int i = 0; i < 8; ++i) { 1584519Sgblack@eecs.umich.edu tmp |= (Ra.uq<hi:lo> >= Rb_or_imm.uq<hi:lo>) << i; 1594519Sgblack@eecs.umich.edu hi += 8; 1604519Sgblack@eecs.umich.edu lo += 8; 1614519Sgblack@eecs.umich.edu } 1624519Sgblack@eecs.umich.edu Rc = tmp; 1634519Sgblack@eecs.umich.edu }}); 1644519Sgblack@eecs.umich.edu } 1654519Sgblack@eecs.umich.edu 1664519Sgblack@eecs.umich.edu 0x11: decode INTFUNC { // integer logical operations 1674519Sgblack@eecs.umich.edu 1684519Sgblack@eecs.umich.edu 0x00: and({{ Rc = Ra & Rb_or_imm; }}); 1694519Sgblack@eecs.umich.edu 0x08: bic({{ Rc = Ra & ~Rb_or_imm; }}); 1704519Sgblack@eecs.umich.edu 0x20: bis({{ Rc = Ra | Rb_or_imm; }}); 1714519Sgblack@eecs.umich.edu 0x28: ornot({{ Rc = Ra | ~Rb_or_imm; }}); 1724519Sgblack@eecs.umich.edu 0x40: xor({{ Rc = Ra ^ Rb_or_imm; }}); 1734712Sgblack@eecs.umich.edu 0x48: eqv({{ Rc = Ra ^ ~Rb_or_imm; }}); 1744519Sgblack@eecs.umich.edu 1754581Sgblack@eecs.umich.edu // conditional moves 1764688Sgblack@eecs.umich.edu 0x14: cmovlbs({{ Rc = ((Ra & 1) == 1) ? Rb_or_imm : Rc; }}); 1774581Sgblack@eecs.umich.edu 0x16: cmovlbc({{ Rc = ((Ra & 1) == 0) ? Rb_or_imm : Rc; }}); 1784519Sgblack@eecs.umich.edu 0x24: cmoveq({{ Rc = (Ra == 0) ? Rb_or_imm : Rc; }}); 1794519Sgblack@eecs.umich.edu 0x26: cmovne({{ Rc = (Ra != 0) ? Rb_or_imm : Rc; }}); 1804519Sgblack@eecs.umich.edu 0x44: cmovlt({{ Rc = (Ra.sq < 0) ? Rb_or_imm : Rc; }}); 1814519Sgblack@eecs.umich.edu 0x46: cmovge({{ Rc = (Ra.sq >= 0) ? Rb_or_imm : Rc; }}); 1824519Sgblack@eecs.umich.edu 0x64: cmovle({{ Rc = (Ra.sq <= 0) ? Rb_or_imm : Rc; }}); 1834519Sgblack@eecs.umich.edu 0x66: cmovgt({{ Rc = (Ra.sq > 0) ? Rb_or_imm : Rc; }}); 1844519Sgblack@eecs.umich.edu 1854519Sgblack@eecs.umich.edu // For AMASK, RA must be R31. 1864712Sgblack@eecs.umich.edu 0x61: decode RA { 1874519Sgblack@eecs.umich.edu 31: amask({{ Rc = Rb_or_imm & ~ULL(0x17); }}); 1884581Sgblack@eecs.umich.edu } 1894688Sgblack@eecs.umich.edu 1904581Sgblack@eecs.umich.edu // For IMPLVER, RA must be R31 and the B operand 1914519Sgblack@eecs.umich.edu // must be the immediate value 1. 1924519Sgblack@eecs.umich.edu 0x6c: decode RA { 1934519Sgblack@eecs.umich.edu 31: decode IMM { 1944519Sgblack@eecs.umich.edu 1: decode INTIMM { 1954519Sgblack@eecs.umich.edu // return EV5 for FULL_SYSTEM and EV6 otherwise 1964519Sgblack@eecs.umich.edu 1: implver({{ 1974519Sgblack@eecs.umich.edu#if FULL_SYSTEM 1984519Sgblack@eecs.umich.edu Rc = 1; 1994519Sgblack@eecs.umich.edu#else 2004519Sgblack@eecs.umich.edu Rc = 2; 2014519Sgblack@eecs.umich.edu#endif 2024519Sgblack@eecs.umich.edu }}); 2034519Sgblack@eecs.umich.edu } 2044519Sgblack@eecs.umich.edu } 2054519Sgblack@eecs.umich.edu } 2064712Sgblack@eecs.umich.edu 2074519Sgblack@eecs.umich.edu#if FULL_SYSTEM 2084581Sgblack@eecs.umich.edu // The mysterious 11.25... 2094688Sgblack@eecs.umich.edu 0x25: WarnUnimpl::eleven25(); 2104581Sgblack@eecs.umich.edu#endif 2114519Sgblack@eecs.umich.edu } 2124519Sgblack@eecs.umich.edu 2134519Sgblack@eecs.umich.edu 0x12: decode INTFUNC { 2144519Sgblack@eecs.umich.edu 0x39: sll({{ Rc = Ra << Rb_or_imm<5:0>; }}); 2154519Sgblack@eecs.umich.edu 0x34: srl({{ Rc = Ra.uq >> Rb_or_imm<5:0>; }}); 2164519Sgblack@eecs.umich.edu 0x3c: sra({{ Rc = Ra.sq >> Rb_or_imm<5:0>; }}); 2174519Sgblack@eecs.umich.edu 2184519Sgblack@eecs.umich.edu 0x02: mskbl({{ Rc = Ra & ~(mask( 8) << (Rb_or_imm<2:0> * 8)); }}); 2194712Sgblack@eecs.umich.edu 0x12: mskwl({{ Rc = Ra & ~(mask(16) << (Rb_or_imm<2:0> * 8)); }}); 2204519Sgblack@eecs.umich.edu 0x22: mskll({{ Rc = Ra & ~(mask(32) << (Rb_or_imm<2:0> * 8)); }}); 2214581Sgblack@eecs.umich.edu 0x32: mskql({{ Rc = Ra & ~(mask(64) << (Rb_or_imm<2:0> * 8)); }}); 2224688Sgblack@eecs.umich.edu 2234581Sgblack@eecs.umich.edu 0x52: mskwh({{ 2244519Sgblack@eecs.umich.edu int bv = Rb_or_imm<2:0>; 2254519Sgblack@eecs.umich.edu Rc = bv ? (Ra & ~(mask(16) >> (64 - 8 * bv))) : Ra; 2264519Sgblack@eecs.umich.edu }}); 2274519Sgblack@eecs.umich.edu 0x62: msklh({{ 2284519Sgblack@eecs.umich.edu int bv = Rb_or_imm<2:0>; 2294519Sgblack@eecs.umich.edu Rc = bv ? (Ra & ~(mask(32) >> (64 - 8 * bv))) : Ra; 2304688Sgblack@eecs.umich.edu }}); 2314688Sgblack@eecs.umich.edu 0x72: mskqh({{ 2324688Sgblack@eecs.umich.edu int bv = Rb_or_imm<2:0>; 2334688Sgblack@eecs.umich.edu Rc = bv ? (Ra & ~(mask(64) >> (64 - 8 * bv))) : Ra; 2344688Sgblack@eecs.umich.edu }}); 2354688Sgblack@eecs.umich.edu 2364688Sgblack@eecs.umich.edu 0x06: extbl({{ Rc = (Ra.uq >> (Rb_or_imm<2:0> * 8))< 7:0>; }}); 2374688Sgblack@eecs.umich.edu 0x16: extwl({{ Rc = (Ra.uq >> (Rb_or_imm<2:0> * 8))<15:0>; }}); 2384688Sgblack@eecs.umich.edu 0x26: extll({{ Rc = (Ra.uq >> (Rb_or_imm<2:0> * 8))<31:0>; }}); 2394688Sgblack@eecs.umich.edu 0x36: extql({{ Rc = (Ra.uq >> (Rb_or_imm<2:0> * 8)); }}); 2404688Sgblack@eecs.umich.edu 2414688Sgblack@eecs.umich.edu 0x5a: extwh({{ 2424688Sgblack@eecs.umich.edu Rc = (Ra << (64 - (Rb_or_imm<2:0> * 8))<5:0>)<15:0>; }}); 2434688Sgblack@eecs.umich.edu 0x6a: extlh({{ 2444688Sgblack@eecs.umich.edu Rc = (Ra << (64 - (Rb_or_imm<2:0> * 8))<5:0>)<31:0>; }}); 2454688Sgblack@eecs.umich.edu 0x7a: extqh({{ 2464528Sgblack@eecs.umich.edu Rc = (Ra << (64 - (Rb_or_imm<2:0> * 8))<5:0>); }}); 2474688Sgblack@eecs.umich.edu 2484701Sgblack@eecs.umich.edu 0x0b: insbl({{ Rc = Ra< 7:0> << (Rb_or_imm<2:0> * 8); }}); 2494519Sgblack@eecs.umich.edu 0x1b: inswl({{ Rc = Ra<15:0> << (Rb_or_imm<2:0> * 8); }}); 2504519Sgblack@eecs.umich.edu 0x2b: insll({{ Rc = Ra<31:0> << (Rb_or_imm<2:0> * 8); }}); 2514519Sgblack@eecs.umich.edu 0x3b: insql({{ Rc = Ra << (Rb_or_imm<2:0> * 8); }}); 2524688Sgblack@eecs.umich.edu 2534701Sgblack@eecs.umich.edu 0x57: inswh({{ 2544688Sgblack@eecs.umich.edu int bv = Rb_or_imm<2:0>; 2554688Sgblack@eecs.umich.edu Rc = bv ? (Ra.uq<15:0> >> (64 - 8 * bv)) : 0; 2564688Sgblack@eecs.umich.edu }}); 2574688Sgblack@eecs.umich.edu 0x67: inslh({{ 2584688Sgblack@eecs.umich.edu int bv = Rb_or_imm<2:0>; 2594688Sgblack@eecs.umich.edu Rc = bv ? (Ra.uq<31:0> >> (64 - 8 * bv)) : 0; 2604688Sgblack@eecs.umich.edu }}); 2614519Sgblack@eecs.umich.edu 0x77: insqh({{ 2624519Sgblack@eecs.umich.edu int bv = Rb_or_imm<2:0>; 2634560Sgblack@eecs.umich.edu Rc = bv ? (Ra.uq >> (64 - 8 * bv)) : 0; 2644539Sgblack@eecs.umich.edu }}); 2654688Sgblack@eecs.umich.edu 2664519Sgblack@eecs.umich.edu 0x30: zap({{ 2674519Sgblack@eecs.umich.edu uint64_t zapmask = 0; 2684519Sgblack@eecs.umich.edu for (int i = 0; i < 8; ++i) { 2694519Sgblack@eecs.umich.edu if (Rb_or_imm<i:>) 2704519Sgblack@eecs.umich.edu zapmask |= (mask(8) << (i * 8)); 2714519Sgblack@eecs.umich.edu } 2724539Sgblack@eecs.umich.edu Rc = Ra & ~zapmask; 2734519Sgblack@eecs.umich.edu }}); 2744528Sgblack@eecs.umich.edu 0x31: zapnot({{ 2754688Sgblack@eecs.umich.edu uint64_t zapmask = 0; 2764701Sgblack@eecs.umich.edu for (int i = 0; i < 8; ++i) { 2774519Sgblack@eecs.umich.edu if (!Rb_or_imm<i:>) 2784519Sgblack@eecs.umich.edu zapmask |= (mask(8) << (i * 8)); 2794560Sgblack@eecs.umich.edu } 2804688Sgblack@eecs.umich.edu Rc = Ra & ~zapmask; 2814701Sgblack@eecs.umich.edu }}); 2824688Sgblack@eecs.umich.edu } 2834688Sgblack@eecs.umich.edu 2844688Sgblack@eecs.umich.edu 0x13: decode INTFUNC { // integer multiplies 2854688Sgblack@eecs.umich.edu 0x00: mull({{ Rc.sl = Ra.sl * Rb_or_imm.sl; }}, IntMultOp); 2864688Sgblack@eecs.umich.edu 0x20: mulq({{ Rc = Ra * Rb_or_imm; }}, IntMultOp); 2874688Sgblack@eecs.umich.edu 0x30: umulh({{ 2884688Sgblack@eecs.umich.edu uint64_t hi, lo; 2894519Sgblack@eecs.umich.edu mul128(Ra, Rb_or_imm, hi, lo); 2904519Sgblack@eecs.umich.edu Rc = hi; 2914560Sgblack@eecs.umich.edu }}, IntMultOp); 2924539Sgblack@eecs.umich.edu 0x40: mullv({{ 2934688Sgblack@eecs.umich.edu // 32-bit multiply with trap on overflow 2944519Sgblack@eecs.umich.edu int64_t Rax = Ra.sl; // sign extended version of Ra.sl 2954519Sgblack@eecs.umich.edu int64_t Rbx = Rb_or_imm.sl; 2964519Sgblack@eecs.umich.edu int64_t tmp = Rax * Rbx; 2974519Sgblack@eecs.umich.edu // To avoid overflow, all the upper 32 bits must match 2984519Sgblack@eecs.umich.edu // the sign bit of the lower 32. We code this as 2994519Sgblack@eecs.umich.edu // checking the upper 33 bits for all 0s or all 1s. 3004539Sgblack@eecs.umich.edu uint64_t sign_bits = tmp<63:31>; 3014519Sgblack@eecs.umich.edu if (sign_bits != 0 && sign_bits != mask(33)) 3024519Sgblack@eecs.umich.edu fault = new IntegerOverflowFault; 3034519Sgblack@eecs.umich.edu Rc.sl = tmp<31:0>; 3044519Sgblack@eecs.umich.edu }}, IntMultOp); 3054519Sgblack@eecs.umich.edu 0x60: mulqv({{ 3064519Sgblack@eecs.umich.edu // 64-bit multiply with trap on overflow 3074519Sgblack@eecs.umich.edu uint64_t hi, lo; 3084519Sgblack@eecs.umich.edu mul128(Ra, Rb_or_imm, hi, lo); 3094519Sgblack@eecs.umich.edu // all the upper 64 bits must match the sign bit of 3104519Sgblack@eecs.umich.edu // the lower 64 3114688Sgblack@eecs.umich.edu if (!((hi == 0 && lo<63:> == 0) || 3124708Sgblack@eecs.umich.edu (hi == mask(64) && lo<63:> == 1))) 3134519Sgblack@eecs.umich.edu fault = new IntegerOverflowFault; 3144519Sgblack@eecs.umich.edu Rc = lo; 3154519Sgblack@eecs.umich.edu }}, IntMultOp); 3164528Sgblack@eecs.umich.edu } 3174595Sgblack@eecs.umich.edu 3184612Sgblack@eecs.umich.edu 0x1c: decode INTFUNC { 3194612Sgblack@eecs.umich.edu 0x00: decode RA { 31: sextb({{ Rc.sb = Rb_or_imm< 7:0>; }}); } 3204688Sgblack@eecs.umich.edu 0x01: decode RA { 31: sextw({{ Rc.sw = Rb_or_imm<15:0>; }}); } 3214708Sgblack@eecs.umich.edu 0x32: ctlz({{ 3224708Sgblack@eecs.umich.edu uint64_t count = 0; 3234595Sgblack@eecs.umich.edu uint64_t temp = Rb; 3244595Sgblack@eecs.umich.edu if (temp<63:32>) temp >>= 32; else count += 32; 3254595Sgblack@eecs.umich.edu if (temp<31:16>) temp >>= 16; else count += 16; 3264595Sgblack@eecs.umich.edu if (temp<15:8>) temp >>= 8; else count += 8; 3274595Sgblack@eecs.umich.edu if (temp<7:4>) temp >>= 4; else count += 4; 3284688Sgblack@eecs.umich.edu if (temp<3:2>) temp >>= 2; else count += 2; 3294688Sgblack@eecs.umich.edu if (temp<1:1>) temp >>= 1; else count += 1; 3304688Sgblack@eecs.umich.edu if ((temp<0:0>) != 0x1) count += 1; 3314688Sgblack@eecs.umich.edu Rc = count; 3324688Sgblack@eecs.umich.edu }}, IntAluOp); 3334688Sgblack@eecs.umich.edu 3344708Sgblack@eecs.umich.edu 0x33: cttz({{ 3354519Sgblack@eecs.umich.edu uint64_t count = 0; 3364519Sgblack@eecs.umich.edu uint64_t temp = Rb; 3374519Sgblack@eecs.umich.edu if (!(temp<31:0>)) { temp >>= 32; count += 32; } 3384519Sgblack@eecs.umich.edu if (!(temp<15:0>)) { temp >>= 16; count += 16; } 3394519Sgblack@eecs.umich.edu if (!(temp<7:0>)) { temp >>= 8; count += 8; } 3404519Sgblack@eecs.umich.edu if (!(temp<3:0>)) { temp >>= 4; count += 4; } 3414519Sgblack@eecs.umich.edu if (!(temp<1:0>)) { temp >>= 2; count += 2; } 3424519Sgblack@eecs.umich.edu if (!(temp<0:0> & ULL(0x1))) count += 1; 3434519Sgblack@eecs.umich.edu Rc = count; 3444519Sgblack@eecs.umich.edu }}, IntAluOp); 3454688Sgblack@eecs.umich.edu 3464688Sgblack@eecs.umich.edu format FailUnimpl { 3474688Sgblack@eecs.umich.edu 0x30: ctpop(); 3484688Sgblack@eecs.umich.edu 0x31: perr(); 3494688Sgblack@eecs.umich.edu 0x34: unpkbw(); 3504688Sgblack@eecs.umich.edu 0x35: unpkbl(); 3514688Sgblack@eecs.umich.edu 0x36: pkwb(); 3524688Sgblack@eecs.umich.edu 0x37: pklb(); 3534688Sgblack@eecs.umich.edu 0x38: minsb8(); 3544688Sgblack@eecs.umich.edu 0x39: minsw4(); 3554519Sgblack@eecs.umich.edu 0x3a: minub8(); 3564688Sgblack@eecs.umich.edu 0x3b: minuw4(); 3574688Sgblack@eecs.umich.edu 0x3c: maxub8(); 3584701Sgblack@eecs.umich.edu 0x3d: maxuw4(); 3594701Sgblack@eecs.umich.edu 0x3e: maxsb8(); 3604519Sgblack@eecs.umich.edu 0x3f: maxsw4(); 3614688Sgblack@eecs.umich.edu } 3624519Sgblack@eecs.umich.edu 3634708Sgblack@eecs.umich.edu format BasicOperateWithNopCheck { 3644708Sgblack@eecs.umich.edu 0x70: decode RB { 3654688Sgblack@eecs.umich.edu 31: ftoit({{ Rc = Fa.uq; }}, FloatCvtOp); 3664595Sgblack@eecs.umich.edu } 3674688Sgblack@eecs.umich.edu 0x78: decode RB { 3684688Sgblack@eecs.umich.edu 31: ftois({{ Rc.sl = t_to_s(Fa.uq); }}, 3694701Sgblack@eecs.umich.edu FloatCvtOp); 3704701Sgblack@eecs.umich.edu } 3714519Sgblack@eecs.umich.edu } 3724688Sgblack@eecs.umich.edu } 3734519Sgblack@eecs.umich.edu } 3744708Sgblack@eecs.umich.edu 3754708Sgblack@eecs.umich.edu // Conditional branches. 3764688Sgblack@eecs.umich.edu format CondBranch { 3774688Sgblack@eecs.umich.edu 0x39: beq({{ cond = (Ra == 0); }}); 3784688Sgblack@eecs.umich.edu 0x3d: bne({{ cond = (Ra != 0); }}); 3794688Sgblack@eecs.umich.edu 0x3e: bge({{ cond = (Ra.sq >= 0); }}); 3804688Sgblack@eecs.umich.edu 0x3f: bgt({{ cond = (Ra.sq > 0); }}); 3814688Sgblack@eecs.umich.edu 0x3b: ble({{ cond = (Ra.sq <= 0); }}); 3824688Sgblack@eecs.umich.edu 0x3a: blt({{ cond = (Ra.sq < 0); }}); 3834688Sgblack@eecs.umich.edu 0x38: blbc({{ cond = ((Ra & 1) == 0); }}); 3844688Sgblack@eecs.umich.edu 0x3c: blbs({{ cond = ((Ra & 1) == 1); }}); 3854708Sgblack@eecs.umich.edu 3864708Sgblack@eecs.umich.edu 0x31: fbeq({{ cond = (Fa == 0); }}); 3874519Sgblack@eecs.umich.edu 0x35: fbne({{ cond = (Fa != 0); }}); 3884592Sgblack@eecs.umich.edu 0x36: fbge({{ cond = (Fa >= 0); }}); 3894708Sgblack@eecs.umich.edu 0x37: fbgt({{ cond = (Fa > 0); }}); 3904592Sgblack@eecs.umich.edu 0x33: fble({{ cond = (Fa <= 0); }}); 3914592Sgblack@eecs.umich.edu 0x32: fblt({{ cond = (Fa < 0); }}); 3924592Sgblack@eecs.umich.edu } 3934592Sgblack@eecs.umich.edu 3944592Sgblack@eecs.umich.edu // unconditional branches 3954592Sgblack@eecs.umich.edu format UncondBranch { 3964592Sgblack@eecs.umich.edu 0x30: br(); 3974592Sgblack@eecs.umich.edu 0x34: bsr(IsCall); 3984592Sgblack@eecs.umich.edu } 3994592Sgblack@eecs.umich.edu 4004592Sgblack@eecs.umich.edu // indirect branches 4014688Sgblack@eecs.umich.edu 0x1a: decode JMPFUNC { 4024688Sgblack@eecs.umich.edu format Jump { 4034701Sgblack@eecs.umich.edu 0: jmp(); 4044701Sgblack@eecs.umich.edu 1: jsr(IsCall); 4054688Sgblack@eecs.umich.edu 2: ret(IsReturn); 4064688Sgblack@eecs.umich.edu 3: jsr_coroutine(IsCall, IsReturn); 4074688Sgblack@eecs.umich.edu } 4084708Sgblack@eecs.umich.edu } 4094708Sgblack@eecs.umich.edu 4104688Sgblack@eecs.umich.edu // Square root and integer-to-FP moves 4114688Sgblack@eecs.umich.edu 0x14: decode FP_SHORTFUNC { 4124708Sgblack@eecs.umich.edu // Integer to FP register moves must have RB == 31 4134708Sgblack@eecs.umich.edu 0x4: decode RB { 4144701Sgblack@eecs.umich.edu 31: decode FP_FULLFUNC { 4154701Sgblack@eecs.umich.edu format BasicOperateWithNopCheck { 4164592Sgblack@eecs.umich.edu 0x004: itofs({{ Fc.uq = s_to_t(Ra.ul); }}, FloatCvtOp); 4174688Sgblack@eecs.umich.edu 0x024: itoft({{ Fc.uq = Ra.uq; }}, FloatCvtOp); 4184592Sgblack@eecs.umich.edu 0x014: FailUnimpl::itoff(); // VAX-format conversion 4194708Sgblack@eecs.umich.edu } 4204708Sgblack@eecs.umich.edu } 4214592Sgblack@eecs.umich.edu } 4224708Sgblack@eecs.umich.edu 4234592Sgblack@eecs.umich.edu // Square root instructions must have FA == 31 4244592Sgblack@eecs.umich.edu 0xb: decode FA { 4254592Sgblack@eecs.umich.edu 31: decode FP_TYPEFUNC { 4264592Sgblack@eecs.umich.edu format FloatingPointOperate { 4274592Sgblack@eecs.umich.edu#if SS_COMPATIBLE_FP 4284592Sgblack@eecs.umich.edu 0x0b: sqrts({{ 4294592Sgblack@eecs.umich.edu if (Fb < 0.0) 4304701Sgblack@eecs.umich.edu fault = new ArithmeticFault; 4314701Sgblack@eecs.umich.edu Fc = sqrt(Fb); 4324592Sgblack@eecs.umich.edu }}, FloatSqrtOp); 4334592Sgblack@eecs.umich.edu#else 4344592Sgblack@eecs.umich.edu 0x0b: sqrts({{ 4354688Sgblack@eecs.umich.edu if (Fb.sf < 0.0) 4364688Sgblack@eecs.umich.edu fault = new ArithmeticFault; 4374708Sgblack@eecs.umich.edu Fc.sf = sqrt(Fb.sf); 4384592Sgblack@eecs.umich.edu }}, FloatSqrtOp); 4394592Sgblack@eecs.umich.edu#endif 4404595Sgblack@eecs.umich.edu 0x2b: sqrtt({{ 4414595Sgblack@eecs.umich.edu if (Fb < 0.0) 4424595Sgblack@eecs.umich.edu fault = new ArithmeticFault; 4434595Sgblack@eecs.umich.edu Fc = sqrt(Fb); 4444595Sgblack@eecs.umich.edu }}, FloatSqrtOp); 4454595Sgblack@eecs.umich.edu } 4464701Sgblack@eecs.umich.edu } 4474701Sgblack@eecs.umich.edu } 4484595Sgblack@eecs.umich.edu 4494595Sgblack@eecs.umich.edu // VAX-format sqrtf and sqrtg are not implemented 4504595Sgblack@eecs.umich.edu 0xa: FailUnimpl::sqrtfg(); 4514688Sgblack@eecs.umich.edu } 4524688Sgblack@eecs.umich.edu 4534708Sgblack@eecs.umich.edu // IEEE floating point 4544595Sgblack@eecs.umich.edu 0x16: decode FP_SHORTFUNC_TOP2 { 4554595Sgblack@eecs.umich.edu // The top two bits of the short function code break this 4564595Sgblack@eecs.umich.edu // space into four groups: binary ops, compares, reserved, and 4574595Sgblack@eecs.umich.edu // conversions. See Table 4-12 of AHB. There are different 4584595Sgblack@eecs.umich.edu // special cases in these different groups, so we decode on 4594595Sgblack@eecs.umich.edu // these top two bits first just to select a decode strategy. 4604519Sgblack@eecs.umich.edu // Most of these instructions may have various trapping and 461 // rounding mode flags set; these are decoded in the 462 // FloatingPointDecode template used by the 463 // FloatingPointOperate format. 464 465 // add/sub/mul/div: just decode on the short function code 466 // and source type. All valid trapping and rounding modes apply. 467 0: decode FP_TRAPMODE { 468 // check for valid trapping modes here 469 0,1,5,7: decode FP_TYPEFUNC { 470 format FloatingPointOperate { 471#if SS_COMPATIBLE_FP 472 0x00: adds({{ Fc = Fa + Fb; }}); 473 0x01: subs({{ Fc = Fa - Fb; }}); 474 0x02: muls({{ Fc = Fa * Fb; }}, FloatMultOp); 475 0x03: divs({{ Fc = Fa / Fb; }}, FloatDivOp); 476#else 477 0x00: adds({{ Fc.sf = Fa.sf + Fb.sf; }}); 478 0x01: subs({{ Fc.sf = Fa.sf - Fb.sf; }}); 479 0x02: muls({{ Fc.sf = Fa.sf * Fb.sf; }}, FloatMultOp); 480 0x03: divs({{ Fc.sf = Fa.sf / Fb.sf; }}, FloatDivOp); 481#endif 482 483 0x20: addt({{ Fc = Fa + Fb; }}); 484 0x21: subt({{ Fc = Fa - Fb; }}); 485 0x22: mult({{ Fc = Fa * Fb; }}, FloatMultOp); 486 0x23: divt({{ Fc = Fa / Fb; }}, FloatDivOp); 487 } 488 } 489 } 490 491 // Floating-point compare instructions must have the default 492 // rounding mode, and may use the default trapping mode or 493 // /SU. Both trapping modes are treated the same by M5; the 494 // only difference on the real hardware (as far a I can tell) 495 // is that without /SU you'd get an imprecise trap if you 496 // tried to compare a NaN with something else (instead of an 497 // "unordered" result). 498 1: decode FP_FULLFUNC { 499 format BasicOperateWithNopCheck { 500 0x0a5, 0x5a5: cmpteq({{ Fc = (Fa == Fb) ? 2.0 : 0.0; }}, 501 FloatCmpOp); 502 0x0a7, 0x5a7: cmptle({{ Fc = (Fa <= Fb) ? 2.0 : 0.0; }}, 503 FloatCmpOp); 504 0x0a6, 0x5a6: cmptlt({{ Fc = (Fa < Fb) ? 2.0 : 0.0; }}, 505 FloatCmpOp); 506 0x0a4, 0x5a4: cmptun({{ // unordered 507 Fc = (!(Fa < Fb) && !(Fa == Fb) && !(Fa > Fb)) ? 2.0 : 0.0; 508 }}, FloatCmpOp); 509 } 510 } 511 512 // The FP-to-integer and integer-to-FP conversion insts 513 // require that FA be 31. 514 3: decode FA { 515 31: decode FP_TYPEFUNC { 516 format FloatingPointOperate { 517 0x2f: decode FP_ROUNDMODE { 518 format FPFixedRounding { 519 // "chopped" i.e. round toward zero 520 0: cvttq({{ Fc.sq = (int64_t)trunc(Fb); }}, 521 Chopped); 522 // round to minus infinity 523 1: cvttq({{ Fc.sq = (int64_t)floor(Fb); }}, 524 MinusInfinity); 525 } 526 default: cvttq({{ Fc.sq = (int64_t)nearbyint(Fb); }}); 527 } 528 529 // The cvtts opcode is overloaded to be cvtst if the trap 530 // mode is 2 or 6 (which are not valid otherwise) 531 0x2c: decode FP_FULLFUNC { 532 format BasicOperateWithNopCheck { 533 // trap on denorm version "cvtst/s" is 534 // simulated same as cvtst 535 0x2ac, 0x6ac: cvtst({{ Fc = Fb.sf; }}); 536 } 537 default: cvtts({{ Fc.sf = Fb; }}); 538 } 539 540 // The trapping mode for integer-to-FP conversions 541 // must be /SUI or nothing; /U and /SU are not 542 // allowed. The full set of rounding modes are 543 // supported though. 544 0x3c: decode FP_TRAPMODE { 545 0,7: cvtqs({{ Fc.sf = Fb.sq; }}); 546 } 547 0x3e: decode FP_TRAPMODE { 548 0,7: cvtqt({{ Fc = Fb.sq; }}); 549 } 550 } 551 } 552 } 553 } 554 555 // misc FP operate 556 0x17: decode FP_FULLFUNC { 557 format BasicOperateWithNopCheck { 558 0x010: cvtlq({{ 559 Fc.sl = (Fb.uq<63:62> << 30) | Fb.uq<58:29>; 560 }}); 561 0x030: cvtql({{ 562 Fc.uq = (Fb.uq<31:30> << 62) | (Fb.uq<29:0> << 29); 563 }}); 564 565 // We treat the precise & imprecise trapping versions of 566 // cvtql identically. 567 0x130, 0x530: cvtqlv({{ 568 // To avoid overflow, all the upper 32 bits must match 569 // the sign bit of the lower 32. We code this as 570 // checking the upper 33 bits for all 0s or all 1s. 571 uint64_t sign_bits = Fb.uq<63:31>; 572 if (sign_bits != 0 && sign_bits != mask(33)) 573 fault = new IntegerOverflowFault; 574 Fc.uq = (Fb.uq<31:30> << 62) | (Fb.uq<29:0> << 29); 575 }}); 576 577 0x020: cpys({{ // copy sign 578 Fc.uq = (Fa.uq<63:> << 63) | Fb.uq<62:0>; 579 }}); 580 0x021: cpysn({{ // copy sign negated 581 Fc.uq = (~Fa.uq<63:> << 63) | Fb.uq<62:0>; 582 }}); 583 0x022: cpyse({{ // copy sign and exponent 584 Fc.uq = (Fa.uq<63:52> << 52) | Fb.uq<51:0>; 585 }}); 586 587 0x02a: fcmoveq({{ Fc = (Fa == 0) ? Fb : Fc; }}); 588 0x02b: fcmovne({{ Fc = (Fa != 0) ? Fb : Fc; }}); 589 0x02c: fcmovlt({{ Fc = (Fa < 0) ? Fb : Fc; }}); 590 0x02d: fcmovge({{ Fc = (Fa >= 0) ? Fb : Fc; }}); 591 0x02e: fcmovle({{ Fc = (Fa <= 0) ? Fb : Fc; }}); 592 0x02f: fcmovgt({{ Fc = (Fa > 0) ? Fb : Fc; }}); 593 594 0x024: mt_fpcr({{ FPCR = Fa.uq; }}, IsIprAccess); 595 0x025: mf_fpcr({{ Fa.uq = FPCR; }}, IsIprAccess); 596 } 597 } 598 599 // miscellaneous mem-format ops 600 0x18: decode MEMFUNC { 601 format WarnUnimpl { 602 0x8000: fetch(); 603 0xa000: fetch_m(); 604 0xe800: ecb(); 605 } 606 607 format MiscPrefetch { 608 0xf800: wh64({{ EA = Rb & ~ULL(63); }}, 609 {{ xc->writeHint(EA, 64, memAccessFlags); }}, 610 mem_flags = NO_FAULT, 611 inst_flags = [IsMemRef, IsDataPrefetch, 612 IsStore, MemWriteOp]); 613 } 614 615 format BasicOperate { 616 0xc000: rpcc({{ 617#if FULL_SYSTEM 618 /* Rb is a fake dependency so here is a fun way to get 619 * the parser to understand that. 620 */ 621 Ra = xc->readMiscRegWithEffect(AlphaISA::IPR_CC, fault) + (Rb & 0); 622 623#else 624 Ra = curTick; 625#endif 626 }}, IsUnverifiable); 627 628 // All of the barrier instructions below do nothing in 629 // their execute() methods (hence the empty code blocks). 630 // All of their functionality is hard-coded in the 631 // pipeline based on the flags IsSerializing, 632 // IsMemBarrier, and IsWriteBarrier. In the current 633 // detailed CPU model, the execute() function only gets 634 // called at fetch, so there's no way to generate pipeline 635 // behavior at any other stage. Once we go to an 636 // exec-in-exec CPU model we should be able to get rid of 637 // these flags and implement this behavior via the 638 // execute() methods. 639 640 // trapb is just a barrier on integer traps, where excb is 641 // a barrier on integer and FP traps. "EXCB is thus a 642 // superset of TRAPB." (Alpha ARM, Sec 4.11.4) We treat 643 // them the same though. 644 0x0000: trapb({{ }}, IsSerializing, IsSerializeBefore, No_OpClass); 645 0x0400: excb({{ }}, IsSerializing, IsSerializeBefore, No_OpClass); 646 0x4000: mb({{ }}, IsMemBarrier, MemReadOp); 647 0x4400: wmb({{ }}, IsWriteBarrier, MemWriteOp); 648 } 649 650#if FULL_SYSTEM 651 format BasicOperate { 652 0xe000: rc({{ 653 Ra = xc->readIntrFlag(); 654 xc->setIntrFlag(0); 655 }}, IsNonSpeculative); 656 0xf000: rs({{ 657 Ra = xc->readIntrFlag(); 658 xc->setIntrFlag(1); 659 }}, IsNonSpeculative); 660 } 661#else 662 format FailUnimpl { 663 0xe000: rc(); 664 0xf000: rs(); 665 } 666#endif 667 } 668 669#if FULL_SYSTEM 670 0x00: CallPal::call_pal({{ 671 if (!palValid || 672 (palPriv 673 && xc->readMiscRegWithEffect(AlphaISA::IPR_ICM, fault) != AlphaISA::mode_kernel)) { 674 // invalid pal function code, or attempt to do privileged 675 // PAL call in non-kernel mode 676 fault = new UnimplementedOpcodeFault; 677 } 678 else { 679 // check to see if simulator wants to do something special 680 // on this PAL call (including maybe suppress it) 681 bool dopal = xc->simPalCheck(palFunc); 682 683 if (dopal) { 684 xc->setMiscRegWithEffect(AlphaISA::IPR_EXC_ADDR, NPC); 685 NPC = xc->readMiscRegWithEffect(AlphaISA::IPR_PAL_BASE, fault) + palOffset; 686 } 687 } 688 }}, IsNonSpeculative); 689#else 690 0x00: decode PALFUNC { 691 format EmulatedCallPal { 692 0x00: halt ({{ 693 SimExit(curTick, "halt instruction encountered"); 694 }}, IsNonSpeculative); 695 0x83: callsys({{ 696 xc->syscall(); 697 }}, IsNonSpeculative); 698 // Read uniq reg into ABI return value register (r0) 699 0x9e: rduniq({{ R0 = Runiq; }}, IsIprAccess); 700 // Write uniq reg with value from ABI arg register (r16) 701 0x9f: wruniq({{ Runiq = R16; }}, IsIprAccess); 702 } 703 } 704#endif 705 706#if FULL_SYSTEM 707 0x1b: decode PALMODE { 708 0: OpcdecFault::hw_st_quad(); 709 1: decode HW_LDST_QUAD { 710 format HwLoad { 711 0: hw_ld({{ EA = (Rb + disp) & ~3; }}, {{ Ra = Mem.ul; }}, L); 712 1: hw_ld({{ EA = (Rb + disp) & ~7; }}, {{ Ra = Mem.uq; }}, Q); 713 } 714 } 715 } 716 717 0x1f: decode PALMODE { 718 0: OpcdecFault::hw_st_cond(); 719 format HwStore { 720 1: decode HW_LDST_COND { 721 0: decode HW_LDST_QUAD { 722 0: hw_st({{ EA = (Rb + disp) & ~3; }}, 723 {{ Mem.ul = Ra<31:0>; }}, L); 724 1: hw_st({{ EA = (Rb + disp) & ~7; }}, 725 {{ Mem.uq = Ra.uq; }}, Q); 726 } 727 728 1: FailUnimpl::hw_st_cond(); 729 } 730 } 731 } 732 733 0x19: decode PALMODE { 734 0: OpcdecFault::hw_mfpr(); 735 format HwMoveIPR { 736 1: hw_mfpr({{ 737 Ra = xc->readMiscRegWithEffect(ipr_index, fault); 738 }}, IsIprAccess); 739 } 740 } 741 742 0x1d: decode PALMODE { 743 0: OpcdecFault::hw_mtpr(); 744 format HwMoveIPR { 745 1: hw_mtpr({{ 746 xc->setMiscRegWithEffect(ipr_index, Ra); 747 if (traceData) { traceData->setData(Ra); } 748 }}, IsIprAccess); 749 } 750 } 751 752 format BasicOperate { 753 0x1e: decode PALMODE { 754 0: OpcdecFault::hw_rei(); 755 1:hw_rei({{ xc->hwrei(); }}, IsSerializing, IsSerializeBefore); 756 } 757 758 // M5 special opcodes use the reserved 0x01 opcode space 759 0x01: decode M5FUNC { 760 0x00: arm({{ 761 AlphaPseudo::arm(xc->xcBase()); 762 }}, IsNonSpeculative); 763 0x01: quiesce({{ 764 AlphaPseudo::quiesce(xc->xcBase()); 765 }}, IsNonSpeculative, IsQuiesce); 766 0x02: quiesceNs({{ 767 AlphaPseudo::quiesceNs(xc->xcBase(), R16); 768 }}, IsNonSpeculative, IsQuiesce); 769 0x03: quiesceCycles({{ 770 AlphaPseudo::quiesceCycles(xc->xcBase(), R16); 771 }}, IsNonSpeculative, IsQuiesce); 772 0x04: quiesceTime({{ 773 R0 = AlphaPseudo::quiesceTime(xc->xcBase()); 774 }}, IsNonSpeculative); 775 0x10: ivlb({{ 776 AlphaPseudo::ivlb(xc->xcBase()); 777 }}, No_OpClass, IsNonSpeculative); 778 0x11: ivle({{ 779 AlphaPseudo::ivle(xc->xcBase()); 780 }}, No_OpClass, IsNonSpeculative); 781 0x20: m5exit_old({{ 782 AlphaPseudo::m5exit_old(xc->xcBase()); 783 }}, No_OpClass, IsNonSpeculative); 784 0x21: m5exit({{ 785 AlphaPseudo::m5exit(xc->xcBase(), R16); 786 }}, No_OpClass, IsNonSpeculative); 787 0x30: initparam({{ Ra = xc->xcBase()->getCpuPtr()->system->init_param; }}); 788 0x40: resetstats({{ 789 AlphaPseudo::resetstats(xc->xcBase(), R16, R17); 790 }}, IsNonSpeculative); 791 0x41: dumpstats({{ 792 AlphaPseudo::dumpstats(xc->xcBase(), R16, R17); 793 }}, IsNonSpeculative); 794 0x42: dumpresetstats({{ 795 AlphaPseudo::dumpresetstats(xc->xcBase(), R16, R17); 796 }}, IsNonSpeculative); 797 0x43: m5checkpoint({{ 798 AlphaPseudo::m5checkpoint(xc->xcBase(), R16, R17); 799 }}, IsNonSpeculative); 800 0x50: m5readfile({{ 801 R0 = AlphaPseudo::readfile(xc->xcBase(), R16, R17, R18); 802 }}, IsNonSpeculative); 803 0x51: m5break({{ 804 AlphaPseudo::debugbreak(xc->xcBase()); 805 }}, IsNonSpeculative); 806 0x52: m5switchcpu({{ 807 AlphaPseudo::switchcpu(xc->xcBase()); 808 }}, IsNonSpeculative); 809 0x53: m5addsymbol({{ 810 AlphaPseudo::addsymbol(xc->xcBase(), R16, R17); 811 }}, IsNonSpeculative); 812 0x54: m5panic({{ 813 panic("M5 panic instruction called at pc=%#x.", xc->readPC()); 814 }}, IsNonSpeculative); 815 816 } 817 } 818#endif 819} 820