decoder.isa revision 3928
13900Ssaidi@eecs.umich.edu// Copyright (c) 2006-2007 The Regents of The University of Michigan
22632Sstever@eecs.umich.edu// All rights reserved.
32632Sstever@eecs.umich.edu//
42632Sstever@eecs.umich.edu// Redistribution and use in source and binary forms, with or without
52632Sstever@eecs.umich.edu// modification, are permitted provided that the following conditions are
62632Sstever@eecs.umich.edu// met: redistributions of source code must retain the above copyright
72632Sstever@eecs.umich.edu// notice, this list of conditions and the following disclaimer;
82632Sstever@eecs.umich.edu// redistributions in binary form must reproduce the above copyright
92632Sstever@eecs.umich.edu// notice, this list of conditions and the following disclaimer in the
102632Sstever@eecs.umich.edu// documentation and/or other materials provided with the distribution;
112632Sstever@eecs.umich.edu// neither the name of the copyright holders nor the names of its
122632Sstever@eecs.umich.edu// contributors may be used to endorse or promote products derived from
132632Sstever@eecs.umich.edu// this software without specific prior written permission.
142632Sstever@eecs.umich.edu//
152632Sstever@eecs.umich.edu// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
162632Sstever@eecs.umich.edu// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
172632Sstever@eecs.umich.edu// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
182632Sstever@eecs.umich.edu// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
192632Sstever@eecs.umich.edu// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
202632Sstever@eecs.umich.edu// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
212632Sstever@eecs.umich.edu// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
222632Sstever@eecs.umich.edu// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
232632Sstever@eecs.umich.edu// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
242632Sstever@eecs.umich.edu// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
252632Sstever@eecs.umich.edu// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
262632Sstever@eecs.umich.edu//
272632Sstever@eecs.umich.edu// Authors: Ali Saidi
282632Sstever@eecs.umich.edu//          Gabe Black
292632Sstever@eecs.umich.edu//          Steve Reinhardt
302632Sstever@eecs.umich.edu
312022SN/A////////////////////////////////////////////////////////////////////
322022SN/A//
332022SN/A// The actual decoder specification
342022SN/A//
352022SN/A
362469SN/Adecode OP default Unknown::unknown()
372469SN/A{
382469SN/A    0x0: decode OP2
392469SN/A    {
402516SN/A        //Throw an illegal instruction acception
412516SN/A        0x0: Trap::illtrap({{fault = new IllegalInstruction;}});
422944Sgblack@eecs.umich.edu        format BranchN
432482SN/A        {
443598Sgblack@eecs.umich.edu            //bpcc
453056Sgblack@eecs.umich.edu            0x1: decode COND2
462469SN/A            {
473056Sgblack@eecs.umich.edu                //Branch Always
483056Sgblack@eecs.umich.edu                0x8: decode A
493056Sgblack@eecs.umich.edu                {
503598Sgblack@eecs.umich.edu                    0x0: bpa(19, {{
512516SN/A                        NNPC = xc->readPC() + disp;
523056Sgblack@eecs.umich.edu                    }});
533598Sgblack@eecs.umich.edu                    0x1: bpa(19, {{
543056Sgblack@eecs.umich.edu                        NPC = xc->readPC() + disp;
553056Sgblack@eecs.umich.edu                        NNPC = NPC + 4;
563056Sgblack@eecs.umich.edu                    }}, ',a');
573056Sgblack@eecs.umich.edu                }
583056Sgblack@eecs.umich.edu                //Branch Never
593056Sgblack@eecs.umich.edu                0x0: decode A
603056Sgblack@eecs.umich.edu                {
613598Sgblack@eecs.umich.edu                    0x0: bpn(19, {{
623056Sgblack@eecs.umich.edu                        NNPC = NNPC;//Don't do anything
633056Sgblack@eecs.umich.edu                    }});
643598Sgblack@eecs.umich.edu                    0x1: bpn(19, {{
653056Sgblack@eecs.umich.edu                        NPC = xc->readNextPC() + 4;
663056Sgblack@eecs.umich.edu                        NNPC = NPC + 4;
673056Sgblack@eecs.umich.edu                    }}, ',a');
683056Sgblack@eecs.umich.edu                }
693056Sgblack@eecs.umich.edu                default: decode BPCC
703056Sgblack@eecs.umich.edu                {
713056Sgblack@eecs.umich.edu                    0x0: bpcci(19, {{
723056Sgblack@eecs.umich.edu                        if(passesCondition(Ccr<3:0>, COND2))
733056Sgblack@eecs.umich.edu                            NNPC = xc->readPC() + disp;
743056Sgblack@eecs.umich.edu                        else
753056Sgblack@eecs.umich.edu                            handle_annul
763056Sgblack@eecs.umich.edu                    }});
773056Sgblack@eecs.umich.edu                    0x2: bpccx(19, {{
783056Sgblack@eecs.umich.edu                        if(passesCondition(Ccr<7:4>, COND2))
793056Sgblack@eecs.umich.edu                            NNPC = xc->readPC() + disp;
803056Sgblack@eecs.umich.edu                        else
813056Sgblack@eecs.umich.edu                            handle_annul
823056Sgblack@eecs.umich.edu                    }});
833056Sgblack@eecs.umich.edu                }
842482SN/A            }
853598Sgblack@eecs.umich.edu            //bicc
863598Sgblack@eecs.umich.edu            0x2: decode COND2
873598Sgblack@eecs.umich.edu            {
883598Sgblack@eecs.umich.edu                //Branch Always
893598Sgblack@eecs.umich.edu                0x8: decode A
903598Sgblack@eecs.umich.edu                {
913598Sgblack@eecs.umich.edu                    0x0: ba(22, {{
923598Sgblack@eecs.umich.edu                        NNPC = xc->readPC() + disp;
933598Sgblack@eecs.umich.edu                    }});
943598Sgblack@eecs.umich.edu                    0x1: ba(22, {{
953598Sgblack@eecs.umich.edu                        NPC = xc->readPC() + disp;
963598Sgblack@eecs.umich.edu                        NNPC = NPC + 4;
973598Sgblack@eecs.umich.edu                    }}, ',a');
983598Sgblack@eecs.umich.edu                }
993598Sgblack@eecs.umich.edu                //Branch Never
1003598Sgblack@eecs.umich.edu                0x0: decode A
1013598Sgblack@eecs.umich.edu                {
1023598Sgblack@eecs.umich.edu                    0x0: bn(22, {{
1033598Sgblack@eecs.umich.edu                        NNPC = NNPC;//Don't do anything
1043598Sgblack@eecs.umich.edu                    }});
1053598Sgblack@eecs.umich.edu                    0x1: bn(22, {{
1063598Sgblack@eecs.umich.edu                        NPC = xc->readNextPC() + 4;
1073598Sgblack@eecs.umich.edu                        NNPC = NPC + 4;
1083598Sgblack@eecs.umich.edu                    }}, ',a');
1093598Sgblack@eecs.umich.edu                }
1103598Sgblack@eecs.umich.edu                default: bicc(22, {{
1113598Sgblack@eecs.umich.edu                    if(passesCondition(Ccr<3:0>, COND2))
1123598Sgblack@eecs.umich.edu                        NNPC = xc->readPC() + disp;
1133598Sgblack@eecs.umich.edu                    else
1143598Sgblack@eecs.umich.edu                        handle_annul
1153598Sgblack@eecs.umich.edu                }});
1163598Sgblack@eecs.umich.edu            }
1172516SN/A        }
1182516SN/A        0x3: decode RCOND2
1192516SN/A        {
1202516SN/A            format BranchSplit
1212482SN/A            {
1222482SN/A                0x1: bpreq({{
1232591SN/A                    if(Rs1.sdw == 0)
1242516SN/A                        NNPC = xc->readPC() + disp;
1252580SN/A                    else
1262580SN/A                        handle_annul
1272482SN/A                }});
1282482SN/A                0x2: bprle({{
1292591SN/A                    if(Rs1.sdw <= 0)
1302516SN/A                        NNPC = xc->readPC() + disp;
1312580SN/A                    else
1322580SN/A                        handle_annul
1332482SN/A                }});
1342482SN/A                0x3: bprl({{
1352591SN/A                    if(Rs1.sdw < 0)
1362516SN/A                        NNPC = xc->readPC() + disp;
1372580SN/A                    else
1382580SN/A                        handle_annul
1392482SN/A                }});
1402482SN/A                0x5: bprne({{
1412591SN/A                    if(Rs1.sdw != 0)
1422516SN/A                        NNPC = xc->readPC() + disp;
1432580SN/A                    else
1442580SN/A                        handle_annul
1452482SN/A                }});
1462482SN/A                0x6: bprg({{
1472591SN/A                    if(Rs1.sdw > 0)
1482516SN/A                        NNPC = xc->readPC() + disp;
1492580SN/A                    else
1502580SN/A                        handle_annul
1512482SN/A                }});
1522482SN/A                0x7: bprge({{
1532591SN/A                    if(Rs1.sdw >= 0)
1542516SN/A                        NNPC = xc->readPC() + disp;
1552580SN/A                    else
1562580SN/A                        handle_annul
1572482SN/A                }});
1582469SN/A            }
1592482SN/A        }
1602516SN/A        //SETHI (or NOP if rd == 0 and imm == 0)
1613042Sgblack@eecs.umich.edu        0x4: SetHi::sethi({{Rd.udw = imm;}});
1622516SN/A        0x5: Trap::fbpfcc({{fault = new FpDisabled;}});
1632516SN/A        0x6: Trap::fbfcc({{fault = new FpDisabled;}});
1642469SN/A    }
1652944Sgblack@eecs.umich.edu    0x1: BranchN::call(30, {{
1663928Ssaidi@eecs.umich.edu            if (Pstate<3:>)
1673928Ssaidi@eecs.umich.edu                R15 = (xc->readPC())<31:0>;
1683928Ssaidi@eecs.umich.edu            else
1693928Ssaidi@eecs.umich.edu                R15 = xc->readPC();
1702516SN/A            NNPC = R15 + disp;
1712469SN/A    }});
1722469SN/A    0x2: decode OP3 {
1732482SN/A        format IntOp {
1742482SN/A            0x00: add({{Rd = Rs1.sdw + Rs2_or_imm13;}});
1752974Sgblack@eecs.umich.edu            0x01: and({{Rd = Rs1.sdw & Rs2_or_imm13;}});
1762974Sgblack@eecs.umich.edu            0x02: or({{Rd = Rs1.sdw | Rs2_or_imm13;}});
1772974Sgblack@eecs.umich.edu            0x03: xor({{Rd = Rs1.sdw ^ Rs2_or_imm13;}});
1782526SN/A            0x04: sub({{Rd = Rs1.sdw - Rs2_or_imm13;}});
1792974Sgblack@eecs.umich.edu            0x05: andn({{Rd = Rs1.sdw & ~Rs2_or_imm13;}});
1802974Sgblack@eecs.umich.edu            0x06: orn({{Rd = Rs1.sdw | ~Rs2_or_imm13;}});
1812974Sgblack@eecs.umich.edu            0x07: xnor({{Rd = ~(Rs1.sdw ^ Rs2_or_imm13);}});
1822646Ssaidi@eecs.umich.edu            0x08: addc({{Rd = Rs1.sdw + Rs2_or_imm13 + Ccr<0:0>;}});
1832974Sgblack@eecs.umich.edu            0x09: mulx({{Rd = Rs1.sdw * Rs2_or_imm13;}});
1842469SN/A            0x0A: umul({{
1852516SN/A                Rd = Rs1.udw<31:0> * Rs2_or_imm13<31:0>;
1862646Ssaidi@eecs.umich.edu                Y = Rd<63:32>;
1872482SN/A            }});
1882469SN/A            0x0B: smul({{
1892516SN/A                Rd.sdw = Rs1.sdw<31:0> * Rs2_or_imm13<31:0>;
1903900Ssaidi@eecs.umich.edu                Y = Rd.sdw<63:32>;
1912482SN/A            }});
1922954Sgblack@eecs.umich.edu            0x0C: subc({{Rd.sdw = Rs1.sdw + (~Rs2_or_imm13) + 1 - Ccr<0:0>}});
1932469SN/A            0x0D: udivx({{
1942516SN/A                if(Rs2_or_imm13 == 0) fault = new DivisionByZero;
1952516SN/A                else Rd.udw = Rs1.udw / Rs2_or_imm13;
1962482SN/A            }});
1972469SN/A            0x0E: udiv({{
1982516SN/A                if(Rs2_or_imm13 == 0) fault = new DivisionByZero;
1992482SN/A                else
2002482SN/A                {
2012646Ssaidi@eecs.umich.edu                    Rd.udw = ((Y << 32) | Rs1.udw<31:0>) / Rs2_or_imm13;
2022482SN/A                    if(Rd.udw >> 32 != 0)
2032482SN/A                        Rd.udw = 0xFFFFFFFF;
2042482SN/A                }
2052482SN/A            }});
2062482SN/A            0x0F: sdiv({{
2072615SN/A                if(Rs2_or_imm13.sdw == 0)
2082469SN/A                    fault = new DivisionByZero;
2092469SN/A                else
2102482SN/A                {
2112646Ssaidi@eecs.umich.edu                    Rd.udw = ((int64_t)((Y << 32) | Rs1.sdw<31:0>)) / Rs2_or_imm13.sdw;
2122482SN/A                    if(Rd.udw<63:31> != 0)
2132482SN/A                        Rd.udw = 0x7FFFFFFF;
2142482SN/A                    else if(Rd.udw<63:> && Rd.udw<62:31> != 0xFFFFFFFF)
2152588SN/A                        Rd.udw = 0xFFFFFFFF80000000ULL;
2162482SN/A                }
2172526SN/A            }});
2182469SN/A        }
2192482SN/A        format IntOpCc {
2202469SN/A            0x10: addcc({{
2212516SN/A                int64_t resTemp, val2 = Rs2_or_imm13;
2222469SN/A                Rd = resTemp = Rs1 + val2;}},
2232580SN/A                {{(Rs1<31:0> + val2<31:0>)<32:>}},
2242469SN/A                {{Rs1<31:> == val2<31:> && val2<31:> != resTemp<31:>}},
2252580SN/A                {{(Rs1<63:1> + val2<63:1> + (Rs1 & val2)<0:>)<63:>}},
2262469SN/A                {{Rs1<63:> == val2<63:> && val2<63:> != resTemp<63:>}}
2272526SN/A            );
2282482SN/A            0x11: IntOpCcRes::andcc({{Rd = Rs1 & Rs2_or_imm13;}});
2292482SN/A            0x12: IntOpCcRes::orcc({{Rd = Rs1 | Rs2_or_imm13;}});
2302482SN/A            0x13: IntOpCcRes::xorcc({{Rd = Rs1 ^ Rs2_or_imm13;}});
2312469SN/A            0x14: subcc({{
2322580SN/A                int64_t val2 = Rs2_or_imm13;
2332580SN/A                Rd = Rs1 - val2;}},
2342580SN/A                {{(~(Rs1<31:0> + (~val2)<31:0> + 1))<32:>}},
2352580SN/A                {{(Rs1<31:> != val2<31:>) && (Rs1<31:> != Rd<31:>)}},
2362580SN/A                {{(~(Rs1<63:1> + (~val2)<63:1> +
2372580SN/A                    (Rs1 | ~val2)<0:>))<63:>}},
2382580SN/A                {{Rs1<63:> != val2<63:> && Rs1<63:> != Rd<63:>}}
2392526SN/A            );
2402482SN/A            0x15: IntOpCcRes::andncc({{Rd = Rs1 & ~Rs2_or_imm13;}});
2412482SN/A            0x16: IntOpCcRes::orncc({{Rd = Rs1 | ~Rs2_or_imm13;}});
2422482SN/A            0x17: IntOpCcRes::xnorcc({{Rd = ~(Rs1 ^ Rs2_or_imm13);}});
2432469SN/A            0x18: addccc({{
2442516SN/A                int64_t resTemp, val2 = Rs2_or_imm13;
2452646Ssaidi@eecs.umich.edu                int64_t carryin = Ccr<0:0>;
2462469SN/A                Rd = resTemp = Rs1 + val2 + carryin;}},
2472580SN/A                {{(Rs1<31:0> + val2<31:0> + carryin)<32:>}},
2482469SN/A                {{Rs1<31:> == val2<31:> && val2<31:> != resTemp<31:>}},
2492580SN/A                {{(Rs1<63:1> + val2<63:1> +
2502580SN/A                    ((Rs1 & val2) | (carryin & (Rs1 | val2)))<0:>)<63:>}},
2512469SN/A                {{Rs1<63:> == val2<63:> && val2<63:> != resTemp<63:>}}
2522526SN/A            );
2532469SN/A            0x1A: umulcc({{
2542615SN/A                uint64_t resTemp;
2552615SN/A                Rd = resTemp = Rs1.udw<31:0> * Rs2_or_imm13.udw<31:0>;
2562646Ssaidi@eecs.umich.edu                Y = resTemp<63:32>;}},
2572526SN/A                {{0}},{{0}},{{0}},{{0}});
2582469SN/A            0x1B: smulcc({{
2592615SN/A                int64_t resTemp;
2602615SN/A                Rd = resTemp = Rs1.sdw<31:0> * Rs2_or_imm13.sdw<31:0>;
2612646Ssaidi@eecs.umich.edu                Y = resTemp<63:32>;}},
2622526SN/A                {{0}},{{0}},{{0}},{{0}});
2632469SN/A            0x1C: subccc({{
2642516SN/A                int64_t resTemp, val2 = Rs2_or_imm13;
2652646Ssaidi@eecs.umich.edu                int64_t carryin = Ccr<0:0>;
2662954Sgblack@eecs.umich.edu                Rd = resTemp = Rs1 + ~val2 + 1 - carryin;}},
2672580SN/A                {{(~((Rs1<31:0> + (~(val2 + carryin))<31:0> + 1))<32:>)}},
2682469SN/A                {{Rs1<31:> != val2<31:> && Rs1<31:> != resTemp<31:>}},
2692580SN/A                {{(~((Rs1<63:1> + (~(val2 + carryin))<63:1>) + (Rs1<0:> + (~(val2+carryin))<0:> + 1)<63:1>))<63:>}},
2702469SN/A                {{Rs1<63:> != val2<63:> && Rs1<63:> != resTemp<63:>}}
2712526SN/A            );
2722469SN/A            0x1D: udivxcc({{
2732615SN/A                if(Rs2_or_imm13.udw == 0) fault = new DivisionByZero;
2742615SN/A                else Rd = Rs1.udw / Rs2_or_imm13.udw;}}
2752526SN/A                ,{{0}},{{0}},{{0}},{{0}});
2762469SN/A            0x1E: udivcc({{
2772615SN/A                uint32_t resTemp, val2 = Rs2_or_imm13.udw;
2782989Ssaidi@eecs.umich.edu                int32_t overflow = 0;
2792469SN/A                if(val2 == 0) fault = new DivisionByZero;
2802469SN/A                else
2812224SN/A                {
2822646Ssaidi@eecs.umich.edu                    resTemp = (uint64_t)((Y << 32) | Rs1.udw<31:0>) / val2;
2832516SN/A                    overflow = (resTemp<63:32> != 0);
2842516SN/A                    if(overflow) Rd = resTemp = 0xFFFFFFFF;
2852516SN/A                    else Rd = resTemp;
2862469SN/A                } }},
2872469SN/A                {{0}},
2882469SN/A                {{overflow}},
2892469SN/A                {{0}},
2902469SN/A                {{0}}
2912526SN/A            );
2922469SN/A            0x1F: sdivcc({{
2932996Sgblack@eecs.umich.edu                int64_t val2 = Rs2_or_imm13.sdw<31:0>;
2942996Sgblack@eecs.umich.edu                bool overflow = false, underflow = false;
2952469SN/A                if(val2 == 0) fault = new DivisionByZero;
2962469SN/A                else
2972469SN/A                {
2982996Sgblack@eecs.umich.edu                    Rd = (int64_t)((Y << 32) | Rs1.sdw<31:0>) / val2;
2992996Sgblack@eecs.umich.edu                    overflow = (Rd<63:31> != 0);
3002996Sgblack@eecs.umich.edu                    underflow = (Rd<63:> && Rd<62:31> != 0xFFFFFFFF);
3012996Sgblack@eecs.umich.edu                    if(overflow) Rd = 0x7FFFFFFF;
3022996Sgblack@eecs.umich.edu                    else if(underflow) Rd = 0xFFFFFFFF80000000ULL;
3032469SN/A                } }},
3042469SN/A                {{0}},
3052469SN/A                {{overflow || underflow}},
3062469SN/A                {{0}},
3072469SN/A                {{0}}
3082526SN/A            );
3092469SN/A            0x20: taddcc({{
3102516SN/A                int64_t resTemp, val2 = Rs2_or_imm13;
3112469SN/A                Rd = resTemp = Rs1 + val2;
3122469SN/A                int32_t overflow = Rs1<1:0> || val2<1:0> || (Rs1<31:> == val2<31:> && val2<31:> != resTemp<31:>);}},
3133753Sgblack@eecs.umich.edu                {{((Rs1<31:0> + val2<31:0>)<32:0>)}},
3142469SN/A                {{overflow}},
3152469SN/A                {{((Rs1 >> 1) + (val2 >> 1) + (Rs1 & val2 & 0x1))<63:>}},
3162469SN/A                {{Rs1<63:> == val2<63:> && val2<63:> != resTemp<63:>}}
3172526SN/A            );
3182469SN/A            0x21: tsubcc({{
3192516SN/A                int64_t resTemp, val2 = Rs2_or_imm13;
3202469SN/A                Rd = resTemp = Rs1 + val2;
3212469SN/A                int32_t overflow = Rs1<1:0> || val2<1:0> || (Rs1<31:> == val2<31:> && val2<31:> != resTemp<31:>);}},
3223753Sgblack@eecs.umich.edu                {{(Rs1<31:0> + val2<31:0>)<32:0>}},
3232469SN/A                {{overflow}},
3242469SN/A                {{((Rs1 >> 1) + (val2 >> 1) + (Rs1 & val2 & 0x1))<63:>}},
3252469SN/A                {{Rs1<63:> == val2<63:> && val2<63:> != resTemp<63:>}}
3262526SN/A            );
3272469SN/A            0x22: taddcctv({{
3282996Sgblack@eecs.umich.edu                int64_t val2 = Rs2_or_imm13;
3292996Sgblack@eecs.umich.edu                Rd = Rs1 + val2;
3302954Sgblack@eecs.umich.edu                int32_t overflow = Rs1<1:0> || val2<1:0> ||
3312954Sgblack@eecs.umich.edu                        (Rs1<31:> == val2<31:> && val2<31:> != Rd<31:>);
3322469SN/A                if(overflow) fault = new TagOverflow;}},
3333753Sgblack@eecs.umich.edu                {{((Rs1<31:0> + val2<31:0>)<32:0>)}},
3342469SN/A                {{overflow}},
3352469SN/A                {{((Rs1 >> 1) + (val2 >> 1) + (Rs1 & val2 & 0x1))<63:>}},
3362996Sgblack@eecs.umich.edu                {{Rs1<63:> == val2<63:> && val2<63:> != Rd<63:>}}
3372526SN/A            );
3382469SN/A            0x23: tsubcctv({{
3392516SN/A                int64_t resTemp, val2 = Rs2_or_imm13;
3402469SN/A                Rd = resTemp = Rs1 + val2;
3412469SN/A                int32_t overflow = Rs1<1:0> || val2<1:0> || (Rs1<31:> == val2<31:> && val2<31:> != resTemp<31:>);
3422469SN/A                if(overflow) fault = new TagOverflow;}},
3433753Sgblack@eecs.umich.edu                {{((Rs1<31:0> + val2<31:0>)<32:0>)}},
3442469SN/A                {{overflow}},
3452469SN/A                {{((Rs1 >> 1) + (val2 >> 1) + (Rs1 & val2 & 0x1))<63:>}},
3462469SN/A                {{Rs1<63:> == val2<63:> && val2<63:> != resTemp<63:>}}
3472526SN/A            );
3482469SN/A            0x24: mulscc({{
3492516SN/A                int64_t resTemp, multiplicand = Rs2_or_imm13;
3502469SN/A                int32_t multiplier = Rs1<31:0>;
3512469SN/A                int32_t savedLSB = Rs1<0:>;
3522516SN/A                multiplier = multiplier<31:1> |
3533753Sgblack@eecs.umich.edu                    ((Ccr<3:3> ^ Ccr<1:1>) << 32);
3542646Ssaidi@eecs.umich.edu                if(!Y<0:>)
3552469SN/A                    multiplicand = 0;
3562469SN/A                Rd = resTemp = multiplicand + multiplier;
3572646Ssaidi@eecs.umich.edu                Y = Y<31:1> | (savedLSB << 31);}},
3583753Sgblack@eecs.umich.edu                {{((multiplicand<31:0> + multiplier<31:0>)<32:0>)}},
3592469SN/A                {{multiplicand<31:> == multiplier<31:> && multiplier<31:> != resTemp<31:>}},
3602469SN/A                {{((multiplicand >> 1) + (multiplier >> 1) + (multiplicand & multiplier & 0x1))<63:>}},
3612469SN/A                {{multiplicand<63:> == multiplier<63:> && multiplier<63:> != resTemp<63:>}}
3622526SN/A            );
3632526SN/A        }
3642526SN/A        format IntOp
3652526SN/A        {
3662526SN/A            0x25: decode X {
3672526SN/A                0x0: sll({{Rd = Rs1 << (I ? SHCNT32 : Rs2<4:0>);}});
3682526SN/A                0x1: sllx({{Rd = Rs1 << (I ? SHCNT64 : Rs2<5:0>);}});
3692469SN/A            }
3702526SN/A            0x26: decode X {
3712526SN/A                0x0: srl({{Rd = Rs1.uw >> (I ? SHCNT32 : Rs2<4:0>);}});
3722526SN/A                0x1: srlx({{Rd = Rs1.udw >> (I ? SHCNT64 : Rs2<5:0>);}});
3732526SN/A            }
3742526SN/A            0x27: decode X {
3752526SN/A                0x0: sra({{Rd = Rs1.sw >> (I ? SHCNT32 : Rs2<4:0>);}});
3762526SN/A                0x1: srax({{Rd = Rs1.sdw >> (I ? SHCNT64 : Rs2<5:0>);}});
3772526SN/A            }
3782954Sgblack@eecs.umich.edu            0x28: decode RS1 {
3793587Sgblack@eecs.umich.edu                0x00: NoPriv::rdy({{Rd = Y;}});
3803587Sgblack@eecs.umich.edu                //1 should cause an illegal instruction exception
3813587Sgblack@eecs.umich.edu                0x02: NoPriv::rdccr({{Rd = Ccr;}});
3823587Sgblack@eecs.umich.edu                0x03: NoPriv::rdasi({{Rd = Asi;}});
3833823Ssaidi@eecs.umich.edu                0x04: PrivCheck::rdtick({{Rd = Tick;}}, {{Tick<63:>}});
3843587Sgblack@eecs.umich.edu                0x05: NoPriv::rdpc({{
3853587Sgblack@eecs.umich.edu                    if(Pstate<3:>)
3863587Sgblack@eecs.umich.edu                        Rd = (xc->readPC())<31:0>;
3873587Sgblack@eecs.umich.edu                    else
3883587Sgblack@eecs.umich.edu                        Rd = xc->readPC();}});
3893587Sgblack@eecs.umich.edu                0x06: NoPriv::rdfprs({{
3903587Sgblack@eecs.umich.edu                    //Wait for all fpops to finish.
3913587Sgblack@eecs.umich.edu                    Rd = Fprs;
3923587Sgblack@eecs.umich.edu                }});
3933587Sgblack@eecs.umich.edu                //7-14 should cause an illegal instruction exception
3943587Sgblack@eecs.umich.edu                0x0F: decode I {
3952954Sgblack@eecs.umich.edu                    0x0: Nop::stbar({{/*stuff*/}});
3962954Sgblack@eecs.umich.edu                    0x1: Nop::membar({{/*stuff*/}});
3972954Sgblack@eecs.umich.edu                }
3983587Sgblack@eecs.umich.edu                0x10: Priv::rdpcr({{Rd = Pcr;}});
3993587Sgblack@eecs.umich.edu                0x11: PrivCheck::rdpic({{Rd = Pic;}}, {{Pcr<0:>}});
4003587Sgblack@eecs.umich.edu                //0x12 should cause an illegal instruction exception
4013587Sgblack@eecs.umich.edu                0x13: NoPriv::rdgsr({{
4023587Sgblack@eecs.umich.edu                    if(Fprs<2:> == 0 || Pstate<4:> == 0)
4033587Sgblack@eecs.umich.edu                        Rd = Gsr;
4043587Sgblack@eecs.umich.edu                    else
4053587Sgblack@eecs.umich.edu                        fault = new FpDisabled;
4062954Sgblack@eecs.umich.edu                }});
4073587Sgblack@eecs.umich.edu                //0x14-0x15 should cause an illegal instruction exception
4083587Sgblack@eecs.umich.edu                0x16: Priv::rdsoftint({{Rd = Softint;}});
4093823Ssaidi@eecs.umich.edu                0x17: Priv::rdtick_cmpr({{Rd = TickCmpr;}});
4103823Ssaidi@eecs.umich.edu                0x18: PrivCheck::rdstick({{Rd = Stick}}, {{Stick<63:>}});
4113823Ssaidi@eecs.umich.edu                0x19: Priv::rdstick_cmpr({{Rd = StickCmpr;}});
4123598Sgblack@eecs.umich.edu                0x1A: Priv::rdstrand_sts_reg({{
4133598Sgblack@eecs.umich.edu                    if(Pstate<2:> && !Hpstate<2:>)
4143598Sgblack@eecs.umich.edu                        Rd = StrandStsReg<0:>;
4153598Sgblack@eecs.umich.edu                    else
4163598Sgblack@eecs.umich.edu                        Rd = StrandStsReg;
4173598Sgblack@eecs.umich.edu                }});
4183598Sgblack@eecs.umich.edu                //0x1A is supposed to be reserved, but it reads the strand
4193598Sgblack@eecs.umich.edu                //status register.
4203598Sgblack@eecs.umich.edu                //0x1B-0x1F should cause an illegal instruction exception
4212954Sgblack@eecs.umich.edu            }
4223587Sgblack@eecs.umich.edu            0x29: decode RS1 {
4233587Sgblack@eecs.umich.edu                0x00: HPriv::rdhprhpstate({{Rd = Hpstate;}});
4243587Sgblack@eecs.umich.edu                0x01: HPriv::rdhprhtstate({{
4253587Sgblack@eecs.umich.edu                    if(Tl == 0)
4263587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
4273587Sgblack@eecs.umich.edu                    Rd = Htstate;
4283587Sgblack@eecs.umich.edu                }});
4293587Sgblack@eecs.umich.edu                //0x02 should cause an illegal instruction exception
4303587Sgblack@eecs.umich.edu                0x03: HPriv::rdhprhintp({{Rd = Hintp;}});
4313587Sgblack@eecs.umich.edu                //0x04 should cause an illegal instruction exception
4323587Sgblack@eecs.umich.edu                0x05: HPriv::rdhprhtba({{Rd = Htba;}});
4333587Sgblack@eecs.umich.edu                0x06: HPriv::rdhprhver({{Rd = Hver;}});
4343587Sgblack@eecs.umich.edu                //0x07-0x1E should cause an illegal instruction exception
4353823Ssaidi@eecs.umich.edu                0x1F: HPriv::rdhprhstick_cmpr({{Rd = HstickCmpr;}});
4363587Sgblack@eecs.umich.edu            }
4373587Sgblack@eecs.umich.edu            0x2A: decode RS1 {
4383587Sgblack@eecs.umich.edu                0x00: Priv::rdprtpc({{
4393587Sgblack@eecs.umich.edu                    if(Tl == 0)
4403587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
4413587Sgblack@eecs.umich.edu                    Rd = Tpc;
4423587Sgblack@eecs.umich.edu                }});
4433587Sgblack@eecs.umich.edu                0x01: Priv::rdprtnpc({{
4443587Sgblack@eecs.umich.edu                    if(Tl == 0)
4453587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
4463587Sgblack@eecs.umich.edu                    Rd = Tnpc;
4473587Sgblack@eecs.umich.edu                }});
4483587Sgblack@eecs.umich.edu                0x02: Priv::rdprtstate({{
4493587Sgblack@eecs.umich.edu                    if(Tl == 0)
4503587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
4513587Sgblack@eecs.umich.edu                    Rd = Tstate;
4523587Sgblack@eecs.umich.edu                }});
4533587Sgblack@eecs.umich.edu                0x03: Priv::rdprtt({{
4543587Sgblack@eecs.umich.edu                    if(Tl == 0)
4553587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
4563587Sgblack@eecs.umich.edu                    Rd = Tt;
4573587Sgblack@eecs.umich.edu                }});
4583823Ssaidi@eecs.umich.edu                0x04: Priv::rdprtick({{Rd = Tick;}});
4593587Sgblack@eecs.umich.edu                0x05: Priv::rdprtba({{Rd = Tba;}});
4603587Sgblack@eecs.umich.edu                0x06: Priv::rdprpstate({{Rd = Pstate;}});
4613587Sgblack@eecs.umich.edu                0x07: Priv::rdprtl({{Rd = Tl;}});
4623587Sgblack@eecs.umich.edu                0x08: Priv::rdprpil({{Rd = Pil;}});
4633587Sgblack@eecs.umich.edu                0x09: Priv::rdprcwp({{Rd = Cwp;}});
4643587Sgblack@eecs.umich.edu                0x0A: Priv::rdprcansave({{Rd = Cansave;}});
4653587Sgblack@eecs.umich.edu                0x0B: Priv::rdprcanrestore({{Rd = Canrestore;}});
4663587Sgblack@eecs.umich.edu                0x0C: Priv::rdprcleanwin({{Rd = Cleanwin;}});
4673587Sgblack@eecs.umich.edu                0x0D: Priv::rdprotherwin({{Rd = Otherwin;}});
4683587Sgblack@eecs.umich.edu                0x0E: Priv::rdprwstate({{Rd = Wstate;}});
4693587Sgblack@eecs.umich.edu                //0x0F should cause an illegal instruction exception
4703587Sgblack@eecs.umich.edu                0x10: Priv::rdprgl({{Rd = Gl;}});
4713587Sgblack@eecs.umich.edu                //0x11-0x1F should cause an illegal instruction exception
4723587Sgblack@eecs.umich.edu            }
4732526SN/A            0x2B: BasicOperate::flushw({{
4743911Ssaidi@eecs.umich.edu                if(NWindows - 2 - Cansave != 0)
4752526SN/A                {
4762526SN/A                    if(Otherwin)
4773909Ssaidi@eecs.umich.edu                        fault = new SpillNOther(4*Wstate<5:3>);
4782526SN/A                    else
4793909Ssaidi@eecs.umich.edu                        fault = new SpillNNormal(4*Wstate<2:0>);
4802526SN/A                }
4812526SN/A            }});
4822526SN/A            0x2C: decode MOVCC3
4832469SN/A            {
4842526SN/A                0x0: Trap::movccfcc({{fault = new FpDisabled;}});
4852526SN/A                0x1: decode CC
4862526SN/A                {
4872526SN/A                    0x0: movcci({{
4882646Ssaidi@eecs.umich.edu                        if(passesCondition(Ccr<3:0>, COND4))
4892591SN/A                            Rd = Rs2_or_imm11;
4902591SN/A                        else
4912591SN/A                            Rd = Rd;
4922526SN/A                    }});
4932526SN/A                    0x2: movccx({{
4942646Ssaidi@eecs.umich.edu                        if(passesCondition(Ccr<7:4>, COND4))
4952591SN/A                            Rd = Rs2_or_imm11;
4962591SN/A                        else
4972591SN/A                            Rd = Rd;
4982526SN/A                    }});
4992224SN/A                }
5002526SN/A            }
5012526SN/A            0x2D: sdivx({{
5022615SN/A                if(Rs2_or_imm13.sdw == 0) fault = new DivisionByZero;
5032615SN/A                else Rd.sdw = Rs1.sdw / Rs2_or_imm13.sdw;
5042526SN/A            }});
5052526SN/A            0x2E: decode RS1 {
5062526SN/A                0x0: IntOp::popc({{
5072526SN/A                    int64_t count = 0;
5082526SN/A                    uint64_t temp = Rs2_or_imm13;
5092526SN/A                    //Count the 1s in the front 4bits until none are left
5102526SN/A                    uint8_t oneBits[] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4};
5112526SN/A                    while(temp)
5122469SN/A                    {
5132526SN/A                            count += oneBits[temp & 0xF];
5142526SN/A                            temp = temp >> 4;
5152516SN/A                    }
5162591SN/A                    Rd = count;
5172516SN/A                }});
5182526SN/A            }
5192526SN/A            0x2F: decode RCOND3
5202526SN/A            {
5212615SN/A                0x1: movreq({{Rd = (Rs1.sdw == 0) ? Rs2_or_imm10 : Rd;}});
5222615SN/A                0x2: movrle({{Rd = (Rs1.sdw <= 0) ? Rs2_or_imm10 : Rd;}});
5232615SN/A                0x3: movrl({{Rd = (Rs1.sdw < 0) ? Rs2_or_imm10 : Rd;}});
5242615SN/A                0x5: movrne({{Rd = (Rs1.sdw != 0) ? Rs2_or_imm10 : Rd;}});
5252615SN/A                0x6: movrg({{Rd = (Rs1.sdw > 0) ? Rs2_or_imm10 : Rd;}});
5262615SN/A                0x7: movrge({{Rd = (Rs1.sdw >= 0) ? Rs2_or_imm10 : Rd;}});
5272526SN/A            }
5283587Sgblack@eecs.umich.edu            0x30: decode RD {
5293587Sgblack@eecs.umich.edu                0x00: NoPriv::wry({{Y = Rs1 ^ Rs2_or_imm13;}});
5303587Sgblack@eecs.umich.edu                //0x01 should cause an illegal instruction exception
5313587Sgblack@eecs.umich.edu                0x02: NoPriv::wrccr({{Ccr = Rs1 ^ Rs2_or_imm13;}});
5323826Ssaidi@eecs.umich.edu                0x03: NoPriv::wrasi({{Asi = Rs1 ^ Rs2_or_imm13;}});
5333587Sgblack@eecs.umich.edu                //0x04-0x05 should cause an illegal instruction exception
5343587Sgblack@eecs.umich.edu                0x06: NoPriv::wrfprs({{Fprs = Rs1 ^ Rs2_or_imm13;}});
5353587Sgblack@eecs.umich.edu                //0x07-0x0E should cause an illegal instruction exception
5363587Sgblack@eecs.umich.edu                0x0F: Trap::softreset({{fault = new SoftwareInitiatedReset;}});
5373587Sgblack@eecs.umich.edu                0x10: Priv::wrpcr({{Pcr = Rs1 ^ Rs2_or_imm13;}});
5383587Sgblack@eecs.umich.edu                0x11: PrivCheck::wrpic({{Pic = Rs1 ^ Rs2_or_imm13;}}, {{Pcr<0:>}});
5393587Sgblack@eecs.umich.edu                //0x12 should cause an illegal instruction exception
5403587Sgblack@eecs.umich.edu                0x13: NoPriv::wrgsr({{
5413587Sgblack@eecs.umich.edu                    if(Fprs<2:> == 0 || Pstate<4:> == 0)
5423587Sgblack@eecs.umich.edu                        return new FpDisabled;
5433587Sgblack@eecs.umich.edu                    Gsr = Rs1 ^ Rs2_or_imm13;
5443587Sgblack@eecs.umich.edu                }});
5453587Sgblack@eecs.umich.edu                0x14: Priv::wrsoftint_set({{SoftintSet = Rs1 ^ Rs2_or_imm13;}});
5463587Sgblack@eecs.umich.edu                0x15: Priv::wrsoftint_clr({{SoftintClr = Rs1 ^ Rs2_or_imm13;}});
5473587Sgblack@eecs.umich.edu                0x16: Priv::wrsoftint({{Softint = Rs1 ^ Rs2_or_imm13;}});
5483823Ssaidi@eecs.umich.edu                0x17: Priv::wrtick_cmpr({{TickCmpr = Rs1 ^ Rs2_or_imm13;}});
5493587Sgblack@eecs.umich.edu                0x18: NoPriv::wrstick({{
5503587Sgblack@eecs.umich.edu                    if(!Hpstate<2:>)
5513587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
5523823Ssaidi@eecs.umich.edu                    Stick = Rs1 ^ Rs2_or_imm13;
5533587Sgblack@eecs.umich.edu                }});
5543823Ssaidi@eecs.umich.edu                0x19: Priv::wrstick_cmpr({{StickCmpr = Rs1 ^ Rs2_or_imm13;}});
5553598Sgblack@eecs.umich.edu                0x1A: Priv::wrstrand_sts_reg({{
5563598Sgblack@eecs.umich.edu                    if(Pstate<2:> && !Hpstate<2:>)
5573598Sgblack@eecs.umich.edu                        StrandStsReg = StrandStsReg<63:1> |
5583598Sgblack@eecs.umich.edu                                (Rs1 ^ Rs2_or_imm13)<0:>;
5593598Sgblack@eecs.umich.edu                    else
5603598Sgblack@eecs.umich.edu                        StrandStsReg = Rs1 ^ Rs2_or_imm13;
5613598Sgblack@eecs.umich.edu                }});
5623598Sgblack@eecs.umich.edu                //0x1A is supposed to be reserved, but it writes the strand
5633598Sgblack@eecs.umich.edu                //status register.
5643598Sgblack@eecs.umich.edu                //0x1B-0x1F should cause an illegal instruction exception
5653587Sgblack@eecs.umich.edu            }
5662526SN/A            0x31: decode FCN {
5673417Sgblack@eecs.umich.edu                0x0: Priv::saved({{
5683417Sgblack@eecs.umich.edu                    assert(Cansave < NWindows - 2);
5693417Sgblack@eecs.umich.edu                    assert(Otherwin || Canrestore);
5703417Sgblack@eecs.umich.edu                    Cansave = Cansave + 1;
5713417Sgblack@eecs.umich.edu                    if(Otherwin == 0)
5723417Sgblack@eecs.umich.edu                        Canrestore = Canrestore - 1;
5733417Sgblack@eecs.umich.edu                    else
5743417Sgblack@eecs.umich.edu                        Otherwin = Otherwin - 1;
5753417Sgblack@eecs.umich.edu                }});
5763598Sgblack@eecs.umich.edu                0x1: Priv::restored({{
5773417Sgblack@eecs.umich.edu                    assert(Cansave || Otherwin);
5783417Sgblack@eecs.umich.edu                    assert(Canrestore < NWindows - 2);
5793417Sgblack@eecs.umich.edu                    Canrestore = Canrestore + 1;
5803417Sgblack@eecs.umich.edu                    if(Otherwin == 0)
5813417Sgblack@eecs.umich.edu                        Cansave = Cansave - 1;
5823417Sgblack@eecs.umich.edu                    else
5833417Sgblack@eecs.umich.edu                        Otherwin = Otherwin - 1;
5843928Ssaidi@eecs.umich.edu
5853928Ssaidi@eecs.umich.edu                    if(Cleanwin < NWindows - 1)
5863928Ssaidi@eecs.umich.edu                        Cleanwin = Cleanwin + 1;
5873417Sgblack@eecs.umich.edu                }});
5882526SN/A            }
5893587Sgblack@eecs.umich.edu            0x32: decode RD {
5903587Sgblack@eecs.umich.edu                0x00: Priv::wrprtpc({{
5913587Sgblack@eecs.umich.edu                    if(Tl == 0)
5923587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
5933587Sgblack@eecs.umich.edu                    else
5943587Sgblack@eecs.umich.edu                        Tpc = Rs1 ^ Rs2_or_imm13;
5953587Sgblack@eecs.umich.edu                }});
5963587Sgblack@eecs.umich.edu                0x01: Priv::wrprtnpc({{
5973587Sgblack@eecs.umich.edu                    if(Tl == 0)
5983587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
5993587Sgblack@eecs.umich.edu                    else
6003587Sgblack@eecs.umich.edu                        Tnpc = Rs1 ^ Rs2_or_imm13;
6013587Sgblack@eecs.umich.edu                }});
6023587Sgblack@eecs.umich.edu                0x02: Priv::wrprtstate({{
6033587Sgblack@eecs.umich.edu                    if(Tl == 0)
6043587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
6053587Sgblack@eecs.umich.edu                    else
6063587Sgblack@eecs.umich.edu                        Tstate = Rs1 ^ Rs2_or_imm13;
6073587Sgblack@eecs.umich.edu                }});
6083587Sgblack@eecs.umich.edu                0x03: Priv::wrprtt({{
6093587Sgblack@eecs.umich.edu                    if(Tl == 0)
6103587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
6113587Sgblack@eecs.umich.edu                    else
6123587Sgblack@eecs.umich.edu                        Tt = Rs1 ^ Rs2_or_imm13;
6133587Sgblack@eecs.umich.edu                }});
6143823Ssaidi@eecs.umich.edu                0x04: HPriv::wrprtick({{Tick = Rs1 ^ Rs2_or_imm13;}});
6153587Sgblack@eecs.umich.edu                0x05: Priv::wrprtba({{Tba = Rs1 ^ Rs2_or_imm13;}});
6163587Sgblack@eecs.umich.edu                0x06: Priv::wrprpstate({{Pstate = Rs1 ^ Rs2_or_imm13;}});
6173587Sgblack@eecs.umich.edu                0x07: Priv::wrprtl({{
6183587Sgblack@eecs.umich.edu                    if(Pstate<2:> && !Hpstate<2:>)
6193587Sgblack@eecs.umich.edu                        Tl = std::min<uint64_t>(Rs1 ^ Rs2_or_imm13, MaxPTL);
6203587Sgblack@eecs.umich.edu                    else
6213587Sgblack@eecs.umich.edu                        Tl = std::min<uint64_t>(Rs1 ^ Rs2_or_imm13, MaxTL);
6223587Sgblack@eecs.umich.edu                }});
6233587Sgblack@eecs.umich.edu                0x08: Priv::wrprpil({{Pil = Rs1 ^ Rs2_or_imm13;}});
6243587Sgblack@eecs.umich.edu                0x09: Priv::wrprcwp({{Cwp = Rs1 ^ Rs2_or_imm13;}});
6253587Sgblack@eecs.umich.edu                0x0A: Priv::wrprcansave({{Cansave = Rs1 ^ Rs2_or_imm13;}});
6263587Sgblack@eecs.umich.edu                0x0B: Priv::wrprcanrestore({{Canrestore = Rs1 ^ Rs2_or_imm13;}});
6273587Sgblack@eecs.umich.edu                0x0C: Priv::wrprcleanwin({{Cleanwin = Rs1 ^ Rs2_or_imm13;}});
6283587Sgblack@eecs.umich.edu                0x0D: Priv::wrprotherwin({{Otherwin = Rs1 ^ Rs2_or_imm13;}});
6293587Sgblack@eecs.umich.edu                0x0E: Priv::wrprwstate({{Wstate = Rs1 ^ Rs2_or_imm13;}});
6303587Sgblack@eecs.umich.edu                //0x0F should cause an illegal instruction exception
6313587Sgblack@eecs.umich.edu                0x10: Priv::wrprgl({{
6323587Sgblack@eecs.umich.edu                    if(Pstate<2:> && !Hpstate<2:>)
6333587Sgblack@eecs.umich.edu                        Gl = std::min<uint64_t>(Rs1 ^ Rs2_or_imm13, MaxPGL);
6343587Sgblack@eecs.umich.edu                    else
6353587Sgblack@eecs.umich.edu                        Gl = std::min<uint64_t>(Rs1 ^ Rs2_or_imm13, MaxGL);
6363587Sgblack@eecs.umich.edu                }});
6373587Sgblack@eecs.umich.edu                //0x11-0x1F should cause an illegal instruction exception
6383587Sgblack@eecs.umich.edu            }
6393587Sgblack@eecs.umich.edu            0x33: decode RD {
6403587Sgblack@eecs.umich.edu                0x00: HPriv::wrhprhpstate({{Hpstate = Rs1 ^ Rs2_or_imm13;}});
6413587Sgblack@eecs.umich.edu                0x01: HPriv::wrhprhtstate({{
6423587Sgblack@eecs.umich.edu                    if(Tl == 0)
6433587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
6443587Sgblack@eecs.umich.edu                    Htstate = Rs1 ^ Rs2_or_imm13;
6453587Sgblack@eecs.umich.edu                }});
6463587Sgblack@eecs.umich.edu                //0x02 should cause an illegal instruction exception
6473587Sgblack@eecs.umich.edu                0x03: HPriv::wrhprhintp({{Hintp = Rs1 ^ Rs2_or_imm13;}});
6483587Sgblack@eecs.umich.edu                //0x04 should cause an illegal instruction exception
6493587Sgblack@eecs.umich.edu                0x05: HPriv::wrhprhtba({{Htba = Rs1 ^ Rs2_or_imm13;}});
6503587Sgblack@eecs.umich.edu                //0x06-0x01D should cause an illegal instruction exception
6513823Ssaidi@eecs.umich.edu                0x1F: HPriv::wrhprhstick_cmpr({{HstickCmpr = Rs1 ^ Rs2_or_imm13;}});
6523587Sgblack@eecs.umich.edu            }
6532954Sgblack@eecs.umich.edu            0x34: decode OPF{
6542963Sgblack@eecs.umich.edu                format BasicOperate{
6552963Sgblack@eecs.umich.edu                    0x01: fmovs({{
6563279Sgblack@eecs.umich.edu                        Frds.uw = Frs2s.uw;
6572963Sgblack@eecs.umich.edu                        //fsr.ftt = fsr.cexc = 0
6582963Sgblack@eecs.umich.edu                        Fsr &= ~(7 << 14);
6592963Sgblack@eecs.umich.edu                        Fsr &= ~(0x1F);
6602963Sgblack@eecs.umich.edu                    }});
6612963Sgblack@eecs.umich.edu                    0x02: fmovd({{
6623057Sgblack@eecs.umich.edu                        Frd.udw = Frs2.udw;
6632963Sgblack@eecs.umich.edu                        //fsr.ftt = fsr.cexc = 0
6642963Sgblack@eecs.umich.edu                        Fsr &= ~(7 << 14);
6652963Sgblack@eecs.umich.edu                        Fsr &= ~(0x1F);
6662963Sgblack@eecs.umich.edu                    }});
6672963Sgblack@eecs.umich.edu                    0x03: Trap::fmovq({{fault = new FpDisabled;}});
6682963Sgblack@eecs.umich.edu                    0x05: fnegs({{
6693279Sgblack@eecs.umich.edu                        Frds.uw = Frs2s.uw ^ (1UL << 31);
6702963Sgblack@eecs.umich.edu                        //fsr.ftt = fsr.cexc = 0
6712963Sgblack@eecs.umich.edu                        Fsr &= ~(7 << 14);
6722963Sgblack@eecs.umich.edu                        Fsr &= ~(0x1F);
6732963Sgblack@eecs.umich.edu                    }});
6742963Sgblack@eecs.umich.edu                    0x06: fnegd({{
6753057Sgblack@eecs.umich.edu                        Frd.udw = Frs2.udw ^ (1ULL << 63);
6762963Sgblack@eecs.umich.edu                        //fsr.ftt = fsr.cexc = 0
6772963Sgblack@eecs.umich.edu                        Fsr &= ~(7 << 14);
6782963Sgblack@eecs.umich.edu                        Fsr &= ~(0x1F);
6792963Sgblack@eecs.umich.edu                    }});
6802963Sgblack@eecs.umich.edu                    0x07: Trap::fnegq({{fault = new FpDisabled;}});
6812963Sgblack@eecs.umich.edu                    0x09: fabss({{
6823279Sgblack@eecs.umich.edu                        Frds.uw = ((1UL << 31) - 1) & Frs2s.uw;
6832963Sgblack@eecs.umich.edu                        //fsr.ftt = fsr.cexc = 0
6842963Sgblack@eecs.umich.edu                        Fsr &= ~(7 << 14);
6852963Sgblack@eecs.umich.edu                        Fsr &= ~(0x1F);
6862963Sgblack@eecs.umich.edu                    }});
6872963Sgblack@eecs.umich.edu                    0x0A: fabsd({{
6883057Sgblack@eecs.umich.edu                        Frd.udw = ((1ULL << 63) - 1) & Frs2.udw;
6892963Sgblack@eecs.umich.edu                        //fsr.ftt = fsr.cexc = 0
6902963Sgblack@eecs.umich.edu                        Fsr &= ~(7 << 14);
6912963Sgblack@eecs.umich.edu                        Fsr &= ~(0x1F);
6922963Sgblack@eecs.umich.edu                    }});
6932963Sgblack@eecs.umich.edu                    0x0B: Trap::fabsq({{fault = new FpDisabled;}});
6943279Sgblack@eecs.umich.edu                    0x29: fsqrts({{Frds.sf = sqrt(Frs2s.sf);}});
6952963Sgblack@eecs.umich.edu                    0x2A: fsqrtd({{Frd.df = sqrt(Frs2.df);}});
6962963Sgblack@eecs.umich.edu                    0x2B: Trap::fsqrtq({{fault = new FpDisabled;}});
6973279Sgblack@eecs.umich.edu                    0x41: fadds({{Frds.sf = Frs1s.sf + Frs2s.sf;}});
6982963Sgblack@eecs.umich.edu                    0x42: faddd({{Frd.df = Frs1.df + Frs2.df;}});
6992963Sgblack@eecs.umich.edu                    0x43: Trap::faddq({{fault = new FpDisabled;}});
7003279Sgblack@eecs.umich.edu                    0x45: fsubs({{Frds.sf = Frs1s.sf - Frs2s.sf;}});
7012963Sgblack@eecs.umich.edu                    0x46: fsubd({{Frd.df = Frs1.df - Frs2.df;}});
7022963Sgblack@eecs.umich.edu                    0x47: Trap::fsubq({{fault = new FpDisabled;}});
7033279Sgblack@eecs.umich.edu                    0x49: fmuls({{Frds.sf = Frs1s.sf * Frs2s.sf;}});
7042963Sgblack@eecs.umich.edu                    0x4A: fmuld({{Frd.df = Frs1.df * Frs2.df;}});
7052963Sgblack@eecs.umich.edu                    0x4B: Trap::fmulq({{fault = new FpDisabled;}});
7063279Sgblack@eecs.umich.edu                    0x4D: fdivs({{Frds.sf = Frs1s.sf / Frs2s.sf;}});
7072963Sgblack@eecs.umich.edu                    0x4E: fdivd({{Frd.df = Frs1.df / Frs2.df;}});
7082963Sgblack@eecs.umich.edu                    0x4F: Trap::fdivq({{fault = new FpDisabled;}});
7093279Sgblack@eecs.umich.edu                    0x69: fsmuld({{Frd.df = Frs1s.sf * Frs2s.sf;}});
7102963Sgblack@eecs.umich.edu                    0x6E: Trap::fdmulq({{fault = new FpDisabled;}});
7112963Sgblack@eecs.umich.edu                    0x81: fstox({{
7123279Sgblack@eecs.umich.edu                            Frd.df = (double)static_cast<int64_t>(Frs2s.sf);
7132963Sgblack@eecs.umich.edu                    }});
7142963Sgblack@eecs.umich.edu                    0x82: fdtox({{
7152963Sgblack@eecs.umich.edu                            Frd.df = (double)static_cast<int64_t>(Frs2.df);
7162963Sgblack@eecs.umich.edu                    }});
7172963Sgblack@eecs.umich.edu                    0x83: Trap::fqtox({{fault = new FpDisabled;}});
7182963Sgblack@eecs.umich.edu                    0x84: fxtos({{
7193279Sgblack@eecs.umich.edu                            Frds.sf = static_cast<float>((int64_t)Frs2.df);
7202963Sgblack@eecs.umich.edu                    }});
7212963Sgblack@eecs.umich.edu                    0x88: fxtod({{
7222963Sgblack@eecs.umich.edu                            Frd.df = static_cast<double>((int64_t)Frs2.df);
7232963Sgblack@eecs.umich.edu                    }});
7242963Sgblack@eecs.umich.edu                    0x8C: Trap::fxtoq({{fault = new FpDisabled;}});
7252963Sgblack@eecs.umich.edu                    0xC4: fitos({{
7263279Sgblack@eecs.umich.edu                            Frds.sf = static_cast<float>((int32_t)Frs2s.sf);
7272963Sgblack@eecs.umich.edu                    }});
7283279Sgblack@eecs.umich.edu                    0xC6: fdtos({{Frds.sf = Frs2.df;}});
7292963Sgblack@eecs.umich.edu                    0xC7: Trap::fqtos({{fault = new FpDisabled;}});
7302963Sgblack@eecs.umich.edu                    0xC8: fitod({{
7313279Sgblack@eecs.umich.edu                            Frd.df = static_cast<double>((int32_t)Frs2s.sf);
7322963Sgblack@eecs.umich.edu                    }});
7333279Sgblack@eecs.umich.edu                    0xC9: fstod({{Frd.df = Frs2s.sf;}});
7342963Sgblack@eecs.umich.edu                    0xCB: Trap::fqtod({{fault = new FpDisabled;}});
7352963Sgblack@eecs.umich.edu                    0xCC: Trap::fitoq({{fault = new FpDisabled;}});
7362963Sgblack@eecs.umich.edu                    0xCD: Trap::fstoq({{fault = new FpDisabled;}});
7372963Sgblack@eecs.umich.edu                    0xCE: Trap::fdtoq({{fault = new FpDisabled;}});
7382963Sgblack@eecs.umich.edu                    0xD1: fstoi({{
7393279Sgblack@eecs.umich.edu                            Frds.sf = (float)static_cast<int32_t>(Frs2s.sf);
7402963Sgblack@eecs.umich.edu                    }});
7412963Sgblack@eecs.umich.edu                    0xD2: fdtoi({{
7423279Sgblack@eecs.umich.edu                            Frds.sf = (float)static_cast<int32_t>(Frs2.df);
7432963Sgblack@eecs.umich.edu                    }});
7442963Sgblack@eecs.umich.edu                    0xD3: Trap::fqtoi({{fault = new FpDisabled;}});
7452963Sgblack@eecs.umich.edu                    default: Trap::fpop1({{fault = new FpDisabled;}});
7462963Sgblack@eecs.umich.edu                }
7472954Sgblack@eecs.umich.edu            }
7482526SN/A            0x35: Trap::fpop2({{fault = new FpDisabled;}});
7492954Sgblack@eecs.umich.edu            //This used to be just impdep1, but now it's a whole bunch
7502954Sgblack@eecs.umich.edu            //of instructions
7512954Sgblack@eecs.umich.edu            0x36: decode OPF{
7522954Sgblack@eecs.umich.edu                0x00: Trap::edge8({{fault = new IllegalInstruction;}});
7532954Sgblack@eecs.umich.edu                0x01: Trap::edge8n({{fault = new IllegalInstruction;}});
7542954Sgblack@eecs.umich.edu                0x02: Trap::edge8l({{fault = new IllegalInstruction;}});
7552954Sgblack@eecs.umich.edu                0x03: Trap::edge8ln({{fault = new IllegalInstruction;}});
7562954Sgblack@eecs.umich.edu                0x04: Trap::edge16({{fault = new IllegalInstruction;}});
7572954Sgblack@eecs.umich.edu                0x05: Trap::edge16n({{fault = new IllegalInstruction;}});
7582954Sgblack@eecs.umich.edu                0x06: Trap::edge16l({{fault = new IllegalInstruction;}});
7592954Sgblack@eecs.umich.edu                0x07: Trap::edge16ln({{fault = new IllegalInstruction;}});
7602954Sgblack@eecs.umich.edu                0x08: Trap::edge32({{fault = new IllegalInstruction;}});
7612954Sgblack@eecs.umich.edu                0x09: Trap::edge32n({{fault = new IllegalInstruction;}});
7622954Sgblack@eecs.umich.edu                0x0A: Trap::edge32l({{fault = new IllegalInstruction;}});
7632954Sgblack@eecs.umich.edu                0x0B: Trap::edge32ln({{fault = new IllegalInstruction;}});
7642954Sgblack@eecs.umich.edu                0x10: Trap::array8({{fault = new IllegalInstruction;}});
7652954Sgblack@eecs.umich.edu                0x12: Trap::array16({{fault = new IllegalInstruction;}});
7662954Sgblack@eecs.umich.edu                0x14: Trap::array32({{fault = new IllegalInstruction;}});
7673042Sgblack@eecs.umich.edu                0x18: BasicOperate::alignaddr({{
7682963Sgblack@eecs.umich.edu                    uint64_t sum = Rs1 + Rs2;
7693042Sgblack@eecs.umich.edu                    Rd = sum & ~7;
7702963Sgblack@eecs.umich.edu                    Gsr = (Gsr & ~7) | (sum & 7);
7712963Sgblack@eecs.umich.edu                }});
7722954Sgblack@eecs.umich.edu                0x19: Trap::bmask({{fault = new IllegalInstruction;}});
7732963Sgblack@eecs.umich.edu                0x1A: BasicOperate::alignaddresslittle({{
7742963Sgblack@eecs.umich.edu                    uint64_t sum = Rs1 + Rs2;
7753042Sgblack@eecs.umich.edu                    Rd = sum & ~7;
7762963Sgblack@eecs.umich.edu                    Gsr = (Gsr & ~7) | ((~sum + 1) & 7);
7772963Sgblack@eecs.umich.edu                }});
7782954Sgblack@eecs.umich.edu                0x20: Trap::fcmple16({{fault = new IllegalInstruction;}});
7792954Sgblack@eecs.umich.edu                0x22: Trap::fcmpne16({{fault = new IllegalInstruction;}});
7802954Sgblack@eecs.umich.edu                0x24: Trap::fcmple32({{fault = new IllegalInstruction;}});
7812954Sgblack@eecs.umich.edu                0x26: Trap::fcmpne32({{fault = new IllegalInstruction;}});
7822954Sgblack@eecs.umich.edu                0x28: Trap::fcmpgt16({{fault = new IllegalInstruction;}});
7832954Sgblack@eecs.umich.edu                0x2A: Trap::fcmpeq16({{fault = new IllegalInstruction;}});
7842954Sgblack@eecs.umich.edu                0x2C: Trap::fcmpgt32({{fault = new IllegalInstruction;}});
7852954Sgblack@eecs.umich.edu                0x2E: Trap::fcmpeq32({{fault = new IllegalInstruction;}});
7862954Sgblack@eecs.umich.edu                0x31: Trap::fmul8x16({{fault = new IllegalInstruction;}});
7872954Sgblack@eecs.umich.edu                0x33: Trap::fmul8x16au({{fault = new IllegalInstruction;}});
7882954Sgblack@eecs.umich.edu                0x35: Trap::fmul8x16al({{fault = new IllegalInstruction;}});
7892954Sgblack@eecs.umich.edu                0x36: Trap::fmul8sux16({{fault = new IllegalInstruction;}});
7902954Sgblack@eecs.umich.edu                0x37: Trap::fmul8ulx16({{fault = new IllegalInstruction;}});
7912954Sgblack@eecs.umich.edu                0x38: Trap::fmuld8sux16({{fault = new IllegalInstruction;}});
7922954Sgblack@eecs.umich.edu                0x39: Trap::fmuld8ulx16({{fault = new IllegalInstruction;}});
7932954Sgblack@eecs.umich.edu                0x3A: Trap::fpack32({{fault = new IllegalInstruction;}});
7942954Sgblack@eecs.umich.edu                0x3B: Trap::fpack16({{fault = new IllegalInstruction;}});
7952954Sgblack@eecs.umich.edu                0x3D: Trap::fpackfix({{fault = new IllegalInstruction;}});
7962954Sgblack@eecs.umich.edu                0x3E: Trap::pdist({{fault = new IllegalInstruction;}});
7972963Sgblack@eecs.umich.edu                0x48: BasicOperate::faligndata({{
7983057Sgblack@eecs.umich.edu                        uint64_t msbX = Frs1.udw;
7993057Sgblack@eecs.umich.edu                        uint64_t lsbX = Frs2.udw;
8003057Sgblack@eecs.umich.edu                        //Some special cases need to be split out, first
8013057Sgblack@eecs.umich.edu                        //because they're the most likely to be used, and
8023057Sgblack@eecs.umich.edu                        //second because otherwise, we end up shifting by
8033057Sgblack@eecs.umich.edu                        //greater than the width of the type being shifted,
8043057Sgblack@eecs.umich.edu                        //namely 64, which produces undefined results according
8053057Sgblack@eecs.umich.edu                        //to the C standard.
8063057Sgblack@eecs.umich.edu                        switch(Gsr<2:0>)
8073057Sgblack@eecs.umich.edu                        {
8083057Sgblack@eecs.umich.edu                            case 0:
8093057Sgblack@eecs.umich.edu                                Frd.udw = msbX;
8103057Sgblack@eecs.umich.edu                                break;
8113057Sgblack@eecs.umich.edu                            case 8:
8123057Sgblack@eecs.umich.edu                                Frd.udw = lsbX;
8133057Sgblack@eecs.umich.edu                                break;
8143057Sgblack@eecs.umich.edu                            default:
8153057Sgblack@eecs.umich.edu                                uint64_t msbShift = Gsr<2:0> * 8;
8163057Sgblack@eecs.umich.edu                                uint64_t lsbShift = (8 - Gsr<2:0>) * 8;
8173057Sgblack@eecs.umich.edu                                uint64_t msbMask = ((uint64_t)(-1)) >> msbShift;
8183057Sgblack@eecs.umich.edu                                uint64_t lsbMask = ((uint64_t)(-1)) << lsbShift;
8193057Sgblack@eecs.umich.edu                                Frd.udw = ((msbX & msbMask) << msbShift) |
8203057Sgblack@eecs.umich.edu                                        ((lsbX & lsbMask) >> lsbShift);
8213057Sgblack@eecs.umich.edu                        }
8222963Sgblack@eecs.umich.edu                }});
8232954Sgblack@eecs.umich.edu                0x4B: Trap::fpmerge({{fault = new IllegalInstruction;}});
8242954Sgblack@eecs.umich.edu                0x4C: Trap::bshuffle({{fault = new IllegalInstruction;}});
8252954Sgblack@eecs.umich.edu                0x4D: Trap::fexpand({{fault = new IllegalInstruction;}});
8262954Sgblack@eecs.umich.edu                0x50: Trap::fpadd16({{fault = new IllegalInstruction;}});
8272954Sgblack@eecs.umich.edu                0x51: Trap::fpadd16s({{fault = new IllegalInstruction;}});
8282954Sgblack@eecs.umich.edu                0x52: Trap::fpadd32({{fault = new IllegalInstruction;}});
8292954Sgblack@eecs.umich.edu                0x53: Trap::fpadd32s({{fault = new IllegalInstruction;}});
8302954Sgblack@eecs.umich.edu                0x54: Trap::fpsub16({{fault = new IllegalInstruction;}});
8312954Sgblack@eecs.umich.edu                0x55: Trap::fpsub16s({{fault = new IllegalInstruction;}});
8322954Sgblack@eecs.umich.edu                0x56: Trap::fpsub32({{fault = new IllegalInstruction;}});
8332954Sgblack@eecs.umich.edu                0x57: Trap::fpsub32s({{fault = new IllegalInstruction;}});
8342963Sgblack@eecs.umich.edu                0x60: BasicOperate::fzero({{Frd.df = 0;}});
8353279Sgblack@eecs.umich.edu                0x61: BasicOperate::fzeros({{Frds.sf = 0;}});
8362954Sgblack@eecs.umich.edu                0x62: Trap::fnor({{fault = new IllegalInstruction;}});
8372954Sgblack@eecs.umich.edu                0x63: Trap::fnors({{fault = new IllegalInstruction;}});
8382954Sgblack@eecs.umich.edu                0x64: Trap::fandnot2({{fault = new IllegalInstruction;}});
8392954Sgblack@eecs.umich.edu                0x65: Trap::fandnot2s({{fault = new IllegalInstruction;}});
8402963Sgblack@eecs.umich.edu                0x66: BasicOperate::fnot2({{
8412963Sgblack@eecs.umich.edu                        Frd.df = (double)(~((uint64_t)Frs2.df));
8422963Sgblack@eecs.umich.edu                }});
8432963Sgblack@eecs.umich.edu                0x67: BasicOperate::fnot2s({{
8443279Sgblack@eecs.umich.edu                        Frds.sf = (float)(~((uint32_t)Frs2s.sf));
8452963Sgblack@eecs.umich.edu                }});
8462954Sgblack@eecs.umich.edu                0x68: Trap::fandnot1({{fault = new IllegalInstruction;}});
8472954Sgblack@eecs.umich.edu                0x69: Trap::fandnot1s({{fault = new IllegalInstruction;}});
8482963Sgblack@eecs.umich.edu                0x6A: BasicOperate::fnot1({{
8492963Sgblack@eecs.umich.edu                        Frd.df = (double)(~((uint64_t)Frs1.df));
8502963Sgblack@eecs.umich.edu                }});
8512963Sgblack@eecs.umich.edu                0x6B: BasicOperate::fnot1s({{
8523279Sgblack@eecs.umich.edu                        Frds.sf = (float)(~((uint32_t)Frs1s.sf));
8532963Sgblack@eecs.umich.edu                }});
8542954Sgblack@eecs.umich.edu                0x6C: Trap::fxor({{fault = new IllegalInstruction;}});
8552954Sgblack@eecs.umich.edu                0x6D: Trap::fxors({{fault = new IllegalInstruction;}});
8562954Sgblack@eecs.umich.edu                0x6E: Trap::fnand({{fault = new IllegalInstruction;}});
8572954Sgblack@eecs.umich.edu                0x6F: Trap::fnands({{fault = new IllegalInstruction;}});
8582954Sgblack@eecs.umich.edu                0x70: Trap::fand({{fault = new IllegalInstruction;}});
8592954Sgblack@eecs.umich.edu                0x71: Trap::fands({{fault = new IllegalInstruction;}});
8602954Sgblack@eecs.umich.edu                0x72: Trap::fxnor({{fault = new IllegalInstruction;}});
8612954Sgblack@eecs.umich.edu                0x73: Trap::fxnors({{fault = new IllegalInstruction;}});
8623057Sgblack@eecs.umich.edu                0x74: BasicOperate::fsrc1({{Frd.udw = Frs1.udw;}});
8633057Sgblack@eecs.umich.edu                0x75: BasicOperate::fsrc1s({{Frd.uw = Frs1.uw;}});
8642954Sgblack@eecs.umich.edu                0x76: Trap::fornot2({{fault = new IllegalInstruction;}});
8652954Sgblack@eecs.umich.edu                0x77: Trap::fornot2s({{fault = new IllegalInstruction;}});
8663057Sgblack@eecs.umich.edu                0x78: BasicOperate::fsrc2({{Frd.udw = Frs2.udw;}});
8673057Sgblack@eecs.umich.edu                0x79: BasicOperate::fsrc2s({{Frd.uw = Frs2.uw;}});
8682954Sgblack@eecs.umich.edu                0x7A: Trap::fornot1({{fault = new IllegalInstruction;}});
8692954Sgblack@eecs.umich.edu                0x7B: Trap::fornot1s({{fault = new IllegalInstruction;}});
8702954Sgblack@eecs.umich.edu                0x7C: Trap::for({{fault = new IllegalInstruction;}});
8712954Sgblack@eecs.umich.edu                0x7D: Trap::fors({{fault = new IllegalInstruction;}});
8722954Sgblack@eecs.umich.edu                0x7E: Trap::fone({{fault = new IllegalInstruction;}});
8732954Sgblack@eecs.umich.edu                0x7F: Trap::fones({{fault = new IllegalInstruction;}});
8742954Sgblack@eecs.umich.edu                0x80: Trap::shutdown({{fault = new IllegalInstruction;}});
8752954Sgblack@eecs.umich.edu                0x81: Trap::siam({{fault = new IllegalInstruction;}});
8762954Sgblack@eecs.umich.edu            }
8772954Sgblack@eecs.umich.edu            0x37: Trap::impdep2({{fault = new IllegalInstruction;}});
8782526SN/A            0x38: Branch::jmpl({{
8792526SN/A                Addr target = Rs1 + Rs2_or_imm13;
8802526SN/A                if(target & 0x3)
8812526SN/A                    fault = new MemAddressNotAligned;
8822526SN/A                else
8832526SN/A                {
8843928Ssaidi@eecs.umich.edu                    if (Pstate<3:>)
8853928Ssaidi@eecs.umich.edu                        (Rd = xc->readPC())<31:0>;
8863928Ssaidi@eecs.umich.edu                    else
8873928Ssaidi@eecs.umich.edu                        Rd = xc->readPC();
8882526SN/A                    NNPC = target;
8892526SN/A                }
8902526SN/A            }});
8912526SN/A            0x39: Branch::return({{
8922561SN/A                //If both MemAddressNotAligned and
8932561SN/A                //a fill trap happen, it's not clear
8942561SN/A                //which one should be returned.
8952526SN/A                Addr target = Rs1 + Rs2_or_imm13;
8962526SN/A                if(target & 0x3)
8972526SN/A                    fault = new MemAddressNotAligned;
8982526SN/A                else
8992526SN/A                    NNPC = target;
9002561SN/A                if(fault == NoFault)
9012561SN/A                {
9022561SN/A                    if(Canrestore == 0)
9032561SN/A                    {
9042561SN/A                        if(Otherwin)
9053909Ssaidi@eecs.umich.edu                            fault = new FillNOther(4*Wstate<5:3>);
9062561SN/A                        else
9073909Ssaidi@eecs.umich.edu                            fault = new FillNNormal(4*Wstate<2:0>);
9082561SN/A                    }
9092561SN/A                    else
9102561SN/A                    {
9113417Sgblack@eecs.umich.edu                        //CWP should be set directly so that it always happens
9123417Sgblack@eecs.umich.edu                        //Also, this will allow writing to the new window and
9133417Sgblack@eecs.umich.edu                        //reading from the old one
9143417Sgblack@eecs.umich.edu                        Cwp = (Cwp - 1 + NWindows) % NWindows;
9152561SN/A                        Cansave = Cansave + 1;
9162561SN/A                        Canrestore = Canrestore - 1;
9173417Sgblack@eecs.umich.edu                        //This is here to make sure the CWP is written
9183417Sgblack@eecs.umich.edu                        //no matter what. This ensures that the results
9193417Sgblack@eecs.umich.edu                        //are written in the new window as well.
9203417Sgblack@eecs.umich.edu                        xc->setMiscRegWithEffect(MISCREG_CWP, Cwp);
9212561SN/A                    }
9222561SN/A                }
9232526SN/A            }});
9242526SN/A            0x3A: decode CC
9252526SN/A            {
9262526SN/A                0x0: Trap::tcci({{
9272646Ssaidi@eecs.umich.edu                    if(passesCondition(Ccr<3:0>, COND2))
9282561SN/A                    {
9293039Sstever@eecs.umich.edu#if FULL_SYSTEM
9302561SN/A                        int lTrapNum = I ? (Rs1 + SW_TRAP) : (Rs1 + Rs2);
9312561SN/A                        DPRINTF(Sparc, "The trap number is %d\n", lTrapNum);
9323531Sgblack@eecs.umich.edu                        fault = new TrapInstruction(lTrapNum);
9332526SN/A#else
9342561SN/A                        DPRINTF(Sparc, "The syscall number is %d\n", R1);
9352561SN/A                        xc->syscall(R1);
9362561SN/A#endif
9372561SN/A                    }
9382526SN/A                }});
9392526SN/A                0x2: Trap::tccx({{
9402646Ssaidi@eecs.umich.edu                    if(passesCondition(Ccr<7:4>, COND2))
9412561SN/A                    {
9423039Sstever@eecs.umich.edu#if FULL_SYSTEM
9432561SN/A                        int lTrapNum = I ? (Rs1 + SW_TRAP) : (Rs1 + Rs2);
9442561SN/A                        DPRINTF(Sparc, "The trap number is %d\n", lTrapNum);
9453531Sgblack@eecs.umich.edu                        fault = new TrapInstruction(lTrapNum);
9462526SN/A#else
9472561SN/A                        DPRINTF(Sparc, "The syscall number is %d\n", R1);
9482561SN/A                        xc->syscall(R1);
9492561SN/A#endif
9502526SN/A                    }
9512526SN/A                }});
9522526SN/A            }
9532526SN/A            0x3B: Nop::flush({{/*Instruction memory flush*/}});
9542526SN/A            0x3C: save({{
9552526SN/A                //CWP should be set directly so that it always happens
9562526SN/A                //Also, this will allow writing to the new window and
9572526SN/A                //reading from the old one
9582526SN/A                if(Cansave == 0)
9592526SN/A                {
9602526SN/A                    if(Otherwin)
9613909Ssaidi@eecs.umich.edu                        fault = new SpillNOther(4*Wstate<5:3>);
9622526SN/A                    else
9633909Ssaidi@eecs.umich.edu                        fault = new SpillNNormal(4*Wstate<2:0>);
9643417Sgblack@eecs.umich.edu                    //Cwp = (Cwp + 2) % NWindows;
9652526SN/A                }
9662526SN/A                else if(Cleanwin - Canrestore == 0)
9672526SN/A                {
9683417Sgblack@eecs.umich.edu                    //Cwp = (Cwp + 1) % NWindows;
9692526SN/A                    fault = new CleanWindow;
9702526SN/A                }
9712526SN/A                else
9722526SN/A                {
9732526SN/A                    Cwp = (Cwp + 1) % NWindows;
9742526SN/A                    Rd = Rs1 + Rs2_or_imm13;
9752561SN/A                    Cansave = Cansave - 1;
9762561SN/A                    Canrestore = Canrestore + 1;
9773417Sgblack@eecs.umich.edu                    //This is here to make sure the CWP is written
9783417Sgblack@eecs.umich.edu                    //no matter what. This ensures that the results
9793417Sgblack@eecs.umich.edu                    //are written in the new window as well.
9803417Sgblack@eecs.umich.edu                    xc->setMiscRegWithEffect(MISCREG_CWP, Cwp);
9812526SN/A                }
9822526SN/A            }});
9832526SN/A            0x3D: restore({{
9842526SN/A                if(Canrestore == 0)
9852526SN/A                {
9862526SN/A                    if(Otherwin)
9873909Ssaidi@eecs.umich.edu                        fault = new FillNOther(4*Wstate<5:3>);
9882526SN/A                    else
9893909Ssaidi@eecs.umich.edu                        fault = new FillNNormal(4*Wstate<2:0>);
9902526SN/A                }
9912526SN/A                else
9922526SN/A                {
9933417Sgblack@eecs.umich.edu                    //CWP should be set directly so that it always happens
9943417Sgblack@eecs.umich.edu                    //Also, this will allow writing to the new window and
9953417Sgblack@eecs.umich.edu                    //reading from the old one
9963417Sgblack@eecs.umich.edu                    Cwp = (Cwp - 1 + NWindows) % NWindows;
9972526SN/A                    Rd = Rs1 + Rs2_or_imm13;
9982561SN/A                    Cansave = Cansave + 1;
9992561SN/A                    Canrestore = Canrestore - 1;
10003417Sgblack@eecs.umich.edu                    //This is here to make sure the CWP is written
10013417Sgblack@eecs.umich.edu                    //no matter what. This ensures that the results
10023417Sgblack@eecs.umich.edu                    //are written in the new window as well.
10033417Sgblack@eecs.umich.edu                    xc->setMiscRegWithEffect(MISCREG_CWP, Cwp);
10042526SN/A                }
10052526SN/A            }});
10062526SN/A            0x3E: decode FCN {
10072526SN/A                0x0: Priv::done({{
10082526SN/A                    if(Tl == 0)
10092526SN/A                        return new IllegalInstruction;
10102646Ssaidi@eecs.umich.edu
10112646Ssaidi@eecs.umich.edu                    Cwp = Tstate<4:0>;
10122646Ssaidi@eecs.umich.edu                    Pstate = Tstate<20:8>;
10132646Ssaidi@eecs.umich.edu                    Asi = Tstate<31:24>;
10142646Ssaidi@eecs.umich.edu                    Ccr = Tstate<39:32>;
10152646Ssaidi@eecs.umich.edu                    Gl = Tstate<42:40>;
10163825Ssaidi@eecs.umich.edu                    Hpstate = Htstate;
10172646Ssaidi@eecs.umich.edu                    NPC = Tnpc;
10182646Ssaidi@eecs.umich.edu                    NNPC = Tnpc + 4;
10192526SN/A                    Tl = Tl - 1;
10202526SN/A                }});
10212938Sgblack@eecs.umich.edu                0x1: Priv::retry({{
10222526SN/A                    if(Tl == 0)
10232526SN/A                        return new IllegalInstruction;
10242646Ssaidi@eecs.umich.edu                    Cwp = Tstate<4:0>;
10252646Ssaidi@eecs.umich.edu                    Pstate = Tstate<20:8>;
10262646Ssaidi@eecs.umich.edu                    Asi = Tstate<31:24>;
10272646Ssaidi@eecs.umich.edu                    Ccr = Tstate<39:32>;
10282646Ssaidi@eecs.umich.edu                    Gl = Tstate<42:40>;
10293826Ssaidi@eecs.umich.edu                    Hpstate = Htstate;
10302646Ssaidi@eecs.umich.edu                    NPC = Tpc;
10313417Sgblack@eecs.umich.edu                    NNPC = Tnpc;
10322526SN/A                    Tl = Tl - 1;
10332526SN/A                }});
10342526SN/A            }
10352526SN/A        }
10362469SN/A    }
10372469SN/A    0x3: decode OP3 {
10382526SN/A        format Load {
10393272Sgblack@eecs.umich.edu            0x00: lduw({{Rd = Mem.uw;}});
10403272Sgblack@eecs.umich.edu            0x01: ldub({{Rd = Mem.ub;}});
10413272Sgblack@eecs.umich.edu            0x02: lduh({{Rd = Mem.uhw;}});
10423835Sgblack@eecs.umich.edu            0x03: ldtw({{
10433272Sgblack@eecs.umich.edu                uint64_t val = Mem.udw;
10442526SN/A                RdLow = val<31:0>;
10452526SN/A                RdHigh = val<63:32>;
10463272Sgblack@eecs.umich.edu            }});
10472526SN/A        }
10482526SN/A        format Store {
10493272Sgblack@eecs.umich.edu            0x04: stw({{Mem.uw = Rd.sw;}});
10503272Sgblack@eecs.umich.edu            0x05: stb({{Mem.ub = Rd.sb;}});
10513272Sgblack@eecs.umich.edu            0x06: sth({{Mem.uhw = Rd.shw;}});
10523835Sgblack@eecs.umich.edu            0x07: sttw({{Mem.udw = RdLow<31:0> | (RdHigh<31:0> << 32);}});
10532526SN/A        }
10542526SN/A        format Load {
10553272Sgblack@eecs.umich.edu            0x08: ldsw({{Rd = (int32_t)Mem.sw;}});
10563272Sgblack@eecs.umich.edu            0x09: ldsb({{Rd = (int8_t)Mem.sb;}});
10573272Sgblack@eecs.umich.edu            0x0A: ldsh({{Rd = (int16_t)Mem.shw;}});
10583272Sgblack@eecs.umich.edu            0x0B: ldx({{Rd = (int64_t)Mem.sdw;}});
10592526SN/A        }
10603438Sgblack@eecs.umich.edu        0x0D: LoadStore::ldstub(
10613438Sgblack@eecs.umich.edu        {{Rd = Mem.ub;}},
10623438Sgblack@eecs.umich.edu        {{Mem.ub = 0xFF;}});
10633272Sgblack@eecs.umich.edu        0x0E: Store::stx({{Mem.udw = Rd}});
10643388Sgblack@eecs.umich.edu        0x0F: LoadStore::swap(
10653438Sgblack@eecs.umich.edu            {{uReg0 = Rd.uw;
10663388Sgblack@eecs.umich.edu            Rd.uw = Mem.uw;}},
10673438Sgblack@eecs.umich.edu            {{Mem.uw = uReg0;}});
10683810Sgblack@eecs.umich.edu        format LoadAlt {
10693810Sgblack@eecs.umich.edu            0x10: lduwa({{Rd = Mem.uw;}}, {{EXT_ASI}});
10703810Sgblack@eecs.umich.edu            0x11: lduba({{Rd = Mem.ub;}}, {{EXT_ASI}});
10713810Sgblack@eecs.umich.edu            0x12: lduha({{Rd = Mem.uhw;}}, {{EXT_ASI}});
10723856Ssaidi@eecs.umich.edu            0x13: decode EXT_ASI {
10733926Ssaidi@eecs.umich.edu                //ASI_LDTD_AIUP
10743926Ssaidi@eecs.umich.edu                0x22: TwinLoad::ldtx_aiup(
10753926Ssaidi@eecs.umich.edu                    {{RdTwin.udw = Mem.udw}}, {{EXT_ASI}});
10763926Ssaidi@eecs.umich.edu                //ASI_LDTD_AIUS
10773926Ssaidi@eecs.umich.edu                0x23: TwinLoad::ldtx_aius(
10783926Ssaidi@eecs.umich.edu                    {{RdTwin.udw = Mem.udw}}, {{EXT_ASI}});
10793856Ssaidi@eecs.umich.edu                //ASI_QUAD_LDD
10803856Ssaidi@eecs.umich.edu                0x24: TwinLoad::ldtx_quad_ldd(
10813856Ssaidi@eecs.umich.edu                    {{RdTwin.udw = Mem.udw}}, {{EXT_ASI}});
10823856Ssaidi@eecs.umich.edu                //ASI_LDTX_REAL
10833856Ssaidi@eecs.umich.edu                0x26: TwinLoad::ldtx_real(
10843856Ssaidi@eecs.umich.edu                    {{RdTwin.udw = Mem.udw}}, {{EXT_ASI}});
10853856Ssaidi@eecs.umich.edu               //ASI_LDTX_N
10863856Ssaidi@eecs.umich.edu               0x27: TwinLoad::ldtx_n(
10873856Ssaidi@eecs.umich.edu                    {{RdTwin.udw = Mem.udw}}, {{EXT_ASI}});
10883856Ssaidi@eecs.umich.edu               //ASI_LDTX_L
10893856Ssaidi@eecs.umich.edu               0x2C: TwinLoad::ldtx_l(
10903856Ssaidi@eecs.umich.edu                    {{RdTwin.udw = Mem.udw}}, {{EXT_ASI}});
10913856Ssaidi@eecs.umich.edu                //ASI_LDTX_REAL_L
10923856Ssaidi@eecs.umich.edu                0x2E: TwinLoad::ldtx_real_l(
10933856Ssaidi@eecs.umich.edu                    {{RdTwin.udw = Mem.udw}}, {{EXT_ASI}});
10943856Ssaidi@eecs.umich.edu                //ASI_LDTX_N_L
10953856Ssaidi@eecs.umich.edu                0x2F: TwinLoad::ldtx_n_l(
10963856Ssaidi@eecs.umich.edu                    {{RdTwin.udw = Mem.udw}}, {{EXT_ASI}});
10973901Ssaidi@eecs.umich.edu                //ASI_LDTX_P
10983901Ssaidi@eecs.umich.edu                0xE2: TwinLoad::ldtx_p(
10993901Ssaidi@eecs.umich.edu                    {{RdTwin.udw = Mem.udw}}, {{EXT_ASI}});
11003926Ssaidi@eecs.umich.edu                //ASI_LDTX_S
11013926Ssaidi@eecs.umich.edu                0xE3: TwinLoad::ldtx_s(
11023926Ssaidi@eecs.umich.edu                    {{RdTwin.udw = Mem.udw}}, {{EXT_ASI}});
11033856Ssaidi@eecs.umich.edu                default: ldtwa({{
11043856Ssaidi@eecs.umich.edu                        uint64_t val = Mem.udw;
11053856Ssaidi@eecs.umich.edu                        RdLow = val<31:0>;
11063856Ssaidi@eecs.umich.edu                        RdHigh = val<63:32>;
11073856Ssaidi@eecs.umich.edu                        }}, {{EXT_ASI}});
11083856Ssaidi@eecs.umich.edu            }
11092526SN/A        }
11103810Sgblack@eecs.umich.edu        format StoreAlt {
11113810Sgblack@eecs.umich.edu            0x14: stwa({{Mem.uw = Rd;}}, {{EXT_ASI}});
11123810Sgblack@eecs.umich.edu            0x15: stba({{Mem.ub = Rd;}}, {{EXT_ASI}});
11133810Sgblack@eecs.umich.edu            0x16: stha({{Mem.uhw = Rd;}}, {{EXT_ASI}});
11143835Sgblack@eecs.umich.edu            0x17: sttwa({{Mem.udw = RdLow<31:0> | RdHigh<31:0> << 32;}}, {{EXT_ASI}});
11152526SN/A        }
11163810Sgblack@eecs.umich.edu        format LoadAlt {
11173810Sgblack@eecs.umich.edu            0x18: ldswa({{Rd = (int32_t)Mem.sw;}}, {{EXT_ASI}});
11183810Sgblack@eecs.umich.edu            0x19: ldsba({{Rd = (int8_t)Mem.sb;}}, {{EXT_ASI}});
11193810Sgblack@eecs.umich.edu            0x1A: ldsha({{Rd = (int16_t)Mem.shw;}}, {{EXT_ASI}});
11203810Sgblack@eecs.umich.edu            0x1B: ldxa({{Rd = (int64_t)Mem.sdw;}}, {{EXT_ASI}});
11212526SN/A        }
11223810Sgblack@eecs.umich.edu        0x1D: LoadStoreAlt::ldstuba(
11233388Sgblack@eecs.umich.edu                {{Rd = Mem.ub;}},
11243810Sgblack@eecs.umich.edu                {{Mem.ub = 0xFF}}, {{EXT_ASI}});
11253810Sgblack@eecs.umich.edu        0x1E: StoreAlt::stxa({{Mem.udw = Rd}}, {{EXT_ASI}});
11263810Sgblack@eecs.umich.edu        0x1F: LoadStoreAlt::swapa(
11273438Sgblack@eecs.umich.edu            {{uReg0 = Rd.uw;
11283388Sgblack@eecs.umich.edu            Rd.uw = Mem.uw;}},
11293810Sgblack@eecs.umich.edu            {{Mem.uw = uReg0;}}, {{EXT_ASI}});
11302526SN/A        format Trap {
11313272Sgblack@eecs.umich.edu            0x20: Load::ldf({{Frd.uw = Mem.uw;}});
11322526SN/A            0x21: decode X {
11333272Sgblack@eecs.umich.edu                0x0: Load::ldfsr({{Fsr = Mem.uw | Fsr<63:32>;}});
11343272Sgblack@eecs.umich.edu                0x1: Load::ldxfsr({{Fsr = Mem.udw;}});
11352469SN/A            }
11362526SN/A            0x22: ldqf({{fault = new FpDisabled;}});
11373272Sgblack@eecs.umich.edu            0x23: Load::lddf({{Frd.udw = Mem.udw;}});
11383272Sgblack@eecs.umich.edu            0x24: Store::stf({{Mem.uw = Frd.uw;}});
11392526SN/A            0x25: decode X {
11403272Sgblack@eecs.umich.edu                0x0: Store::stfsr({{Mem.uw = Fsr<31:0>;}});
11413272Sgblack@eecs.umich.edu                0x1: Store::stxfsr({{Mem.udw = Fsr;}});
11422526SN/A            }
11432526SN/A            0x26: stqf({{fault = new FpDisabled;}});
11443272Sgblack@eecs.umich.edu            0x27: Store::stdf({{Mem.udw = Frd.udw;}});
11452526SN/A            0x2D: Nop::prefetch({{ }});
11463810Sgblack@eecs.umich.edu            0x30: LoadAlt::ldfa({{Frd.uw = Mem.uw;}}, {{EXT_ASI}});
11472526SN/A            0x32: ldqfa({{fault = new FpDisabled;}});
11483272Sgblack@eecs.umich.edu            format LoadAlt {
11493272Sgblack@eecs.umich.edu                0x33: decode EXT_ASI {
11503272Sgblack@eecs.umich.edu                    //ASI_NUCLEUS
11513272Sgblack@eecs.umich.edu                    0x04: FailUnimpl::lddfa_n();
11523272Sgblack@eecs.umich.edu                    //ASI_NUCLEUS_LITTLE
11533272Sgblack@eecs.umich.edu                    0x0C: FailUnimpl::lddfa_nl();
11543272Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_PRIMARY
11553272Sgblack@eecs.umich.edu                    0x10: FailUnimpl::lddfa_aiup();
11563272Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_PRIMARY_LITTLE
11573272Sgblack@eecs.umich.edu                    0x18: FailUnimpl::lddfa_aiupl();
11583272Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_SECONDARY
11593272Sgblack@eecs.umich.edu                    0x11: FailUnimpl::lddfa_aius();
11603272Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_SECONDARY_LITTLE
11613272Sgblack@eecs.umich.edu                    0x19: FailUnimpl::lddfa_aiusl();
11623272Sgblack@eecs.umich.edu                    //ASI_REAL
11633272Sgblack@eecs.umich.edu                    0x14: FailUnimpl::lddfa_real();
11643272Sgblack@eecs.umich.edu                    //ASI_REAL_LITTLE
11653272Sgblack@eecs.umich.edu                    0x1C: FailUnimpl::lddfa_real_l();
11663272Sgblack@eecs.umich.edu                    //ASI_REAL_IO
11673272Sgblack@eecs.umich.edu                    0x15: FailUnimpl::lddfa_real_io();
11683272Sgblack@eecs.umich.edu                    //ASI_REAL_IO_LITTLE
11693272Sgblack@eecs.umich.edu                    0x1D: FailUnimpl::lddfa_real_io_l();
11703272Sgblack@eecs.umich.edu                    //ASI_PRIMARY
11713272Sgblack@eecs.umich.edu                    0x80: FailUnimpl::lddfa_p();
11723272Sgblack@eecs.umich.edu                    //ASI_PRIMARY_LITTLE
11733272Sgblack@eecs.umich.edu                    0x88: FailUnimpl::lddfa_pl();
11743272Sgblack@eecs.umich.edu                    //ASI_SECONDARY
11753272Sgblack@eecs.umich.edu                    0x81: FailUnimpl::lddfa_s();
11763272Sgblack@eecs.umich.edu                    //ASI_SECONDARY_LITTLE
11773272Sgblack@eecs.umich.edu                    0x89: FailUnimpl::lddfa_sl();
11783272Sgblack@eecs.umich.edu                    //ASI_PRIMARY_NO_FAULT
11793272Sgblack@eecs.umich.edu                    0x82: FailUnimpl::lddfa_pnf();
11803272Sgblack@eecs.umich.edu                    //ASI_PRIMARY_NO_FAULT_LITTLE
11813272Sgblack@eecs.umich.edu                    0x8A: FailUnimpl::lddfa_pnfl();
11823272Sgblack@eecs.umich.edu                    //ASI_SECONDARY_NO_FAULT
11833272Sgblack@eecs.umich.edu                    0x83: FailUnimpl::lddfa_snf();
11843272Sgblack@eecs.umich.edu                    //ASI_SECONDARY_NO_FAULT_LITTLE
11853272Sgblack@eecs.umich.edu                    0x8B: FailUnimpl::lddfa_snfl();
11863272Sgblack@eecs.umich.edu
11873272Sgblack@eecs.umich.edu                    format BlockLoad {
11883272Sgblack@eecs.umich.edu                        // LDBLOCKF
11893272Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_PRIMARY
11903272Sgblack@eecs.umich.edu                        0x16: FailUnimpl::ldblockf_aiup();
11913272Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_SECONDARY
11923272Sgblack@eecs.umich.edu                        0x17: FailUnimpl::ldblockf_aius();
11933272Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_PRIMARY_LITTLE
11943272Sgblack@eecs.umich.edu                        0x1E: FailUnimpl::ldblockf_aiupl();
11953272Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_SECONDARY_LITTLE
11963272Sgblack@eecs.umich.edu                        0x1F: FailUnimpl::ldblockf_aiusl();
11973272Sgblack@eecs.umich.edu                        //ASI_BLOCK_PRIMARY
11983810Sgblack@eecs.umich.edu                        0xF0: ldblockf_p({{Frd_N.udw = Mem.udw;}}, {{EXT_ASI}});
11993272Sgblack@eecs.umich.edu                        //ASI_BLOCK_SECONDARY
12003272Sgblack@eecs.umich.edu                        0xF1: FailUnimpl::ldblockf_s();
12013272Sgblack@eecs.umich.edu                        //ASI_BLOCK_PRIMARY_LITTLE
12023272Sgblack@eecs.umich.edu                        0xF8: FailUnimpl::ldblockf_pl();
12033272Sgblack@eecs.umich.edu                        //ASI_BLOCK_SECONDARY_LITTLE
12043272Sgblack@eecs.umich.edu                        0xF9: FailUnimpl::ldblockf_sl();
12053272Sgblack@eecs.umich.edu                    }
12063272Sgblack@eecs.umich.edu
12073272Sgblack@eecs.umich.edu                    //LDSHORTF
12083272Sgblack@eecs.umich.edu                    //ASI_FL8_PRIMARY
12093272Sgblack@eecs.umich.edu                    0xD0: FailUnimpl::ldshortf_8p();
12103272Sgblack@eecs.umich.edu                    //ASI_FL8_SECONDARY
12113272Sgblack@eecs.umich.edu                    0xD1: FailUnimpl::ldshortf_8s();
12123272Sgblack@eecs.umich.edu                    //ASI_FL8_PRIMARY_LITTLE
12133272Sgblack@eecs.umich.edu                    0xD8: FailUnimpl::ldshortf_8pl();
12143272Sgblack@eecs.umich.edu                    //ASI_FL8_SECONDARY_LITTLE
12153272Sgblack@eecs.umich.edu                    0xD9: FailUnimpl::ldshortf_8sl();
12163272Sgblack@eecs.umich.edu                    //ASI_FL16_PRIMARY
12173272Sgblack@eecs.umich.edu                    0xD2: FailUnimpl::ldshortf_16p();
12183272Sgblack@eecs.umich.edu                    //ASI_FL16_SECONDARY
12193272Sgblack@eecs.umich.edu                    0xD3: FailUnimpl::ldshortf_16s();
12203272Sgblack@eecs.umich.edu                    //ASI_FL16_PRIMARY_LITTLE
12213272Sgblack@eecs.umich.edu                    0xDA: FailUnimpl::ldshortf_16pl();
12223272Sgblack@eecs.umich.edu                    //ASI_FL16_SECONDARY_LITTLE
12233272Sgblack@eecs.umich.edu                    0xDB: FailUnimpl::ldshortf_16sl();
12243272Sgblack@eecs.umich.edu                    //Not an ASI which is legal with lddfa
12253378Sgblack@eecs.umich.edu                    default: Trap::lddfa_bad_asi(
12263378Sgblack@eecs.umich.edu                        {{fault = new DataAccessException;}});
12273272Sgblack@eecs.umich.edu                }
12283272Sgblack@eecs.umich.edu            }
12293272Sgblack@eecs.umich.edu            0x34: Store::stfa({{Mem.uw = Frd.uw;}});
12302954Sgblack@eecs.umich.edu            0x36: stqfa({{fault = new FpDisabled;}});
12313378Sgblack@eecs.umich.edu            format StoreAlt {
12323378Sgblack@eecs.umich.edu                0x37: decode EXT_ASI {
12333378Sgblack@eecs.umich.edu                    //ASI_NUCLEUS
12343378Sgblack@eecs.umich.edu                    0x04: FailUnimpl::stdfa_n();
12353378Sgblack@eecs.umich.edu                    //ASI_NUCLEUS_LITTLE
12363378Sgblack@eecs.umich.edu                    0x0C: FailUnimpl::stdfa_nl();
12373378Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_PRIMARY
12383378Sgblack@eecs.umich.edu                    0x10: FailUnimpl::stdfa_aiup();
12393378Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_PRIMARY_LITTLE
12403378Sgblack@eecs.umich.edu                    0x18: FailUnimpl::stdfa_aiupl();
12413378Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_SECONDARY
12423378Sgblack@eecs.umich.edu                    0x11: FailUnimpl::stdfa_aius();
12433378Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_SECONDARY_LITTLE
12443378Sgblack@eecs.umich.edu                    0x19: FailUnimpl::stdfa_aiusl();
12453378Sgblack@eecs.umich.edu                    //ASI_REAL
12463378Sgblack@eecs.umich.edu                    0x14: FailUnimpl::stdfa_real();
12473378Sgblack@eecs.umich.edu                    //ASI_REAL_LITTLE
12483378Sgblack@eecs.umich.edu                    0x1C: FailUnimpl::stdfa_real_l();
12493378Sgblack@eecs.umich.edu                    //ASI_REAL_IO
12503378Sgblack@eecs.umich.edu                    0x15: FailUnimpl::stdfa_real_io();
12513378Sgblack@eecs.umich.edu                    //ASI_REAL_IO_LITTLE
12523378Sgblack@eecs.umich.edu                    0x1D: FailUnimpl::stdfa_real_io_l();
12533378Sgblack@eecs.umich.edu                    //ASI_PRIMARY
12543378Sgblack@eecs.umich.edu                    0x80: FailUnimpl::stdfa_p();
12553378Sgblack@eecs.umich.edu                    //ASI_PRIMARY_LITTLE
12563378Sgblack@eecs.umich.edu                    0x88: FailUnimpl::stdfa_pl();
12573378Sgblack@eecs.umich.edu                    //ASI_SECONDARY
12583378Sgblack@eecs.umich.edu                    0x81: FailUnimpl::stdfa_s();
12593378Sgblack@eecs.umich.edu                    //ASI_SECONDARY_LITTLE
12603378Sgblack@eecs.umich.edu                    0x89: FailUnimpl::stdfa_sl();
12613378Sgblack@eecs.umich.edu                    //ASI_PRIMARY_NO_FAULT
12623378Sgblack@eecs.umich.edu                    0x82: FailUnimpl::stdfa_pnf();
12633378Sgblack@eecs.umich.edu                    //ASI_PRIMARY_NO_FAULT_LITTLE
12643378Sgblack@eecs.umich.edu                    0x8A: FailUnimpl::stdfa_pnfl();
12653378Sgblack@eecs.umich.edu                    //ASI_SECONDARY_NO_FAULT
12663378Sgblack@eecs.umich.edu                    0x83: FailUnimpl::stdfa_snf();
12673378Sgblack@eecs.umich.edu                    //ASI_SECONDARY_NO_FAULT_LITTLE
12683378Sgblack@eecs.umich.edu                    0x8B: FailUnimpl::stdfa_snfl();
12693378Sgblack@eecs.umich.edu
12703378Sgblack@eecs.umich.edu                    format BlockStore {
12713378Sgblack@eecs.umich.edu                        // STBLOCKF
12723378Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_PRIMARY
12733378Sgblack@eecs.umich.edu                        0x16: FailUnimpl::stblockf_aiup();
12743378Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_SECONDARY
12753378Sgblack@eecs.umich.edu                        0x17: FailUnimpl::stblockf_aius();
12763378Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_PRIMARY_LITTLE
12773378Sgblack@eecs.umich.edu                        0x1E: FailUnimpl::stblockf_aiupl();
12783378Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_SECONDARY_LITTLE
12793378Sgblack@eecs.umich.edu                        0x1F: FailUnimpl::stblockf_aiusl();
12803378Sgblack@eecs.umich.edu                        //ASI_BLOCK_PRIMARY
12813810Sgblack@eecs.umich.edu                        0xF0: stblockf_p({{Mem.udw = Frd_N.udw;}}, {{EXT_ASI}});
12823378Sgblack@eecs.umich.edu                        //ASI_BLOCK_SECONDARY
12833378Sgblack@eecs.umich.edu                        0xF1: FailUnimpl::stblockf_s();
12843378Sgblack@eecs.umich.edu                        //ASI_BLOCK_PRIMARY_LITTLE
12853378Sgblack@eecs.umich.edu                        0xF8: FailUnimpl::stblockf_pl();
12863378Sgblack@eecs.umich.edu                        //ASI_BLOCK_SECONDARY_LITTLE
12873378Sgblack@eecs.umich.edu                        0xF9: FailUnimpl::stblockf_sl();
12883378Sgblack@eecs.umich.edu                    }
12893378Sgblack@eecs.umich.edu
12903378Sgblack@eecs.umich.edu                    //STSHORTF
12913378Sgblack@eecs.umich.edu                    //ASI_FL8_PRIMARY
12923378Sgblack@eecs.umich.edu                    0xD0: FailUnimpl::stshortf_8p();
12933378Sgblack@eecs.umich.edu                    //ASI_FL8_SECONDARY
12943378Sgblack@eecs.umich.edu                    0xD1: FailUnimpl::stshortf_8s();
12953378Sgblack@eecs.umich.edu                    //ASI_FL8_PRIMARY_LITTLE
12963378Sgblack@eecs.umich.edu                    0xD8: FailUnimpl::stshortf_8pl();
12973378Sgblack@eecs.umich.edu                    //ASI_FL8_SECONDARY_LITTLE
12983378Sgblack@eecs.umich.edu                    0xD9: FailUnimpl::stshortf_8sl();
12993378Sgblack@eecs.umich.edu                    //ASI_FL16_PRIMARY
13003378Sgblack@eecs.umich.edu                    0xD2: FailUnimpl::stshortf_16p();
13013378Sgblack@eecs.umich.edu                    //ASI_FL16_SECONDARY
13023378Sgblack@eecs.umich.edu                    0xD3: FailUnimpl::stshortf_16s();
13033378Sgblack@eecs.umich.edu                    //ASI_FL16_PRIMARY_LITTLE
13043378Sgblack@eecs.umich.edu                    0xDA: FailUnimpl::stshortf_16pl();
13053378Sgblack@eecs.umich.edu                    //ASI_FL16_SECONDARY_LITTLE
13063378Sgblack@eecs.umich.edu                    0xDB: FailUnimpl::stshortf_16sl();
13073378Sgblack@eecs.umich.edu                    //Not an ASI which is legal with lddfa
13083378Sgblack@eecs.umich.edu                    default: Trap::stdfa_bad_asi(
13093378Sgblack@eecs.umich.edu                        {{fault = new DataAccessException;}});
13103378Sgblack@eecs.umich.edu                }
13113378Sgblack@eecs.umich.edu            }
13123439Sgblack@eecs.umich.edu            0x3C: Cas::casa(
13133439Sgblack@eecs.umich.edu                {{uReg0 = Mem.uw;}},
13143439Sgblack@eecs.umich.edu                {{if(Rs2.uw == uReg0)
13152526SN/A                        Mem.uw = Rd.uw;
13163439Sgblack@eecs.umich.edu                else
13173439Sgblack@eecs.umich.edu                        storeCond = false;
13183810Sgblack@eecs.umich.edu                Rd.uw = uReg0;}}, {{EXT_ASI}});
13192526SN/A            0x3D: Nop::prefetcha({{ }});
13203439Sgblack@eecs.umich.edu            0x3E: Cas::casxa(
13213439Sgblack@eecs.umich.edu                {{uReg0 = Mem.udw;}},
13223439Sgblack@eecs.umich.edu                {{if(Rs2 == uReg0)
13232526SN/A                        Mem.udw = Rd;
13243439Sgblack@eecs.umich.edu                else
13253439Sgblack@eecs.umich.edu                        storeCond = false;
13263810Sgblack@eecs.umich.edu                Rd = uReg0;}}, {{EXT_ASI}});
13272526SN/A        }
13282469SN/A    }
13292022SN/A}
1330