decoder.isa revision 3598
12632Sstever@eecs.umich.edu// Copyright (c) 2006 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, {{
1662516SN/A            R15 = xc->readPC();
1672516SN/A            NNPC = R15 + disp;
1682469SN/A    }});
1692469SN/A    0x2: decode OP3 {
1702482SN/A        format IntOp {
1712482SN/A            0x00: add({{Rd = Rs1.sdw + Rs2_or_imm13;}});
1722974Sgblack@eecs.umich.edu            0x01: and({{Rd = Rs1.sdw & Rs2_or_imm13;}});
1732974Sgblack@eecs.umich.edu            0x02: or({{Rd = Rs1.sdw | Rs2_or_imm13;}});
1742974Sgblack@eecs.umich.edu            0x03: xor({{Rd = Rs1.sdw ^ Rs2_or_imm13;}});
1752526SN/A            0x04: sub({{Rd = Rs1.sdw - Rs2_or_imm13;}});
1762974Sgblack@eecs.umich.edu            0x05: andn({{Rd = Rs1.sdw & ~Rs2_or_imm13;}});
1772974Sgblack@eecs.umich.edu            0x06: orn({{Rd = Rs1.sdw | ~Rs2_or_imm13;}});
1782974Sgblack@eecs.umich.edu            0x07: xnor({{Rd = ~(Rs1.sdw ^ Rs2_or_imm13);}});
1792646Ssaidi@eecs.umich.edu            0x08: addc({{Rd = Rs1.sdw + Rs2_or_imm13 + Ccr<0:0>;}});
1802974Sgblack@eecs.umich.edu            0x09: mulx({{Rd = Rs1.sdw * Rs2_or_imm13;}});
1812469SN/A            0x0A: umul({{
1822516SN/A                Rd = Rs1.udw<31:0> * Rs2_or_imm13<31:0>;
1832646Ssaidi@eecs.umich.edu                Y = Rd<63:32>;
1842482SN/A            }});
1852469SN/A            0x0B: smul({{
1862516SN/A                Rd.sdw = Rs1.sdw<31:0> * Rs2_or_imm13<31:0>;
1872646Ssaidi@eecs.umich.edu                Y = Rd.sdw;
1882482SN/A            }});
1892954Sgblack@eecs.umich.edu            0x0C: subc({{Rd.sdw = Rs1.sdw + (~Rs2_or_imm13) + 1 - Ccr<0:0>}});
1902469SN/A            0x0D: udivx({{
1912516SN/A                if(Rs2_or_imm13 == 0) fault = new DivisionByZero;
1922516SN/A                else Rd.udw = Rs1.udw / Rs2_or_imm13;
1932482SN/A            }});
1942469SN/A            0x0E: udiv({{
1952516SN/A                if(Rs2_or_imm13 == 0) fault = new DivisionByZero;
1962482SN/A                else
1972482SN/A                {
1982646Ssaidi@eecs.umich.edu                    Rd.udw = ((Y << 32) | Rs1.udw<31:0>) / Rs2_or_imm13;
1992482SN/A                    if(Rd.udw >> 32 != 0)
2002482SN/A                        Rd.udw = 0xFFFFFFFF;
2012482SN/A                }
2022482SN/A            }});
2032482SN/A            0x0F: sdiv({{
2042615SN/A                if(Rs2_or_imm13.sdw == 0)
2052469SN/A                    fault = new DivisionByZero;
2062469SN/A                else
2072482SN/A                {
2082646Ssaidi@eecs.umich.edu                    Rd.udw = ((int64_t)((Y << 32) | Rs1.sdw<31:0>)) / Rs2_or_imm13.sdw;
2092482SN/A                    if(Rd.udw<63:31> != 0)
2102482SN/A                        Rd.udw = 0x7FFFFFFF;
2112482SN/A                    else if(Rd.udw<63:> && Rd.udw<62:31> != 0xFFFFFFFF)
2122588SN/A                        Rd.udw = 0xFFFFFFFF80000000ULL;
2132482SN/A                }
2142526SN/A            }});
2152469SN/A        }
2162482SN/A        format IntOpCc {
2172469SN/A            0x10: addcc({{
2182516SN/A                int64_t resTemp, val2 = Rs2_or_imm13;
2192469SN/A                Rd = resTemp = Rs1 + val2;}},
2202580SN/A                {{(Rs1<31:0> + val2<31:0>)<32:>}},
2212469SN/A                {{Rs1<31:> == val2<31:> && val2<31:> != resTemp<31:>}},
2222580SN/A                {{(Rs1<63:1> + val2<63:1> + (Rs1 & val2)<0:>)<63:>}},
2232469SN/A                {{Rs1<63:> == val2<63:> && val2<63:> != resTemp<63:>}}
2242526SN/A            );
2252482SN/A            0x11: IntOpCcRes::andcc({{Rd = Rs1 & Rs2_or_imm13;}});
2262482SN/A            0x12: IntOpCcRes::orcc({{Rd = Rs1 | Rs2_or_imm13;}});
2272482SN/A            0x13: IntOpCcRes::xorcc({{Rd = Rs1 ^ Rs2_or_imm13;}});
2282469SN/A            0x14: subcc({{
2292580SN/A                int64_t val2 = Rs2_or_imm13;
2302580SN/A                Rd = Rs1 - val2;}},
2312580SN/A                {{(~(Rs1<31:0> + (~val2)<31:0> + 1))<32:>}},
2322580SN/A                {{(Rs1<31:> != val2<31:>) && (Rs1<31:> != Rd<31:>)}},
2332580SN/A                {{(~(Rs1<63:1> + (~val2)<63:1> +
2342580SN/A                    (Rs1 | ~val2)<0:>))<63:>}},
2352580SN/A                {{Rs1<63:> != val2<63:> && Rs1<63:> != Rd<63:>}}
2362526SN/A            );
2372482SN/A            0x15: IntOpCcRes::andncc({{Rd = Rs1 & ~Rs2_or_imm13;}});
2382482SN/A            0x16: IntOpCcRes::orncc({{Rd = Rs1 | ~Rs2_or_imm13;}});
2392482SN/A            0x17: IntOpCcRes::xnorcc({{Rd = ~(Rs1 ^ Rs2_or_imm13);}});
2402469SN/A            0x18: addccc({{
2412516SN/A                int64_t resTemp, val2 = Rs2_or_imm13;
2422646Ssaidi@eecs.umich.edu                int64_t carryin = Ccr<0:0>;
2432469SN/A                Rd = resTemp = Rs1 + val2 + carryin;}},
2442580SN/A                {{(Rs1<31:0> + val2<31:0> + carryin)<32:>}},
2452469SN/A                {{Rs1<31:> == val2<31:> && val2<31:> != resTemp<31:>}},
2462580SN/A                {{(Rs1<63:1> + val2<63:1> +
2472580SN/A                    ((Rs1 & val2) | (carryin & (Rs1 | val2)))<0:>)<63:>}},
2482469SN/A                {{Rs1<63:> == val2<63:> && val2<63:> != resTemp<63:>}}
2492526SN/A            );
2502469SN/A            0x1A: umulcc({{
2512615SN/A                uint64_t resTemp;
2522615SN/A                Rd = resTemp = Rs1.udw<31:0> * Rs2_or_imm13.udw<31:0>;
2532646Ssaidi@eecs.umich.edu                Y = resTemp<63:32>;}},
2542526SN/A                {{0}},{{0}},{{0}},{{0}});
2552469SN/A            0x1B: smulcc({{
2562615SN/A                int64_t resTemp;
2572615SN/A                Rd = resTemp = Rs1.sdw<31:0> * Rs2_or_imm13.sdw<31:0>;
2582646Ssaidi@eecs.umich.edu                Y = resTemp<63:32>;}},
2592526SN/A                {{0}},{{0}},{{0}},{{0}});
2602469SN/A            0x1C: subccc({{
2612516SN/A                int64_t resTemp, val2 = Rs2_or_imm13;
2622646Ssaidi@eecs.umich.edu                int64_t carryin = Ccr<0:0>;
2632954Sgblack@eecs.umich.edu                Rd = resTemp = Rs1 + ~val2 + 1 - carryin;}},
2642580SN/A                {{(~((Rs1<31:0> + (~(val2 + carryin))<31:0> + 1))<32:>)}},
2652469SN/A                {{Rs1<31:> != val2<31:> && Rs1<31:> != resTemp<31:>}},
2662580SN/A                {{(~((Rs1<63:1> + (~(val2 + carryin))<63:1>) + (Rs1<0:> + (~(val2+carryin))<0:> + 1)<63:1>))<63:>}},
2672469SN/A                {{Rs1<63:> != val2<63:> && Rs1<63:> != resTemp<63:>}}
2682526SN/A            );
2692469SN/A            0x1D: udivxcc({{
2702615SN/A                if(Rs2_or_imm13.udw == 0) fault = new DivisionByZero;
2712615SN/A                else Rd = Rs1.udw / Rs2_or_imm13.udw;}}
2722526SN/A                ,{{0}},{{0}},{{0}},{{0}});
2732469SN/A            0x1E: udivcc({{
2742615SN/A                uint32_t resTemp, val2 = Rs2_or_imm13.udw;
2752989Ssaidi@eecs.umich.edu                int32_t overflow = 0;
2762469SN/A                if(val2 == 0) fault = new DivisionByZero;
2772469SN/A                else
2782224SN/A                {
2792646Ssaidi@eecs.umich.edu                    resTemp = (uint64_t)((Y << 32) | Rs1.udw<31:0>) / val2;
2802516SN/A                    overflow = (resTemp<63:32> != 0);
2812516SN/A                    if(overflow) Rd = resTemp = 0xFFFFFFFF;
2822516SN/A                    else Rd = resTemp;
2832469SN/A                } }},
2842469SN/A                {{0}},
2852469SN/A                {{overflow}},
2862469SN/A                {{0}},
2872469SN/A                {{0}}
2882526SN/A            );
2892469SN/A            0x1F: sdivcc({{
2902996Sgblack@eecs.umich.edu                int64_t val2 = Rs2_or_imm13.sdw<31:0>;
2912996Sgblack@eecs.umich.edu                bool overflow = false, underflow = false;
2922469SN/A                if(val2 == 0) fault = new DivisionByZero;
2932469SN/A                else
2942469SN/A                {
2952996Sgblack@eecs.umich.edu                    Rd = (int64_t)((Y << 32) | Rs1.sdw<31:0>) / val2;
2962996Sgblack@eecs.umich.edu                    overflow = (Rd<63:31> != 0);
2972996Sgblack@eecs.umich.edu                    underflow = (Rd<63:> && Rd<62:31> != 0xFFFFFFFF);
2982996Sgblack@eecs.umich.edu                    if(overflow) Rd = 0x7FFFFFFF;
2992996Sgblack@eecs.umich.edu                    else if(underflow) Rd = 0xFFFFFFFF80000000ULL;
3002469SN/A                } }},
3012469SN/A                {{0}},
3022469SN/A                {{overflow || underflow}},
3032469SN/A                {{0}},
3042469SN/A                {{0}}
3052526SN/A            );
3062469SN/A            0x20: taddcc({{
3072516SN/A                int64_t resTemp, val2 = Rs2_or_imm13;
3082469SN/A                Rd = resTemp = Rs1 + val2;
3092469SN/A                int32_t overflow = Rs1<1:0> || val2<1:0> || (Rs1<31:> == val2<31:> && val2<31:> != resTemp<31:>);}},
3102469SN/A                {{((Rs1 & 0xFFFFFFFF + val2 & 0xFFFFFFFF) >> 31)}},
3112469SN/A                {{overflow}},
3122469SN/A                {{((Rs1 >> 1) + (val2 >> 1) + (Rs1 & val2 & 0x1))<63:>}},
3132469SN/A                {{Rs1<63:> == val2<63:> && val2<63:> != resTemp<63:>}}
3142526SN/A            );
3152469SN/A            0x21: tsubcc({{
3162516SN/A                int64_t resTemp, val2 = Rs2_or_imm13;
3172469SN/A                Rd = resTemp = Rs1 + val2;
3182469SN/A                int32_t overflow = Rs1<1:0> || val2<1:0> || (Rs1<31:> == val2<31:> && val2<31:> != resTemp<31:>);}},
3192516SN/A                {{(Rs1 & 0xFFFFFFFF + val2 & 0xFFFFFFFF) >> 31}},
3202469SN/A                {{overflow}},
3212469SN/A                {{((Rs1 >> 1) + (val2 >> 1) + (Rs1 & val2 & 0x1))<63:>}},
3222469SN/A                {{Rs1<63:> == val2<63:> && val2<63:> != resTemp<63:>}}
3232526SN/A            );
3242469SN/A            0x22: taddcctv({{
3252996Sgblack@eecs.umich.edu                int64_t val2 = Rs2_or_imm13;
3262996Sgblack@eecs.umich.edu                Rd = Rs1 + val2;
3272954Sgblack@eecs.umich.edu                int32_t overflow = Rs1<1:0> || val2<1:0> ||
3282954Sgblack@eecs.umich.edu                        (Rs1<31:> == val2<31:> && val2<31:> != Rd<31:>);
3292469SN/A                if(overflow) fault = new TagOverflow;}},
3302469SN/A                {{((Rs1 & 0xFFFFFFFF + val2 & 0xFFFFFFFF) >> 31)}},
3312469SN/A                {{overflow}},
3322469SN/A                {{((Rs1 >> 1) + (val2 >> 1) + (Rs1 & val2 & 0x1))<63:>}},
3332996Sgblack@eecs.umich.edu                {{Rs1<63:> == val2<63:> && val2<63:> != Rd<63:>}}
3342526SN/A            );
3352469SN/A            0x23: tsubcctv({{
3362516SN/A                int64_t resTemp, val2 = Rs2_or_imm13;
3372469SN/A                Rd = resTemp = Rs1 + val2;
3382469SN/A                int32_t overflow = Rs1<1:0> || val2<1:0> || (Rs1<31:> == val2<31:> && val2<31:> != resTemp<31:>);
3392469SN/A                if(overflow) fault = new TagOverflow;}},
3402469SN/A                {{((Rs1 & 0xFFFFFFFF + val2 & 0xFFFFFFFF) >> 31)}},
3412469SN/A                {{overflow}},
3422469SN/A                {{((Rs1 >> 1) + (val2 >> 1) + (Rs1 & val2 & 0x1))<63:>}},
3432469SN/A                {{Rs1<63:> == val2<63:> && val2<63:> != resTemp<63:>}}
3442526SN/A            );
3452469SN/A            0x24: mulscc({{
3462516SN/A                int64_t resTemp, multiplicand = Rs2_or_imm13;
3472469SN/A                int32_t multiplier = Rs1<31:0>;
3482469SN/A                int32_t savedLSB = Rs1<0:>;
3492516SN/A                multiplier = multiplier<31:1> |
3502646Ssaidi@eecs.umich.edu                    ((Ccr<3:3>
3512646Ssaidi@eecs.umich.edu                    ^ Ccr<1:1>) << 32);
3522646Ssaidi@eecs.umich.edu                if(!Y<0:>)
3532469SN/A                    multiplicand = 0;
3542469SN/A                Rd = resTemp = multiplicand + multiplier;
3552646Ssaidi@eecs.umich.edu                Y = Y<31:1> | (savedLSB << 31);}},
3562469SN/A                {{((multiplicand & 0xFFFFFFFF + multiplier & 0xFFFFFFFF) >> 31)}},
3572469SN/A                {{multiplicand<31:> == multiplier<31:> && multiplier<31:> != resTemp<31:>}},
3582469SN/A                {{((multiplicand >> 1) + (multiplier >> 1) + (multiplicand & multiplier & 0x1))<63:>}},
3592469SN/A                {{multiplicand<63:> == multiplier<63:> && multiplier<63:> != resTemp<63:>}}
3602526SN/A            );
3612526SN/A        }
3622526SN/A        format IntOp
3632526SN/A        {
3642526SN/A            0x25: decode X {
3652526SN/A                0x0: sll({{Rd = Rs1 << (I ? SHCNT32 : Rs2<4:0>);}});
3662526SN/A                0x1: sllx({{Rd = Rs1 << (I ? SHCNT64 : Rs2<5:0>);}});
3672469SN/A            }
3682526SN/A            0x26: decode X {
3692526SN/A                0x0: srl({{Rd = Rs1.uw >> (I ? SHCNT32 : Rs2<4:0>);}});
3702526SN/A                0x1: srlx({{Rd = Rs1.udw >> (I ? SHCNT64 : Rs2<5:0>);}});
3712526SN/A            }
3722526SN/A            0x27: decode X {
3732526SN/A                0x0: sra({{Rd = Rs1.sw >> (I ? SHCNT32 : Rs2<4:0>);}});
3742526SN/A                0x1: srax({{Rd = Rs1.sdw >> (I ? SHCNT64 : Rs2<5:0>);}});
3752526SN/A            }
3762954Sgblack@eecs.umich.edu            0x28: decode RS1 {
3773587Sgblack@eecs.umich.edu                0x00: NoPriv::rdy({{Rd = Y;}});
3783587Sgblack@eecs.umich.edu                //1 should cause an illegal instruction exception
3793587Sgblack@eecs.umich.edu                0x02: NoPriv::rdccr({{Rd = Ccr;}});
3803587Sgblack@eecs.umich.edu                0x03: NoPriv::rdasi({{Rd = Asi;}});
3813587Sgblack@eecs.umich.edu                0x04: PrivCheck::rdtick({{Rd = Tick;}}, {{Tick<63:>}});
3823587Sgblack@eecs.umich.edu                0x05: NoPriv::rdpc({{
3833587Sgblack@eecs.umich.edu                    if(Pstate<3:>)
3843587Sgblack@eecs.umich.edu                        Rd = (xc->readPC())<31:0>;
3853587Sgblack@eecs.umich.edu                    else
3863587Sgblack@eecs.umich.edu                        Rd = xc->readPC();}});
3873587Sgblack@eecs.umich.edu                0x06: NoPriv::rdfprs({{
3883587Sgblack@eecs.umich.edu                    //Wait for all fpops to finish.
3893587Sgblack@eecs.umich.edu                    Rd = Fprs;
3903587Sgblack@eecs.umich.edu                }});
3913587Sgblack@eecs.umich.edu                //7-14 should cause an illegal instruction exception
3923587Sgblack@eecs.umich.edu                0x0F: decode I {
3932954Sgblack@eecs.umich.edu                    0x0: Nop::stbar({{/*stuff*/}});
3942954Sgblack@eecs.umich.edu                    0x1: Nop::membar({{/*stuff*/}});
3952954Sgblack@eecs.umich.edu                }
3963587Sgblack@eecs.umich.edu                0x10: Priv::rdpcr({{Rd = Pcr;}});
3973587Sgblack@eecs.umich.edu                0x11: PrivCheck::rdpic({{Rd = Pic;}}, {{Pcr<0:>}});
3983587Sgblack@eecs.umich.edu                //0x12 should cause an illegal instruction exception
3993587Sgblack@eecs.umich.edu                0x13: NoPriv::rdgsr({{
4003587Sgblack@eecs.umich.edu                    if(Fprs<2:> == 0 || Pstate<4:> == 0)
4013587Sgblack@eecs.umich.edu                        Rd = Gsr;
4023587Sgblack@eecs.umich.edu                    else
4033587Sgblack@eecs.umich.edu                        fault = new FpDisabled;
4042954Sgblack@eecs.umich.edu                }});
4053587Sgblack@eecs.umich.edu                //0x14-0x15 should cause an illegal instruction exception
4063587Sgblack@eecs.umich.edu                0x16: Priv::rdsoftint({{Rd = Softint;}});
4073587Sgblack@eecs.umich.edu                0x17: Priv::rdtick_cmpr({{Rd = TickCmpr;}});
4083587Sgblack@eecs.umich.edu                0x18: PrivCheck::rdstick({{Rd = Stick}}, {{Stick<63:>}});
4093587Sgblack@eecs.umich.edu                0x19: Priv::rdstick_cmpr({{Rd = StickCmpr;}});
4103598Sgblack@eecs.umich.edu                0x1A: Priv::rdstrand_sts_reg({{
4113598Sgblack@eecs.umich.edu                    if(Pstate<2:> && !Hpstate<2:>)
4123598Sgblack@eecs.umich.edu                        Rd = StrandStsReg<0:>;
4133598Sgblack@eecs.umich.edu                    else
4143598Sgblack@eecs.umich.edu                        Rd = StrandStsReg;
4153598Sgblack@eecs.umich.edu                }});
4163598Sgblack@eecs.umich.edu                //0x1A is supposed to be reserved, but it reads the strand
4173598Sgblack@eecs.umich.edu                //status register.
4183598Sgblack@eecs.umich.edu                //0x1B-0x1F should cause an illegal instruction exception
4192954Sgblack@eecs.umich.edu            }
4203587Sgblack@eecs.umich.edu            0x29: decode RS1 {
4213587Sgblack@eecs.umich.edu                0x00: HPriv::rdhprhpstate({{Rd = Hpstate;}});
4223587Sgblack@eecs.umich.edu                0x01: HPriv::rdhprhtstate({{
4233587Sgblack@eecs.umich.edu                    if(Tl == 0)
4243587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
4253587Sgblack@eecs.umich.edu                    Rd = Htstate;
4263587Sgblack@eecs.umich.edu                }});
4273587Sgblack@eecs.umich.edu                //0x02 should cause an illegal instruction exception
4283587Sgblack@eecs.umich.edu                0x03: HPriv::rdhprhintp({{Rd = Hintp;}});
4293587Sgblack@eecs.umich.edu                //0x04 should cause an illegal instruction exception
4303587Sgblack@eecs.umich.edu                0x05: HPriv::rdhprhtba({{Rd = Htba;}});
4313587Sgblack@eecs.umich.edu                0x06: HPriv::rdhprhver({{Rd = Hver;}});
4323587Sgblack@eecs.umich.edu                //0x07-0x1E should cause an illegal instruction exception
4333587Sgblack@eecs.umich.edu                0x1F: HPriv::rdhprhstick_cmpr({{Rd = HstickCmpr;}});
4343587Sgblack@eecs.umich.edu            }
4353587Sgblack@eecs.umich.edu            0x2A: decode RS1 {
4363587Sgblack@eecs.umich.edu                0x00: Priv::rdprtpc({{
4373587Sgblack@eecs.umich.edu                    if(Tl == 0)
4383587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
4393587Sgblack@eecs.umich.edu                    Rd = Tpc;
4403587Sgblack@eecs.umich.edu                }});
4413587Sgblack@eecs.umich.edu                0x01: Priv::rdprtnpc({{
4423587Sgblack@eecs.umich.edu                    if(Tl == 0)
4433587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
4443587Sgblack@eecs.umich.edu                    Rd = Tnpc;
4453587Sgblack@eecs.umich.edu                }});
4463587Sgblack@eecs.umich.edu                0x02: Priv::rdprtstate({{
4473587Sgblack@eecs.umich.edu                    if(Tl == 0)
4483587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
4493587Sgblack@eecs.umich.edu                    Rd = Tstate;
4503587Sgblack@eecs.umich.edu                }});
4513587Sgblack@eecs.umich.edu                0x03: Priv::rdprtt({{
4523587Sgblack@eecs.umich.edu                    if(Tl == 0)
4533587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
4543587Sgblack@eecs.umich.edu                    Rd = Tt;
4553587Sgblack@eecs.umich.edu                }});
4563587Sgblack@eecs.umich.edu                0x04: Priv::rdprtick({{Rd = Tick;}});
4573587Sgblack@eecs.umich.edu                0x05: Priv::rdprtba({{Rd = Tba;}});
4583587Sgblack@eecs.umich.edu                0x06: Priv::rdprpstate({{Rd = Pstate;}});
4593587Sgblack@eecs.umich.edu                0x07: Priv::rdprtl({{Rd = Tl;}});
4603587Sgblack@eecs.umich.edu                0x08: Priv::rdprpil({{Rd = Pil;}});
4613587Sgblack@eecs.umich.edu                0x09: Priv::rdprcwp({{Rd = Cwp;}});
4623587Sgblack@eecs.umich.edu                0x0A: Priv::rdprcansave({{Rd = Cansave;}});
4633587Sgblack@eecs.umich.edu                0x0B: Priv::rdprcanrestore({{Rd = Canrestore;}});
4643587Sgblack@eecs.umich.edu                0x0C: Priv::rdprcleanwin({{Rd = Cleanwin;}});
4653587Sgblack@eecs.umich.edu                0x0D: Priv::rdprotherwin({{Rd = Otherwin;}});
4663587Sgblack@eecs.umich.edu                0x0E: Priv::rdprwstate({{Rd = Wstate;}});
4673587Sgblack@eecs.umich.edu                //0x0F should cause an illegal instruction exception
4683587Sgblack@eecs.umich.edu                0x10: Priv::rdprgl({{Rd = Gl;}});
4693587Sgblack@eecs.umich.edu                //0x11-0x1F should cause an illegal instruction exception
4703587Sgblack@eecs.umich.edu            }
4712526SN/A            0x2B: BasicOperate::flushw({{
4722526SN/A                if(NWindows - 2 - Cansave == 0)
4732526SN/A                {
4742526SN/A                    if(Otherwin)
4752646Ssaidi@eecs.umich.edu                        fault = new SpillNOther(Wstate<5:3>);
4762526SN/A                    else
4772646Ssaidi@eecs.umich.edu                        fault = new SpillNNormal(Wstate<2:0>);
4782526SN/A                }
4792526SN/A            }});
4802526SN/A            0x2C: decode MOVCC3
4812469SN/A            {
4822526SN/A                0x0: Trap::movccfcc({{fault = new FpDisabled;}});
4832526SN/A                0x1: decode CC
4842526SN/A                {
4852526SN/A                    0x0: movcci({{
4862646Ssaidi@eecs.umich.edu                        if(passesCondition(Ccr<3:0>, COND4))
4872591SN/A                            Rd = Rs2_or_imm11;
4882591SN/A                        else
4892591SN/A                            Rd = Rd;
4902526SN/A                    }});
4912526SN/A                    0x2: movccx({{
4922646Ssaidi@eecs.umich.edu                        if(passesCondition(Ccr<7:4>, COND4))
4932591SN/A                            Rd = Rs2_or_imm11;
4942591SN/A                        else
4952591SN/A                            Rd = Rd;
4962526SN/A                    }});
4972224SN/A                }
4982526SN/A            }
4992526SN/A            0x2D: sdivx({{
5002615SN/A                if(Rs2_or_imm13.sdw == 0) fault = new DivisionByZero;
5012615SN/A                else Rd.sdw = Rs1.sdw / Rs2_or_imm13.sdw;
5022526SN/A            }});
5032526SN/A            0x2E: decode RS1 {
5042526SN/A                0x0: IntOp::popc({{
5052526SN/A                    int64_t count = 0;
5062526SN/A                    uint64_t temp = Rs2_or_imm13;
5072526SN/A                    //Count the 1s in the front 4bits until none are left
5082526SN/A                    uint8_t oneBits[] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4};
5092526SN/A                    while(temp)
5102469SN/A                    {
5112526SN/A                            count += oneBits[temp & 0xF];
5122526SN/A                            temp = temp >> 4;
5132516SN/A                    }
5142591SN/A                    Rd = count;
5152516SN/A                }});
5162526SN/A            }
5172526SN/A            0x2F: decode RCOND3
5182526SN/A            {
5192615SN/A                0x1: movreq({{Rd = (Rs1.sdw == 0) ? Rs2_or_imm10 : Rd;}});
5202615SN/A                0x2: movrle({{Rd = (Rs1.sdw <= 0) ? Rs2_or_imm10 : Rd;}});
5212615SN/A                0x3: movrl({{Rd = (Rs1.sdw < 0) ? Rs2_or_imm10 : Rd;}});
5222615SN/A                0x5: movrne({{Rd = (Rs1.sdw != 0) ? Rs2_or_imm10 : Rd;}});
5232615SN/A                0x6: movrg({{Rd = (Rs1.sdw > 0) ? Rs2_or_imm10 : Rd;}});
5242615SN/A                0x7: movrge({{Rd = (Rs1.sdw >= 0) ? Rs2_or_imm10 : Rd;}});
5252526SN/A            }
5263587Sgblack@eecs.umich.edu            0x30: decode RD {
5273587Sgblack@eecs.umich.edu                0x00: NoPriv::wry({{Y = Rs1 ^ Rs2_or_imm13;}});
5283587Sgblack@eecs.umich.edu                //0x01 should cause an illegal instruction exception
5293587Sgblack@eecs.umich.edu                0x02: NoPriv::wrccr({{Ccr = Rs1 ^ Rs2_or_imm13;}});
5303587Sgblack@eecs.umich.edu                0x03: NoPriv::wrasi({{Ccr = Rs1 ^ Rs2_or_imm13;}});
5313587Sgblack@eecs.umich.edu                //0x04-0x05 should cause an illegal instruction exception
5323587Sgblack@eecs.umich.edu                0x06: NoPriv::wrfprs({{Fprs = Rs1 ^ Rs2_or_imm13;}});
5333587Sgblack@eecs.umich.edu                //0x07-0x0E should cause an illegal instruction exception
5343587Sgblack@eecs.umich.edu                0x0F: Trap::softreset({{fault = new SoftwareInitiatedReset;}});
5353587Sgblack@eecs.umich.edu                0x10: Priv::wrpcr({{Pcr = Rs1 ^ Rs2_or_imm13;}});
5363587Sgblack@eecs.umich.edu                0x11: PrivCheck::wrpic({{Pic = Rs1 ^ Rs2_or_imm13;}}, {{Pcr<0:>}});
5373587Sgblack@eecs.umich.edu                //0x12 should cause an illegal instruction exception
5383587Sgblack@eecs.umich.edu                0x13: NoPriv::wrgsr({{
5393587Sgblack@eecs.umich.edu                    if(Fprs<2:> == 0 || Pstate<4:> == 0)
5403587Sgblack@eecs.umich.edu                        return new FpDisabled;
5413587Sgblack@eecs.umich.edu                    Gsr = Rs1 ^ Rs2_or_imm13;
5423587Sgblack@eecs.umich.edu                }});
5433587Sgblack@eecs.umich.edu                0x14: Priv::wrsoftint_set({{SoftintSet = Rs1 ^ Rs2_or_imm13;}});
5443587Sgblack@eecs.umich.edu                0x15: Priv::wrsoftint_clr({{SoftintClr = Rs1 ^ Rs2_or_imm13;}});
5453587Sgblack@eecs.umich.edu                0x16: Priv::wrsoftint({{Softint = Rs1 ^ Rs2_or_imm13;}});
5463587Sgblack@eecs.umich.edu                0x17: Priv::wrtick_cmpr({{TickCmpr = Rs1 ^ Rs2_or_imm13;}});
5473587Sgblack@eecs.umich.edu                0x18: NoPriv::wrstick({{
5483587Sgblack@eecs.umich.edu                    if(!Hpstate<2:>)
5493587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
5503587Sgblack@eecs.umich.edu                    Stick = Rs1 ^ Rs2_or_imm13;
5513587Sgblack@eecs.umich.edu                }});
5523587Sgblack@eecs.umich.edu                0x19: Priv::wrstick_cmpr({{StickCmpr = Rs1 ^ Rs2_or_imm13;}});
5533598Sgblack@eecs.umich.edu                0x1A: Priv::wrstrand_sts_reg({{
5543598Sgblack@eecs.umich.edu                    if(Pstate<2:> && !Hpstate<2:>)
5553598Sgblack@eecs.umich.edu                        StrandStsReg = StrandStsReg<63:1> |
5563598Sgblack@eecs.umich.edu                                (Rs1 ^ Rs2_or_imm13)<0:>;
5573598Sgblack@eecs.umich.edu                    else
5583598Sgblack@eecs.umich.edu                        StrandStsReg = Rs1 ^ Rs2_or_imm13;
5593598Sgblack@eecs.umich.edu                }});
5603598Sgblack@eecs.umich.edu                //0x1A is supposed to be reserved, but it writes the strand
5613598Sgblack@eecs.umich.edu                //status register.
5623598Sgblack@eecs.umich.edu                //0x1B-0x1F should cause an illegal instruction exception
5633587Sgblack@eecs.umich.edu            }
5642526SN/A            0x31: decode FCN {
5653417Sgblack@eecs.umich.edu                0x0: Priv::saved({{
5663417Sgblack@eecs.umich.edu                    assert(Cansave < NWindows - 2);
5673417Sgblack@eecs.umich.edu                    assert(Otherwin || Canrestore);
5683417Sgblack@eecs.umich.edu                    Cansave = Cansave + 1;
5693417Sgblack@eecs.umich.edu                    if(Otherwin == 0)
5703417Sgblack@eecs.umich.edu                        Canrestore = Canrestore - 1;
5713417Sgblack@eecs.umich.edu                    else
5723417Sgblack@eecs.umich.edu                        Otherwin = Otherwin - 1;
5733417Sgblack@eecs.umich.edu                }});
5743598Sgblack@eecs.umich.edu                0x1: Priv::restored({{
5753417Sgblack@eecs.umich.edu                    assert(Cansave || Otherwin);
5763417Sgblack@eecs.umich.edu                    assert(Canrestore < NWindows - 2);
5773417Sgblack@eecs.umich.edu                    Canrestore = Canrestore + 1;
5783417Sgblack@eecs.umich.edu                    if(Otherwin == 0)
5793417Sgblack@eecs.umich.edu                        Cansave = Cansave - 1;
5803417Sgblack@eecs.umich.edu                    else
5813417Sgblack@eecs.umich.edu                        Otherwin = Otherwin - 1;
5823417Sgblack@eecs.umich.edu                }});
5832526SN/A            }
5843587Sgblack@eecs.umich.edu            0x32: decode RD {
5853587Sgblack@eecs.umich.edu                0x00: Priv::wrprtpc({{
5863587Sgblack@eecs.umich.edu                    if(Tl == 0)
5873587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
5883587Sgblack@eecs.umich.edu                    else
5893587Sgblack@eecs.umich.edu                        Tpc = Rs1 ^ Rs2_or_imm13;
5903587Sgblack@eecs.umich.edu                }});
5913587Sgblack@eecs.umich.edu                0x01: Priv::wrprtnpc({{
5923587Sgblack@eecs.umich.edu                    if(Tl == 0)
5933587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
5943587Sgblack@eecs.umich.edu                    else
5953587Sgblack@eecs.umich.edu                        Tnpc = Rs1 ^ Rs2_or_imm13;
5963587Sgblack@eecs.umich.edu                }});
5973587Sgblack@eecs.umich.edu                0x02: Priv::wrprtstate({{
5983587Sgblack@eecs.umich.edu                    if(Tl == 0)
5993587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
6003587Sgblack@eecs.umich.edu                    else
6013587Sgblack@eecs.umich.edu                        Tstate = Rs1 ^ Rs2_or_imm13;
6023587Sgblack@eecs.umich.edu                }});
6033587Sgblack@eecs.umich.edu                0x03: Priv::wrprtt({{
6043587Sgblack@eecs.umich.edu                    if(Tl == 0)
6053587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
6063587Sgblack@eecs.umich.edu                    else
6073587Sgblack@eecs.umich.edu                        Tt = Rs1 ^ Rs2_or_imm13;
6083587Sgblack@eecs.umich.edu                }});
6093587Sgblack@eecs.umich.edu                0x04: HPriv::wrprtick({{Tick = Rs1 ^ Rs2_or_imm13;}});
6103587Sgblack@eecs.umich.edu                0x05: Priv::wrprtba({{Tba = Rs1 ^ Rs2_or_imm13;}});
6113587Sgblack@eecs.umich.edu                0x06: Priv::wrprpstate({{Pstate = Rs1 ^ Rs2_or_imm13;}});
6123587Sgblack@eecs.umich.edu                0x07: Priv::wrprtl({{
6133587Sgblack@eecs.umich.edu                    if(Pstate<2:> && !Hpstate<2:>)
6143587Sgblack@eecs.umich.edu                        Tl = std::min<uint64_t>(Rs1 ^ Rs2_or_imm13, MaxPTL);
6153587Sgblack@eecs.umich.edu                    else
6163587Sgblack@eecs.umich.edu                        Tl = std::min<uint64_t>(Rs1 ^ Rs2_or_imm13, MaxTL);
6173587Sgblack@eecs.umich.edu                }});
6183587Sgblack@eecs.umich.edu                0x08: Priv::wrprpil({{Pil = Rs1 ^ Rs2_or_imm13;}});
6193587Sgblack@eecs.umich.edu                0x09: Priv::wrprcwp({{Cwp = Rs1 ^ Rs2_or_imm13;}});
6203587Sgblack@eecs.umich.edu                0x0A: Priv::wrprcansave({{Cansave = Rs1 ^ Rs2_or_imm13;}});
6213587Sgblack@eecs.umich.edu                0x0B: Priv::wrprcanrestore({{Canrestore = Rs1 ^ Rs2_or_imm13;}});
6223587Sgblack@eecs.umich.edu                0x0C: Priv::wrprcleanwin({{Cleanwin = Rs1 ^ Rs2_or_imm13;}});
6233587Sgblack@eecs.umich.edu                0x0D: Priv::wrprotherwin({{Otherwin = Rs1 ^ Rs2_or_imm13;}});
6243587Sgblack@eecs.umich.edu                0x0E: Priv::wrprwstate({{Wstate = Rs1 ^ Rs2_or_imm13;}});
6253587Sgblack@eecs.umich.edu                //0x0F should cause an illegal instruction exception
6263587Sgblack@eecs.umich.edu                0x10: Priv::wrprgl({{
6273587Sgblack@eecs.umich.edu                    if(Pstate<2:> && !Hpstate<2:>)
6283587Sgblack@eecs.umich.edu                        Gl = std::min<uint64_t>(Rs1 ^ Rs2_or_imm13, MaxPGL);
6293587Sgblack@eecs.umich.edu                    else
6303587Sgblack@eecs.umich.edu                        Gl = std::min<uint64_t>(Rs1 ^ Rs2_or_imm13, MaxGL);
6313587Sgblack@eecs.umich.edu                }});
6323587Sgblack@eecs.umich.edu                //0x11-0x1F should cause an illegal instruction exception
6333587Sgblack@eecs.umich.edu            }
6343587Sgblack@eecs.umich.edu            0x33: decode RD {
6353587Sgblack@eecs.umich.edu                0x00: HPriv::wrhprhpstate({{Hpstate = Rs1 ^ Rs2_or_imm13;}});
6363587Sgblack@eecs.umich.edu                0x01: HPriv::wrhprhtstate({{
6373587Sgblack@eecs.umich.edu                    if(Tl == 0)
6383587Sgblack@eecs.umich.edu                        return new IllegalInstruction;
6393587Sgblack@eecs.umich.edu                    Htstate = Rs1 ^ Rs2_or_imm13;
6403587Sgblack@eecs.umich.edu                }});
6413587Sgblack@eecs.umich.edu                //0x02 should cause an illegal instruction exception
6423587Sgblack@eecs.umich.edu                0x03: HPriv::wrhprhintp({{Hintp = Rs1 ^ Rs2_or_imm13;}});
6433587Sgblack@eecs.umich.edu                //0x04 should cause an illegal instruction exception
6443587Sgblack@eecs.umich.edu                0x05: HPriv::wrhprhtba({{Htba = Rs1 ^ Rs2_or_imm13;}});
6453587Sgblack@eecs.umich.edu                //0x06-0x01D should cause an illegal instruction exception
6463587Sgblack@eecs.umich.edu                0x1F: HPriv::wrhprhstick_cmpr({{HstickCmpr = Rs1 ^ Rs2_or_imm13;}});
6473587Sgblack@eecs.umich.edu            }
6482954Sgblack@eecs.umich.edu            0x34: decode OPF{
6492963Sgblack@eecs.umich.edu                format BasicOperate{
6502963Sgblack@eecs.umich.edu                    0x01: fmovs({{
6513279Sgblack@eecs.umich.edu                        Frds.uw = Frs2s.uw;
6522963Sgblack@eecs.umich.edu                        //fsr.ftt = fsr.cexc = 0
6532963Sgblack@eecs.umich.edu                        Fsr &= ~(7 << 14);
6542963Sgblack@eecs.umich.edu                        Fsr &= ~(0x1F);
6552963Sgblack@eecs.umich.edu                    }});
6562963Sgblack@eecs.umich.edu                    0x02: fmovd({{
6573057Sgblack@eecs.umich.edu                        Frd.udw = Frs2.udw;
6582963Sgblack@eecs.umich.edu                        //fsr.ftt = fsr.cexc = 0
6592963Sgblack@eecs.umich.edu                        Fsr &= ~(7 << 14);
6602963Sgblack@eecs.umich.edu                        Fsr &= ~(0x1F);
6612963Sgblack@eecs.umich.edu                    }});
6622963Sgblack@eecs.umich.edu                    0x03: Trap::fmovq({{fault = new FpDisabled;}});
6632963Sgblack@eecs.umich.edu                    0x05: fnegs({{
6643279Sgblack@eecs.umich.edu                        Frds.uw = Frs2s.uw ^ (1UL << 31);
6652963Sgblack@eecs.umich.edu                        //fsr.ftt = fsr.cexc = 0
6662963Sgblack@eecs.umich.edu                        Fsr &= ~(7 << 14);
6672963Sgblack@eecs.umich.edu                        Fsr &= ~(0x1F);
6682963Sgblack@eecs.umich.edu                    }});
6692963Sgblack@eecs.umich.edu                    0x06: fnegd({{
6703057Sgblack@eecs.umich.edu                        Frd.udw = Frs2.udw ^ (1ULL << 63);
6712963Sgblack@eecs.umich.edu                        //fsr.ftt = fsr.cexc = 0
6722963Sgblack@eecs.umich.edu                        Fsr &= ~(7 << 14);
6732963Sgblack@eecs.umich.edu                        Fsr &= ~(0x1F);
6742963Sgblack@eecs.umich.edu                    }});
6752963Sgblack@eecs.umich.edu                    0x07: Trap::fnegq({{fault = new FpDisabled;}});
6762963Sgblack@eecs.umich.edu                    0x09: fabss({{
6773279Sgblack@eecs.umich.edu                        Frds.uw = ((1UL << 31) - 1) & Frs2s.uw;
6782963Sgblack@eecs.umich.edu                        //fsr.ftt = fsr.cexc = 0
6792963Sgblack@eecs.umich.edu                        Fsr &= ~(7 << 14);
6802963Sgblack@eecs.umich.edu                        Fsr &= ~(0x1F);
6812963Sgblack@eecs.umich.edu                    }});
6822963Sgblack@eecs.umich.edu                    0x0A: fabsd({{
6833057Sgblack@eecs.umich.edu                        Frd.udw = ((1ULL << 63) - 1) & Frs2.udw;
6842963Sgblack@eecs.umich.edu                        //fsr.ftt = fsr.cexc = 0
6852963Sgblack@eecs.umich.edu                        Fsr &= ~(7 << 14);
6862963Sgblack@eecs.umich.edu                        Fsr &= ~(0x1F);
6872963Sgblack@eecs.umich.edu                    }});
6882963Sgblack@eecs.umich.edu                    0x0B: Trap::fabsq({{fault = new FpDisabled;}});
6893279Sgblack@eecs.umich.edu                    0x29: fsqrts({{Frds.sf = sqrt(Frs2s.sf);}});
6902963Sgblack@eecs.umich.edu                    0x2A: fsqrtd({{Frd.df = sqrt(Frs2.df);}});
6912963Sgblack@eecs.umich.edu                    0x2B: Trap::fsqrtq({{fault = new FpDisabled;}});
6923279Sgblack@eecs.umich.edu                    0x41: fadds({{Frds.sf = Frs1s.sf + Frs2s.sf;}});
6932963Sgblack@eecs.umich.edu                    0x42: faddd({{Frd.df = Frs1.df + Frs2.df;}});
6942963Sgblack@eecs.umich.edu                    0x43: Trap::faddq({{fault = new FpDisabled;}});
6953279Sgblack@eecs.umich.edu                    0x45: fsubs({{Frds.sf = Frs1s.sf - Frs2s.sf;}});
6962963Sgblack@eecs.umich.edu                    0x46: fsubd({{Frd.df = Frs1.df - Frs2.df;}});
6972963Sgblack@eecs.umich.edu                    0x47: Trap::fsubq({{fault = new FpDisabled;}});
6983279Sgblack@eecs.umich.edu                    0x49: fmuls({{Frds.sf = Frs1s.sf * Frs2s.sf;}});
6992963Sgblack@eecs.umich.edu                    0x4A: fmuld({{Frd.df = Frs1.df * Frs2.df;}});
7002963Sgblack@eecs.umich.edu                    0x4B: Trap::fmulq({{fault = new FpDisabled;}});
7013279Sgblack@eecs.umich.edu                    0x4D: fdivs({{Frds.sf = Frs1s.sf / Frs2s.sf;}});
7022963Sgblack@eecs.umich.edu                    0x4E: fdivd({{Frd.df = Frs1.df / Frs2.df;}});
7032963Sgblack@eecs.umich.edu                    0x4F: Trap::fdivq({{fault = new FpDisabled;}});
7043279Sgblack@eecs.umich.edu                    0x69: fsmuld({{Frd.df = Frs1s.sf * Frs2s.sf;}});
7052963Sgblack@eecs.umich.edu                    0x6E: Trap::fdmulq({{fault = new FpDisabled;}});
7062963Sgblack@eecs.umich.edu                    0x81: fstox({{
7073279Sgblack@eecs.umich.edu                            Frd.df = (double)static_cast<int64_t>(Frs2s.sf);
7082963Sgblack@eecs.umich.edu                    }});
7092963Sgblack@eecs.umich.edu                    0x82: fdtox({{
7102963Sgblack@eecs.umich.edu                            Frd.df = (double)static_cast<int64_t>(Frs2.df);
7112963Sgblack@eecs.umich.edu                    }});
7122963Sgblack@eecs.umich.edu                    0x83: Trap::fqtox({{fault = new FpDisabled;}});
7132963Sgblack@eecs.umich.edu                    0x84: fxtos({{
7143279Sgblack@eecs.umich.edu                            Frds.sf = static_cast<float>((int64_t)Frs2.df);
7152963Sgblack@eecs.umich.edu                    }});
7162963Sgblack@eecs.umich.edu                    0x88: fxtod({{
7172963Sgblack@eecs.umich.edu                            Frd.df = static_cast<double>((int64_t)Frs2.df);
7182963Sgblack@eecs.umich.edu                    }});
7192963Sgblack@eecs.umich.edu                    0x8C: Trap::fxtoq({{fault = new FpDisabled;}});
7202963Sgblack@eecs.umich.edu                    0xC4: fitos({{
7213279Sgblack@eecs.umich.edu                            Frds.sf = static_cast<float>((int32_t)Frs2s.sf);
7222963Sgblack@eecs.umich.edu                    }});
7233279Sgblack@eecs.umich.edu                    0xC6: fdtos({{Frds.sf = Frs2.df;}});
7242963Sgblack@eecs.umich.edu                    0xC7: Trap::fqtos({{fault = new FpDisabled;}});
7252963Sgblack@eecs.umich.edu                    0xC8: fitod({{
7263279Sgblack@eecs.umich.edu                            Frd.df = static_cast<double>((int32_t)Frs2s.sf);
7272963Sgblack@eecs.umich.edu                    }});
7283279Sgblack@eecs.umich.edu                    0xC9: fstod({{Frd.df = Frs2s.sf;}});
7292963Sgblack@eecs.umich.edu                    0xCB: Trap::fqtod({{fault = new FpDisabled;}});
7302963Sgblack@eecs.umich.edu                    0xCC: Trap::fitoq({{fault = new FpDisabled;}});
7312963Sgblack@eecs.umich.edu                    0xCD: Trap::fstoq({{fault = new FpDisabled;}});
7322963Sgblack@eecs.umich.edu                    0xCE: Trap::fdtoq({{fault = new FpDisabled;}});
7332963Sgblack@eecs.umich.edu                    0xD1: fstoi({{
7343279Sgblack@eecs.umich.edu                            Frds.sf = (float)static_cast<int32_t>(Frs2s.sf);
7352963Sgblack@eecs.umich.edu                    }});
7362963Sgblack@eecs.umich.edu                    0xD2: fdtoi({{
7373279Sgblack@eecs.umich.edu                            Frds.sf = (float)static_cast<int32_t>(Frs2.df);
7382963Sgblack@eecs.umich.edu                    }});
7392963Sgblack@eecs.umich.edu                    0xD3: Trap::fqtoi({{fault = new FpDisabled;}});
7402963Sgblack@eecs.umich.edu                    default: Trap::fpop1({{fault = new FpDisabled;}});
7412963Sgblack@eecs.umich.edu                }
7422954Sgblack@eecs.umich.edu            }
7432526SN/A            0x35: Trap::fpop2({{fault = new FpDisabled;}});
7442954Sgblack@eecs.umich.edu            //This used to be just impdep1, but now it's a whole bunch
7452954Sgblack@eecs.umich.edu            //of instructions
7462954Sgblack@eecs.umich.edu            0x36: decode OPF{
7472954Sgblack@eecs.umich.edu                0x00: Trap::edge8({{fault = new IllegalInstruction;}});
7482954Sgblack@eecs.umich.edu                0x01: Trap::edge8n({{fault = new IllegalInstruction;}});
7492954Sgblack@eecs.umich.edu                0x02: Trap::edge8l({{fault = new IllegalInstruction;}});
7502954Sgblack@eecs.umich.edu                0x03: Trap::edge8ln({{fault = new IllegalInstruction;}});
7512954Sgblack@eecs.umich.edu                0x04: Trap::edge16({{fault = new IllegalInstruction;}});
7522954Sgblack@eecs.umich.edu                0x05: Trap::edge16n({{fault = new IllegalInstruction;}});
7532954Sgblack@eecs.umich.edu                0x06: Trap::edge16l({{fault = new IllegalInstruction;}});
7542954Sgblack@eecs.umich.edu                0x07: Trap::edge16ln({{fault = new IllegalInstruction;}});
7552954Sgblack@eecs.umich.edu                0x08: Trap::edge32({{fault = new IllegalInstruction;}});
7562954Sgblack@eecs.umich.edu                0x09: Trap::edge32n({{fault = new IllegalInstruction;}});
7572954Sgblack@eecs.umich.edu                0x0A: Trap::edge32l({{fault = new IllegalInstruction;}});
7582954Sgblack@eecs.umich.edu                0x0B: Trap::edge32ln({{fault = new IllegalInstruction;}});
7592954Sgblack@eecs.umich.edu                0x10: Trap::array8({{fault = new IllegalInstruction;}});
7602954Sgblack@eecs.umich.edu                0x12: Trap::array16({{fault = new IllegalInstruction;}});
7612954Sgblack@eecs.umich.edu                0x14: Trap::array32({{fault = new IllegalInstruction;}});
7623042Sgblack@eecs.umich.edu                0x18: BasicOperate::alignaddr({{
7632963Sgblack@eecs.umich.edu                    uint64_t sum = Rs1 + Rs2;
7643042Sgblack@eecs.umich.edu                    Rd = sum & ~7;
7652963Sgblack@eecs.umich.edu                    Gsr = (Gsr & ~7) | (sum & 7);
7662963Sgblack@eecs.umich.edu                }});
7672954Sgblack@eecs.umich.edu                0x19: Trap::bmask({{fault = new IllegalInstruction;}});
7682963Sgblack@eecs.umich.edu                0x1A: BasicOperate::alignaddresslittle({{
7692963Sgblack@eecs.umich.edu                    uint64_t sum = Rs1 + Rs2;
7703042Sgblack@eecs.umich.edu                    Rd = sum & ~7;
7712963Sgblack@eecs.umich.edu                    Gsr = (Gsr & ~7) | ((~sum + 1) & 7);
7722963Sgblack@eecs.umich.edu                }});
7732954Sgblack@eecs.umich.edu                0x20: Trap::fcmple16({{fault = new IllegalInstruction;}});
7742954Sgblack@eecs.umich.edu                0x22: Trap::fcmpne16({{fault = new IllegalInstruction;}});
7752954Sgblack@eecs.umich.edu                0x24: Trap::fcmple32({{fault = new IllegalInstruction;}});
7762954Sgblack@eecs.umich.edu                0x26: Trap::fcmpne32({{fault = new IllegalInstruction;}});
7772954Sgblack@eecs.umich.edu                0x28: Trap::fcmpgt16({{fault = new IllegalInstruction;}});
7782954Sgblack@eecs.umich.edu                0x2A: Trap::fcmpeq16({{fault = new IllegalInstruction;}});
7792954Sgblack@eecs.umich.edu                0x2C: Trap::fcmpgt32({{fault = new IllegalInstruction;}});
7802954Sgblack@eecs.umich.edu                0x2E: Trap::fcmpeq32({{fault = new IllegalInstruction;}});
7812954Sgblack@eecs.umich.edu                0x31: Trap::fmul8x16({{fault = new IllegalInstruction;}});
7822954Sgblack@eecs.umich.edu                0x33: Trap::fmul8x16au({{fault = new IllegalInstruction;}});
7832954Sgblack@eecs.umich.edu                0x35: Trap::fmul8x16al({{fault = new IllegalInstruction;}});
7842954Sgblack@eecs.umich.edu                0x36: Trap::fmul8sux16({{fault = new IllegalInstruction;}});
7852954Sgblack@eecs.umich.edu                0x37: Trap::fmul8ulx16({{fault = new IllegalInstruction;}});
7862954Sgblack@eecs.umich.edu                0x38: Trap::fmuld8sux16({{fault = new IllegalInstruction;}});
7872954Sgblack@eecs.umich.edu                0x39: Trap::fmuld8ulx16({{fault = new IllegalInstruction;}});
7882954Sgblack@eecs.umich.edu                0x3A: Trap::fpack32({{fault = new IllegalInstruction;}});
7892954Sgblack@eecs.umich.edu                0x3B: Trap::fpack16({{fault = new IllegalInstruction;}});
7902954Sgblack@eecs.umich.edu                0x3D: Trap::fpackfix({{fault = new IllegalInstruction;}});
7912954Sgblack@eecs.umich.edu                0x3E: Trap::pdist({{fault = new IllegalInstruction;}});
7922963Sgblack@eecs.umich.edu                0x48: BasicOperate::faligndata({{
7933057Sgblack@eecs.umich.edu                        uint64_t msbX = Frs1.udw;
7943057Sgblack@eecs.umich.edu                        uint64_t lsbX = Frs2.udw;
7953057Sgblack@eecs.umich.edu                        //Some special cases need to be split out, first
7963057Sgblack@eecs.umich.edu                        //because they're the most likely to be used, and
7973057Sgblack@eecs.umich.edu                        //second because otherwise, we end up shifting by
7983057Sgblack@eecs.umich.edu                        //greater than the width of the type being shifted,
7993057Sgblack@eecs.umich.edu                        //namely 64, which produces undefined results according
8003057Sgblack@eecs.umich.edu                        //to the C standard.
8013057Sgblack@eecs.umich.edu                        switch(Gsr<2:0>)
8023057Sgblack@eecs.umich.edu                        {
8033057Sgblack@eecs.umich.edu                            case 0:
8043057Sgblack@eecs.umich.edu                                Frd.udw = msbX;
8053057Sgblack@eecs.umich.edu                                break;
8063057Sgblack@eecs.umich.edu                            case 8:
8073057Sgblack@eecs.umich.edu                                Frd.udw = lsbX;
8083057Sgblack@eecs.umich.edu                                break;
8093057Sgblack@eecs.umich.edu                            default:
8103057Sgblack@eecs.umich.edu                                uint64_t msbShift = Gsr<2:0> * 8;
8113057Sgblack@eecs.umich.edu                                uint64_t lsbShift = (8 - Gsr<2:0>) * 8;
8123057Sgblack@eecs.umich.edu                                uint64_t msbMask = ((uint64_t)(-1)) >> msbShift;
8133057Sgblack@eecs.umich.edu                                uint64_t lsbMask = ((uint64_t)(-1)) << lsbShift;
8143057Sgblack@eecs.umich.edu                                Frd.udw = ((msbX & msbMask) << msbShift) |
8153057Sgblack@eecs.umich.edu                                        ((lsbX & lsbMask) >> lsbShift);
8163057Sgblack@eecs.umich.edu                        }
8172963Sgblack@eecs.umich.edu                }});
8182954Sgblack@eecs.umich.edu                0x4B: Trap::fpmerge({{fault = new IllegalInstruction;}});
8192954Sgblack@eecs.umich.edu                0x4C: Trap::bshuffle({{fault = new IllegalInstruction;}});
8202954Sgblack@eecs.umich.edu                0x4D: Trap::fexpand({{fault = new IllegalInstruction;}});
8212954Sgblack@eecs.umich.edu                0x50: Trap::fpadd16({{fault = new IllegalInstruction;}});
8222954Sgblack@eecs.umich.edu                0x51: Trap::fpadd16s({{fault = new IllegalInstruction;}});
8232954Sgblack@eecs.umich.edu                0x52: Trap::fpadd32({{fault = new IllegalInstruction;}});
8242954Sgblack@eecs.umich.edu                0x53: Trap::fpadd32s({{fault = new IllegalInstruction;}});
8252954Sgblack@eecs.umich.edu                0x54: Trap::fpsub16({{fault = new IllegalInstruction;}});
8262954Sgblack@eecs.umich.edu                0x55: Trap::fpsub16s({{fault = new IllegalInstruction;}});
8272954Sgblack@eecs.umich.edu                0x56: Trap::fpsub32({{fault = new IllegalInstruction;}});
8282954Sgblack@eecs.umich.edu                0x57: Trap::fpsub32s({{fault = new IllegalInstruction;}});
8292963Sgblack@eecs.umich.edu                0x60: BasicOperate::fzero({{Frd.df = 0;}});
8303279Sgblack@eecs.umich.edu                0x61: BasicOperate::fzeros({{Frds.sf = 0;}});
8312954Sgblack@eecs.umich.edu                0x62: Trap::fnor({{fault = new IllegalInstruction;}});
8322954Sgblack@eecs.umich.edu                0x63: Trap::fnors({{fault = new IllegalInstruction;}});
8332954Sgblack@eecs.umich.edu                0x64: Trap::fandnot2({{fault = new IllegalInstruction;}});
8342954Sgblack@eecs.umich.edu                0x65: Trap::fandnot2s({{fault = new IllegalInstruction;}});
8352963Sgblack@eecs.umich.edu                0x66: BasicOperate::fnot2({{
8362963Sgblack@eecs.umich.edu                        Frd.df = (double)(~((uint64_t)Frs2.df));
8372963Sgblack@eecs.umich.edu                }});
8382963Sgblack@eecs.umich.edu                0x67: BasicOperate::fnot2s({{
8393279Sgblack@eecs.umich.edu                        Frds.sf = (float)(~((uint32_t)Frs2s.sf));
8402963Sgblack@eecs.umich.edu                }});
8412954Sgblack@eecs.umich.edu                0x68: Trap::fandnot1({{fault = new IllegalInstruction;}});
8422954Sgblack@eecs.umich.edu                0x69: Trap::fandnot1s({{fault = new IllegalInstruction;}});
8432963Sgblack@eecs.umich.edu                0x6A: BasicOperate::fnot1({{
8442963Sgblack@eecs.umich.edu                        Frd.df = (double)(~((uint64_t)Frs1.df));
8452963Sgblack@eecs.umich.edu                }});
8462963Sgblack@eecs.umich.edu                0x6B: BasicOperate::fnot1s({{
8473279Sgblack@eecs.umich.edu                        Frds.sf = (float)(~((uint32_t)Frs1s.sf));
8482963Sgblack@eecs.umich.edu                }});
8492954Sgblack@eecs.umich.edu                0x6C: Trap::fxor({{fault = new IllegalInstruction;}});
8502954Sgblack@eecs.umich.edu                0x6D: Trap::fxors({{fault = new IllegalInstruction;}});
8512954Sgblack@eecs.umich.edu                0x6E: Trap::fnand({{fault = new IllegalInstruction;}});
8522954Sgblack@eecs.umich.edu                0x6F: Trap::fnands({{fault = new IllegalInstruction;}});
8532954Sgblack@eecs.umich.edu                0x70: Trap::fand({{fault = new IllegalInstruction;}});
8542954Sgblack@eecs.umich.edu                0x71: Trap::fands({{fault = new IllegalInstruction;}});
8552954Sgblack@eecs.umich.edu                0x72: Trap::fxnor({{fault = new IllegalInstruction;}});
8562954Sgblack@eecs.umich.edu                0x73: Trap::fxnors({{fault = new IllegalInstruction;}});
8573057Sgblack@eecs.umich.edu                0x74: BasicOperate::fsrc1({{Frd.udw = Frs1.udw;}});
8583057Sgblack@eecs.umich.edu                0x75: BasicOperate::fsrc1s({{Frd.uw = Frs1.uw;}});
8592954Sgblack@eecs.umich.edu                0x76: Trap::fornot2({{fault = new IllegalInstruction;}});
8602954Sgblack@eecs.umich.edu                0x77: Trap::fornot2s({{fault = new IllegalInstruction;}});
8613057Sgblack@eecs.umich.edu                0x78: BasicOperate::fsrc2({{Frd.udw = Frs2.udw;}});
8623057Sgblack@eecs.umich.edu                0x79: BasicOperate::fsrc2s({{Frd.uw = Frs2.uw;}});
8632954Sgblack@eecs.umich.edu                0x7A: Trap::fornot1({{fault = new IllegalInstruction;}});
8642954Sgblack@eecs.umich.edu                0x7B: Trap::fornot1s({{fault = new IllegalInstruction;}});
8652954Sgblack@eecs.umich.edu                0x7C: Trap::for({{fault = new IllegalInstruction;}});
8662954Sgblack@eecs.umich.edu                0x7D: Trap::fors({{fault = new IllegalInstruction;}});
8672954Sgblack@eecs.umich.edu                0x7E: Trap::fone({{fault = new IllegalInstruction;}});
8682954Sgblack@eecs.umich.edu                0x7F: Trap::fones({{fault = new IllegalInstruction;}});
8692954Sgblack@eecs.umich.edu                0x80: Trap::shutdown({{fault = new IllegalInstruction;}});
8702954Sgblack@eecs.umich.edu                0x81: Trap::siam({{fault = new IllegalInstruction;}});
8712954Sgblack@eecs.umich.edu            }
8722954Sgblack@eecs.umich.edu            0x37: Trap::impdep2({{fault = new IllegalInstruction;}});
8732526SN/A            0x38: Branch::jmpl({{
8742526SN/A                Addr target = Rs1 + Rs2_or_imm13;
8752526SN/A                if(target & 0x3)
8762526SN/A                    fault = new MemAddressNotAligned;
8772526SN/A                else
8782526SN/A                {
8792526SN/A                    Rd = xc->readPC();
8802526SN/A                    NNPC = target;
8812526SN/A                }
8822526SN/A            }});
8832526SN/A            0x39: Branch::return({{
8842561SN/A                //If both MemAddressNotAligned and
8852561SN/A                //a fill trap happen, it's not clear
8862561SN/A                //which one should be returned.
8872526SN/A                Addr target = Rs1 + Rs2_or_imm13;
8882526SN/A                if(target & 0x3)
8892526SN/A                    fault = new MemAddressNotAligned;
8902526SN/A                else
8912526SN/A                    NNPC = target;
8922561SN/A                if(fault == NoFault)
8932561SN/A                {
8942561SN/A                    if(Canrestore == 0)
8952561SN/A                    {
8962561SN/A                        if(Otherwin)
8972646Ssaidi@eecs.umich.edu                            fault = new FillNOther(Wstate<5:3>);
8982561SN/A                        else
8992646Ssaidi@eecs.umich.edu                            fault = new FillNNormal(Wstate<2:0>);
9002561SN/A                    }
9012561SN/A                    else
9022561SN/A                    {
9033417Sgblack@eecs.umich.edu                        //CWP should be set directly so that it always happens
9043417Sgblack@eecs.umich.edu                        //Also, this will allow writing to the new window and
9053417Sgblack@eecs.umich.edu                        //reading from the old one
9063417Sgblack@eecs.umich.edu                        Cwp = (Cwp - 1 + NWindows) % NWindows;
9072561SN/A                        Cansave = Cansave + 1;
9082561SN/A                        Canrestore = Canrestore - 1;
9093417Sgblack@eecs.umich.edu                        //This is here to make sure the CWP is written
9103417Sgblack@eecs.umich.edu                        //no matter what. This ensures that the results
9113417Sgblack@eecs.umich.edu                        //are written in the new window as well.
9123417Sgblack@eecs.umich.edu                        xc->setMiscRegWithEffect(MISCREG_CWP, Cwp);
9132561SN/A                    }
9142561SN/A                }
9152526SN/A            }});
9162526SN/A            0x3A: decode CC
9172526SN/A            {
9182526SN/A                0x0: Trap::tcci({{
9192646Ssaidi@eecs.umich.edu                    if(passesCondition(Ccr<3:0>, COND2))
9202561SN/A                    {
9213039Sstever@eecs.umich.edu#if FULL_SYSTEM
9222561SN/A                        int lTrapNum = I ? (Rs1 + SW_TRAP) : (Rs1 + Rs2);
9232561SN/A                        DPRINTF(Sparc, "The trap number is %d\n", lTrapNum);
9243531Sgblack@eecs.umich.edu                        fault = new TrapInstruction(lTrapNum);
9252526SN/A#else
9262561SN/A                        DPRINTF(Sparc, "The syscall number is %d\n", R1);
9272561SN/A                        xc->syscall(R1);
9282561SN/A#endif
9292561SN/A                    }
9302526SN/A                }});
9312526SN/A                0x2: Trap::tccx({{
9322646Ssaidi@eecs.umich.edu                    if(passesCondition(Ccr<7:4>, COND2))
9332561SN/A                    {
9343039Sstever@eecs.umich.edu#if FULL_SYSTEM
9352561SN/A                        int lTrapNum = I ? (Rs1 + SW_TRAP) : (Rs1 + Rs2);
9362561SN/A                        DPRINTF(Sparc, "The trap number is %d\n", lTrapNum);
9373531Sgblack@eecs.umich.edu                        fault = new TrapInstruction(lTrapNum);
9382526SN/A#else
9392561SN/A                        DPRINTF(Sparc, "The syscall number is %d\n", R1);
9402561SN/A                        xc->syscall(R1);
9412561SN/A#endif
9422526SN/A                    }
9432526SN/A                }});
9442526SN/A            }
9452526SN/A            0x3B: Nop::flush({{/*Instruction memory flush*/}});
9462526SN/A            0x3C: save({{
9472526SN/A                //CWP should be set directly so that it always happens
9482526SN/A                //Also, this will allow writing to the new window and
9492526SN/A                //reading from the old one
9502526SN/A                if(Cansave == 0)
9512526SN/A                {
9522526SN/A                    if(Otherwin)
9532646Ssaidi@eecs.umich.edu                        fault = new SpillNOther(Wstate<5:3>);
9542526SN/A                    else
9552646Ssaidi@eecs.umich.edu                        fault = new SpillNNormal(Wstate<2:0>);
9563417Sgblack@eecs.umich.edu                    //Cwp = (Cwp + 2) % NWindows;
9572526SN/A                }
9582526SN/A                else if(Cleanwin - Canrestore == 0)
9592526SN/A                {
9603417Sgblack@eecs.umich.edu                    //Cwp = (Cwp + 1) % NWindows;
9612526SN/A                    fault = new CleanWindow;
9622526SN/A                }
9632526SN/A                else
9642526SN/A                {
9652526SN/A                    Cwp = (Cwp + 1) % NWindows;
9662526SN/A                    Rd = Rs1 + Rs2_or_imm13;
9672561SN/A                    Cansave = Cansave - 1;
9682561SN/A                    Canrestore = Canrestore + 1;
9693417Sgblack@eecs.umich.edu                    //This is here to make sure the CWP is written
9703417Sgblack@eecs.umich.edu                    //no matter what. This ensures that the results
9713417Sgblack@eecs.umich.edu                    //are written in the new window as well.
9723417Sgblack@eecs.umich.edu                    xc->setMiscRegWithEffect(MISCREG_CWP, Cwp);
9732526SN/A                }
9742526SN/A            }});
9752526SN/A            0x3D: restore({{
9762526SN/A                if(Canrestore == 0)
9772526SN/A                {
9782526SN/A                    if(Otherwin)
9792646Ssaidi@eecs.umich.edu                        fault = new FillNOther(Wstate<5:3>);
9802526SN/A                    else
9812646Ssaidi@eecs.umich.edu                        fault = new FillNNormal(Wstate<2:0>);
9822526SN/A                }
9832526SN/A                else
9842526SN/A                {
9853417Sgblack@eecs.umich.edu                    //CWP should be set directly so that it always happens
9863417Sgblack@eecs.umich.edu                    //Also, this will allow writing to the new window and
9873417Sgblack@eecs.umich.edu                    //reading from the old one
9883417Sgblack@eecs.umich.edu                    Cwp = (Cwp - 1 + NWindows) % NWindows;
9892526SN/A                    Rd = Rs1 + Rs2_or_imm13;
9902561SN/A                    Cansave = Cansave + 1;
9912561SN/A                    Canrestore = Canrestore - 1;
9923417Sgblack@eecs.umich.edu                    //This is here to make sure the CWP is written
9933417Sgblack@eecs.umich.edu                    //no matter what. This ensures that the results
9943417Sgblack@eecs.umich.edu                    //are written in the new window as well.
9953417Sgblack@eecs.umich.edu                    xc->setMiscRegWithEffect(MISCREG_CWP, Cwp);
9962526SN/A                }
9972526SN/A            }});
9982526SN/A            0x3E: decode FCN {
9992526SN/A                0x0: Priv::done({{
10002526SN/A                    if(Tl == 0)
10012526SN/A                        return new IllegalInstruction;
10022646Ssaidi@eecs.umich.edu
10032646Ssaidi@eecs.umich.edu                    Cwp = Tstate<4:0>;
10042646Ssaidi@eecs.umich.edu                    Pstate = Tstate<20:8>;
10052646Ssaidi@eecs.umich.edu                    Asi = Tstate<31:24>;
10062646Ssaidi@eecs.umich.edu                    Ccr = Tstate<39:32>;
10072646Ssaidi@eecs.umich.edu                    Gl = Tstate<42:40>;
10082646Ssaidi@eecs.umich.edu                    NPC = Tnpc;
10092646Ssaidi@eecs.umich.edu                    NNPC = Tnpc + 4;
10102526SN/A                    Tl = Tl - 1;
10112526SN/A                }});
10122938Sgblack@eecs.umich.edu                0x1: Priv::retry({{
10132526SN/A                    if(Tl == 0)
10142526SN/A                        return new IllegalInstruction;
10152646Ssaidi@eecs.umich.edu                    Cwp = Tstate<4:0>;
10162646Ssaidi@eecs.umich.edu                    Pstate = Tstate<20:8>;
10172646Ssaidi@eecs.umich.edu                    Asi = Tstate<31:24>;
10182646Ssaidi@eecs.umich.edu                    Ccr = Tstate<39:32>;
10192646Ssaidi@eecs.umich.edu                    Gl = Tstate<42:40>;
10202646Ssaidi@eecs.umich.edu                    NPC = Tpc;
10213417Sgblack@eecs.umich.edu                    NNPC = Tnpc;
10222526SN/A                    Tl = Tl - 1;
10232526SN/A                }});
10242526SN/A            }
10252526SN/A        }
10262469SN/A    }
10272469SN/A    0x3: decode OP3 {
10282526SN/A        format Load {
10293272Sgblack@eecs.umich.edu            0x00: lduw({{Rd = Mem.uw;}});
10303272Sgblack@eecs.umich.edu            0x01: ldub({{Rd = Mem.ub;}});
10313272Sgblack@eecs.umich.edu            0x02: lduh({{Rd = Mem.uhw;}});
10322526SN/A            0x03: ldd({{
10333272Sgblack@eecs.umich.edu                uint64_t val = Mem.udw;
10342526SN/A                RdLow = val<31:0>;
10352526SN/A                RdHigh = val<63:32>;
10363272Sgblack@eecs.umich.edu            }});
10372526SN/A        }
10382526SN/A        format Store {
10393272Sgblack@eecs.umich.edu            0x04: stw({{Mem.uw = Rd.sw;}});
10403272Sgblack@eecs.umich.edu            0x05: stb({{Mem.ub = Rd.sb;}});
10413272Sgblack@eecs.umich.edu            0x06: sth({{Mem.uhw = Rd.shw;}});
10423272Sgblack@eecs.umich.edu            0x07: std({{Mem.udw = RdLow<31:0> | (RdHigh<31:0> << 32);}});
10432526SN/A        }
10442526SN/A        format Load {
10453272Sgblack@eecs.umich.edu            0x08: ldsw({{Rd = (int32_t)Mem.sw;}});
10463272Sgblack@eecs.umich.edu            0x09: ldsb({{Rd = (int8_t)Mem.sb;}});
10473272Sgblack@eecs.umich.edu            0x0A: ldsh({{Rd = (int16_t)Mem.shw;}});
10483272Sgblack@eecs.umich.edu            0x0B: ldx({{Rd = (int64_t)Mem.sdw;}});
10492526SN/A        }
10503438Sgblack@eecs.umich.edu        0x0D: LoadStore::ldstub(
10513438Sgblack@eecs.umich.edu        {{Rd = Mem.ub;}},
10523438Sgblack@eecs.umich.edu        {{Mem.ub = 0xFF;}});
10533272Sgblack@eecs.umich.edu        0x0E: Store::stx({{Mem.udw = Rd}});
10543388Sgblack@eecs.umich.edu        0x0F: LoadStore::swap(
10553438Sgblack@eecs.umich.edu            {{uReg0 = Rd.uw;
10563388Sgblack@eecs.umich.edu            Rd.uw = Mem.uw;}},
10573438Sgblack@eecs.umich.edu            {{Mem.uw = uReg0;}});
10582526SN/A        format Load {
10593272Sgblack@eecs.umich.edu            0x10: lduwa({{Rd = Mem.uw;}});
10603272Sgblack@eecs.umich.edu            0x11: lduba({{Rd = Mem.ub;}});
10613272Sgblack@eecs.umich.edu            0x12: lduha({{Rd = Mem.uhw;}});
10622526SN/A            0x13: ldda({{
10633272Sgblack@eecs.umich.edu                uint64_t val = Mem.udw;
10642526SN/A                RdLow = val<31:0>;
10652526SN/A                RdHigh = val<63:32>;
10663272Sgblack@eecs.umich.edu            }});
10672526SN/A        }
10682526SN/A        format Store {
10693272Sgblack@eecs.umich.edu            0x14: stwa({{Mem.uw = Rd;}});
10703272Sgblack@eecs.umich.edu            0x15: stba({{Mem.ub = Rd;}});
10713272Sgblack@eecs.umich.edu            0x16: stha({{Mem.uhw = Rd;}});
10723272Sgblack@eecs.umich.edu            0x17: stda({{Mem.udw = RdLow<31:0> | RdHigh<31:0> << 32;}});
10732526SN/A        }
10742526SN/A        format Load {
10753272Sgblack@eecs.umich.edu            0x18: ldswa({{Rd = (int32_t)Mem.sw;}});
10763272Sgblack@eecs.umich.edu            0x19: ldsba({{Rd = (int8_t)Mem.sb;}});
10773272Sgblack@eecs.umich.edu            0x1A: ldsha({{Rd = (int16_t)Mem.shw;}});
10783272Sgblack@eecs.umich.edu            0x1B: ldxa({{Rd = (int64_t)Mem.sdw;}});
10792526SN/A        }
10803388Sgblack@eecs.umich.edu        0x1D: LoadStore::ldstuba(
10813388Sgblack@eecs.umich.edu                {{Rd = Mem.ub;}},
10823388Sgblack@eecs.umich.edu                {{Mem.ub = 0xFF}});
10833272Sgblack@eecs.umich.edu        0x1E: Store::stxa({{Mem.udw = Rd}});
10843388Sgblack@eecs.umich.edu        0x1F: LoadStore::swapa(
10853438Sgblack@eecs.umich.edu            {{uReg0 = Rd.uw;
10863388Sgblack@eecs.umich.edu            Rd.uw = Mem.uw;}},
10873438Sgblack@eecs.umich.edu            {{Mem.uw = uReg0;}});
10882526SN/A        format Trap {
10893272Sgblack@eecs.umich.edu            0x20: Load::ldf({{Frd.uw = Mem.uw;}});
10902526SN/A            0x21: decode X {
10913272Sgblack@eecs.umich.edu                0x0: Load::ldfsr({{Fsr = Mem.uw | Fsr<63:32>;}});
10923272Sgblack@eecs.umich.edu                0x1: Load::ldxfsr({{Fsr = Mem.udw;}});
10932469SN/A            }
10942526SN/A            0x22: ldqf({{fault = new FpDisabled;}});
10953272Sgblack@eecs.umich.edu            0x23: Load::lddf({{Frd.udw = Mem.udw;}});
10963272Sgblack@eecs.umich.edu            0x24: Store::stf({{Mem.uw = Frd.uw;}});
10972526SN/A            0x25: decode X {
10983272Sgblack@eecs.umich.edu                0x0: Store::stfsr({{Mem.uw = Fsr<31:0>;}});
10993272Sgblack@eecs.umich.edu                0x1: Store::stxfsr({{Mem.udw = Fsr;}});
11002526SN/A            }
11012526SN/A            0x26: stqf({{fault = new FpDisabled;}});
11023272Sgblack@eecs.umich.edu            0x27: Store::stdf({{Mem.udw = Frd.udw;}});
11032526SN/A            0x2D: Nop::prefetch({{ }});
11043272Sgblack@eecs.umich.edu            0x30: Load::ldfa({{Frd.uw = Mem.uw;}});
11052526SN/A            0x32: ldqfa({{fault = new FpDisabled;}});
11063272Sgblack@eecs.umich.edu            format LoadAlt {
11073272Sgblack@eecs.umich.edu                0x33: decode EXT_ASI {
11083272Sgblack@eecs.umich.edu                    //ASI_NUCLEUS
11093272Sgblack@eecs.umich.edu                    0x04: FailUnimpl::lddfa_n();
11103272Sgblack@eecs.umich.edu                    //ASI_NUCLEUS_LITTLE
11113272Sgblack@eecs.umich.edu                    0x0C: FailUnimpl::lddfa_nl();
11123272Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_PRIMARY
11133272Sgblack@eecs.umich.edu                    0x10: FailUnimpl::lddfa_aiup();
11143272Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_PRIMARY_LITTLE
11153272Sgblack@eecs.umich.edu                    0x18: FailUnimpl::lddfa_aiupl();
11163272Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_SECONDARY
11173272Sgblack@eecs.umich.edu                    0x11: FailUnimpl::lddfa_aius();
11183272Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_SECONDARY_LITTLE
11193272Sgblack@eecs.umich.edu                    0x19: FailUnimpl::lddfa_aiusl();
11203272Sgblack@eecs.umich.edu                    //ASI_REAL
11213272Sgblack@eecs.umich.edu                    0x14: FailUnimpl::lddfa_real();
11223272Sgblack@eecs.umich.edu                    //ASI_REAL_LITTLE
11233272Sgblack@eecs.umich.edu                    0x1C: FailUnimpl::lddfa_real_l();
11243272Sgblack@eecs.umich.edu                    //ASI_REAL_IO
11253272Sgblack@eecs.umich.edu                    0x15: FailUnimpl::lddfa_real_io();
11263272Sgblack@eecs.umich.edu                    //ASI_REAL_IO_LITTLE
11273272Sgblack@eecs.umich.edu                    0x1D: FailUnimpl::lddfa_real_io_l();
11283272Sgblack@eecs.umich.edu                    //ASI_PRIMARY
11293272Sgblack@eecs.umich.edu                    0x80: FailUnimpl::lddfa_p();
11303272Sgblack@eecs.umich.edu                    //ASI_PRIMARY_LITTLE
11313272Sgblack@eecs.umich.edu                    0x88: FailUnimpl::lddfa_pl();
11323272Sgblack@eecs.umich.edu                    //ASI_SECONDARY
11333272Sgblack@eecs.umich.edu                    0x81: FailUnimpl::lddfa_s();
11343272Sgblack@eecs.umich.edu                    //ASI_SECONDARY_LITTLE
11353272Sgblack@eecs.umich.edu                    0x89: FailUnimpl::lddfa_sl();
11363272Sgblack@eecs.umich.edu                    //ASI_PRIMARY_NO_FAULT
11373272Sgblack@eecs.umich.edu                    0x82: FailUnimpl::lddfa_pnf();
11383272Sgblack@eecs.umich.edu                    //ASI_PRIMARY_NO_FAULT_LITTLE
11393272Sgblack@eecs.umich.edu                    0x8A: FailUnimpl::lddfa_pnfl();
11403272Sgblack@eecs.umich.edu                    //ASI_SECONDARY_NO_FAULT
11413272Sgblack@eecs.umich.edu                    0x83: FailUnimpl::lddfa_snf();
11423272Sgblack@eecs.umich.edu                    //ASI_SECONDARY_NO_FAULT_LITTLE
11433272Sgblack@eecs.umich.edu                    0x8B: FailUnimpl::lddfa_snfl();
11443272Sgblack@eecs.umich.edu
11453272Sgblack@eecs.umich.edu                    format BlockLoad {
11463272Sgblack@eecs.umich.edu                        // LDBLOCKF
11473272Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_PRIMARY
11483272Sgblack@eecs.umich.edu                        0x16: FailUnimpl::ldblockf_aiup();
11493272Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_SECONDARY
11503272Sgblack@eecs.umich.edu                        0x17: FailUnimpl::ldblockf_aius();
11513272Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_PRIMARY_LITTLE
11523272Sgblack@eecs.umich.edu                        0x1E: FailUnimpl::ldblockf_aiupl();
11533272Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_SECONDARY_LITTLE
11543272Sgblack@eecs.umich.edu                        0x1F: FailUnimpl::ldblockf_aiusl();
11553272Sgblack@eecs.umich.edu                        //ASI_BLOCK_PRIMARY
11563378Sgblack@eecs.umich.edu                        0xF0: ldblockf_p({{Frd_N.udw = Mem.udw;}});
11573272Sgblack@eecs.umich.edu                        //ASI_BLOCK_SECONDARY
11583272Sgblack@eecs.umich.edu                        0xF1: FailUnimpl::ldblockf_s();
11593272Sgblack@eecs.umich.edu                        //ASI_BLOCK_PRIMARY_LITTLE
11603272Sgblack@eecs.umich.edu                        0xF8: FailUnimpl::ldblockf_pl();
11613272Sgblack@eecs.umich.edu                        //ASI_BLOCK_SECONDARY_LITTLE
11623272Sgblack@eecs.umich.edu                        0xF9: FailUnimpl::ldblockf_sl();
11633272Sgblack@eecs.umich.edu                    }
11643272Sgblack@eecs.umich.edu
11653272Sgblack@eecs.umich.edu                    //LDSHORTF
11663272Sgblack@eecs.umich.edu                    //ASI_FL8_PRIMARY
11673272Sgblack@eecs.umich.edu                    0xD0: FailUnimpl::ldshortf_8p();
11683272Sgblack@eecs.umich.edu                    //ASI_FL8_SECONDARY
11693272Sgblack@eecs.umich.edu                    0xD1: FailUnimpl::ldshortf_8s();
11703272Sgblack@eecs.umich.edu                    //ASI_FL8_PRIMARY_LITTLE
11713272Sgblack@eecs.umich.edu                    0xD8: FailUnimpl::ldshortf_8pl();
11723272Sgblack@eecs.umich.edu                    //ASI_FL8_SECONDARY_LITTLE
11733272Sgblack@eecs.umich.edu                    0xD9: FailUnimpl::ldshortf_8sl();
11743272Sgblack@eecs.umich.edu                    //ASI_FL16_PRIMARY
11753272Sgblack@eecs.umich.edu                    0xD2: FailUnimpl::ldshortf_16p();
11763272Sgblack@eecs.umich.edu                    //ASI_FL16_SECONDARY
11773272Sgblack@eecs.umich.edu                    0xD3: FailUnimpl::ldshortf_16s();
11783272Sgblack@eecs.umich.edu                    //ASI_FL16_PRIMARY_LITTLE
11793272Sgblack@eecs.umich.edu                    0xDA: FailUnimpl::ldshortf_16pl();
11803272Sgblack@eecs.umich.edu                    //ASI_FL16_SECONDARY_LITTLE
11813272Sgblack@eecs.umich.edu                    0xDB: FailUnimpl::ldshortf_16sl();
11823272Sgblack@eecs.umich.edu                    //Not an ASI which is legal with lddfa
11833378Sgblack@eecs.umich.edu                    default: Trap::lddfa_bad_asi(
11843378Sgblack@eecs.umich.edu                        {{fault = new DataAccessException;}});
11853272Sgblack@eecs.umich.edu                }
11863272Sgblack@eecs.umich.edu            }
11873272Sgblack@eecs.umich.edu            0x34: Store::stfa({{Mem.uw = Frd.uw;}});
11882954Sgblack@eecs.umich.edu            0x36: stqfa({{fault = new FpDisabled;}});
11893378Sgblack@eecs.umich.edu            format StoreAlt {
11903378Sgblack@eecs.umich.edu                0x37: decode EXT_ASI {
11913378Sgblack@eecs.umich.edu                    //ASI_NUCLEUS
11923378Sgblack@eecs.umich.edu                    0x04: FailUnimpl::stdfa_n();
11933378Sgblack@eecs.umich.edu                    //ASI_NUCLEUS_LITTLE
11943378Sgblack@eecs.umich.edu                    0x0C: FailUnimpl::stdfa_nl();
11953378Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_PRIMARY
11963378Sgblack@eecs.umich.edu                    0x10: FailUnimpl::stdfa_aiup();
11973378Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_PRIMARY_LITTLE
11983378Sgblack@eecs.umich.edu                    0x18: FailUnimpl::stdfa_aiupl();
11993378Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_SECONDARY
12003378Sgblack@eecs.umich.edu                    0x11: FailUnimpl::stdfa_aius();
12013378Sgblack@eecs.umich.edu                    //ASI_AS_IF_USER_SECONDARY_LITTLE
12023378Sgblack@eecs.umich.edu                    0x19: FailUnimpl::stdfa_aiusl();
12033378Sgblack@eecs.umich.edu                    //ASI_REAL
12043378Sgblack@eecs.umich.edu                    0x14: FailUnimpl::stdfa_real();
12053378Sgblack@eecs.umich.edu                    //ASI_REAL_LITTLE
12063378Sgblack@eecs.umich.edu                    0x1C: FailUnimpl::stdfa_real_l();
12073378Sgblack@eecs.umich.edu                    //ASI_REAL_IO
12083378Sgblack@eecs.umich.edu                    0x15: FailUnimpl::stdfa_real_io();
12093378Sgblack@eecs.umich.edu                    //ASI_REAL_IO_LITTLE
12103378Sgblack@eecs.umich.edu                    0x1D: FailUnimpl::stdfa_real_io_l();
12113378Sgblack@eecs.umich.edu                    //ASI_PRIMARY
12123378Sgblack@eecs.umich.edu                    0x80: FailUnimpl::stdfa_p();
12133378Sgblack@eecs.umich.edu                    //ASI_PRIMARY_LITTLE
12143378Sgblack@eecs.umich.edu                    0x88: FailUnimpl::stdfa_pl();
12153378Sgblack@eecs.umich.edu                    //ASI_SECONDARY
12163378Sgblack@eecs.umich.edu                    0x81: FailUnimpl::stdfa_s();
12173378Sgblack@eecs.umich.edu                    //ASI_SECONDARY_LITTLE
12183378Sgblack@eecs.umich.edu                    0x89: FailUnimpl::stdfa_sl();
12193378Sgblack@eecs.umich.edu                    //ASI_PRIMARY_NO_FAULT
12203378Sgblack@eecs.umich.edu                    0x82: FailUnimpl::stdfa_pnf();
12213378Sgblack@eecs.umich.edu                    //ASI_PRIMARY_NO_FAULT_LITTLE
12223378Sgblack@eecs.umich.edu                    0x8A: FailUnimpl::stdfa_pnfl();
12233378Sgblack@eecs.umich.edu                    //ASI_SECONDARY_NO_FAULT
12243378Sgblack@eecs.umich.edu                    0x83: FailUnimpl::stdfa_snf();
12253378Sgblack@eecs.umich.edu                    //ASI_SECONDARY_NO_FAULT_LITTLE
12263378Sgblack@eecs.umich.edu                    0x8B: FailUnimpl::stdfa_snfl();
12273378Sgblack@eecs.umich.edu
12283378Sgblack@eecs.umich.edu                    format BlockStore {
12293378Sgblack@eecs.umich.edu                        // STBLOCKF
12303378Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_PRIMARY
12313378Sgblack@eecs.umich.edu                        0x16: FailUnimpl::stblockf_aiup();
12323378Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_SECONDARY
12333378Sgblack@eecs.umich.edu                        0x17: FailUnimpl::stblockf_aius();
12343378Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_PRIMARY_LITTLE
12353378Sgblack@eecs.umich.edu                        0x1E: FailUnimpl::stblockf_aiupl();
12363378Sgblack@eecs.umich.edu                        //ASI_BLOCK_AS_IF_USER_SECONDARY_LITTLE
12373378Sgblack@eecs.umich.edu                        0x1F: FailUnimpl::stblockf_aiusl();
12383378Sgblack@eecs.umich.edu                        //ASI_BLOCK_PRIMARY
12393378Sgblack@eecs.umich.edu                        0xF0: stblockf_p({{Mem.udw = Frd_N.udw;}});
12403378Sgblack@eecs.umich.edu                        //ASI_BLOCK_SECONDARY
12413378Sgblack@eecs.umich.edu                        0xF1: FailUnimpl::stblockf_s();
12423378Sgblack@eecs.umich.edu                        //ASI_BLOCK_PRIMARY_LITTLE
12433378Sgblack@eecs.umich.edu                        0xF8: FailUnimpl::stblockf_pl();
12443378Sgblack@eecs.umich.edu                        //ASI_BLOCK_SECONDARY_LITTLE
12453378Sgblack@eecs.umich.edu                        0xF9: FailUnimpl::stblockf_sl();
12463378Sgblack@eecs.umich.edu                    }
12473378Sgblack@eecs.umich.edu
12483378Sgblack@eecs.umich.edu                    //STSHORTF
12493378Sgblack@eecs.umich.edu                    //ASI_FL8_PRIMARY
12503378Sgblack@eecs.umich.edu                    0xD0: FailUnimpl::stshortf_8p();
12513378Sgblack@eecs.umich.edu                    //ASI_FL8_SECONDARY
12523378Sgblack@eecs.umich.edu                    0xD1: FailUnimpl::stshortf_8s();
12533378Sgblack@eecs.umich.edu                    //ASI_FL8_PRIMARY_LITTLE
12543378Sgblack@eecs.umich.edu                    0xD8: FailUnimpl::stshortf_8pl();
12553378Sgblack@eecs.umich.edu                    //ASI_FL8_SECONDARY_LITTLE
12563378Sgblack@eecs.umich.edu                    0xD9: FailUnimpl::stshortf_8sl();
12573378Sgblack@eecs.umich.edu                    //ASI_FL16_PRIMARY
12583378Sgblack@eecs.umich.edu                    0xD2: FailUnimpl::stshortf_16p();
12593378Sgblack@eecs.umich.edu                    //ASI_FL16_SECONDARY
12603378Sgblack@eecs.umich.edu                    0xD3: FailUnimpl::stshortf_16s();
12613378Sgblack@eecs.umich.edu                    //ASI_FL16_PRIMARY_LITTLE
12623378Sgblack@eecs.umich.edu                    0xDA: FailUnimpl::stshortf_16pl();
12633378Sgblack@eecs.umich.edu                    //ASI_FL16_SECONDARY_LITTLE
12643378Sgblack@eecs.umich.edu                    0xDB: FailUnimpl::stshortf_16sl();
12653378Sgblack@eecs.umich.edu                    //Not an ASI which is legal with lddfa
12663378Sgblack@eecs.umich.edu                    default: Trap::stdfa_bad_asi(
12673378Sgblack@eecs.umich.edu                        {{fault = new DataAccessException;}});
12683378Sgblack@eecs.umich.edu                }
12693378Sgblack@eecs.umich.edu            }
12703439Sgblack@eecs.umich.edu            0x3C: Cas::casa(
12713439Sgblack@eecs.umich.edu                {{uReg0 = Mem.uw;}},
12723439Sgblack@eecs.umich.edu                {{if(Rs2.uw == uReg0)
12732526SN/A                        Mem.uw = Rd.uw;
12743439Sgblack@eecs.umich.edu                else
12753439Sgblack@eecs.umich.edu                        storeCond = false;
12763439Sgblack@eecs.umich.edu                Rd.uw = uReg0;}});
12772526SN/A            0x3D: Nop::prefetcha({{ }});
12783439Sgblack@eecs.umich.edu            0x3E: Cas::casxa(
12793439Sgblack@eecs.umich.edu                {{uReg0 = Mem.udw;}},
12803439Sgblack@eecs.umich.edu                {{if(Rs2 == uReg0)
12812526SN/A                        Mem.udw = Rd;
12823439Sgblack@eecs.umich.edu                else
12833439Sgblack@eecs.umich.edu                        storeCond = false;
12843439Sgblack@eecs.umich.edu                Rd = uReg0;}});
12852526SN/A        }
12862469SN/A    }
12872022SN/A}
1288