114184Sgabeblack@google.com/*
214184Sgabeblack@google.com * Copyright (c) 2019 ARM Limited
314184Sgabeblack@google.com * All rights reserved
414184Sgabeblack@google.com *
514184Sgabeblack@google.com * The license below extends only to copyright in the software and shall
614184Sgabeblack@google.com * not be construed as granting a license to any other intellectual
714184Sgabeblack@google.com * property including but not limited to intellectual property relating
814184Sgabeblack@google.com * to a hardware implementation of the functionality of the software
914184Sgabeblack@google.com * licensed hereunder.  You may use the software subject to the license
1014184Sgabeblack@google.com * terms below provided that you ensure that this notice is replicated
1114184Sgabeblack@google.com * unmodified and in its entirety in all distributions of the software,
1214184Sgabeblack@google.com * modified or unmodified, in source code or in binary form.
1314184Sgabeblack@google.com *
1414184Sgabeblack@google.com * Copyright (c) 1999-2013 Mark D. Hill and David A. Wood
1514184Sgabeblack@google.com * All rights reserved.
1614184Sgabeblack@google.com *
1714184Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
1814184Sgabeblack@google.com * modification, are permitted provided that the following conditions are
1914184Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
2014184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
2114184Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
2214184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
2314184Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
2414184Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
2514184Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
2614184Sgabeblack@google.com * this software without specific prior written permission.
2714184Sgabeblack@google.com *
2814184Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2914184Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3014184Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3114184Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3214184Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3314184Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3414184Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3514184Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3614184Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3714184Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3814184Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3914184Sgabeblack@google.com */
4014184Sgabeblack@google.com
4114184Sgabeblack@google.commachine(MachineType:L2Cache, "Token protocol")
4214184Sgabeblack@google.com: CacheMemory * L2cache;
4314184Sgabeblack@google.com  Cycles response_latency := 1;
4414184Sgabeblack@google.com  Cycles request_latency := 1;
4514184Sgabeblack@google.com
4614184Sgabeblack@google.com  // L2 BANK QUEUES
4714184Sgabeblack@google.com  // From local bank of L2 cache TO the network
4814184Sgabeblack@google.com  MessageBuffer * L1RequestFromL2Cache, network="To", virtual_network="0",
4914184Sgabeblack@google.com        vnet_type="request";  // this L2 bank -> a local L1
5014184Sgabeblack@google.com  MessageBuffer * GlobalRequestFromL2Cache, network="To", virtual_network="1",
5114184Sgabeblack@google.com        vnet_type="request";  // this L2 bank -> mod-directory
5214184Sgabeblack@google.com  MessageBuffer * responseFromL2Cache, network="To", virtual_network="2",
5314184Sgabeblack@google.com        vnet_type="response";  // this L2 bank -> a local L1 || mod-directory
5414184Sgabeblack@google.com
5514184Sgabeblack@google.com  // FROM the network to this local bank of L2 cache
5614184Sgabeblack@google.com  MessageBuffer * L1RequestToL2Cache, network="From", virtual_network="0",
5714184Sgabeblack@google.com        vnet_type="request";  // a local L1 -> this L2 bank, Lets try this???
5814184Sgabeblack@google.com  MessageBuffer * GlobalRequestToL2Cache, network="From", virtual_network="1",
5914184Sgabeblack@google.com        vnet_type="request";  // mod-directory -> this L2 bank
6014184Sgabeblack@google.com  MessageBuffer * responseToL2Cache, network="From", virtual_network="2",
6114184Sgabeblack@google.com        vnet_type="response";  // a local L1 || mod-directory -> this L2 bank
6214184Sgabeblack@google.com
6314184Sgabeblack@google.com  MessageBuffer * triggerQueue;
6414184Sgabeblack@google.com{
6514184Sgabeblack@google.com  // STATES
6614184Sgabeblack@google.com  state_declaration(State, desc="L2 Cache states", default="L2Cache_State_I") {
6714184Sgabeblack@google.com
6814184Sgabeblack@google.com    // Stable states
6914184Sgabeblack@google.com    NP, AccessPermission:Invalid, desc="Not Present";
7014184Sgabeblack@google.com    I, AccessPermission:Invalid, desc="Invalid";
7114184Sgabeblack@google.com    ILS, AccessPermission:Invalid, desc="Idle/NP, but local sharers exist";
7214184Sgabeblack@google.com    ILX, AccessPermission:Invalid, desc="Idle/NP, but local exclusive exists";
7314184Sgabeblack@google.com    ILO, AccessPermission:Invalid, desc="Idle/NP, but local owner exists";
7414184Sgabeblack@google.com    ILOX, AccessPermission:Invalid, desc="Idle/NP, but local owner exists and chip is exclusive";
7514184Sgabeblack@google.com    ILOS, AccessPermission:Invalid, desc="Idle/NP, but local owner exists and local sharers as well";
7614184Sgabeblack@google.com    ILOSX, AccessPermission:Invalid, desc="Idle/NP, but local owner exists, local sharers exist, chip is exclusive ";
7714184Sgabeblack@google.com    S, AccessPermission:Read_Only, desc="Shared, no local sharers";
7814184Sgabeblack@google.com    O, AccessPermission:Read_Only, desc="Owned, no local sharers";
7914184Sgabeblack@google.com    OLS, AccessPermission:Read_Only, desc="Owned with local sharers";
8014184Sgabeblack@google.com    OLSX, AccessPermission:Read_Only, desc="Owned with local sharers, chip is exclusive";
8114184Sgabeblack@google.com    SLS, AccessPermission:Read_Only, desc="Shared with local sharers";
8214184Sgabeblack@google.com    M, AccessPermission:Read_Write, desc="Modified";
8314184Sgabeblack@google.com
8414184Sgabeblack@google.com    // Transient States
8514184Sgabeblack@google.com
8614184Sgabeblack@google.com    IFGX, AccessPermission:Busy, desc="Blocked, forwarded global GETX to local owner/exclusive.  No other on-chip invs needed";
8714184Sgabeblack@google.com    IFGS, AccessPermission:Busy, desc="Blocked, forwarded global GETS to local owner";
8814184Sgabeblack@google.com    ISFGS, AccessPermission:Busy, desc="Blocked, forwarded global GETS to local owner, local sharers exist";
8914184Sgabeblack@google.com    IFGXX, AccessPermission:Busy, desc="Blocked, forwarded global GETX to local owner but may need acks from other sharers";
9014184Sgabeblack@google.com    OLSF, AccessPermission:Busy, desc="Blocked, got Fwd_GETX with local sharers, waiting for local inv acks";
9114184Sgabeblack@google.com
9214184Sgabeblack@google.com    // writebacks
9314184Sgabeblack@google.com    ILOW, AccessPermission:Busy, desc="local WB request, was ILO";
9414184Sgabeblack@google.com    ILOXW, AccessPermission:Busy, desc="local WB request, was ILOX";
9514184Sgabeblack@google.com    ILOSW, AccessPermission:Busy, desc="local WB request, was ILOS";
9614184Sgabeblack@google.com    ILOSXW, AccessPermission:Busy, desc="local WB request, was ILOSX";
9714184Sgabeblack@google.com    SLSW, AccessPermission:Busy, desc="local WB request, was SLS";
9814184Sgabeblack@google.com    OLSW, AccessPermission:Busy, desc="local WB request, was OLS";
9914184Sgabeblack@google.com    ILSW, AccessPermission:Busy, desc="local WB request, was ILS";
10014184Sgabeblack@google.com    IW, AccessPermission:Busy, desc="local WB request from only sharer, was ILS";
10114184Sgabeblack@google.com    OW, AccessPermission:Busy, desc="local WB request from only sharer, was OLS";
10214184Sgabeblack@google.com    SW, AccessPermission:Busy, desc="local WB request from only sharer, was SLS";
10314184Sgabeblack@google.com    OXW, AccessPermission:Busy, desc="local WB request from only sharer, was OLSX";
10414184Sgabeblack@google.com    OLSXW, AccessPermission:Busy, desc="local WB request from sharer, was OLSX";
10514184Sgabeblack@google.com    ILXW, AccessPermission:Busy, desc="local WB request, was ILX";
10614184Sgabeblack@google.com
10714184Sgabeblack@google.com    IFLS, AccessPermission:Busy, desc="Blocked, forwarded local GETS to _some_ local sharer";
10814184Sgabeblack@google.com    IFLO, AccessPermission:Busy, desc="Blocked, forwarded local GETS to local owner";
10914184Sgabeblack@google.com    IFLOX, AccessPermission:Busy, desc="Blocked, forwarded local GETS to local owner but chip is exclusive";
11014184Sgabeblack@google.com    IFLOXX, AccessPermission:Busy, desc="Blocked, forwarded local GETX to local owner/exclusive, chip is exclusive";
11114184Sgabeblack@google.com    IFLOSX, AccessPermission:Busy, desc="Blocked, forwarded local GETS to local owner w/ other sharers, chip is exclusive";
11214184Sgabeblack@google.com    IFLXO, AccessPermission:Busy, desc="Blocked, forwarded local GETX to local owner with other sharers, chip is exclusive";
11314184Sgabeblack@google.com
11414184Sgabeblack@google.com    IGS, AccessPermission:Busy, desc="Semi-blocked, issued local GETS to directory";
11514184Sgabeblack@google.com    IGM, AccessPermission:Busy, desc="Blocked, issued local GETX to directory. Need global acks and data";
11614184Sgabeblack@google.com    IGMLS, AccessPermission:Busy, desc="Blocked, issued local GETX to directory but may need to INV local sharers";
11714184Sgabeblack@google.com    IGMO, AccessPermission:Busy, desc="Blocked, have data for local GETX but need all acks";
11814184Sgabeblack@google.com    IGMIO, AccessPermission:Busy, desc="Blocked, issued local GETX, local owner with possible local sharer, may need to INV";
11914184Sgabeblack@google.com    OGMIO, AccessPermission:Busy, desc="Blocked, issued local GETX, was owner, may need to INV";
12014184Sgabeblack@google.com    IGMIOF, AccessPermission:Busy, desc="Blocked, issued local GETX, local owner, waiting for global acks, got Fwd_GETX";
12114184Sgabeblack@google.com    IGMIOFS, AccessPermission:Busy, desc="Blocked, issued local GETX, local owner, waiting for global acks, got Fwd_GETS";
12214184Sgabeblack@google.com    OGMIOF, AccessPermission:Busy, desc="Blocked, issued local GETX, was owner, waiting for global acks, got Fwd_GETX";
12314184Sgabeblack@google.com
12414184Sgabeblack@google.com    II, AccessPermission:Busy, desc="Blocked, handling invalidations";
12514184Sgabeblack@google.com    MM, AccessPermission:Busy, desc="Blocked, was M satisfying local GETX";
12614184Sgabeblack@google.com    SS, AccessPermission:Busy, desc="Blocked, was S satisfying local GETS";
12714184Sgabeblack@google.com    OO, AccessPermission:Busy, desc="Blocked, was O satisfying local GETS";
12814184Sgabeblack@google.com    OLSS, AccessPermission:Busy, desc="Blocked, satisfying local GETS";
12914184Sgabeblack@google.com    OLSXS, AccessPermission:Busy, desc="Blocked, satisfying local GETS";
13014184Sgabeblack@google.com    SLSS, AccessPermission:Busy, desc="Blocked, satisfying local GETS";
13114184Sgabeblack@google.com
13214184Sgabeblack@google.com    OI, AccessPermission:Busy, desc="Blocked, doing writeback, was O";
13314184Sgabeblack@google.com    MI, AccessPermission:Busy, desc="Blocked, doing writeback, was M";
13414184Sgabeblack@google.com    MII, AccessPermission:Busy, desc="Blocked, doing writeback, was M, got Fwd_GETX";
13514184Sgabeblack@google.com    OLSI, AccessPermission:Busy, desc="Blocked, doing writeback, was OLS";
13614184Sgabeblack@google.com    ILSI, AccessPermission:Busy, desc="Blocked, doing writeback, was OLS got Fwd_GETX";
13714184Sgabeblack@google.com
13814184Sgabeblack@google.com    // DMA blocking states
13914184Sgabeblack@google.com    ILOSD, AccessPermission:Busy, desc="Blocked, waiting for DMA ack";
14014184Sgabeblack@google.com    ILOSXD, AccessPermission:Busy, desc="Blocked, waiting for DMA ack";
14114184Sgabeblack@google.com    ILOD, AccessPermission:Busy, desc="Blocked, waiting for DMA ack";
14214184Sgabeblack@google.com    ILXD, AccessPermission:Busy, desc="Blocked, waiting for DMA ack";
14314184Sgabeblack@google.com    ILOXD, AccessPermission:Busy, desc="Blocked, waiting for DMA ack";
14414184Sgabeblack@google.com  }
14514184Sgabeblack@google.com
14614184Sgabeblack@google.com  // EVENTS
14714184Sgabeblack@google.com  enumeration(Event, desc="Cache events") {
14814184Sgabeblack@google.com
14914184Sgabeblack@google.com    // Requests
15014184Sgabeblack@google.com    L1_GETS,             desc="local L1 GETS request";
15114184Sgabeblack@google.com    L1_GETX,             desc="local L1 GETX request";
15214184Sgabeblack@google.com    L1_PUTO,             desc="local owner wants to writeback";
15314184Sgabeblack@google.com    L1_PUTX,             desc="local exclusive wants to writeback";
15414184Sgabeblack@google.com    L1_PUTS_only,             desc="only local sharer wants to writeback";
15514184Sgabeblack@google.com    L1_PUTS,             desc="local sharer wants to writeback";
15614184Sgabeblack@google.com    Fwd_GETX,      desc="A GetX from another processor";
15714184Sgabeblack@google.com    Fwd_GETS,      desc="A GetS from another processor";
15814184Sgabeblack@google.com    Fwd_DMA,      desc="A request from DMA";
15914184Sgabeblack@google.com    Own_GETX,      desc="A GetX from this node";
16014184Sgabeblack@google.com    Inv,           desc="Invalidations from the directory";
16114184Sgabeblack@google.com
16214184Sgabeblack@google.com    // Responses
16314184Sgabeblack@google.com    IntAck,             desc="Received an ack message";
16414184Sgabeblack@google.com    ExtAck,             desc="Received an ack message";
16514184Sgabeblack@google.com    All_Acks,         desc="Received all ack messages";
16614184Sgabeblack@google.com    Data,            desc="Received a data message, responder has a shared copy";
16714184Sgabeblack@google.com    Data_Exclusive,  desc="Received a data message";
16814184Sgabeblack@google.com    L1_WBCLEANDATA,       desc="Writeback from L1, with data";
16914184Sgabeblack@google.com    L1_WBDIRTYDATA,       desc="Writeback from L1, with data";
17014184Sgabeblack@google.com
17114184Sgabeblack@google.com    Writeback_Ack,   desc="Writeback O.K. from directory";
17214184Sgabeblack@google.com    Writeback_Nack,  desc="Writeback not O.K. from directory";
17314184Sgabeblack@google.com
17414184Sgabeblack@google.com    Unblock,         desc="Local L1 is telling L2 dir to unblock";
17514184Sgabeblack@google.com    Exclusive_Unblock,         desc="Local L1 is telling L2 dir to unblock";
17614184Sgabeblack@google.com
17714184Sgabeblack@google.com    DmaAck,          desc="DMA ack from local L1";
17814184Sgabeblack@google.com    // events initiated by this L2
17914184Sgabeblack@google.com    L2_Replacement,     desc="L2 Replacement", format="!r";
18014184Sgabeblack@google.com
18114184Sgabeblack@google.com  }
18214184Sgabeblack@google.com
18314184Sgabeblack@google.com  // TYPES
18414184Sgabeblack@google.com
18514184Sgabeblack@google.com  // CacheEntry
18614184Sgabeblack@google.com  structure(Entry, desc="...", interface="AbstractCacheEntry") {
18714184Sgabeblack@google.com    State CacheState,        desc="cache state";
18814184Sgabeblack@google.com    NetDest Sharers,            desc="Set of the internal processors that want the block in shared state";
18914184Sgabeblack@google.com    MachineID Owner,    desc="ID of the L1 cache to forward the block to once we get a response";
19014184Sgabeblack@google.com    bool OwnerValid, default="false", desc="true if Owner means something";
19114184Sgabeblack@google.com    bool Dirty,              desc="Is the data dirty (different than memory)?";
19214184Sgabeblack@google.com    DataBlock DataBlk,       desc="data for the block";
19314184Sgabeblack@google.com  }
19414184Sgabeblack@google.com
19514184Sgabeblack@google.com
19614184Sgabeblack@google.com  structure(DirEntry, desc="...", interface="AbstractEntry") {
19714184Sgabeblack@google.com    NetDest Sharers,            desc="Set of the internal processors that want the block in shared state";
19814184Sgabeblack@google.com    MachineID Owner,   desc="ID of the L1 cache to forward the block to once we get a response";
19914184Sgabeblack@google.com    bool OwnerValid, default="false", desc="true if Owner means something";
20014184Sgabeblack@google.com    State DirState,        desc="directory state";
20114184Sgabeblack@google.com  }
20214184Sgabeblack@google.com
20314184Sgabeblack@google.com  // TBE fields
20414184Sgabeblack@google.com  structure(TBE, desc="...") {
20514184Sgabeblack@google.com    Addr addr,                      desc="Physical address for this TBE";
20614184Sgabeblack@google.com    State TBEState,                       desc="Transient state";
20714184Sgabeblack@google.com    Addr PC,                           desc="Program counter of request";
20814184Sgabeblack@google.com    DataBlock DataBlk,                    desc="Buffer for the data block";
20914184Sgabeblack@google.com    bool Dirty,              desc="Is the data dirty (different than memory)?";
21014184Sgabeblack@google.com
21114184Sgabeblack@google.com    int NumExtPendingAcks, default="0",      desc="Number of global acks/data messages waiting for";
21214184Sgabeblack@google.com    int NumIntPendingAcks, default="0",      desc="Number of global acks/data messages waiting for";
21314184Sgabeblack@google.com    int Fwd_GETX_ExtAcks, default="0",                 desc="Number of acks that requestor will need";
21414184Sgabeblack@google.com    int Local_GETX_IntAcks, default="0",                 desc="Number of acks that requestor will need";
21514184Sgabeblack@google.com
21614184Sgabeblack@google.com    NetDest L1_GetS_IDs,            desc="Set of the internal processors that want the block in shared state";
21714184Sgabeblack@google.com    MachineID L1_GetX_ID,          desc="ID of the L1 cache to forward the block to once we get a response";
21814184Sgabeblack@google.com    NetDest Fwd_GetS_IDs,            desc="Set of the internal processors that want the block in shared state";
21914184Sgabeblack@google.com    MachineID Fwd_GetX_ID,          desc="ID of the L1 cache to forward the block to once we get a response";
22014184Sgabeblack@google.com  }
22114184Sgabeblack@google.com
22214184Sgabeblack@google.com  structure(TBETable, external = "yes") {
22314184Sgabeblack@google.com    TBE lookup(Addr);
22414184Sgabeblack@google.com    void allocate(Addr);
22514184Sgabeblack@google.com    void deallocate(Addr);
22614184Sgabeblack@google.com    bool isPresent(Addr);
22714184Sgabeblack@google.com  }
22814184Sgabeblack@google.com
22914184Sgabeblack@google.com  structure(PerfectCacheMemory, external = "yes") {
23014184Sgabeblack@google.com    void allocate(Addr);
23114184Sgabeblack@google.com    void deallocate(Addr);
23214184Sgabeblack@google.com    DirEntry lookup(Addr);
23314184Sgabeblack@google.com    bool isTagPresent(Addr);
23414184Sgabeblack@google.com  }
23514184Sgabeblack@google.com
23614184Sgabeblack@google.com  TBETable TBEs, template="<L2Cache_TBE>", constructor="m_number_of_TBEs";
23714184Sgabeblack@google.com  PerfectCacheMemory localDirectory, template="<L2Cache_DirEntry>";
23814184Sgabeblack@google.com
23914184Sgabeblack@google.com  Tick clockEdge();
24014184Sgabeblack@google.com  Tick cyclesToTicks(Cycles c);
24114184Sgabeblack@google.com  void set_cache_entry(AbstractCacheEntry b);
24214184Sgabeblack@google.com  void unset_cache_entry();
24314184Sgabeblack@google.com  void set_tbe(TBE b);
24414184Sgabeblack@google.com  void unset_tbe();
24514184Sgabeblack@google.com  MachineID mapAddressToMachine(Addr addr, MachineType mtype);
24614184Sgabeblack@google.com  void wakeUpAllBuffers(Addr a);
24714184Sgabeblack@google.com
24814184Sgabeblack@google.com  // Latency for responses that fetch data from cache
24914184Sgabeblack@google.com  Cycles cacheResponseLatency() {
25014184Sgabeblack@google.com    if (L2cache.getTagLatency() > response_latency) {
25114184Sgabeblack@google.com      return L2cache.getTagLatency();
25214184Sgabeblack@google.com    }
25314184Sgabeblack@google.com    else {
25414184Sgabeblack@google.com      return response_latency;
25514184Sgabeblack@google.com    }
25614184Sgabeblack@google.com  }
25714184Sgabeblack@google.com
25814184Sgabeblack@google.com  Entry getCacheEntry(Addr address), return_by_pointer="yes" {
25914184Sgabeblack@google.com    return static_cast(Entry, "pointer", L2cache[address]);
26014184Sgabeblack@google.com  }
26114184Sgabeblack@google.com
26214184Sgabeblack@google.com  bool isDirTagPresent(Addr addr) {
26314184Sgabeblack@google.com    return (localDirectory.isTagPresent(addr) );
26414184Sgabeblack@google.com  }
26514184Sgabeblack@google.com
26614184Sgabeblack@google.com  DirEntry getDirEntry(Addr address), return_by_pointer="yes" {
26714184Sgabeblack@google.com    return localDirectory.lookup(address);
26814184Sgabeblack@google.com  }
26914184Sgabeblack@google.com
27014184Sgabeblack@google.com  bool isOnlySharer(Entry cache_entry, Addr addr, MachineID shar_id) {
27114184Sgabeblack@google.com    if (is_valid(cache_entry)) {
27214184Sgabeblack@google.com      assert (localDirectory.isTagPresent(addr) == false);
27314184Sgabeblack@google.com      if (cache_entry.Sharers.count() > 1) {
27414184Sgabeblack@google.com        return false;
27514184Sgabeblack@google.com      }
27614184Sgabeblack@google.com      else if (cache_entry.Sharers.count() == 1) {
27714184Sgabeblack@google.com        if (cache_entry.Sharers.isElement(shar_id)) {
27814184Sgabeblack@google.com          return true;
27914184Sgabeblack@google.com        }
28014184Sgabeblack@google.com        else {
28114184Sgabeblack@google.com          return false;  // something happened which should cause this PUTS to be nacked
28214184Sgabeblack@google.com        }
28314184Sgabeblack@google.com        return true;
28414184Sgabeblack@google.com      }
28514184Sgabeblack@google.com      else {
28614184Sgabeblack@google.com        return false;
28714184Sgabeblack@google.com      }
28814184Sgabeblack@google.com    }
28914184Sgabeblack@google.com    else if (localDirectory.isTagPresent(addr)){
29014184Sgabeblack@google.com      DirEntry dir_entry := getDirEntry(addr);
29114184Sgabeblack@google.com      if (dir_entry.Sharers.count() > 1) {
29214184Sgabeblack@google.com        return false;
29314184Sgabeblack@google.com      }
29414184Sgabeblack@google.com      else if (dir_entry.Sharers.count() == 1) {
29514184Sgabeblack@google.com        if (dir_entry.Sharers.isElement(shar_id)) {
29614184Sgabeblack@google.com          return true;
29714184Sgabeblack@google.com        }
29814184Sgabeblack@google.com        else {
29914184Sgabeblack@google.com          return false;  // something happened which should cause this PUTS to be nacked
30014184Sgabeblack@google.com        }
30114184Sgabeblack@google.com      }
30214184Sgabeblack@google.com      else {
30314184Sgabeblack@google.com        return false;
30414184Sgabeblack@google.com      }
30514184Sgabeblack@google.com    }
30614184Sgabeblack@google.com    else {
30714184Sgabeblack@google.com      // shouldn't happen unless L1 issues PUTS before unblock received
30814184Sgabeblack@google.com      return false;
30914184Sgabeblack@google.com    }
31014184Sgabeblack@google.com  }
31114184Sgabeblack@google.com
31214184Sgabeblack@google.com  void copyCacheStateToDir(Entry cache_entry, Addr addr) {
31314184Sgabeblack@google.com    assert(localDirectory.isTagPresent(addr) == false);
31414184Sgabeblack@google.com    assert(is_valid(cache_entry));
31514184Sgabeblack@google.com    localDirectory.allocate(addr);
31614184Sgabeblack@google.com    DirEntry dir_entry := getDirEntry(addr);
31714184Sgabeblack@google.com    dir_entry.DirState := cache_entry.CacheState;
31814184Sgabeblack@google.com    dir_entry.Sharers := cache_entry.Sharers;
31914184Sgabeblack@google.com    dir_entry.Owner := cache_entry.Owner;
32014184Sgabeblack@google.com    dir_entry.OwnerValid := cache_entry.OwnerValid;
32114184Sgabeblack@google.com
32214184Sgabeblack@google.com  }
32314184Sgabeblack@google.com
32414184Sgabeblack@google.com  void copyDirToCache(Entry cache_entry, Addr addr) {
32514184Sgabeblack@google.com    assert(is_valid(cache_entry));
32614184Sgabeblack@google.com    DirEntry dir_entry := getDirEntry(addr);
32714184Sgabeblack@google.com    cache_entry.Sharers := dir_entry.Sharers;
32814184Sgabeblack@google.com    cache_entry.Owner := dir_entry.Owner;
32914184Sgabeblack@google.com    cache_entry.OwnerValid := dir_entry.OwnerValid;
33014184Sgabeblack@google.com  }
33114184Sgabeblack@google.com
33214184Sgabeblack@google.com
33314184Sgabeblack@google.com  void recordLocalSharerInDir(Entry cache_entry, Addr addr, MachineID shar_id) {
33414184Sgabeblack@google.com    if (is_valid(cache_entry)) {
33514184Sgabeblack@google.com      assert (localDirectory.isTagPresent(addr) == false);
33614184Sgabeblack@google.com      cache_entry.Sharers.add(shar_id);
33714184Sgabeblack@google.com    }
33814184Sgabeblack@google.com    else {
33914184Sgabeblack@google.com      if (localDirectory.isTagPresent(addr) == false) {
34014184Sgabeblack@google.com        localDirectory.allocate(addr);
34114184Sgabeblack@google.com        DirEntry dir_entry := getDirEntry(addr);
34214184Sgabeblack@google.com        dir_entry.Sharers.clear();
34314184Sgabeblack@google.com        dir_entry.OwnerValid := false;
34414184Sgabeblack@google.com      }
34514184Sgabeblack@google.com      DirEntry dir_entry := getDirEntry(addr);
34614184Sgabeblack@google.com      dir_entry.Sharers.add(shar_id);
34714184Sgabeblack@google.com    }
34814184Sgabeblack@google.com  }
34914184Sgabeblack@google.com
35014184Sgabeblack@google.com  void recordNewLocalExclusiveInDir(Entry cache_entry, Addr addr, MachineID exc_id) {
35114184Sgabeblack@google.com
35214184Sgabeblack@google.com    if (is_valid(cache_entry)) {
35314184Sgabeblack@google.com      assert (localDirectory.isTagPresent(addr) == false);
35414184Sgabeblack@google.com      cache_entry.Sharers.clear();
35514184Sgabeblack@google.com      cache_entry.OwnerValid := true;
35614184Sgabeblack@google.com      cache_entry.Owner := exc_id;
35714184Sgabeblack@google.com    }
35814184Sgabeblack@google.com    else {
35914184Sgabeblack@google.com      if (localDirectory.isTagPresent(addr) == false) {
36014184Sgabeblack@google.com        localDirectory.allocate(addr);
36114184Sgabeblack@google.com      }
36214184Sgabeblack@google.com      DirEntry dir_entry := getDirEntry(addr);
36314184Sgabeblack@google.com      dir_entry.Sharers.clear();
36414184Sgabeblack@google.com      dir_entry.OwnerValid := true;
36514184Sgabeblack@google.com      dir_entry.Owner := exc_id;
36614184Sgabeblack@google.com    }
36714184Sgabeblack@google.com  }
36814184Sgabeblack@google.com
36914184Sgabeblack@google.com  void removeAllLocalSharersFromDir(Entry cache_entry, Addr addr) {
37014184Sgabeblack@google.com    if (is_valid(cache_entry)) {
37114184Sgabeblack@google.com      assert (localDirectory.isTagPresent(addr) == false);
37214184Sgabeblack@google.com      cache_entry.Sharers.clear();
37314184Sgabeblack@google.com      cache_entry.OwnerValid := false;
37414184Sgabeblack@google.com    }
37514184Sgabeblack@google.com    else {
37614184Sgabeblack@google.com      DirEntry dir_entry := getDirEntry(addr);
37714184Sgabeblack@google.com      dir_entry.Sharers.clear();
37814184Sgabeblack@google.com      dir_entry.OwnerValid := false;
37914184Sgabeblack@google.com    }
38014184Sgabeblack@google.com  }
38114184Sgabeblack@google.com
38214184Sgabeblack@google.com  void removeSharerFromDir(Entry cache_entry, Addr addr, MachineID sender) {
38314184Sgabeblack@google.com    if (is_valid(cache_entry)) {
38414184Sgabeblack@google.com      assert (localDirectory.isTagPresent(addr) == false);
38514184Sgabeblack@google.com      cache_entry.Sharers.remove(sender);
38614184Sgabeblack@google.com    }
38714184Sgabeblack@google.com    else {
38814184Sgabeblack@google.com      DirEntry dir_entry := getDirEntry(addr);
38914184Sgabeblack@google.com      dir_entry.Sharers.remove(sender);
39014184Sgabeblack@google.com    }
39114184Sgabeblack@google.com  }
39214184Sgabeblack@google.com
39314184Sgabeblack@google.com  void removeOwnerFromDir(Entry cache_entry, Addr addr, MachineID sender) {
39414184Sgabeblack@google.com    if (is_valid(cache_entry)) {
39514184Sgabeblack@google.com      assert (localDirectory.isTagPresent(addr) == false);
39614184Sgabeblack@google.com      cache_entry.OwnerValid := false;
39714184Sgabeblack@google.com    }
39814184Sgabeblack@google.com    else {
39914184Sgabeblack@google.com      DirEntry dir_entry := getDirEntry(addr);
40014184Sgabeblack@google.com      dir_entry.OwnerValid := false;
40114184Sgabeblack@google.com    }
40214184Sgabeblack@google.com  }
40314184Sgabeblack@google.com
40414184Sgabeblack@google.com  bool isLocalSharer(Entry cache_entry, Addr addr, MachineID shar_id) {
40514184Sgabeblack@google.com    if (is_valid(cache_entry)) {
40614184Sgabeblack@google.com      assert (localDirectory.isTagPresent(addr) == false);
40714184Sgabeblack@google.com      return cache_entry.Sharers.isElement(shar_id);
40814184Sgabeblack@google.com    }
40914184Sgabeblack@google.com    else {
41014184Sgabeblack@google.com      DirEntry dir_entry := getDirEntry(addr);
41114184Sgabeblack@google.com      return dir_entry.Sharers.isElement(shar_id);
41214184Sgabeblack@google.com    }
41314184Sgabeblack@google.com  }
41414184Sgabeblack@google.com
41514184Sgabeblack@google.com  NetDest getLocalSharers(Entry cache_entry, Addr addr) {
41614184Sgabeblack@google.com    if (is_valid(cache_entry)) {
41714184Sgabeblack@google.com      assert (localDirectory.isTagPresent(addr) == false);
41814184Sgabeblack@google.com      return cache_entry.Sharers;
41914184Sgabeblack@google.com    }
42014184Sgabeblack@google.com    else {
42114184Sgabeblack@google.com      DirEntry dir_entry := getDirEntry(addr);
42214184Sgabeblack@google.com      return dir_entry.Sharers;
42314184Sgabeblack@google.com    }
42414184Sgabeblack@google.com  }
42514184Sgabeblack@google.com
42614184Sgabeblack@google.com  MachineID getLocalOwner(Entry cache_entry, Addr addr) {
42714184Sgabeblack@google.com    if (is_valid(cache_entry)) {
42814184Sgabeblack@google.com      assert (localDirectory.isTagPresent(addr) == false);
42914184Sgabeblack@google.com      return cache_entry.Owner;
43014184Sgabeblack@google.com    }
43114184Sgabeblack@google.com    else {
43214184Sgabeblack@google.com      DirEntry dir_entry := getDirEntry(addr);
43314184Sgabeblack@google.com      return dir_entry.Owner;
43414184Sgabeblack@google.com    }
43514184Sgabeblack@google.com  }
43614184Sgabeblack@google.com
43714184Sgabeblack@google.com  int countLocalSharers(Entry cache_entry, Addr addr) {
43814184Sgabeblack@google.com    if (is_valid(cache_entry)) {
43914184Sgabeblack@google.com      assert (localDirectory.isTagPresent(addr) == false);
44014184Sgabeblack@google.com      return cache_entry.Sharers.count();
44114184Sgabeblack@google.com    }
44214184Sgabeblack@google.com    else {
44314184Sgabeblack@google.com      DirEntry dir_entry := getDirEntry(addr);
44414184Sgabeblack@google.com      return dir_entry.Sharers.count();
44514184Sgabeblack@google.com    }
44614184Sgabeblack@google.com  }
44714184Sgabeblack@google.com
44814184Sgabeblack@google.com  bool isLocalOwnerValid(Entry cache_entry, Addr addr) {
44914184Sgabeblack@google.com    if (is_valid(cache_entry)) {
45014184Sgabeblack@google.com      assert (localDirectory.isTagPresent(addr) == false);
45114184Sgabeblack@google.com      return cache_entry.OwnerValid;
45214184Sgabeblack@google.com    }
45314184Sgabeblack@google.com    else {
45414184Sgabeblack@google.com      DirEntry dir_entry := getDirEntry(addr);
45514184Sgabeblack@google.com      return dir_entry.OwnerValid;
45614184Sgabeblack@google.com    }
45714184Sgabeblack@google.com  }
45814184Sgabeblack@google.com
45914184Sgabeblack@google.com  int countLocalSharersExceptRequestor(Entry cache_entry, Addr addr, MachineID requestor) {
46014184Sgabeblack@google.com    if (is_valid(cache_entry)) {
46114184Sgabeblack@google.com      assert (localDirectory.isTagPresent(addr) == false);
46214184Sgabeblack@google.com      if (cache_entry.Sharers.isElement(requestor)) {
46314184Sgabeblack@google.com        return ( cache_entry.Sharers.count() - 1 );
46414184Sgabeblack@google.com      }
46514184Sgabeblack@google.com      else {
46614184Sgabeblack@google.com        return cache_entry.Sharers.count();
46714184Sgabeblack@google.com      }
46814184Sgabeblack@google.com    }
46914184Sgabeblack@google.com    else {
47014184Sgabeblack@google.com      DirEntry dir_entry := getDirEntry(addr);
47114184Sgabeblack@google.com      if (dir_entry.Sharers.isElement(requestor)) {
47214184Sgabeblack@google.com        return ( dir_entry.Sharers.count() - 1 );
47314184Sgabeblack@google.com      }
47414184Sgabeblack@google.com      else {
47514184Sgabeblack@google.com        return dir_entry.Sharers.count();
47614184Sgabeblack@google.com      }
47714184Sgabeblack@google.com    }
47814184Sgabeblack@google.com  }
47914184Sgabeblack@google.com
48014184Sgabeblack@google.com  State getState(TBE tbe, Entry cache_entry, Addr addr) {
48114184Sgabeblack@google.com
48214184Sgabeblack@google.com    if (is_valid(tbe)) {
48314184Sgabeblack@google.com      return tbe.TBEState;
48414184Sgabeblack@google.com    } else if (is_valid(cache_entry)) {
48514184Sgabeblack@google.com      return cache_entry.CacheState;
48614184Sgabeblack@google.com    } else if (isDirTagPresent(addr)) {
48714184Sgabeblack@google.com      DirEntry dir_entry := getDirEntry(addr);
48814184Sgabeblack@google.com      return dir_entry.DirState;
48914184Sgabeblack@google.com    } else {
49014184Sgabeblack@google.com      return State:NP;
49114184Sgabeblack@google.com    }
49214184Sgabeblack@google.com  }
49314184Sgabeblack@google.com
49414184Sgabeblack@google.com  std::string getCoherenceRequestTypeStr(CoherenceRequestType type) {
49514184Sgabeblack@google.com    return CoherenceRequestType_to_string(type);
49614184Sgabeblack@google.com  }
49714184Sgabeblack@google.com
49814184Sgabeblack@google.com  void setState(TBE tbe, Entry cache_entry, Addr addr, State state) {
49914184Sgabeblack@google.com    assert((localDirectory.isTagPresent(addr) && L2cache.isTagPresent(addr)) == false);
50014184Sgabeblack@google.com
50114184Sgabeblack@google.com    if (is_valid(tbe)) {
50214184Sgabeblack@google.com      tbe.TBEState := state;
50314184Sgabeblack@google.com    }
50414184Sgabeblack@google.com
50514184Sgabeblack@google.com    if (
50614184Sgabeblack@google.com         (state == State:M) ||
50714184Sgabeblack@google.com         (state == State:O) ||
50814184Sgabeblack@google.com         (state == State:S) ||
50914184Sgabeblack@google.com         (state == State:OLS) ||
51014184Sgabeblack@google.com         (state == State:SLS) ||
51114184Sgabeblack@google.com         (state == State:OLSX) ||
51214184Sgabeblack@google.com         (state == State:SLS)
51314184Sgabeblack@google.com       ) {
51414184Sgabeblack@google.com       assert(is_valid(cache_entry));
51514184Sgabeblack@google.com    }
51614184Sgabeblack@google.com    else if (
51714184Sgabeblack@google.com         (state == State:ILS) ||
51814184Sgabeblack@google.com         (state == State:ILX) ||
51914184Sgabeblack@google.com         (state == State:ILO) ||
52014184Sgabeblack@google.com         (state == State:ILOX) ||
52114184Sgabeblack@google.com         (state == State:ILOS) ||
52214184Sgabeblack@google.com         (state == State:ILOSX)
52314184Sgabeblack@google.com       ) {
52414184Sgabeblack@google.com       // assert(isCacheTagPresent(addr) == false);
52514184Sgabeblack@google.com    }
52614184Sgabeblack@google.com
52714184Sgabeblack@google.com    if (is_valid(cache_entry)) {
52814184Sgabeblack@google.com      if ( ((cache_entry.CacheState != State:M) && (state == State:M)) ||
52914184Sgabeblack@google.com           ((cache_entry.CacheState != State:S) && (state == State:S)) ||
53014184Sgabeblack@google.com           ((cache_entry.CacheState != State:O) && (state == State:O)) ) {
53114184Sgabeblack@google.com        cache_entry.CacheState := state;
53214184Sgabeblack@google.com        // disable Coherence Checker for now
53314184Sgabeblack@google.com        // sequencer.checkCoherence(addr);
53414184Sgabeblack@google.com      }
53514184Sgabeblack@google.com      else {
53614184Sgabeblack@google.com        cache_entry.CacheState := state;
53714184Sgabeblack@google.com      }
53814184Sgabeblack@google.com    }
53914184Sgabeblack@google.com    else if (localDirectory.isTagPresent(addr)) {
54014184Sgabeblack@google.com      DirEntry dir_entry := getDirEntry(addr);
54114184Sgabeblack@google.com      dir_entry.DirState := state;
54214184Sgabeblack@google.com    }
54314184Sgabeblack@google.com  }
54414184Sgabeblack@google.com
54514184Sgabeblack@google.com  AccessPermission getAccessPermission(Addr addr) {
54614184Sgabeblack@google.com    TBE tbe := TBEs[addr];
54714184Sgabeblack@google.com    if(is_valid(tbe)) {
54814184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", L2Cache_State_to_permission(tbe.TBEState));
54914184Sgabeblack@google.com      return L2Cache_State_to_permission(tbe.TBEState);
55014184Sgabeblack@google.com    }
55114184Sgabeblack@google.com
55214184Sgabeblack@google.com    Entry cache_entry := getCacheEntry(addr);
55314184Sgabeblack@google.com    if(is_valid(cache_entry)) {
55414184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", L2Cache_State_to_permission(cache_entry.CacheState));
55514184Sgabeblack@google.com      return L2Cache_State_to_permission(cache_entry.CacheState);
55614184Sgabeblack@google.com    }
55714184Sgabeblack@google.com
55814184Sgabeblack@google.com    DPRINTF(RubySlicc, "AccessPermission_NotPresent\n");
55914184Sgabeblack@google.com    return AccessPermission:NotPresent;
56014184Sgabeblack@google.com  }
56114184Sgabeblack@google.com
56214184Sgabeblack@google.com  void setAccessPermission(Entry cache_entry, Addr addr, State state) {
56314184Sgabeblack@google.com    if (is_valid(cache_entry)) {
56414184Sgabeblack@google.com      cache_entry.changePermission(L2Cache_State_to_permission(state));
56514184Sgabeblack@google.com    }
56614184Sgabeblack@google.com  }
56714184Sgabeblack@google.com
56814184Sgabeblack@google.com  void functionalRead(Addr addr, Packet *pkt) {
56914184Sgabeblack@google.com    TBE tbe := TBEs[addr];
57014184Sgabeblack@google.com    if(is_valid(tbe)) {
57114184Sgabeblack@google.com      testAndRead(addr, tbe.DataBlk, pkt);
57214184Sgabeblack@google.com    } else {
57314184Sgabeblack@google.com      testAndRead(addr, getCacheEntry(addr).DataBlk, pkt);
57414184Sgabeblack@google.com    }
57514184Sgabeblack@google.com  }
57614184Sgabeblack@google.com
57714184Sgabeblack@google.com  int functionalWrite(Addr addr, Packet *pkt) {
57814184Sgabeblack@google.com    int num_functional_writes := 0;
57914184Sgabeblack@google.com
58014184Sgabeblack@google.com    TBE tbe := TBEs[addr];
58114184Sgabeblack@google.com    if(is_valid(tbe)) {
58214184Sgabeblack@google.com      num_functional_writes := num_functional_writes +
58314184Sgabeblack@google.com        testAndWrite(addr, tbe.DataBlk, pkt);
58414184Sgabeblack@google.com      return num_functional_writes;
58514184Sgabeblack@google.com    }
58614184Sgabeblack@google.com
58714184Sgabeblack@google.com    num_functional_writes := num_functional_writes +
58814184Sgabeblack@google.com        testAndWrite(addr, getCacheEntry(addr).DataBlk, pkt);
58914184Sgabeblack@google.com    return num_functional_writes;
59014184Sgabeblack@google.com  }
59114184Sgabeblack@google.com
59214184Sgabeblack@google.com  out_port(globalRequestNetwork_out, RequestMsg, GlobalRequestFromL2Cache);
59314184Sgabeblack@google.com  out_port(localRequestNetwork_out, RequestMsg, L1RequestFromL2Cache);
59414184Sgabeblack@google.com  out_port(responseNetwork_out, ResponseMsg, responseFromL2Cache);
59514184Sgabeblack@google.com
59614184Sgabeblack@google.com  out_port(triggerQueue_out, TriggerMsg, triggerQueue);
59714184Sgabeblack@google.com
59814184Sgabeblack@google.com
59914184Sgabeblack@google.com  // ** IN_PORTS **
60014184Sgabeblack@google.com
60114184Sgabeblack@google.com  // Trigger Queue
60214184Sgabeblack@google.com  in_port(triggerQueue_in, TriggerMsg, triggerQueue, rank=3) {
60314184Sgabeblack@google.com    if (triggerQueue_in.isReady(clockEdge())) {
60414184Sgabeblack@google.com      peek(triggerQueue_in, TriggerMsg) {
60514184Sgabeblack@google.com        if (in_msg.Type == TriggerType:ALL_ACKS) {
60614184Sgabeblack@google.com          trigger(Event:All_Acks, in_msg.addr,
60714184Sgabeblack@google.com                  getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
60814184Sgabeblack@google.com        } else {
60914184Sgabeblack@google.com          error("Unexpected message");
61014184Sgabeblack@google.com        }
61114184Sgabeblack@google.com      }
61214184Sgabeblack@google.com    }
61314184Sgabeblack@google.com  }
61414184Sgabeblack@google.com
61514184Sgabeblack@google.com  // Response Network
61614184Sgabeblack@google.com  in_port(responseNetwork_in, ResponseMsg, responseToL2Cache, rank=2) {
61714184Sgabeblack@google.com    if (responseNetwork_in.isReady(clockEdge())) {
61814184Sgabeblack@google.com      peek(responseNetwork_in, ResponseMsg) {
61914184Sgabeblack@google.com        assert(in_msg.Destination.isElement(machineID));
62014184Sgabeblack@google.com        if (in_msg.Type == CoherenceResponseType:ACK) {
62114184Sgabeblack@google.com          if (in_msg.SenderMachine == MachineType:L2Cache) {
62214184Sgabeblack@google.com            trigger(Event:ExtAck, in_msg.addr,
62314184Sgabeblack@google.com                    getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
62414184Sgabeblack@google.com          }
62514184Sgabeblack@google.com          else {
62614184Sgabeblack@google.com            trigger(Event:IntAck, in_msg.addr,
62714184Sgabeblack@google.com                    getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
62814184Sgabeblack@google.com          }
62914184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:DATA) {
63014184Sgabeblack@google.com          trigger(Event:Data, in_msg.addr,
63114184Sgabeblack@google.com                  getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
63214184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:DATA_EXCLUSIVE) {
63314184Sgabeblack@google.com          trigger(Event:Data_Exclusive, in_msg.addr,
63414184Sgabeblack@google.com                  getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
63514184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:UNBLOCK) {
63614184Sgabeblack@google.com          DPRINTF(RubySlicc, "Received Unblock from L1 addr: %x\n", in_msg.addr);
63714184Sgabeblack@google.com          trigger(Event:Unblock, in_msg.addr,
63814184Sgabeblack@google.com                  getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
63914184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:UNBLOCK_EXCLUSIVE) {
64014184Sgabeblack@google.com          trigger(Event:Exclusive_Unblock, in_msg.addr,
64114184Sgabeblack@google.com                  getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
64214184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:WB_ACK) {
64314184Sgabeblack@google.com          trigger(Event:Writeback_Ack, in_msg.addr,
64414184Sgabeblack@google.com                  getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
64514184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:WB_NACK) {
64614184Sgabeblack@google.com          trigger(Event:Writeback_Nack, in_msg.addr,
64714184Sgabeblack@google.com                  getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
64814184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:DMA_ACK) {
64914184Sgabeblack@google.com          trigger(Event:DmaAck, in_msg.addr,
65014184Sgabeblack@google.com                  getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
65114184Sgabeblack@google.com        } else {
65214184Sgabeblack@google.com          error("Unexpected message");
65314184Sgabeblack@google.com        }
65414184Sgabeblack@google.com      }
65514184Sgabeblack@google.com    }
65614184Sgabeblack@google.com  }
65714184Sgabeblack@google.com
65814184Sgabeblack@google.com
65914184Sgabeblack@google.com  // Request Network
66014184Sgabeblack@google.com  in_port(requestNetwork_in, RequestMsg, GlobalRequestToL2Cache, rank=1) {
66114184Sgabeblack@google.com    if (requestNetwork_in.isReady(clockEdge())) {
66214184Sgabeblack@google.com      peek(requestNetwork_in, RequestMsg) {
66314184Sgabeblack@google.com        if (in_msg.Type == CoherenceRequestType:GETX || in_msg.Type == CoherenceRequestType:DMA_WRITE) {
66414184Sgabeblack@google.com          if (in_msg.Requestor == machineID) {
66514184Sgabeblack@google.com            trigger(Event:Own_GETX, in_msg.addr,
66614184Sgabeblack@google.com                    getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
66714184Sgabeblack@google.com          } else {
66814184Sgabeblack@google.com            trigger(Event:Fwd_GETX, in_msg.addr,
66914184Sgabeblack@google.com                    getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
67014184Sgabeblack@google.com          }
67114184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:GETS) {
67214184Sgabeblack@google.com          trigger(Event:Fwd_GETS, in_msg.addr,
67314184Sgabeblack@google.com                  getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
67414184Sgabeblack@google.com        } else if(in_msg.Type == CoherenceRequestType:DMA_READ) {
67514184Sgabeblack@google.com          trigger(Event:Fwd_DMA, in_msg.addr,
67614184Sgabeblack@google.com                  getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
67714184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:INV) {
67814184Sgabeblack@google.com          trigger(Event:Inv, in_msg.addr,
67914184Sgabeblack@google.com                  getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
68014184Sgabeblack@google.com        } else {
68114184Sgabeblack@google.com          error("Unexpected message");
68214184Sgabeblack@google.com        }
68314184Sgabeblack@google.com      }
68414184Sgabeblack@google.com    }
68514184Sgabeblack@google.com  }
68614184Sgabeblack@google.com
68714184Sgabeblack@google.com  in_port(L1requestNetwork_in, RequestMsg, L1RequestToL2Cache, rank=0) {
68814184Sgabeblack@google.com    if (L1requestNetwork_in.isReady(clockEdge())) {
68914184Sgabeblack@google.com      peek(L1requestNetwork_in, RequestMsg) {
69014184Sgabeblack@google.com        assert(in_msg.Destination.isElement(machineID));
69114184Sgabeblack@google.com        if (in_msg.Type == CoherenceRequestType:GETX) {
69214184Sgabeblack@google.com          trigger(Event:L1_GETX, in_msg.addr,
69314184Sgabeblack@google.com                  getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
69414184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:GETS) {
69514184Sgabeblack@google.com            trigger(Event:L1_GETS, in_msg.addr,
69614184Sgabeblack@google.com                  getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
69714184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:PUTO) {
69814184Sgabeblack@google.com          trigger(Event:L1_PUTO, in_msg.addr,
69914184Sgabeblack@google.com                  getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
70014184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:PUTX) {
70114184Sgabeblack@google.com          trigger(Event:L1_PUTX, in_msg.addr,
70214184Sgabeblack@google.com                  getCacheEntry(in_msg.addr), TBEs[in_msg.addr]);
70314184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:PUTS) {
70414184Sgabeblack@google.com          Entry cache_entry := getCacheEntry(in_msg.addr);
70514184Sgabeblack@google.com          if (isOnlySharer(cache_entry, in_msg.addr, in_msg.Requestor)) {
70614184Sgabeblack@google.com            trigger(Event:L1_PUTS_only, in_msg.addr,
70714184Sgabeblack@google.com                    cache_entry, TBEs[in_msg.addr]);
70814184Sgabeblack@google.com          }
70914184Sgabeblack@google.com          else {
71014184Sgabeblack@google.com            trigger(Event:L1_PUTS, in_msg.addr,
71114184Sgabeblack@google.com                    cache_entry, TBEs[in_msg.addr]);
71214184Sgabeblack@google.com          }
71314184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:WRITEBACK_DIRTY_DATA) {
71414184Sgabeblack@google.com          Entry cache_entry := getCacheEntry(in_msg.addr);
71514184Sgabeblack@google.com          if (is_invalid(cache_entry) &&
71614184Sgabeblack@google.com                   L2cache.cacheAvail(in_msg.addr) == false) {
71714300Sjqu32@wisc.edu            Addr victim := L2cache.cacheProbe(in_msg.addr);
71814300Sjqu32@wisc.edu            trigger(Event:L2_Replacement,
71914300Sjqu32@wisc.edu                    victim, getCacheEntry(victim), TBEs[victim]);
72014184Sgabeblack@google.com          }
72114184Sgabeblack@google.com          else {
72214184Sgabeblack@google.com            trigger(Event:L1_WBDIRTYDATA, in_msg.addr,
72314184Sgabeblack@google.com                    cache_entry, TBEs[in_msg.addr]);
72414184Sgabeblack@google.com          }
72514184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:WRITEBACK_CLEAN_DATA) {
72614184Sgabeblack@google.com          Entry cache_entry := getCacheEntry(in_msg.addr);
72714184Sgabeblack@google.com          if (is_invalid(cache_entry) &&
72814184Sgabeblack@google.com                   L2cache.cacheAvail(in_msg.addr) == false) {
72914300Sjqu32@wisc.edu            Addr victim := L2cache.cacheProbe(in_msg.addr);
73014300Sjqu32@wisc.edu            trigger(Event:L2_Replacement,
73114300Sjqu32@wisc.edu                    victim, getCacheEntry(victim), TBEs[victim]);
73214184Sgabeblack@google.com          }
73314184Sgabeblack@google.com          else {
73414184Sgabeblack@google.com            trigger(Event:L1_WBCLEANDATA, in_msg.addr,
73514184Sgabeblack@google.com                    cache_entry, TBEs[in_msg.addr]);
73614184Sgabeblack@google.com          }
73714184Sgabeblack@google.com        } else {
73814184Sgabeblack@google.com          error("Unexpected message");
73914184Sgabeblack@google.com        }
74014184Sgabeblack@google.com      }
74114184Sgabeblack@google.com    }
74214184Sgabeblack@google.com  }
74314184Sgabeblack@google.com
74414184Sgabeblack@google.com
74514184Sgabeblack@google.com  // ACTIONS
74614184Sgabeblack@google.com
74714184Sgabeblack@google.com  action(a_issueGETS, "a", desc="issue local request globally") {
74814184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
74914184Sgabeblack@google.com      enqueue(globalRequestNetwork_out, RequestMsg, request_latency) {
75014184Sgabeblack@google.com        out_msg.addr := address;
75114184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:GETS;
75214184Sgabeblack@google.com        out_msg.RequestorMachine := MachineType:L2Cache;
75314184Sgabeblack@google.com        out_msg.Requestor := machineID;
75414184Sgabeblack@google.com        out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
75514184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Request_Control;
75614184Sgabeblack@google.com      }
75714184Sgabeblack@google.com    }
75814184Sgabeblack@google.com  }
75914184Sgabeblack@google.com
76014184Sgabeblack@google.com  action(a_issueGETX, "\a", desc="issue local request globally") {
76114184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
76214184Sgabeblack@google.com      enqueue(globalRequestNetwork_out, RequestMsg, request_latency) {
76314184Sgabeblack@google.com        out_msg.addr := address;
76414184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:GETX;
76514184Sgabeblack@google.com        out_msg.RequestorMachine := MachineType:L2Cache;
76614184Sgabeblack@google.com        out_msg.Requestor := machineID;
76714184Sgabeblack@google.com        out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
76814184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Request_Control;
76914184Sgabeblack@google.com      }
77014184Sgabeblack@google.com    }
77114184Sgabeblack@google.com  }
77214184Sgabeblack@google.com
77314184Sgabeblack@google.com  action(b_issuePUTX, "b", desc="Issue PUTX") {
77414184Sgabeblack@google.com    enqueue(globalRequestNetwork_out, RequestMsg, request_latency) {
77514184Sgabeblack@google.com      out_msg.addr := address;
77614184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:PUTX;
77714184Sgabeblack@google.com      out_msg.RequestorMachine := MachineType:L2Cache;
77814184Sgabeblack@google.com      out_msg.Requestor := machineID;
77914184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
78014184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Writeback_Control;
78114184Sgabeblack@google.com    }
78214184Sgabeblack@google.com  }
78314184Sgabeblack@google.com
78414184Sgabeblack@google.com  action(b_issuePUTO, "\b", desc="Issue PUTO") {
78514184Sgabeblack@google.com    enqueue(globalRequestNetwork_out, RequestMsg, request_latency) {
78614184Sgabeblack@google.com      out_msg.addr := address;
78714184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:PUTO;
78814184Sgabeblack@google.com      out_msg.Requestor := machineID;
78914184Sgabeblack@google.com      out_msg.RequestorMachine := MachineType:L2Cache;
79014184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
79114184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Writeback_Control;
79214184Sgabeblack@google.com    }
79314184Sgabeblack@google.com  }
79414184Sgabeblack@google.com
79514184Sgabeblack@google.com  /* PUTO, but local sharers exist */
79614184Sgabeblack@google.com  action(b_issuePUTO_ls, "\bb", desc="Issue PUTO") {
79714184Sgabeblack@google.com    enqueue(globalRequestNetwork_out, RequestMsg, request_latency) {
79814184Sgabeblack@google.com      out_msg.addr := address;
79914184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:PUTO_SHARERS;
80014184Sgabeblack@google.com      out_msg.Requestor := machineID;
80114184Sgabeblack@google.com      out_msg.RequestorMachine := MachineType:L2Cache;
80214184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
80314184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Writeback_Control;
80414184Sgabeblack@google.com    }
80514184Sgabeblack@google.com  }
80614184Sgabeblack@google.com
80714184Sgabeblack@google.com  action(c_sendDataFromTBEToL1GETS, "c", desc="Send data from TBE to L1 requestors in TBE") {
80814184Sgabeblack@google.com    assert(is_valid(tbe));
80914184Sgabeblack@google.com    enqueue(responseNetwork_out, ResponseMsg, response_latency) {
81014184Sgabeblack@google.com      out_msg.addr := address;
81114184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:DATA;
81214184Sgabeblack@google.com      out_msg.Sender := machineID;
81314184Sgabeblack@google.com      out_msg.SenderMachine := MachineType:L2Cache;
81414184Sgabeblack@google.com      out_msg.Destination.addNetDest(tbe.L1_GetS_IDs);
81514184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
81614184Sgabeblack@google.com      // out_msg.Dirty := tbe.Dirty;
81714184Sgabeblack@google.com      // shared data should be clean
81814184Sgabeblack@google.com      out_msg.Dirty := false;
81914184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
82014184Sgabeblack@google.com    }
82114184Sgabeblack@google.com    DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n",
82214184Sgabeblack@google.com            address, tbe.DataBlk);
82314184Sgabeblack@google.com  }
82414184Sgabeblack@google.com
82514184Sgabeblack@google.com  action(c_sendDataFromTBEToL1GETX, "\c", desc="Send data from TBE to L1 requestors in TBE") {
82614184Sgabeblack@google.com    assert(is_valid(tbe));
82714184Sgabeblack@google.com    enqueue(responseNetwork_out, ResponseMsg, response_latency) {
82814184Sgabeblack@google.com      out_msg.addr := address;
82914184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
83014184Sgabeblack@google.com      out_msg.Sender := machineID;
83114184Sgabeblack@google.com      out_msg.SenderMachine := MachineType:L2Cache;
83214184Sgabeblack@google.com      out_msg.Destination.add(tbe.L1_GetX_ID);
83314184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
83414184Sgabeblack@google.com      out_msg.Dirty := tbe.Dirty;
83514184Sgabeblack@google.com      out_msg.Acks := tbe.Local_GETX_IntAcks;
83614184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
83714184Sgabeblack@google.com    }
83814184Sgabeblack@google.com    DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n",
83914184Sgabeblack@google.com            address, tbe.DataBlk);
84014184Sgabeblack@google.com  }
84114184Sgabeblack@google.com
84214184Sgabeblack@google.com  action(c_sendExclusiveDataFromTBEToL1GETS, "\cc", desc="Send data from TBE to L1 requestors in TBE") {
84314184Sgabeblack@google.com    assert(is_valid(tbe));
84414184Sgabeblack@google.com    enqueue(responseNetwork_out, ResponseMsg, response_latency) {
84514184Sgabeblack@google.com      out_msg.addr := address;
84614184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
84714184Sgabeblack@google.com      out_msg.Sender := machineID;
84814184Sgabeblack@google.com      out_msg.SenderMachine := MachineType:L2Cache;
84914184Sgabeblack@google.com      out_msg.Destination.addNetDest(tbe.L1_GetS_IDs);
85014184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
85114184Sgabeblack@google.com      out_msg.Dirty := tbe.Dirty;
85214184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
85314184Sgabeblack@google.com    }
85414184Sgabeblack@google.com  }
85514184Sgabeblack@google.com
85614184Sgabeblack@google.com  action(c_sendDataFromTBEToFwdGETX, "cc", desc="Send data from TBE to external GETX") {
85714184Sgabeblack@google.com    assert(is_valid(tbe));
85814184Sgabeblack@google.com    enqueue(responseNetwork_out, ResponseMsg, response_latency) {
85914184Sgabeblack@google.com      out_msg.addr := address;
86014184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
86114184Sgabeblack@google.com      out_msg.Sender := machineID;
86214184Sgabeblack@google.com      out_msg.SenderMachine := MachineType:L2Cache;
86314184Sgabeblack@google.com      out_msg.Destination.add(tbe.Fwd_GetX_ID);
86414184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
86514184Sgabeblack@google.com      out_msg.Dirty := tbe.Dirty;
86614184Sgabeblack@google.com      out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
86714184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
86814184Sgabeblack@google.com    }
86914184Sgabeblack@google.com  }
87014184Sgabeblack@google.com
87114184Sgabeblack@google.com  action(cd_sendDataFromTBEToFwdDma, "cd", desc="Send data from TBE to external GETX") {
87214184Sgabeblack@google.com    assert(is_valid(tbe));
87314184Sgabeblack@google.com    peek(requestNetwork_in, RequestMsg) {
87414184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, response_latency) {
87514184Sgabeblack@google.com        out_msg.addr := address;
87614184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA;
87714184Sgabeblack@google.com        out_msg.Sender := machineID;
87814184Sgabeblack@google.com        out_msg.SenderMachine := MachineType:L2Cache;
87914184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
88014184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
88114184Sgabeblack@google.com        // out_msg.Dirty := tbe.Dirty;
88214184Sgabeblack@google.com        // shared data should be clean
88314184Sgabeblack@google.com        out_msg.Dirty := false;
88414184Sgabeblack@google.com        out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
88514184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
88614184Sgabeblack@google.com      }
88714184Sgabeblack@google.com    }
88814184Sgabeblack@google.com    DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n",
88914184Sgabeblack@google.com            address, tbe.DataBlk);
89014184Sgabeblack@google.com  }
89114184Sgabeblack@google.com
89214184Sgabeblack@google.com  action(c_sendDataFromTBEToFwdGETS, "ccc", desc="Send data from TBE to external GETX") {
89314184Sgabeblack@google.com    assert(is_valid(tbe));
89414184Sgabeblack@google.com    enqueue(responseNetwork_out, ResponseMsg, response_latency) {
89514184Sgabeblack@google.com      out_msg.addr := address;
89614184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:DATA;
89714184Sgabeblack@google.com      out_msg.Sender := machineID;
89814184Sgabeblack@google.com      out_msg.SenderMachine := MachineType:L2Cache;
89914184Sgabeblack@google.com      out_msg.Destination.addNetDest(tbe.Fwd_GetS_IDs);
90014184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
90114184Sgabeblack@google.com      // out_msg.Dirty := tbe.Dirty;
90214184Sgabeblack@google.com      // shared data should be clean
90314184Sgabeblack@google.com      out_msg.Dirty := false;
90414184Sgabeblack@google.com      out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
90514184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
90614184Sgabeblack@google.com    }
90714184Sgabeblack@google.com    DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n",
90814184Sgabeblack@google.com            address, tbe.DataBlk);
90914184Sgabeblack@google.com  }
91014184Sgabeblack@google.com
91114184Sgabeblack@google.com  action(c_sendExclusiveDataFromTBEToFwdGETS, "\ccc", desc="Send data from TBE to external GETX") {
91214184Sgabeblack@google.com    assert(is_valid(tbe));
91314184Sgabeblack@google.com    enqueue(responseNetwork_out, ResponseMsg, response_latency) {
91414184Sgabeblack@google.com      out_msg.addr := address;
91514184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
91614184Sgabeblack@google.com      out_msg.Sender := machineID;
91714184Sgabeblack@google.com      out_msg.SenderMachine := MachineType:L2Cache;
91814184Sgabeblack@google.com      out_msg.Destination.addNetDest(tbe.Fwd_GetS_IDs);
91914184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
92014184Sgabeblack@google.com      out_msg.Dirty := tbe.Dirty;
92114184Sgabeblack@google.com      out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
92214184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
92314184Sgabeblack@google.com    }
92414184Sgabeblack@google.com    DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n",
92514184Sgabeblack@google.com            address, tbe.DataBlk);
92614184Sgabeblack@google.com  }
92714184Sgabeblack@google.com
92814184Sgabeblack@google.com  action(d_sendDataToL1GETS, "d", desc="Send data directly to L1 requestor") {
92914184Sgabeblack@google.com    assert(is_valid(cache_entry));
93014184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
93114184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cacheResponseLatency()) {
93214184Sgabeblack@google.com        out_msg.addr := address;
93314184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA;
93414184Sgabeblack@google.com        out_msg.Sender := machineID;
93514184Sgabeblack@google.com        out_msg.SenderMachine := MachineType:L2Cache;
93614184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
93714184Sgabeblack@google.com        out_msg.DataBlk := cache_entry.DataBlk;
93814184Sgabeblack@google.com        // out_msg.Dirty := cache_entry.Dirty;
93914184Sgabeblack@google.com        // shared data should be clean
94014184Sgabeblack@google.com        out_msg.Dirty := false;
94114184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:ResponseL2hit_Data;
94214184Sgabeblack@google.com      }
94314184Sgabeblack@google.com    }
94414184Sgabeblack@google.com    DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n",
94514184Sgabeblack@google.com            address, cache_entry.DataBlk);
94614184Sgabeblack@google.com  }
94714184Sgabeblack@google.com
94814184Sgabeblack@google.com  action(d_sendDataToL1GETX, "\d", desc="Send data and a token from TBE to L1 requestor") {
94914184Sgabeblack@google.com    assert(is_valid(cache_entry));
95014184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
95114184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cacheResponseLatency()) {
95214184Sgabeblack@google.com        assert(is_valid(tbe));
95314184Sgabeblack@google.com        out_msg.addr := address;
95414184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
95514184Sgabeblack@google.com        out_msg.Sender := machineID;
95614184Sgabeblack@google.com        out_msg.SenderMachine := MachineType:L2Cache;
95714184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
95814184Sgabeblack@google.com        out_msg.DataBlk := cache_entry.DataBlk;
95914184Sgabeblack@google.com        out_msg.Dirty := cache_entry.Dirty;
96014184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:ResponseL2hit_Data;
96114184Sgabeblack@google.com        out_msg.Acks := tbe.Local_GETX_IntAcks;
96214184Sgabeblack@google.com      }
96314184Sgabeblack@google.com    }
96414184Sgabeblack@google.com    DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n",
96514184Sgabeblack@google.com            address, cache_entry.DataBlk);
96614184Sgabeblack@google.com  }
96714184Sgabeblack@google.com
96814184Sgabeblack@google.com  action(dd_sendDataToFwdGETX, "dd", desc="send data") {
96914184Sgabeblack@google.com    assert(is_valid(cache_entry));
97014184Sgabeblack@google.com    peek(requestNetwork_in, RequestMsg) {
97114184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cacheResponseLatency()) {
97214184Sgabeblack@google.com        out_msg.addr := address;
97314184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
97414184Sgabeblack@google.com        out_msg.Sender := machineID;
97514184Sgabeblack@google.com        out_msg.SenderMachine := MachineType:L2Cache;
97614184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
97714184Sgabeblack@google.com        out_msg.DataBlk := cache_entry.DataBlk;
97814184Sgabeblack@google.com        out_msg.Dirty := cache_entry.Dirty;
97914184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
98014184Sgabeblack@google.com        out_msg.Acks := in_msg.Acks;
98114184Sgabeblack@google.com      }
98214184Sgabeblack@google.com    }
98314184Sgabeblack@google.com    DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n",
98414184Sgabeblack@google.com            address, cache_entry.DataBlk);
98514184Sgabeblack@google.com  }
98614184Sgabeblack@google.com
98714184Sgabeblack@google.com
98814184Sgabeblack@google.com  action(dd_sendDataToFwdGETS, "\dd", desc="send data") {
98914184Sgabeblack@google.com    assert(is_valid(cache_entry));
99014184Sgabeblack@google.com    peek(requestNetwork_in, RequestMsg) {
99114184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cacheResponseLatency()) {
99214184Sgabeblack@google.com        out_msg.addr := address;
99314184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA;
99414184Sgabeblack@google.com        out_msg.Sender := machineID;
99514184Sgabeblack@google.com        out_msg.SenderMachine := MachineType:L2Cache;
99614184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
99714184Sgabeblack@google.com        out_msg.DataBlk := cache_entry.DataBlk;
99814184Sgabeblack@google.com        // out_msg.Dirty := cache_entry.Dirty;
99914184Sgabeblack@google.com        // shared data should be clean
100014184Sgabeblack@google.com        out_msg.Dirty := false;
100114184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
100214184Sgabeblack@google.com      }
100314184Sgabeblack@google.com    }
100414184Sgabeblack@google.com    DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n",
100514184Sgabeblack@google.com            address, cache_entry.DataBlk);
100614184Sgabeblack@google.com  }
100714184Sgabeblack@google.com
100814184Sgabeblack@google.com  action(dd_sendExclusiveDataToFwdGETS, "\d\d", desc="send data") {
100914184Sgabeblack@google.com    assert(is_valid(cache_entry));
101014184Sgabeblack@google.com    peek(requestNetwork_in, RequestMsg) {
101114184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cacheResponseLatency()) {
101214184Sgabeblack@google.com        out_msg.addr := address;
101314184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
101414184Sgabeblack@google.com        out_msg.Sender := machineID;
101514184Sgabeblack@google.com        out_msg.SenderMachine := MachineType:L2Cache;
101614184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
101714184Sgabeblack@google.com        out_msg.DataBlk := cache_entry.DataBlk;
101814184Sgabeblack@google.com        out_msg.Dirty := cache_entry.Dirty;
101914184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
102014184Sgabeblack@google.com      }
102114184Sgabeblack@google.com    }
102214184Sgabeblack@google.com  }
102314184Sgabeblack@google.com
102414184Sgabeblack@google.com  action(e_sendAck, "e", desc="Send ack with the tokens we've collected thus far.") {
102514184Sgabeblack@google.com    enqueue(responseNetwork_out, ResponseMsg, response_latency) {
102614184Sgabeblack@google.com      assert(is_valid(tbe));
102714184Sgabeblack@google.com      out_msg.addr := address;
102814184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:ACK;
102914184Sgabeblack@google.com      out_msg.Sender := machineID;
103014184Sgabeblack@google.com      out_msg.SenderMachine := MachineType:L2Cache;
103114184Sgabeblack@google.com
103214184Sgabeblack@google.com      out_msg.Destination.add( tbe.Fwd_GetX_ID);
103314184Sgabeblack@google.com      out_msg.Acks := 0 - 1;
103414184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Control;
103514184Sgabeblack@google.com    }
103614184Sgabeblack@google.com  }
103714184Sgabeblack@google.com
103814184Sgabeblack@google.com  action(e_sendAckToL1Requestor, "\e", desc="Send ack with the tokens we've collected thus far.") {
103914184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
104014184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, response_latency) {
104114184Sgabeblack@google.com        out_msg.addr := address;
104214184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:ACK;
104314184Sgabeblack@google.com        out_msg.Sender := machineID;
104414184Sgabeblack@google.com        out_msg.SenderMachine := MachineType:L2Cache;
104514184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
104614184Sgabeblack@google.com        out_msg.Acks := 0 - 1;
104714184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Control;
104814184Sgabeblack@google.com      }
104914184Sgabeblack@google.com    }
105014184Sgabeblack@google.com  }
105114184Sgabeblack@google.com
105214184Sgabeblack@google.com  action(e_sendAckToL1RequestorFromTBE, "eee", desc="Send ack with the tokens we've collected thus far.") {
105314184Sgabeblack@google.com    enqueue(responseNetwork_out, ResponseMsg, response_latency) {
105414184Sgabeblack@google.com      assert(is_valid(tbe));
105514184Sgabeblack@google.com      out_msg.addr := address;
105614184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:ACK;
105714184Sgabeblack@google.com      out_msg.Sender := machineID;
105814184Sgabeblack@google.com      out_msg.SenderMachine := MachineType:L2Cache;
105914184Sgabeblack@google.com      out_msg.Destination.add(tbe.L1_GetX_ID);
106014184Sgabeblack@google.com      out_msg.Acks := 0 - 1;
106114184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Control;
106214184Sgabeblack@google.com    }
106314184Sgabeblack@google.com  }
106414184Sgabeblack@google.com
106514184Sgabeblack@google.com  action(ee_sendLocalInv, "\ee", desc="Send local invalidates") {
106614184Sgabeblack@google.com    assert(is_valid(tbe));
106714184Sgabeblack@google.com    tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
106814184Sgabeblack@google.com    DPRINTF(RubySlicc, "Address: %#x, Local Sharers: %s, Pending Acks: %d\n",
106914184Sgabeblack@google.com            address, getLocalSharers(cache_entry, address),
107014184Sgabeblack@google.com            tbe.NumIntPendingAcks);
107114184Sgabeblack@google.com    if (isLocalOwnerValid(cache_entry, address)) {
107214184Sgabeblack@google.com      tbe.NumIntPendingAcks := tbe.NumIntPendingAcks + 1;
107314184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", getLocalOwner(cache_entry, address));
107414184Sgabeblack@google.com    }
107514184Sgabeblack@google.com
107614184Sgabeblack@google.com    enqueue( localRequestNetwork_out, RequestMsg, response_latency ) {
107714184Sgabeblack@google.com      out_msg.addr := address;
107814184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:INV;
107914184Sgabeblack@google.com      out_msg.Requestor := machineID;
108014184Sgabeblack@google.com      out_msg.RequestorMachine := MachineType:L2Cache;
108114184Sgabeblack@google.com      out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
108214184Sgabeblack@google.com      if (isLocalOwnerValid(cache_entry, address))
108314184Sgabeblack@google.com      {
108414184Sgabeblack@google.com        out_msg.Destination.add(getLocalOwner(cache_entry, address));
108514184Sgabeblack@google.com      }
108614184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Invalidate_Control;
108714184Sgabeblack@google.com    }
108814184Sgabeblack@google.com  }
108914184Sgabeblack@google.com
109014184Sgabeblack@google.com  action(ee_sendLocalInvSharersOnly, "\eee", desc="Send local invalidates to sharers if they exist") {
109114184Sgabeblack@google.com
109214184Sgabeblack@google.com    // assert(countLocalSharers(address)  > 0);
109314184Sgabeblack@google.com    assert(is_valid(tbe));
109414184Sgabeblack@google.com    tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
109514184Sgabeblack@google.com
109614184Sgabeblack@google.com    if (countLocalSharers(cache_entry, address) > 0) {
109714184Sgabeblack@google.com      enqueue( localRequestNetwork_out, RequestMsg, response_latency ) {
109814184Sgabeblack@google.com        out_msg.addr := address;
109914184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:INV;
110014184Sgabeblack@google.com        out_msg.Requestor := machineID;
110114184Sgabeblack@google.com        out_msg.RequestorMachine := MachineType:L2Cache;
110214184Sgabeblack@google.com        out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
110314184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Invalidate_Control;
110414184Sgabeblack@google.com      }
110514184Sgabeblack@google.com    }
110614184Sgabeblack@google.com  }
110714184Sgabeblack@google.com
110814184Sgabeblack@google.com  action(ee_addLocalIntAck, "e\ee", desc="add a local ack to wait for") {
110914184Sgabeblack@google.com    assert(is_valid(tbe));
111014184Sgabeblack@google.com    tbe.NumIntPendingAcks := tbe.NumIntPendingAcks + 1;
111114184Sgabeblack@google.com  }
111214184Sgabeblack@google.com
111314184Sgabeblack@google.com  action(ee_issueLocalInvExceptL1Requestor, "\eeee", desc="Send local invalidates to sharers if they exist") {
111414184Sgabeblack@google.com      peek(L1requestNetwork_in, RequestMsg) {
111514184Sgabeblack@google.com
111614184Sgabeblack@google.com//         assert(countLocalSharers(address) > 0);
111714184Sgabeblack@google.com        if (countLocalSharers(cache_entry, address) == 0) {
111814184Sgabeblack@google.com          tbe.NumIntPendingAcks := 0;
111914184Sgabeblack@google.com        }
112014184Sgabeblack@google.com        else {
112114184Sgabeblack@google.com
112214184Sgabeblack@google.com          if (isLocalSharer(cache_entry, address, in_msg.Requestor)) {
112314184Sgabeblack@google.com            tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address) - 1;
112414184Sgabeblack@google.com          }
112514184Sgabeblack@google.com          else {
112614184Sgabeblack@google.com            tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
112714184Sgabeblack@google.com          }
112814184Sgabeblack@google.com
112914184Sgabeblack@google.com          enqueue( localRequestNetwork_out, RequestMsg, response_latency ) {
113014184Sgabeblack@google.com            out_msg.addr := address;
113114184Sgabeblack@google.com            out_msg.Type := CoherenceRequestType:INV;
113214184Sgabeblack@google.com            out_msg.Requestor := in_msg.Requestor;
113314184Sgabeblack@google.com            out_msg.RequestorMachine := MachineType:L1Cache;
113414184Sgabeblack@google.com            out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
113514184Sgabeblack@google.com            out_msg.Destination.remove(in_msg.Requestor);
113614184Sgabeblack@google.com            out_msg.MessageSize := MessageSizeType:Invalidate_Control;
113714184Sgabeblack@google.com          }
113814184Sgabeblack@google.com        }
113914184Sgabeblack@google.com      }
114014184Sgabeblack@google.com  }
114114184Sgabeblack@google.com
114214184Sgabeblack@google.com  action(ee_issueLocalInvExceptL1RequestorInTBE, "\eeeeee", desc="Send local invalidates to sharers if they exist") {
114314184Sgabeblack@google.com    assert(is_valid(tbe));
114414184Sgabeblack@google.com    if (countLocalSharers(cache_entry, address) == 0) {
114514184Sgabeblack@google.com      tbe.NumIntPendingAcks := 0;
114614184Sgabeblack@google.com    }
114714184Sgabeblack@google.com    else {
114814184Sgabeblack@google.com      if (isLocalSharer(cache_entry, address, tbe.L1_GetX_ID)) {
114914184Sgabeblack@google.com        tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address) - 1;
115014184Sgabeblack@google.com      }
115114184Sgabeblack@google.com      else {
115214184Sgabeblack@google.com        tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
115314184Sgabeblack@google.com      }
115414184Sgabeblack@google.com    }
115514184Sgabeblack@google.com    enqueue( localRequestNetwork_out, RequestMsg, response_latency ) {
115614184Sgabeblack@google.com        out_msg.addr := address;
115714184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:INV;
115814184Sgabeblack@google.com        out_msg.Requestor := tbe.L1_GetX_ID;
115914184Sgabeblack@google.com        out_msg.RequestorMachine := MachineType:L1Cache;
116014184Sgabeblack@google.com        out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
116114184Sgabeblack@google.com        out_msg.Destination.remove(tbe.L1_GetX_ID);
116214184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Invalidate_Control;
116314184Sgabeblack@google.com    }
116414184Sgabeblack@google.com  }
116514184Sgabeblack@google.com
116614184Sgabeblack@google.com
116714184Sgabeblack@google.com  action(f_sendUnblock, "f", desc="Send unblock to global directory") {
116814184Sgabeblack@google.com    enqueue(responseNetwork_out, ResponseMsg, response_latency) {
116914184Sgabeblack@google.com      out_msg.addr := address;
117014184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:UNBLOCK;
117114184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
117214184Sgabeblack@google.com      out_msg.Sender := machineID;
117314184Sgabeblack@google.com      out_msg.SenderMachine := MachineType:L2Cache;
117414184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Unblock_Control;
117514184Sgabeblack@google.com    }
117614184Sgabeblack@google.com  }
117714184Sgabeblack@google.com
117814184Sgabeblack@google.com
117914184Sgabeblack@google.com  action(f_sendExclusiveUnblock, "\f", desc="Send unblock to global directory") {
118014184Sgabeblack@google.com    enqueue(responseNetwork_out, ResponseMsg, response_latency) {
118114184Sgabeblack@google.com      out_msg.addr := address;
118214184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:UNBLOCK_EXCLUSIVE;
118314184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
118414184Sgabeblack@google.com      out_msg.Sender := machineID;
118514184Sgabeblack@google.com      out_msg.SenderMachine := MachineType:L2Cache;
118614184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Unblock_Control;
118714184Sgabeblack@google.com    }
118814184Sgabeblack@google.com  }
118914184Sgabeblack@google.com
119014184Sgabeblack@google.com
119114184Sgabeblack@google.com  action(g_recordLocalSharer, "g", desc="Record new local sharer from unblock message") {
119214184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
119314184Sgabeblack@google.com      recordLocalSharerInDir(cache_entry, in_msg.addr, in_msg.Sender);
119414184Sgabeblack@google.com    }
119514184Sgabeblack@google.com  }
119614184Sgabeblack@google.com
119714184Sgabeblack@google.com  action(g_recordLocalExclusive, "\g", desc="Record new local exclusive sharer from unblock message") {
119814184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
119914184Sgabeblack@google.com      recordNewLocalExclusiveInDir(cache_entry, address, in_msg.Sender);
120014184Sgabeblack@google.com    }
120114184Sgabeblack@google.com  }
120214184Sgabeblack@google.com
120314184Sgabeblack@google.com  action(gg_clearLocalSharers, "gg", desc="Clear local sharers") {
120414184Sgabeblack@google.com    removeAllLocalSharersFromDir(cache_entry, address);
120514184Sgabeblack@google.com  }
120614184Sgabeblack@google.com
120714184Sgabeblack@google.com  action(gg_clearSharerFromL1Response, "\gg", desc="Clear sharer from L1 response queue") {
120814184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
120914184Sgabeblack@google.com      removeSharerFromDir(cache_entry, in_msg.addr, in_msg.Sender);
121014184Sgabeblack@google.com    }
121114184Sgabeblack@google.com  }
121214184Sgabeblack@google.com
121314184Sgabeblack@google.com  action(gg_clearSharerFromL1Request, "clsl1r", desc="Clear sharer from L1 request queue") {
121414184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
121514184Sgabeblack@google.com      removeSharerFromDir(cache_entry, in_msg.addr, in_msg.Requestor);
121614184Sgabeblack@google.com    }
121714184Sgabeblack@google.com  }
121814184Sgabeblack@google.com
121914184Sgabeblack@google.com  action(gg_clearOwnerFromL1Request, "clol1r", desc="Clear owner from L1 request queue") {
122014184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
122114184Sgabeblack@google.com      removeOwnerFromDir(cache_entry, in_msg.addr, in_msg.Requestor);
122214184Sgabeblack@google.com    }
122314184Sgabeblack@google.com  }
122414184Sgabeblack@google.com
122514184Sgabeblack@google.com  action(h_countLocalSharersExceptRequestor, "h", desc="counts number of acks needed for L1 GETX") {
122614184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
122714184Sgabeblack@google.com      assert(is_valid(tbe));
122814184Sgabeblack@google.com      tbe.Local_GETX_IntAcks := countLocalSharersExceptRequestor(cache_entry, address, in_msg.Requestor);
122914184Sgabeblack@google.com    }
123014184Sgabeblack@google.com  }
123114184Sgabeblack@google.com
123214184Sgabeblack@google.com  action(h_clearIntAcks, "\h", desc="clear IntAcks") {
123314184Sgabeblack@google.com    assert(is_valid(tbe));
123414184Sgabeblack@google.com    tbe.Local_GETX_IntAcks := 0;
123514184Sgabeblack@google.com  }
123614184Sgabeblack@google.com
123714184Sgabeblack@google.com  action(hh_countLocalSharersExceptL1GETXRequestorInTBE, "hh", desc="counts number of acks needed for L1 GETX") {
123814184Sgabeblack@google.com    assert(is_valid(tbe));
123914184Sgabeblack@google.com    tbe.Local_GETX_IntAcks := countLocalSharersExceptRequestor(cache_entry, address, tbe.L1_GetX_ID);
124014184Sgabeblack@google.com  }
124114184Sgabeblack@google.com
124214184Sgabeblack@google.com  action(i_copyDataToTBE, "\i", desc="Copy data from response queue to TBE") {
124314184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
124414184Sgabeblack@google.com      assert(is_valid(tbe));
124514184Sgabeblack@google.com      tbe.DataBlk := in_msg.DataBlk;
124614184Sgabeblack@google.com      tbe.Dirty := in_msg.Dirty;
124714184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(in_msg.Sender);
124814184Sgabeblack@google.com    }
124914184Sgabeblack@google.com  }
125014184Sgabeblack@google.com
125114184Sgabeblack@google.com  action(i_allocateTBE, "i", desc="Allocate TBE for internal/external request(isPrefetch=0, number of invalidates=0)") {
125214184Sgabeblack@google.com    check_allocate(TBEs);
125314184Sgabeblack@google.com    TBEs.allocate(address);
125414184Sgabeblack@google.com    set_tbe(TBEs[address]);
125514184Sgabeblack@google.com    if(is_valid(cache_entry)) {
125614184Sgabeblack@google.com      tbe.DataBlk := cache_entry.DataBlk;
125714184Sgabeblack@google.com      tbe.Dirty := cache_entry.Dirty;
125814184Sgabeblack@google.com    }
125914184Sgabeblack@google.com    tbe.NumIntPendingAcks := 0;  // default value
126014184Sgabeblack@google.com    tbe.NumExtPendingAcks := 0;  // default value
126114184Sgabeblack@google.com    tbe.Fwd_GetS_IDs.clear();
126214184Sgabeblack@google.com    tbe.L1_GetS_IDs.clear();
126314184Sgabeblack@google.com  }
126414184Sgabeblack@google.com
126514184Sgabeblack@google.com
126614184Sgabeblack@google.com
126714184Sgabeblack@google.com  action(j_forwardGlobalRequestToLocalOwner, "j", desc="Forward external request to local owner") {
126814184Sgabeblack@google.com    peek(requestNetwork_in, RequestMsg) {
126914184Sgabeblack@google.com      enqueue( localRequestNetwork_out, RequestMsg, response_latency ) {
127014184Sgabeblack@google.com        out_msg.addr := in_msg.addr;
127114184Sgabeblack@google.com        out_msg.Type := in_msg.Type;
127214184Sgabeblack@google.com        out_msg.Requestor := machineID;
127314184Sgabeblack@google.com        out_msg.RequestorMachine := MachineType:L2Cache;
127414184Sgabeblack@google.com        out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.addr));
127514184Sgabeblack@google.com        out_msg.Type := in_msg.Type;
127614184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Forwarded_Control;
127714184Sgabeblack@google.com        out_msg.Acks := 0 - 1;
127814184Sgabeblack@google.com      }
127914184Sgabeblack@google.com    }
128014184Sgabeblack@google.com  }
128114184Sgabeblack@google.com
128214184Sgabeblack@google.com  action(jd_forwardDmaRequestToLocalOwner, "jd", desc="Forward dma request to local owner") {
128314184Sgabeblack@google.com    peek(requestNetwork_in, RequestMsg) {
128414184Sgabeblack@google.com      enqueue( localRequestNetwork_out, RequestMsg, response_latency ) {
128514184Sgabeblack@google.com        out_msg.addr := in_msg.addr;
128614184Sgabeblack@google.com        out_msg.Type := in_msg.Type;
128714184Sgabeblack@google.com        out_msg.Requestor := in_msg.Requestor;
128814184Sgabeblack@google.com        out_msg.RequestorMachine := in_msg.RequestorMachine;
128914184Sgabeblack@google.com        out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.addr));
129014184Sgabeblack@google.com        out_msg.Type := in_msg.Type;
129114184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Forwarded_Control;
129214184Sgabeblack@google.com        out_msg.Acks := 0 - 1;
129314184Sgabeblack@google.com      }
129414184Sgabeblack@google.com    }
129514184Sgabeblack@google.com  }
129614184Sgabeblack@google.com
129714184Sgabeblack@google.com
129814184Sgabeblack@google.com  action(k_forwardLocalGETSToLocalSharer, "k", desc="Forward local request to local sharer/owner") {
129914184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
130014184Sgabeblack@google.com      enqueue( localRequestNetwork_out, RequestMsg, response_latency ) {
130114184Sgabeblack@google.com        out_msg.addr := in_msg.addr;
130214184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:GETS;
130314184Sgabeblack@google.com        out_msg.Requestor := in_msg.Requestor;
130414184Sgabeblack@google.com        out_msg.RequestorMachine := MachineType:L1Cache;
130514184Sgabeblack@google.com        // should randomize this so one node doesn't get abused more than others
130614184Sgabeblack@google.com        DirEntry dir_entry := getDirEntry(in_msg.addr);
130714184Sgabeblack@google.com        out_msg.Destination.add(dir_entry.Sharers.smallestElement(MachineType:L1Cache));
130814184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Forwarded_Control;
130914184Sgabeblack@google.com      }
131014184Sgabeblack@google.com    }
131114184Sgabeblack@google.com  }
131214184Sgabeblack@google.com
131314184Sgabeblack@google.com  action(k_forwardLocalGETXToLocalOwner, "\k", desc="Forward local request to local owner") {
131414184Sgabeblack@google.com    enqueue( localRequestNetwork_out, RequestMsg, response_latency ) {
131514184Sgabeblack@google.com      assert(is_valid(tbe));
131614184Sgabeblack@google.com      out_msg.addr := address;
131714184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:GETX;
131814184Sgabeblack@google.com      out_msg.Requestor := tbe.L1_GetX_ID;
131914184Sgabeblack@google.com      out_msg.RequestorMachine := MachineType:L1Cache;
132014184Sgabeblack@google.com      DirEntry dir_entry := getDirEntry(address);
132114184Sgabeblack@google.com      out_msg.Destination.add(dir_entry.Owner);
132214184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Forwarded_Control;
132314184Sgabeblack@google.com      out_msg.Acks := 1 + tbe.Local_GETX_IntAcks;
132414184Sgabeblack@google.com    }
132514184Sgabeblack@google.com  }
132614184Sgabeblack@google.com
132714184Sgabeblack@google.com  // same as previous except that it assumes to TBE is present to get number of acks
132814184Sgabeblack@google.com  action(kk_forwardLocalGETXToLocalExclusive, "kk", desc="Forward local request to local owner") {
132914184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
133014184Sgabeblack@google.com      enqueue( localRequestNetwork_out, RequestMsg, response_latency ) {
133114184Sgabeblack@google.com        out_msg.addr := in_msg.addr;
133214184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:GETX;
133314184Sgabeblack@google.com        out_msg.Requestor := in_msg.Requestor;
133414184Sgabeblack@google.com        out_msg.RequestorMachine := MachineType:L1Cache;
133514184Sgabeblack@google.com        out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.addr));
133614184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Forwarded_Control;
133714184Sgabeblack@google.com        out_msg.Acks := 1;
133814184Sgabeblack@google.com      }
133914184Sgabeblack@google.com    }
134014184Sgabeblack@google.com  }
134114184Sgabeblack@google.com
134214184Sgabeblack@google.com  action(kk_forwardLocalGETSToLocalOwner, "\kk", desc="Forward local request to local owner") {
134314184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
134414184Sgabeblack@google.com      enqueue( localRequestNetwork_out, RequestMsg, response_latency ) {
134514184Sgabeblack@google.com        out_msg.addr := in_msg.addr;
134614184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:GETS;
134714184Sgabeblack@google.com        out_msg.Requestor := in_msg.Requestor;
134814184Sgabeblack@google.com        out_msg.RequestorMachine := MachineType:L1Cache;
134914184Sgabeblack@google.com        out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.addr));
135014184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Forwarded_Control;
135114184Sgabeblack@google.com      }
135214184Sgabeblack@google.com    }
135314184Sgabeblack@google.com  }
135414184Sgabeblack@google.com
135514184Sgabeblack@google.com
135614184Sgabeblack@google.com  action(l_writebackAckNeedData, "l", desc="Send writeback ack to L1 requesting data") {
135714184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
135814184Sgabeblack@google.com      enqueue( responseNetwork_out, ResponseMsg, response_latency ) {
135914184Sgabeblack@google.com        out_msg.addr := in_msg.addr;
136014184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:WB_ACK_DATA;
136114184Sgabeblack@google.com        out_msg.Sender := machineID;
136214184Sgabeblack@google.com        out_msg.SenderMachine := MachineType:L2Cache;
136314184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
136414184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Control;
136514184Sgabeblack@google.com      }
136614184Sgabeblack@google.com    }
136714184Sgabeblack@google.com  }
136814184Sgabeblack@google.com
136914184Sgabeblack@google.com  action(l_writebackAckDropData, "\l", desc="Send writeback ack to L1 indicating to drop data") {
137014184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
137114184Sgabeblack@google.com      enqueue( responseNetwork_out, ResponseMsg, response_latency ) {
137214184Sgabeblack@google.com        out_msg.addr := in_msg.addr;
137314184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:WB_ACK;
137414184Sgabeblack@google.com        out_msg.Sender := machineID;
137514184Sgabeblack@google.com        out_msg.SenderMachine := MachineType:L2Cache;
137614184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
137714184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Control;
137814184Sgabeblack@google.com      }
137914184Sgabeblack@google.com    }
138014184Sgabeblack@google.com  }
138114184Sgabeblack@google.com
138214184Sgabeblack@google.com  action(ll_writebackNack, "\ll", desc="Send writeback nack to L1") {
138314184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
138414184Sgabeblack@google.com      enqueue( responseNetwork_out, ResponseMsg, response_latency ) {
138514184Sgabeblack@google.com        out_msg.addr := in_msg.addr;
138614184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:WB_NACK;
138714184Sgabeblack@google.com        out_msg.Sender := machineID;
138814184Sgabeblack@google.com        out_msg.SenderMachine := MachineType:L2Cache;
138914184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
139014184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Control;
139114184Sgabeblack@google.com      }
139214184Sgabeblack@google.com    }
139314184Sgabeblack@google.com  }
139414184Sgabeblack@google.com
139514184Sgabeblack@google.com  action(m_popRequestQueue, "m", desc="Pop request queue.") {
139614184Sgabeblack@google.com    requestNetwork_in.dequeue(clockEdge());
139714184Sgabeblack@google.com  }
139814184Sgabeblack@google.com
139914184Sgabeblack@google.com  action(m_decrementNumberOfMessagesInt, "\m", desc="Decrement the number of messages for which we're waiting") {
140014184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
140114184Sgabeblack@google.com      assert(is_valid(tbe));
140214184Sgabeblack@google.com      tbe.NumIntPendingAcks := tbe.NumIntPendingAcks + in_msg.Acks;
140314184Sgabeblack@google.com    }
140414184Sgabeblack@google.com  }
140514184Sgabeblack@google.com
140614184Sgabeblack@google.com  action(m_decrementNumberOfMessagesExt, "\mmm", desc="Decrement the number of messages for which we're waiting") {
140714184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
140814184Sgabeblack@google.com      assert(is_valid(tbe));
140914184Sgabeblack@google.com      tbe.NumExtPendingAcks := tbe.NumExtPendingAcks - in_msg.Acks;
141014184Sgabeblack@google.com    }
141114184Sgabeblack@google.com  }
141214184Sgabeblack@google.com
141314184Sgabeblack@google.com  action(mm_decrementNumberOfMessagesExt, "\mm", desc="Decrement the number of messages for which we're waiting") {
141414184Sgabeblack@google.com    peek(requestNetwork_in, RequestMsg) {
141514184Sgabeblack@google.com      assert(is_valid(tbe));
141614184Sgabeblack@google.com      tbe.NumExtPendingAcks := tbe.NumExtPendingAcks - in_msg.Acks;
141714184Sgabeblack@google.com    }
141814184Sgabeblack@google.com  }
141914184Sgabeblack@google.com
142014184Sgabeblack@google.com  action(n_popResponseQueue, "n", desc="Pop response queue") {
142114184Sgabeblack@google.com    responseNetwork_in.dequeue(clockEdge());
142214184Sgabeblack@google.com  }
142314184Sgabeblack@google.com
142414184Sgabeblack@google.com  action(n_popTriggerQueue, "\n", desc="Pop trigger queue.") {
142514184Sgabeblack@google.com    triggerQueue_in.dequeue(clockEdge());
142614184Sgabeblack@google.com  }
142714184Sgabeblack@google.com
142814184Sgabeblack@google.com  action(o_popL1RequestQueue, "o", desc="Pop L1 request queue.") {
142914184Sgabeblack@google.com    L1requestNetwork_in.dequeue(clockEdge());
143014184Sgabeblack@google.com  }
143114184Sgabeblack@google.com
143214184Sgabeblack@google.com
143314184Sgabeblack@google.com  action(o_checkForIntCompletion, "\o", desc="Check if we have received all the messages required for completion") {
143414184Sgabeblack@google.com    assert(is_valid(tbe));
143514184Sgabeblack@google.com    if (tbe.NumIntPendingAcks == 0) {
143614184Sgabeblack@google.com      enqueue(triggerQueue_out, TriggerMsg) {
143714184Sgabeblack@google.com        out_msg.addr := address;
143814184Sgabeblack@google.com        out_msg.Type := TriggerType:ALL_ACKS;
143914184Sgabeblack@google.com      }
144014184Sgabeblack@google.com    }
144114184Sgabeblack@google.com  }
144214184Sgabeblack@google.com
144314184Sgabeblack@google.com  action(o_checkForExtCompletion, "\oo", desc="Check if we have received all the messages required for completion") {
144414184Sgabeblack@google.com    assert(is_valid(tbe));
144514184Sgabeblack@google.com    if (tbe.NumExtPendingAcks == 0) {
144614184Sgabeblack@google.com      enqueue(triggerQueue_out, TriggerMsg) {
144714184Sgabeblack@google.com        out_msg.addr := address;
144814184Sgabeblack@google.com        out_msg.Type := TriggerType:ALL_ACKS;
144914184Sgabeblack@google.com      }
145014184Sgabeblack@google.com    }
145114184Sgabeblack@google.com  }
145214184Sgabeblack@google.com
145314184Sgabeblack@google.com
145414184Sgabeblack@google.com  action( qq_sendDataFromTBEToMemory, "qq", desc="Send data from TBE to directory") {
145514184Sgabeblack@google.com    enqueue(globalRequestNetwork_out, RequestMsg, response_latency) {
145614184Sgabeblack@google.com      assert(is_valid(tbe));
145714184Sgabeblack@google.com      out_msg.addr := address;
145814184Sgabeblack@google.com      out_msg.Requestor := machineID;
145914184Sgabeblack@google.com      out_msg.RequestorMachine := MachineType:L2Cache;
146014184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
146114184Sgabeblack@google.com      if (tbe.Dirty) {
146214184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:WRITEBACK_DIRTY_DATA;
146314184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
146414184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Data;
146514184Sgabeblack@google.com      } else {
146614184Sgabeblack@google.com         out_msg.Type := CoherenceRequestType:WRITEBACK_CLEAN_ACK;
146714184Sgabeblack@google.com        // NOTE: in a real system this would not send data.  We send
146814184Sgabeblack@google.com        // data here only so we can check it at the memory
146914184Sgabeblack@google.com         out_msg.DataBlk := tbe.DataBlk;
147014184Sgabeblack@google.com         out_msg.MessageSize := MessageSizeType:Writeback_Control;
147114184Sgabeblack@google.com      }
147214184Sgabeblack@google.com    }
147314184Sgabeblack@google.com  }
147414184Sgabeblack@google.com
147514184Sgabeblack@google.com  action( r_setMRU, "\rrr", desc="manually set the MRU bit for cache line" ) {
147614184Sgabeblack@google.com    if(is_valid(cache_entry)) {
147714184Sgabeblack@google.com      L2cache.setMRU(address);
147814184Sgabeblack@google.com    }
147914184Sgabeblack@google.com  }
148014184Sgabeblack@google.com
148114184Sgabeblack@google.com  action( s_recordGetXL1ID, "ss", desc="record local GETX requestor") {
148214184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
148314184Sgabeblack@google.com      assert(is_valid(tbe));
148414184Sgabeblack@google.com      tbe.L1_GetX_ID := in_msg.Requestor;
148514184Sgabeblack@google.com    }
148614184Sgabeblack@google.com  }
148714184Sgabeblack@google.com
148814184Sgabeblack@google.com  action(s_deallocateTBE, "s", desc="Deallocate external TBE") {
148914184Sgabeblack@google.com    TBEs.deallocate(address);
149014184Sgabeblack@google.com    unset_tbe();
149114184Sgabeblack@google.com  }
149214184Sgabeblack@google.com
149314184Sgabeblack@google.com  action( s_recordGetSL1ID, "\ss", desc="record local GETS requestor") {
149414184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
149514184Sgabeblack@google.com      assert(is_valid(tbe));
149614184Sgabeblack@google.com      tbe.L1_GetS_IDs.add(in_msg.Requestor);
149714184Sgabeblack@google.com    }
149814184Sgabeblack@google.com  }
149914184Sgabeblack@google.com
150014184Sgabeblack@google.com  action(t_recordFwdXID, "t", desc="record global GETX requestor") {
150114184Sgabeblack@google.com    peek(requestNetwork_in, RequestMsg) {
150214184Sgabeblack@google.com      assert(is_valid(tbe));
150314184Sgabeblack@google.com      tbe.Fwd_GetX_ID := in_msg.Requestor;
150414184Sgabeblack@google.com      tbe.Fwd_GETX_ExtAcks := in_msg.Acks;
150514184Sgabeblack@google.com    }
150614184Sgabeblack@google.com  }
150714184Sgabeblack@google.com
150814184Sgabeblack@google.com  action(t_recordFwdSID, "\t", desc="record global GETS requestor") {
150914184Sgabeblack@google.com    peek(requestNetwork_in, RequestMsg) {
151014184Sgabeblack@google.com      assert(is_valid(tbe));
151114184Sgabeblack@google.com      tbe.Fwd_GetS_IDs.clear();
151214184Sgabeblack@google.com      tbe.Fwd_GetS_IDs.add(in_msg.Requestor);
151314184Sgabeblack@google.com    }
151414184Sgabeblack@google.com  }
151514184Sgabeblack@google.com
151614184Sgabeblack@google.com
151714184Sgabeblack@google.com  action(u_writeCleanDataToCache, "wCd", desc="Write clean data to cache") {
151814184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
151914184Sgabeblack@google.com      assert(is_valid(cache_entry));
152014184Sgabeblack@google.com      cache_entry.DataBlk := in_msg.DataBlk;
152114184Sgabeblack@google.com      DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n",
152214184Sgabeblack@google.com            address, cache_entry.DataBlk);
152314184Sgabeblack@google.com      assert(cache_entry.Dirty == false);
152414184Sgabeblack@google.com    }
152514184Sgabeblack@google.com  }
152614184Sgabeblack@google.com
152714184Sgabeblack@google.com  action(u_writeDirtyDataToCache, "wDd", desc="Write dirty data to cache") {
152814184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
152914184Sgabeblack@google.com      assert(is_valid(cache_entry));
153014184Sgabeblack@google.com      cache_entry.DataBlk := in_msg.DataBlk;
153114184Sgabeblack@google.com      DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n",
153214184Sgabeblack@google.com            address, cache_entry.DataBlk);
153314184Sgabeblack@google.com      cache_entry.Dirty := true;
153414184Sgabeblack@google.com    }
153514184Sgabeblack@google.com  }
153614184Sgabeblack@google.com
153714184Sgabeblack@google.com  action(vv_allocateL2CacheBlock, "\v", desc="Set L2 cache tag equal to tag of block B.") {
153814184Sgabeblack@google.com    set_cache_entry(L2cache.allocate(address, new Entry));
153914184Sgabeblack@google.com  }
154014184Sgabeblack@google.com
154114184Sgabeblack@google.com  action(rr_deallocateL2CacheBlock, "\r", desc="Deallocate L2 cache block.  Sets the cache to not present, allowing a replacement in parallel with a fetch.") {
154214184Sgabeblack@google.com    L2cache.deallocate(address);
154314184Sgabeblack@google.com    unset_cache_entry();
154414184Sgabeblack@google.com  }
154514184Sgabeblack@google.com
154614184Sgabeblack@google.com  action(uu_profileMiss, "\um", desc="Profile the demand miss") {
154714184Sgabeblack@google.com      ++L2cache.demand_misses;
154814184Sgabeblack@google.com  }
154914184Sgabeblack@google.com
155014184Sgabeblack@google.com  action(uu_profileHit, "\uh", desc="Profile the demand hit") {
155114184Sgabeblack@google.com      ++L2cache.demand_hits;
155214184Sgabeblack@google.com  }
155314184Sgabeblack@google.com
155414184Sgabeblack@google.com  action(y_copyCacheStateToDir, "y", desc="Copy cache state to directory state") {
155514184Sgabeblack@google.com    copyCacheStateToDir(cache_entry, address);
155614184Sgabeblack@google.com  }
155714184Sgabeblack@google.com
155814184Sgabeblack@google.com  action(y_copyDirToCacheAndRemove, "/y", desc="Copy dir state to cache and remove") {
155914184Sgabeblack@google.com    copyDirToCache(cache_entry, address);
156014184Sgabeblack@google.com    localDirectory.deallocate(address);
156114184Sgabeblack@google.com  }
156214184Sgabeblack@google.com
156314184Sgabeblack@google.com  action(zz_recycleGlobalRequestQueue, "\zglb", desc="Send the head of the mandatory queue to the back of the queue.") {
156414184Sgabeblack@google.com    peek(requestNetwork_in, RequestMsg) {
156514184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(in_msg.Requestor);
156614184Sgabeblack@google.com    }
156714184Sgabeblack@google.com    requestNetwork_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
156814184Sgabeblack@google.com  }
156914184Sgabeblack@google.com
157014184Sgabeblack@google.com  action(zz_recycleL1RequestQueue, "\zl1", desc="Send the head of the mandatory queue to the back of the queue.") {
157114184Sgabeblack@google.com    peek(L1requestNetwork_in, RequestMsg) {
157214184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(in_msg.Requestor);
157314184Sgabeblack@google.com    }
157414184Sgabeblack@google.com    L1requestNetwork_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
157514184Sgabeblack@google.com  }
157614184Sgabeblack@google.com
157714184Sgabeblack@google.com  action(st_stallAndWaitL1RequestQueue, "st", desc="Stall and wait on the address") {
157814184Sgabeblack@google.com    stall_and_wait(L1requestNetwork_in, address);
157914184Sgabeblack@google.com  }
158014184Sgabeblack@google.com
158114184Sgabeblack@google.com  action(wa_wakeUpDependents, "wa", desc="Wake up any requests waiting for this address") {
158214184Sgabeblack@google.com    wakeUpAllBuffers(address);
158314184Sgabeblack@google.com  }
158414184Sgabeblack@google.com
158514184Sgabeblack@google.com  action(da_sendDmaAckUnblock, "da", desc="Send dma ack to global directory") {
158614184Sgabeblack@google.com    enqueue(responseNetwork_out, ResponseMsg, response_latency) {
158714184Sgabeblack@google.com      out_msg.addr := address;
158814184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:DMA_ACK;
158914184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
159014184Sgabeblack@google.com      out_msg.Sender := machineID;
159114184Sgabeblack@google.com      out_msg.SenderMachine := MachineType:L2Cache;
159214184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Unblock_Control;
159314184Sgabeblack@google.com    }
159414184Sgabeblack@google.com  }
159514184Sgabeblack@google.com
159614184Sgabeblack@google.com
159714184Sgabeblack@google.com
159814184Sgabeblack@google.com  //*****************************************************
159914184Sgabeblack@google.com  // TRANSITIONS
160014184Sgabeblack@google.com  //*****************************************************
160114184Sgabeblack@google.com
160214184Sgabeblack@google.com  transition({II, IFGX, IFGS, ISFGS, IFGXX, IFLXO, ILOW, ILOXW, ILOSW, ILOSXW, SLSW, OLSW, ILSW, IW, OW, SW, OXW, OLSXW, ILXW, IFLS, IFLO, IFLOX, IFLOXX, IFLOSX, OLSXS, IGS, IGM, IGMLS, IGMO, IGMIO, OGMIO, IGMIOF, OGMIOF, MM, SS, OO, OI, MI, MII, OLSI, ILSI, SLSS, OLSS, OLSF, IGMIOFS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {L1_PUTO, L1_PUTS, L1_PUTS_only, L1_PUTX}) {
160314184Sgabeblack@google.com    st_stallAndWaitL1RequestQueue;
160414184Sgabeblack@google.com  }
160514184Sgabeblack@google.com
160614184Sgabeblack@google.com  transition({II, IFGX, IFGS, ISFGS, IFGXX, IFLXO, ILOW, ILOXW, ILOSW, ILOSXW, SLSW, OLSW, ILSW, IW, OW, SW, OXW, OLSXW, ILXW, IFLS, IFLO, IFLOX, IFLOXX, IFLOSX, OLSXS, IGS, IGM, IGMLS, IGMO, IGMIO, OGMIO, IGMIOF, OGMIOF, MM, SS, OO, OI, MI, MII, OLSI, ILSI, SLSS, OLSS, OLSF, IGMIOFS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {L1_GETX, L1_GETS}) {
160714184Sgabeblack@google.com    st_stallAndWaitL1RequestQueue;
160814184Sgabeblack@google.com  }
160914184Sgabeblack@google.com
161014184Sgabeblack@google.com  transition({IFGX, IFGS, ISFGS, IFGXX, IFLXO, ILOW, ILOXW, ILOSW, ILOSXW, SLSW, OLSW, ILSW, IW, ILXW, OW, SW, OXW, OLSXW, IFLS, IFLO, IFLOX, IFLOXX, IFLOSX,OLSXS,  IGS, IGM, IGMLS, IGMO, MM, SS, OO, OI, MI, MII, OLSI, ILSI, SLSS, OLSS, OLSF, IGMIOFS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, L2_Replacement) {
161114184Sgabeblack@google.com    zz_recycleL1RequestQueue;
161214184Sgabeblack@google.com  }
161314184Sgabeblack@google.com
161414184Sgabeblack@google.com  transition({IFGX, IFGS, ISFGS, IFGXX, IFLXO, ILOW, ILOXW, ILOSW, ILOSXW, SLSW, OLSW, ILSW, IW, OW, SW, OXW, OLSXW, ILXW, IFLS, IFLO, IFLOX, IFLOXX, IFLOSX,OLSXS, IGS, IGM, MM, SS, OO, SLSS, OLSS, OLSF, IGMIOFS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {Fwd_GETX, Fwd_GETS, Fwd_DMA}) {
161514184Sgabeblack@google.com    zz_recycleGlobalRequestQueue;
161614184Sgabeblack@google.com  }
161714184Sgabeblack@google.com
161814184Sgabeblack@google.com  transition({OGMIO, IGMIO, IGMO}, Fwd_DMA) {
161914184Sgabeblack@google.com    zz_recycleGlobalRequestQueue;
162014184Sgabeblack@google.com  }
162114184Sgabeblack@google.com
162214184Sgabeblack@google.com  transition({IFGX, IFGS, ISFGS, IFGXX, IFLXO, ILOW, ILOXW, ILOSW, ILOSXW, SLSW, OLSW, ILSW, IW, OW, SW, OXW, OLSXW, ILXW, IFLS, IFLO, IFLOX, IFLOXX, IFLOSX,OLSXS, MM, SS, OO, SLSS, OLSS, OLSF, IGMIOFS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {Inv}) {
162314184Sgabeblack@google.com    zz_recycleGlobalRequestQueue;
162414184Sgabeblack@google.com  }
162514184Sgabeblack@google.com
162614184Sgabeblack@google.com  transition({IGM, IGS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {Own_GETX}) {
162714184Sgabeblack@google.com    zz_recycleGlobalRequestQueue;
162814184Sgabeblack@google.com  }
162914184Sgabeblack@google.com
163014184Sgabeblack@google.com  // must happened because we forwarded GETX to local exclusive trying to do wb
163114184Sgabeblack@google.com  transition({I, M, O, ILS, ILOX, OLS, OLSX, SLS, S}, L1_PUTX) {
163214184Sgabeblack@google.com    ll_writebackNack;
163314184Sgabeblack@google.com    o_popL1RequestQueue;
163414184Sgabeblack@google.com  }
163514184Sgabeblack@google.com
163614184Sgabeblack@google.com  transition({M}, {L1_PUTS, L1_PUTO} ) {
163714184Sgabeblack@google.com    ll_writebackNack;
163814184Sgabeblack@google.com    o_popL1RequestQueue;
163914184Sgabeblack@google.com  }
164014184Sgabeblack@google.com
164114184Sgabeblack@google.com  transition({ILS, OLSX}, L1_PUTO){
164214184Sgabeblack@google.com    ll_writebackNack;
164314184Sgabeblack@google.com    o_popL1RequestQueue;
164414184Sgabeblack@google.com  }
164514184Sgabeblack@google.com
164614184Sgabeblack@google.com// happened if we forwarded GETS to exclusive who tried to do writeback
164714184Sgabeblack@google.com//  ?? should we just Nack these instead?  Could be a bugs here
164814184Sgabeblack@google.com  transition(ILO, L1_PUTX, ILOW) {
164914184Sgabeblack@google.com     l_writebackAckNeedData;
165014184Sgabeblack@google.com     o_popL1RequestQueue;
165114184Sgabeblack@google.com  }
165214184Sgabeblack@google.com
165314184Sgabeblack@google.com  // this can happen if we forwarded a L1_GETX to exclusiver after it issued a PUTX
165414184Sgabeblack@google.com  transition(ILOS, L1_PUTX, ILOSW) {
165514184Sgabeblack@google.com    l_writebackAckNeedData;
165614184Sgabeblack@google.com    o_popL1RequestQueue;
165714184Sgabeblack@google.com  }
165814184Sgabeblack@google.com
165914184Sgabeblack@google.com  transition(ILOSX, L1_PUTX, ILOSXW) {
166014184Sgabeblack@google.com    l_writebackAckNeedData;
166114184Sgabeblack@google.com    o_popL1RequestQueue;
166214184Sgabeblack@google.com  }
166314184Sgabeblack@google.com
166414184Sgabeblack@google.com  // must happened because we got Inv when L1 attempted PUTS
166514184Sgabeblack@google.com  transition(I, L1_PUTS) {
166614184Sgabeblack@google.com    ll_writebackNack;
166714184Sgabeblack@google.com    o_popL1RequestQueue;
166814184Sgabeblack@google.com  }
166914184Sgabeblack@google.com
167014184Sgabeblack@google.com  transition(I, L1_PUTO) {
167114184Sgabeblack@google.com    ll_writebackNack;
167214184Sgabeblack@google.com    o_popL1RequestQueue;
167314184Sgabeblack@google.com  }
167414184Sgabeblack@google.com
167514184Sgabeblack@google.com  // FORWARDED REQUESTS
167614184Sgabeblack@google.com
167714184Sgabeblack@google.com  transition({ILO, ILX, ILOX}, Fwd_GETS, IFGS) {
167814184Sgabeblack@google.com    i_allocateTBE;
167914184Sgabeblack@google.com    t_recordFwdSID;
168014184Sgabeblack@google.com    j_forwardGlobalRequestToLocalOwner;
168114184Sgabeblack@google.com    m_popRequestQueue;
168214184Sgabeblack@google.com  }
168314184Sgabeblack@google.com
168414184Sgabeblack@google.com  transition({ILOS, ILOSX}, Fwd_GETS, ISFGS) {
168514184Sgabeblack@google.com    i_allocateTBE;
168614184Sgabeblack@google.com    t_recordFwdSID;
168714184Sgabeblack@google.com    j_forwardGlobalRequestToLocalOwner;
168814184Sgabeblack@google.com    m_popRequestQueue;
168914184Sgabeblack@google.com  }
169014184Sgabeblack@google.com
169114184Sgabeblack@google.com  transition(ILOS, Fwd_DMA, ILOSD) {
169214184Sgabeblack@google.com    i_allocateTBE;
169314184Sgabeblack@google.com    jd_forwardDmaRequestToLocalOwner;
169414184Sgabeblack@google.com    m_popRequestQueue;
169514184Sgabeblack@google.com  }
169614184Sgabeblack@google.com
169714184Sgabeblack@google.com  transition(ILOSD, DmaAck, ILOS) {
169814184Sgabeblack@google.com    s_deallocateTBE;
169914184Sgabeblack@google.com    da_sendDmaAckUnblock;
170014184Sgabeblack@google.com    n_popResponseQueue;
170114184Sgabeblack@google.com    wa_wakeUpDependents;
170214184Sgabeblack@google.com  }
170314184Sgabeblack@google.com
170414184Sgabeblack@google.com  transition(ILOSX, Fwd_DMA, ILOSXD) {
170514184Sgabeblack@google.com    i_allocateTBE;
170614184Sgabeblack@google.com    t_recordFwdSID;
170714184Sgabeblack@google.com    jd_forwardDmaRequestToLocalOwner;
170814184Sgabeblack@google.com    m_popRequestQueue;
170914184Sgabeblack@google.com  }
171014184Sgabeblack@google.com
171114184Sgabeblack@google.com  transition(ILOSXD, DmaAck, ILOSX) {
171214184Sgabeblack@google.com    s_deallocateTBE;
171314184Sgabeblack@google.com    da_sendDmaAckUnblock;
171414184Sgabeblack@google.com    n_popResponseQueue;
171514184Sgabeblack@google.com    wa_wakeUpDependents;
171614184Sgabeblack@google.com  }
171714184Sgabeblack@google.com
171814184Sgabeblack@google.com  transition(ILO, Fwd_DMA, ILOD) {
171914184Sgabeblack@google.com    i_allocateTBE;
172014184Sgabeblack@google.com    t_recordFwdSID;
172114184Sgabeblack@google.com    jd_forwardDmaRequestToLocalOwner;
172214184Sgabeblack@google.com    m_popRequestQueue;
172314184Sgabeblack@google.com  }
172414184Sgabeblack@google.com
172514184Sgabeblack@google.com  transition(ILOD, DmaAck, ILO) {
172614184Sgabeblack@google.com    s_deallocateTBE;
172714184Sgabeblack@google.com    da_sendDmaAckUnblock;
172814184Sgabeblack@google.com    n_popResponseQueue;
172914184Sgabeblack@google.com    wa_wakeUpDependents;
173014184Sgabeblack@google.com  }
173114184Sgabeblack@google.com
173214184Sgabeblack@google.com  transition(ILX, Fwd_DMA, ILXD) {
173314184Sgabeblack@google.com    i_allocateTBE;
173414184Sgabeblack@google.com    t_recordFwdSID;
173514184Sgabeblack@google.com    jd_forwardDmaRequestToLocalOwner;
173614184Sgabeblack@google.com    m_popRequestQueue;
173714184Sgabeblack@google.com  }
173814184Sgabeblack@google.com
173914184Sgabeblack@google.com  transition(ILXD, DmaAck, ILX) {
174014184Sgabeblack@google.com    s_deallocateTBE;
174114184Sgabeblack@google.com    da_sendDmaAckUnblock;
174214184Sgabeblack@google.com    n_popResponseQueue;
174314184Sgabeblack@google.com    wa_wakeUpDependents;
174414184Sgabeblack@google.com  }
174514184Sgabeblack@google.com
174614184Sgabeblack@google.com  transition(ILOX, Fwd_DMA, ILOXD) {
174714184Sgabeblack@google.com    i_allocateTBE;
174814184Sgabeblack@google.com    t_recordFwdSID;
174914184Sgabeblack@google.com    jd_forwardDmaRequestToLocalOwner;
175014184Sgabeblack@google.com    m_popRequestQueue;
175114184Sgabeblack@google.com  }
175214184Sgabeblack@google.com
175314184Sgabeblack@google.com  transition(ILOXD, DmaAck, ILOX) {
175414184Sgabeblack@google.com    s_deallocateTBE;
175514184Sgabeblack@google.com    da_sendDmaAckUnblock;
175614184Sgabeblack@google.com    n_popResponseQueue;
175714184Sgabeblack@google.com    wa_wakeUpDependents;
175814184Sgabeblack@google.com  }
175914184Sgabeblack@google.com
176014184Sgabeblack@google.com  transition({ILOS, ILOSX, ILO, ILX, ILOX, ILXW}, Data) {
176114184Sgabeblack@google.com    i_copyDataToTBE;
176214184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETS;
176314184Sgabeblack@google.com    s_deallocateTBE;
176414184Sgabeblack@google.com    n_popResponseQueue;
176514184Sgabeblack@google.com  }
176614184Sgabeblack@google.com
176714184Sgabeblack@google.com  transition(IFGS, Data, ILO) {
176814184Sgabeblack@google.com    i_copyDataToTBE;
176914184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETS;
177014184Sgabeblack@google.com    s_deallocateTBE;
177114184Sgabeblack@google.com    n_popResponseQueue;
177214184Sgabeblack@google.com    wa_wakeUpDependents;
177314184Sgabeblack@google.com  }
177414184Sgabeblack@google.com
177514184Sgabeblack@google.com  transition(ISFGS, Data, ILOS) {
177614184Sgabeblack@google.com    i_copyDataToTBE;
177714184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETS;
177814184Sgabeblack@google.com    s_deallocateTBE;
177914184Sgabeblack@google.com    n_popResponseQueue;
178014184Sgabeblack@google.com    wa_wakeUpDependents;
178114184Sgabeblack@google.com  }
178214184Sgabeblack@google.com
178314184Sgabeblack@google.com  transition(IFGS, Data_Exclusive, I) {
178414184Sgabeblack@google.com    i_copyDataToTBE;
178514184Sgabeblack@google.com    c_sendExclusiveDataFromTBEToFwdGETS;
178614184Sgabeblack@google.com    gg_clearLocalSharers;
178714184Sgabeblack@google.com    s_deallocateTBE;
178814184Sgabeblack@google.com    n_popResponseQueue;
178914184Sgabeblack@google.com    wa_wakeUpDependents;
179014184Sgabeblack@google.com  }
179114184Sgabeblack@google.com
179214184Sgabeblack@google.com
179314184Sgabeblack@google.com  transition({ILX, ILO, ILOX}, Fwd_GETX, IFGX) {
179414184Sgabeblack@google.com    i_allocateTBE;
179514184Sgabeblack@google.com    t_recordFwdXID;
179614184Sgabeblack@google.com    j_forwardGlobalRequestToLocalOwner;
179714184Sgabeblack@google.com    m_popRequestQueue;
179814184Sgabeblack@google.com  }
179914184Sgabeblack@google.com
180014184Sgabeblack@google.com  transition(IFGX, {Data_Exclusive, Data}, I) {
180114184Sgabeblack@google.com    i_copyDataToTBE;
180214184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETX;
180314184Sgabeblack@google.com    gg_clearLocalSharers;
180414184Sgabeblack@google.com    s_deallocateTBE;
180514184Sgabeblack@google.com    n_popResponseQueue;
180614184Sgabeblack@google.com    wa_wakeUpDependents;
180714184Sgabeblack@google.com  }
180814184Sgabeblack@google.com
180914184Sgabeblack@google.com  transition({ILOSX, ILOS}, Fwd_GETX, IFGXX) {
181014184Sgabeblack@google.com    i_allocateTBE;
181114184Sgabeblack@google.com    t_recordFwdXID;
181214184Sgabeblack@google.com    j_forwardGlobalRequestToLocalOwner;
181314184Sgabeblack@google.com    ee_sendLocalInvSharersOnly;
181414184Sgabeblack@google.com    ee_addLocalIntAck;
181514184Sgabeblack@google.com    m_popRequestQueue;
181614184Sgabeblack@google.com  }
181714184Sgabeblack@google.com
181814184Sgabeblack@google.com
181914184Sgabeblack@google.com  transition(IFGXX, IntAck) {
182014184Sgabeblack@google.com    m_decrementNumberOfMessagesInt;
182114184Sgabeblack@google.com    o_checkForIntCompletion;
182214184Sgabeblack@google.com    n_popResponseQueue;
182314184Sgabeblack@google.com  }
182414184Sgabeblack@google.com
182514184Sgabeblack@google.com  transition(IFGXX, Data_Exclusive) {
182614184Sgabeblack@google.com    i_copyDataToTBE;
182714184Sgabeblack@google.com    m_decrementNumberOfMessagesInt;
182814184Sgabeblack@google.com    o_checkForIntCompletion;
182914184Sgabeblack@google.com    n_popResponseQueue;
183014184Sgabeblack@google.com  }
183114184Sgabeblack@google.com
183214184Sgabeblack@google.com  transition(IFGXX, All_Acks, I) {
183314184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETX;
183414184Sgabeblack@google.com    gg_clearLocalSharers;
183514184Sgabeblack@google.com    s_deallocateTBE;
183614184Sgabeblack@google.com    n_popTriggerQueue;
183714184Sgabeblack@google.com    wa_wakeUpDependents;
183814184Sgabeblack@google.com  }
183914184Sgabeblack@google.com
184014184Sgabeblack@google.com
184114184Sgabeblack@google.com  // transition({O, OX}, Fwd_GETX, I) {
184214184Sgabeblack@google.com  transition(O, Fwd_GETX, I) {
184314184Sgabeblack@google.com    dd_sendDataToFwdGETX;
184414184Sgabeblack@google.com    y_copyCacheStateToDir;
184514184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
184614184Sgabeblack@google.com    m_popRequestQueue;
184714184Sgabeblack@google.com  }
184814184Sgabeblack@google.com
184914184Sgabeblack@google.com  transition({O, OLS}, Fwd_GETS) {
185014184Sgabeblack@google.com    dd_sendDataToFwdGETS;
185114184Sgabeblack@google.com    m_popRequestQueue;
185214184Sgabeblack@google.com  }
185314184Sgabeblack@google.com
185414184Sgabeblack@google.com  transition({O, OLS}, Fwd_DMA) {
185514184Sgabeblack@google.com    dd_sendDataToFwdGETS;
185614184Sgabeblack@google.com    da_sendDmaAckUnblock;
185714184Sgabeblack@google.com    m_popRequestQueue;
185814184Sgabeblack@google.com  }
185914184Sgabeblack@google.com
186014184Sgabeblack@google.com  // transition({OLSX, OX}, Fwd_GETS, O) {
186114184Sgabeblack@google.com  transition(OLSX, Fwd_GETS, OLS) {
186214184Sgabeblack@google.com    dd_sendDataToFwdGETS;
186314184Sgabeblack@google.com    m_popRequestQueue;
186414184Sgabeblack@google.com  }
186514184Sgabeblack@google.com
186614184Sgabeblack@google.com  transition(OLSX, Fwd_DMA) {
186714184Sgabeblack@google.com    dd_sendDataToFwdGETS;
186814184Sgabeblack@google.com    da_sendDmaAckUnblock;
186914184Sgabeblack@google.com    m_popRequestQueue;
187014184Sgabeblack@google.com  }
187114184Sgabeblack@google.com
187214184Sgabeblack@google.com  transition(M, Fwd_GETX, I) {
187314184Sgabeblack@google.com    dd_sendDataToFwdGETX;
187414184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
187514184Sgabeblack@google.com    m_popRequestQueue;
187614184Sgabeblack@google.com  }
187714184Sgabeblack@google.com
187814184Sgabeblack@google.com  // MAKE THIS THE SAME POLICY FOR NOW
187914184Sgabeblack@google.com
188014184Sgabeblack@google.com  // transition(M, Fwd_GETS, O) {
188114184Sgabeblack@google.com  //   dd_sendDataToFwdGETS;
188214184Sgabeblack@google.com  //   m_popRequestQueue;
188314184Sgabeblack@google.com  // }
188414184Sgabeblack@google.com
188514184Sgabeblack@google.com  transition(M, Fwd_GETS, I) {
188614184Sgabeblack@google.com     dd_sendExclusiveDataToFwdGETS;
188714184Sgabeblack@google.com     rr_deallocateL2CacheBlock;
188814184Sgabeblack@google.com     m_popRequestQueue;
188914184Sgabeblack@google.com  }
189014184Sgabeblack@google.com
189114184Sgabeblack@google.com  transition(M, Fwd_DMA) {
189214184Sgabeblack@google.com     dd_sendExclusiveDataToFwdGETS;
189314184Sgabeblack@google.com     da_sendDmaAckUnblock;
189414184Sgabeblack@google.com     m_popRequestQueue;
189514184Sgabeblack@google.com  }
189614184Sgabeblack@google.com
189714184Sgabeblack@google.com  transition({OLS, OLSX}, Fwd_GETX, OLSF) {
189814184Sgabeblack@google.com    i_allocateTBE;
189914184Sgabeblack@google.com    t_recordFwdXID;
190014184Sgabeblack@google.com    ee_sendLocalInv;
190114184Sgabeblack@google.com    m_popRequestQueue;
190214184Sgabeblack@google.com  }
190314184Sgabeblack@google.com
190414184Sgabeblack@google.com  transition(OLSF, IntAck) {
190514184Sgabeblack@google.com    m_decrementNumberOfMessagesInt;
190614184Sgabeblack@google.com    o_checkForIntCompletion;
190714184Sgabeblack@google.com    n_popResponseQueue;
190814184Sgabeblack@google.com  }
190914184Sgabeblack@google.com
191014184Sgabeblack@google.com  transition(OLSF, All_Acks, I) {
191114184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETX;
191214184Sgabeblack@google.com    gg_clearLocalSharers;
191314184Sgabeblack@google.com    s_deallocateTBE;
191414184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
191514184Sgabeblack@google.com    n_popTriggerQueue;
191614184Sgabeblack@google.com    wa_wakeUpDependents;
191714184Sgabeblack@google.com  }
191814184Sgabeblack@google.com
191914184Sgabeblack@google.com
192014184Sgabeblack@google.com
192114184Sgabeblack@google.com  // INVALIDATIONS FROM GLOBAL DIRECTORY
192214184Sgabeblack@google.com
192314184Sgabeblack@google.com  transition({IGM, IGS}, Inv) {
192414184Sgabeblack@google.com    t_recordFwdXID;
192514184Sgabeblack@google.com    e_sendAck;
192614184Sgabeblack@google.com    m_popRequestQueue;
192714184Sgabeblack@google.com  }
192814184Sgabeblack@google.com
192914184Sgabeblack@google.com  transition({I,NP}, Inv) {
193014184Sgabeblack@google.com    i_allocateTBE;
193114184Sgabeblack@google.com    t_recordFwdXID;
193214184Sgabeblack@google.com    e_sendAck;
193314184Sgabeblack@google.com    s_deallocateTBE;
193414184Sgabeblack@google.com    m_popRequestQueue;
193514184Sgabeblack@google.com  }
193614184Sgabeblack@google.com
193714184Sgabeblack@google.com  // NEED INV for S state
193814184Sgabeblack@google.com
193914184Sgabeblack@google.com  transition({ILS, ILO, ILX}, Inv, II) {
194014184Sgabeblack@google.com    i_allocateTBE;
194114184Sgabeblack@google.com    t_recordFwdXID;
194214184Sgabeblack@google.com    ee_sendLocalInv;
194314184Sgabeblack@google.com    gg_clearLocalSharers;
194414184Sgabeblack@google.com    m_popRequestQueue;
194514184Sgabeblack@google.com  }
194614184Sgabeblack@google.com
194714184Sgabeblack@google.com  transition(SLS, Inv, II) {
194814184Sgabeblack@google.com    i_allocateTBE;
194914184Sgabeblack@google.com    t_recordFwdXID;
195014184Sgabeblack@google.com    ee_sendLocalInv;
195114184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
195214184Sgabeblack@google.com    m_popRequestQueue;
195314184Sgabeblack@google.com  }
195414184Sgabeblack@google.com
195514184Sgabeblack@google.com  transition(II, IntAck) {
195614184Sgabeblack@google.com    m_decrementNumberOfMessagesInt;
195714184Sgabeblack@google.com    o_checkForIntCompletion;
195814184Sgabeblack@google.com    n_popResponseQueue;
195914184Sgabeblack@google.com  }
196014184Sgabeblack@google.com
196114184Sgabeblack@google.com  transition(II, All_Acks, I) {
196214184Sgabeblack@google.com    e_sendAck;
196314184Sgabeblack@google.com    s_deallocateTBE;
196414184Sgabeblack@google.com    n_popTriggerQueue;
196514184Sgabeblack@google.com    wa_wakeUpDependents;
196614184Sgabeblack@google.com  }
196714184Sgabeblack@google.com
196814184Sgabeblack@google.com  transition(S, Inv, I) {
196914184Sgabeblack@google.com    i_allocateTBE;
197014184Sgabeblack@google.com    t_recordFwdXID;
197114184Sgabeblack@google.com    e_sendAck;
197214184Sgabeblack@google.com    s_deallocateTBE;
197314184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
197414184Sgabeblack@google.com    m_popRequestQueue;
197514184Sgabeblack@google.com  }
197614184Sgabeblack@google.com
197714184Sgabeblack@google.com
197814184Sgabeblack@google.com  // LOCAL REQUESTS SATISFIED LOCALLY
197914184Sgabeblack@google.com
198014184Sgabeblack@google.com  transition(OLSX, L1_GETX, IFLOX) {
198114184Sgabeblack@google.com    i_allocateTBE;
198214184Sgabeblack@google.com    s_recordGetXL1ID;
198314184Sgabeblack@google.com    // count number of INVs needed that doesn't include requestor
198414184Sgabeblack@google.com    h_countLocalSharersExceptRequestor;
198514184Sgabeblack@google.com    // issue INVs to everyone except requestor
198614184Sgabeblack@google.com    ee_issueLocalInvExceptL1Requestor;
198714184Sgabeblack@google.com    d_sendDataToL1GETX
198814184Sgabeblack@google.com    y_copyCacheStateToDir;
198914184Sgabeblack@google.com    r_setMRU;
199014184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
199114184Sgabeblack@google.com    uu_profileHit;
199214184Sgabeblack@google.com    o_popL1RequestQueue;
199314184Sgabeblack@google.com  }
199414184Sgabeblack@google.com
199514184Sgabeblack@google.com  transition(IFLOX, Exclusive_Unblock, ILX) {
199614184Sgabeblack@google.com    g_recordLocalExclusive;
199714184Sgabeblack@google.com    s_deallocateTBE;
199814184Sgabeblack@google.com    n_popResponseQueue;
199914184Sgabeblack@google.com    wa_wakeUpDependents;
200014184Sgabeblack@google.com  }
200114184Sgabeblack@google.com
200214184Sgabeblack@google.com  transition(OLSX, L1_GETS, OLSXS) {
200314184Sgabeblack@google.com    d_sendDataToL1GETS;
200414184Sgabeblack@google.com    r_setMRU;
200514184Sgabeblack@google.com    uu_profileHit;
200614184Sgabeblack@google.com    o_popL1RequestQueue;
200714184Sgabeblack@google.com  }
200814184Sgabeblack@google.com
200914184Sgabeblack@google.com  transition(OLSXS, Unblock, OLSX) {
201014184Sgabeblack@google.com    g_recordLocalSharer;
201114184Sgabeblack@google.com    n_popResponseQueue;
201214184Sgabeblack@google.com    wa_wakeUpDependents;
201314184Sgabeblack@google.com  }
201414184Sgabeblack@google.com
201514184Sgabeblack@google.com  // after this, can't get Fwd_GETX
201614184Sgabeblack@google.com  transition(IGMO, Own_GETX) {
201714184Sgabeblack@google.com    mm_decrementNumberOfMessagesExt;
201814184Sgabeblack@google.com    o_checkForExtCompletion;
201914184Sgabeblack@google.com    m_popRequestQueue;
202014184Sgabeblack@google.com
202114184Sgabeblack@google.com  }
202214184Sgabeblack@google.com
202314184Sgabeblack@google.com
202414184Sgabeblack@google.com  transition(ILX, L1_GETS, IFLOXX) {
202514184Sgabeblack@google.com    kk_forwardLocalGETSToLocalOwner;
202614184Sgabeblack@google.com    uu_profileMiss;
202714184Sgabeblack@google.com    o_popL1RequestQueue;
202814184Sgabeblack@google.com  }
202914184Sgabeblack@google.com
203014184Sgabeblack@google.com  transition(ILOSX, L1_GETS, IFLOSX) {
203114184Sgabeblack@google.com    kk_forwardLocalGETSToLocalOwner;
203214184Sgabeblack@google.com    uu_profileMiss;
203314184Sgabeblack@google.com    o_popL1RequestQueue;
203414184Sgabeblack@google.com  }
203514184Sgabeblack@google.com
203614184Sgabeblack@google.com  transition({ILOS, ILO}, L1_GETS, IFLO) {
203714184Sgabeblack@google.com    kk_forwardLocalGETSToLocalOwner;
203814184Sgabeblack@google.com    uu_profileMiss;
203914184Sgabeblack@google.com    o_popL1RequestQueue;
204014184Sgabeblack@google.com  }
204114184Sgabeblack@google.com
204214184Sgabeblack@google.com  transition(ILS, L1_GETS, IFLS) {
204314184Sgabeblack@google.com    k_forwardLocalGETSToLocalSharer;
204414184Sgabeblack@google.com    uu_profileMiss;
204514184Sgabeblack@google.com    o_popL1RequestQueue;
204614184Sgabeblack@google.com  }
204714184Sgabeblack@google.com
204814184Sgabeblack@google.com  transition({ILX, ILOX}, L1_GETX, IFLOXX) {
204914184Sgabeblack@google.com    kk_forwardLocalGETXToLocalExclusive;
205014184Sgabeblack@google.com    e_sendAckToL1Requestor;
205114184Sgabeblack@google.com    uu_profileMiss;
205214184Sgabeblack@google.com    o_popL1RequestQueue;
205314184Sgabeblack@google.com  }
205414184Sgabeblack@google.com
205514184Sgabeblack@google.com  transition(ILOX, L1_GETS, IFLOX) {
205614184Sgabeblack@google.com    kk_forwardLocalGETSToLocalOwner;
205714184Sgabeblack@google.com    uu_profileMiss;
205814184Sgabeblack@google.com    o_popL1RequestQueue;
205914184Sgabeblack@google.com  }
206014184Sgabeblack@google.com
206114184Sgabeblack@google.com  transition(IFLOX, Unblock, ILOSX) {
206214184Sgabeblack@google.com    g_recordLocalSharer;
206314184Sgabeblack@google.com    n_popResponseQueue;
206414184Sgabeblack@google.com    wa_wakeUpDependents;
206514184Sgabeblack@google.com  }
206614184Sgabeblack@google.com
206714184Sgabeblack@google.com  transition(IFLS, Unblock, ILS) {
206814184Sgabeblack@google.com    g_recordLocalSharer;
206914184Sgabeblack@google.com    n_popResponseQueue;
207014184Sgabeblack@google.com    wa_wakeUpDependents;
207114184Sgabeblack@google.com  }
207214184Sgabeblack@google.com
207314184Sgabeblack@google.com  transition(IFLOXX, Unblock, ILOSX) {
207414184Sgabeblack@google.com    g_recordLocalSharer;
207514184Sgabeblack@google.com    n_popResponseQueue;
207614184Sgabeblack@google.com    wa_wakeUpDependents;
207714184Sgabeblack@google.com  }
207814184Sgabeblack@google.com
207914184Sgabeblack@google.com  transition(IFLOSX, Unblock, ILOSX) {
208014184Sgabeblack@google.com    g_recordLocalSharer;
208114184Sgabeblack@google.com    n_popResponseQueue;
208214184Sgabeblack@google.com    wa_wakeUpDependents;
208314184Sgabeblack@google.com  }
208414184Sgabeblack@google.com
208514184Sgabeblack@google.com  transition({IFLOSX, IFLOXX}, Exclusive_Unblock, ILX) {
208614184Sgabeblack@google.com    g_recordLocalExclusive;
208714184Sgabeblack@google.com    n_popResponseQueue;
208814184Sgabeblack@google.com    wa_wakeUpDependents;
208914184Sgabeblack@google.com  }
209014184Sgabeblack@google.com
209114184Sgabeblack@google.com  transition(IFLO, Unblock, ILOS) {
209214184Sgabeblack@google.com    g_recordLocalSharer;
209314184Sgabeblack@google.com    n_popResponseQueue;
209414184Sgabeblack@google.com    wa_wakeUpDependents;
209514184Sgabeblack@google.com  }
209614184Sgabeblack@google.com
209714184Sgabeblack@google.com
209814184Sgabeblack@google.com  transition(ILOSX, L1_GETX, IFLXO) {
209914184Sgabeblack@google.com    i_allocateTBE;
210014184Sgabeblack@google.com    s_recordGetXL1ID;
210114184Sgabeblack@google.com    h_countLocalSharersExceptRequestor;
210214184Sgabeblack@google.com    ee_issueLocalInvExceptL1Requestor;
210314184Sgabeblack@google.com    k_forwardLocalGETXToLocalOwner;
210414184Sgabeblack@google.com    e_sendAckToL1RequestorFromTBE;
210514184Sgabeblack@google.com    uu_profileMiss;
210614184Sgabeblack@google.com    o_popL1RequestQueue;
210714184Sgabeblack@google.com  }
210814184Sgabeblack@google.com
210914184Sgabeblack@google.com  transition(IFLXO, Exclusive_Unblock, ILX) {
211014184Sgabeblack@google.com    g_recordLocalExclusive;
211114184Sgabeblack@google.com    s_deallocateTBE;
211214184Sgabeblack@google.com    n_popResponseQueue;
211314184Sgabeblack@google.com    wa_wakeUpDependents;
211414184Sgabeblack@google.com  }
211514184Sgabeblack@google.com
211614184Sgabeblack@google.com  // LOCAL REQUESTS THAT MUST ISSUE
211714184Sgabeblack@google.com
211814184Sgabeblack@google.com  transition(NP, {L1_PUTS, L1_PUTX, L1_PUTO}) {
211914184Sgabeblack@google.com    ll_writebackNack;
212014184Sgabeblack@google.com    o_popL1RequestQueue;
212114184Sgabeblack@google.com  }
212214184Sgabeblack@google.com
212314184Sgabeblack@google.com  transition({NP, I}, L1_GETS, IGS) {
212414184Sgabeblack@google.com    i_allocateTBE;
212514184Sgabeblack@google.com    s_recordGetSL1ID;
212614184Sgabeblack@google.com    a_issueGETS;
212714184Sgabeblack@google.com    uu_profileMiss;
212814184Sgabeblack@google.com    o_popL1RequestQueue;
212914184Sgabeblack@google.com  }
213014184Sgabeblack@google.com
213114184Sgabeblack@google.com  transition({NP, I}, L1_GETX, IGM) {
213214184Sgabeblack@google.com    i_allocateTBE;
213314184Sgabeblack@google.com    s_recordGetXL1ID;
213414184Sgabeblack@google.com    a_issueGETX;
213514184Sgabeblack@google.com    uu_profileMiss;
213614184Sgabeblack@google.com    o_popL1RequestQueue;
213714184Sgabeblack@google.com  }
213814184Sgabeblack@google.com
213914184Sgabeblack@google.com  transition(S, L1_GETX, IGM) {
214014184Sgabeblack@google.com    i_allocateTBE;
214114184Sgabeblack@google.com    s_recordGetXL1ID;
214214184Sgabeblack@google.com    a_issueGETX;
214314184Sgabeblack@google.com    y_copyCacheStateToDir;
214414184Sgabeblack@google.com    r_setMRU;
214514184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
214614184Sgabeblack@google.com    uu_profileMiss;
214714184Sgabeblack@google.com    o_popL1RequestQueue;
214814184Sgabeblack@google.com  }
214914184Sgabeblack@google.com
215014184Sgabeblack@google.com  transition(ILS, L1_GETX, IGMLS) {
215114184Sgabeblack@google.com    i_allocateTBE;
215214184Sgabeblack@google.com    s_recordGetXL1ID;
215314184Sgabeblack@google.com    a_issueGETX;
215414184Sgabeblack@google.com    // count number of INVs (just sharers?) needed that doesn't include requestor
215514184Sgabeblack@google.com    h_countLocalSharersExceptRequestor;
215614184Sgabeblack@google.com    uu_profileMiss;
215714184Sgabeblack@google.com    o_popL1RequestQueue;
215814184Sgabeblack@google.com  }
215914184Sgabeblack@google.com
216014184Sgabeblack@google.com  transition(IGMLS, Inv) {
216114184Sgabeblack@google.com    t_recordFwdXID;
216214184Sgabeblack@google.com    ee_sendLocalInv;
216314184Sgabeblack@google.com    m_popRequestQueue;
216414184Sgabeblack@google.com  }
216514184Sgabeblack@google.com
216614184Sgabeblack@google.com  transition(IGMLS, IntAck) {
216714184Sgabeblack@google.com    m_decrementNumberOfMessagesInt;
216814184Sgabeblack@google.com    o_checkForIntCompletion;
216914184Sgabeblack@google.com    n_popResponseQueue;
217014184Sgabeblack@google.com  }
217114184Sgabeblack@google.com
217214184Sgabeblack@google.com  transition(IGMLS, All_Acks, IGM) {
217314184Sgabeblack@google.com    gg_clearLocalSharers;
217414184Sgabeblack@google.com    h_clearIntAcks;
217514184Sgabeblack@google.com    e_sendAck;
217614184Sgabeblack@google.com    n_popTriggerQueue;
217714184Sgabeblack@google.com  }
217814184Sgabeblack@google.com
217914184Sgabeblack@google.com  // transition(IGMLS, ExtAck, IGMO) {
218014184Sgabeblack@google.com  transition(IGMLS, ExtAck) {
218114184Sgabeblack@google.com    m_decrementNumberOfMessagesExt;
218214184Sgabeblack@google.com    o_checkForExtCompletion;
218314184Sgabeblack@google.com    n_popResponseQueue;
218414184Sgabeblack@google.com  }
218514184Sgabeblack@google.com
218614184Sgabeblack@google.com  transition(IGMLS, {Data, Data_Exclusive}, IGMO) {
218714184Sgabeblack@google.com    ee_issueLocalInvExceptL1RequestorInTBE;
218814184Sgabeblack@google.com    i_copyDataToTBE;
218914184Sgabeblack@google.com    m_decrementNumberOfMessagesExt;
219014184Sgabeblack@google.com    o_checkForExtCompletion;
219114184Sgabeblack@google.com    n_popResponseQueue;
219214184Sgabeblack@google.com  }
219314184Sgabeblack@google.com
219414184Sgabeblack@google.com
219514184Sgabeblack@google.com  transition(ILOS, L1_GETX, IGMIO) {
219614184Sgabeblack@google.com    i_allocateTBE;
219714184Sgabeblack@google.com    s_recordGetXL1ID;
219814184Sgabeblack@google.com    a_issueGETX;
219914184Sgabeblack@google.com    uu_profileMiss;
220014184Sgabeblack@google.com    o_popL1RequestQueue;
220114184Sgabeblack@google.com  }
220214184Sgabeblack@google.com
220314184Sgabeblack@google.com  // new exclusive happened while sharer attempted writeback
220414184Sgabeblack@google.com  transition(ILX, {L1_PUTS, L1_PUTS_only, L1_PUTO}) {
220514184Sgabeblack@google.com    ll_writebackNack;
220614184Sgabeblack@google.com    o_popL1RequestQueue;
220714184Sgabeblack@google.com  }
220814184Sgabeblack@google.com
220914184Sgabeblack@google.com  transition(S, L1_PUTS) {
221014184Sgabeblack@google.com    ll_writebackNack;
221114184Sgabeblack@google.com    o_popL1RequestQueue;
221214184Sgabeblack@google.com  }
221314184Sgabeblack@google.com
221414184Sgabeblack@google.com  transition(OLS, L1_GETX, OGMIO) {
221514184Sgabeblack@google.com    i_allocateTBE;
221614184Sgabeblack@google.com    s_recordGetXL1ID;
221714184Sgabeblack@google.com    a_issueGETX;
221814184Sgabeblack@google.com    h_countLocalSharersExceptRequestor;
221914184Sgabeblack@google.com    // COPY DATA FROM CACHE TO TBE (happens during i_allocateTBE)
222014184Sgabeblack@google.com    y_copyCacheStateToDir;
222114184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
222214184Sgabeblack@google.com    uu_profileMiss;
222314184Sgabeblack@google.com    o_popL1RequestQueue;
222414184Sgabeblack@google.com  }
222514184Sgabeblack@google.com
222614184Sgabeblack@google.com  transition(OGMIO, Fwd_GETS) {
222714184Sgabeblack@google.com    t_recordFwdSID;
222814184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETS;
222914184Sgabeblack@google.com    m_popRequestQueue;
223014184Sgabeblack@google.com  }
223114184Sgabeblack@google.com
223214184Sgabeblack@google.com  transition(ILO, L1_GETX, IGMIO) {
223314184Sgabeblack@google.com    i_allocateTBE;
223414184Sgabeblack@google.com    s_recordGetXL1ID;
223514184Sgabeblack@google.com    a_issueGETX;
223614184Sgabeblack@google.com    // the following, of course, returns 0 sharers but do anyways for consistency
223714184Sgabeblack@google.com    h_countLocalSharersExceptRequestor;
223814184Sgabeblack@google.com    uu_profileMiss;
223914184Sgabeblack@google.com    o_popL1RequestQueue;
224014184Sgabeblack@google.com  }
224114184Sgabeblack@google.com
224214184Sgabeblack@google.com  transition({ILO, ILOX}, L1_PUTS) {
224314184Sgabeblack@google.com    ll_writebackNack;
224414184Sgabeblack@google.com    o_popL1RequestQueue;
224514184Sgabeblack@google.com  }
224614184Sgabeblack@google.com
224714184Sgabeblack@google.com  transition(IGMIO, Fwd_GETX, IGMIOF) {
224814184Sgabeblack@google.com    t_recordFwdXID;
224914184Sgabeblack@google.com    j_forwardGlobalRequestToLocalOwner;
225014184Sgabeblack@google.com    ee_sendLocalInvSharersOnly;
225114184Sgabeblack@google.com    ee_addLocalIntAck;
225214184Sgabeblack@google.com    m_popRequestQueue;
225314184Sgabeblack@google.com  }
225414184Sgabeblack@google.com
225514184Sgabeblack@google.com  transition(IGMIO, Fwd_GETS, IGMIOFS) {
225614184Sgabeblack@google.com    t_recordFwdSID;
225714184Sgabeblack@google.com    j_forwardGlobalRequestToLocalOwner;
225814184Sgabeblack@google.com    m_popRequestQueue;
225914184Sgabeblack@google.com  }
226014184Sgabeblack@google.com
226114184Sgabeblack@google.com  transition(IGMIOFS, Data, IGMIO) {
226214184Sgabeblack@google.com    i_copyDataToTBE;
226314184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETS;
226414184Sgabeblack@google.com    n_popResponseQueue;
226514184Sgabeblack@google.com  }
226614184Sgabeblack@google.com
226714184Sgabeblack@google.com  transition(OGMIO, Fwd_GETX, OGMIOF) {
226814184Sgabeblack@google.com    t_recordFwdXID;
226914184Sgabeblack@google.com    ee_sendLocalInvSharersOnly;
227014184Sgabeblack@google.com    m_popRequestQueue;
227114184Sgabeblack@google.com  }
227214184Sgabeblack@google.com
227314184Sgabeblack@google.com  transition(OGMIOF, IntAck) {
227414184Sgabeblack@google.com    m_decrementNumberOfMessagesInt;
227514184Sgabeblack@google.com    o_checkForIntCompletion;
227614184Sgabeblack@google.com    n_popResponseQueue;
227714184Sgabeblack@google.com  }
227814184Sgabeblack@google.com
227914184Sgabeblack@google.com  transition(OGMIOF, All_Acks, IGM) {
228014184Sgabeblack@google.com    gg_clearLocalSharers;
228114184Sgabeblack@google.com    hh_countLocalSharersExceptL1GETXRequestorInTBE;
228214184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETX;
228314184Sgabeblack@google.com    n_popTriggerQueue;
228414184Sgabeblack@google.com  }
228514184Sgabeblack@google.com
228614184Sgabeblack@google.com  transition(IGMIOF, IntAck) {
228714184Sgabeblack@google.com    m_decrementNumberOfMessagesInt;
228814184Sgabeblack@google.com    o_checkForIntCompletion;
228914184Sgabeblack@google.com    n_popResponseQueue;
229014184Sgabeblack@google.com  }
229114184Sgabeblack@google.com
229214184Sgabeblack@google.com  transition(IGMIOF, Data_Exclusive) {
229314184Sgabeblack@google.com    i_copyDataToTBE;
229414184Sgabeblack@google.com    m_decrementNumberOfMessagesInt;
229514184Sgabeblack@google.com    o_checkForIntCompletion;
229614184Sgabeblack@google.com    n_popResponseQueue;
229714184Sgabeblack@google.com  }
229814184Sgabeblack@google.com
229914184Sgabeblack@google.com  transition(IGMIOF, All_Acks, IGM) {
230014184Sgabeblack@google.com    gg_clearLocalSharers;
230114184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETX;
230214184Sgabeblack@google.com    n_popTriggerQueue;
230314184Sgabeblack@google.com  }
230414184Sgabeblack@google.com
230514184Sgabeblack@google.com  transition(IGMIO, All_Acks, IGMO) {
230614184Sgabeblack@google.com    hh_countLocalSharersExceptL1GETXRequestorInTBE;
230714184Sgabeblack@google.com    ee_issueLocalInvExceptL1RequestorInTBE;
230814184Sgabeblack@google.com    k_forwardLocalGETXToLocalOwner;
230914184Sgabeblack@google.com    e_sendAckToL1RequestorFromTBE;
231014184Sgabeblack@google.com    n_popTriggerQueue;
231114184Sgabeblack@google.com  }
231214184Sgabeblack@google.com
231314184Sgabeblack@google.com  transition(OGMIO, All_Acks, IGMO) {
231414184Sgabeblack@google.com    ee_issueLocalInvExceptL1RequestorInTBE;
231514184Sgabeblack@google.com    c_sendDataFromTBEToL1GETX;
231614184Sgabeblack@google.com    n_popTriggerQueue;
231714184Sgabeblack@google.com  }
231814184Sgabeblack@google.com
231914184Sgabeblack@google.com  transition({IGMIO, OGMIO}, Own_GETX) {
232014184Sgabeblack@google.com    mm_decrementNumberOfMessagesExt;
232114184Sgabeblack@google.com    o_checkForExtCompletion;
232214184Sgabeblack@google.com    m_popRequestQueue;
232314184Sgabeblack@google.com
232414184Sgabeblack@google.com  }
232514184Sgabeblack@google.com
232614184Sgabeblack@google.com  transition(IGM, {Data, Data_Exclusive}, IGMO) {
232714184Sgabeblack@google.com    i_copyDataToTBE;
232814184Sgabeblack@google.com    m_decrementNumberOfMessagesExt;
232914184Sgabeblack@google.com    o_checkForExtCompletion;
233014184Sgabeblack@google.com    n_popResponseQueue;
233114184Sgabeblack@google.com  }
233214184Sgabeblack@google.com
233314184Sgabeblack@google.com  transition({IGM, IGMIO, OGMIO}, ExtAck) {
233414184Sgabeblack@google.com    m_decrementNumberOfMessagesExt;
233514184Sgabeblack@google.com    o_checkForExtCompletion;
233614184Sgabeblack@google.com    n_popResponseQueue;
233714184Sgabeblack@google.com  }
233814184Sgabeblack@google.com
233914184Sgabeblack@google.com  transition(IGMO, ExtAck) {
234014184Sgabeblack@google.com    m_decrementNumberOfMessagesExt;
234114184Sgabeblack@google.com    o_checkForExtCompletion;
234214184Sgabeblack@google.com    n_popResponseQueue;
234314184Sgabeblack@google.com  }
234414184Sgabeblack@google.com
234514184Sgabeblack@google.com  transition(IGS, Data) {
234614184Sgabeblack@google.com    i_copyDataToTBE;
234714184Sgabeblack@google.com    m_decrementNumberOfMessagesExt;
234814184Sgabeblack@google.com    c_sendDataFromTBEToL1GETS;
234914184Sgabeblack@google.com    n_popResponseQueue;
235014184Sgabeblack@google.com  }
235114184Sgabeblack@google.com
235214184Sgabeblack@google.com  transition(IGS, Data_Exclusive) {
235314184Sgabeblack@google.com    i_copyDataToTBE;
235414184Sgabeblack@google.com    m_decrementNumberOfMessagesExt;
235514184Sgabeblack@google.com    c_sendExclusiveDataFromTBEToL1GETS;
235614184Sgabeblack@google.com    n_popResponseQueue;
235714184Sgabeblack@google.com  }
235814184Sgabeblack@google.com
235914184Sgabeblack@google.com  transition(IGS, Unblock, ILS) {
236014184Sgabeblack@google.com    g_recordLocalSharer;
236114184Sgabeblack@google.com    f_sendUnblock;
236214184Sgabeblack@google.com    s_deallocateTBE;
236314184Sgabeblack@google.com    n_popResponseQueue;
236414184Sgabeblack@google.com    wa_wakeUpDependents;
236514184Sgabeblack@google.com  }
236614184Sgabeblack@google.com
236714184Sgabeblack@google.com  transition(IGS, Exclusive_Unblock, ILX) {
236814184Sgabeblack@google.com    g_recordLocalExclusive;
236914184Sgabeblack@google.com    f_sendExclusiveUnblock;
237014184Sgabeblack@google.com    s_deallocateTBE;
237114184Sgabeblack@google.com    n_popResponseQueue;
237214184Sgabeblack@google.com    wa_wakeUpDependents;
237314184Sgabeblack@google.com  }
237414184Sgabeblack@google.com
237514184Sgabeblack@google.com  transition(IGMO, All_Acks) {
237614184Sgabeblack@google.com    c_sendDataFromTBEToL1GETX;
237714184Sgabeblack@google.com    n_popTriggerQueue;
237814184Sgabeblack@google.com  }
237914184Sgabeblack@google.com
238014184Sgabeblack@google.com  transition(IGMO, Exclusive_Unblock, ILX) {
238114184Sgabeblack@google.com    g_recordLocalExclusive;
238214184Sgabeblack@google.com    f_sendExclusiveUnblock;
238314184Sgabeblack@google.com    s_deallocateTBE;
238414184Sgabeblack@google.com    n_popResponseQueue;
238514184Sgabeblack@google.com    wa_wakeUpDependents;
238614184Sgabeblack@google.com  }
238714184Sgabeblack@google.com
238814184Sgabeblack@google.com
238914184Sgabeblack@google.com  transition(SLS, L1_GETX, IGMLS) {
239014184Sgabeblack@google.com    i_allocateTBE;
239114184Sgabeblack@google.com    s_recordGetXL1ID;
239214184Sgabeblack@google.com    a_issueGETX;
239314184Sgabeblack@google.com    // count number of INVs needed that doesn't include requestor
239414184Sgabeblack@google.com    h_countLocalSharersExceptRequestor;
239514184Sgabeblack@google.com    // issue INVs to everyone except requestor
239614184Sgabeblack@google.com    y_copyCacheStateToDir;
239714184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
239814184Sgabeblack@google.com    uu_profileMiss;
239914184Sgabeblack@google.com    o_popL1RequestQueue;
240014184Sgabeblack@google.com
240114184Sgabeblack@google.com  }
240214184Sgabeblack@google.com
240314184Sgabeblack@google.com  transition(SLS, L1_GETS, SLSS ) {
240414184Sgabeblack@google.com    d_sendDataToL1GETS;
240514184Sgabeblack@google.com    r_setMRU;
240614184Sgabeblack@google.com    uu_profileHit;
240714184Sgabeblack@google.com    o_popL1RequestQueue;
240814184Sgabeblack@google.com  }
240914184Sgabeblack@google.com
241014184Sgabeblack@google.com  transition(SLSS, Unblock, SLS) {
241114184Sgabeblack@google.com    g_recordLocalSharer;
241214184Sgabeblack@google.com    n_popResponseQueue;
241314184Sgabeblack@google.com    wa_wakeUpDependents;
241414184Sgabeblack@google.com  }
241514184Sgabeblack@google.com
241614184Sgabeblack@google.com
241714184Sgabeblack@google.com  transition(O, L1_GETX, IGMO) {
241814184Sgabeblack@google.com    i_allocateTBE;
241914184Sgabeblack@google.com    s_recordGetXL1ID;
242014184Sgabeblack@google.com    a_issueGETX;
242114184Sgabeblack@google.com    y_copyCacheStateToDir;
242214184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
242314184Sgabeblack@google.com    uu_profileMiss;
242414184Sgabeblack@google.com    o_popL1RequestQueue;
242514184Sgabeblack@google.com  }
242614184Sgabeblack@google.com
242714184Sgabeblack@google.com  transition(OLS, L1_GETS, OLSS) {
242814184Sgabeblack@google.com    d_sendDataToL1GETS;
242914184Sgabeblack@google.com    r_setMRU;
243014184Sgabeblack@google.com    uu_profileHit;
243114184Sgabeblack@google.com    o_popL1RequestQueue;
243214184Sgabeblack@google.com  }
243314184Sgabeblack@google.com
243414184Sgabeblack@google.com  transition(OLSS, Unblock, OLS) {
243514184Sgabeblack@google.com    g_recordLocalSharer;
243614184Sgabeblack@google.com    n_popResponseQueue;
243714184Sgabeblack@google.com    wa_wakeUpDependents;
243814184Sgabeblack@google.com  }
243914184Sgabeblack@google.com
244014184Sgabeblack@google.com  transition(IGMO, Fwd_GETX, IGM) {
244114184Sgabeblack@google.com    t_recordFwdXID;
244214184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETX;
244314184Sgabeblack@google.com    m_popRequestQueue;
244414184Sgabeblack@google.com
244514184Sgabeblack@google.com  }
244614184Sgabeblack@google.com
244714184Sgabeblack@google.com  transition(IGMO, Fwd_GETS) {
244814184Sgabeblack@google.com    t_recordFwdSID;
244914184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETS;
245014184Sgabeblack@google.com    m_popRequestQueue;
245114184Sgabeblack@google.com  }
245214184Sgabeblack@google.com
245314184Sgabeblack@google.com
245414184Sgabeblack@google.com  // LOCAL REQUESTS SATISFIED DIRECTLY BY L2
245514184Sgabeblack@google.com
245614184Sgabeblack@google.com  transition(M, L1_GETX, MM) {
245714184Sgabeblack@google.com    i_allocateTBE;
245814184Sgabeblack@google.com    // should count 0 of course
245914184Sgabeblack@google.com    h_countLocalSharersExceptRequestor;
246014184Sgabeblack@google.com    d_sendDataToL1GETX;
246114184Sgabeblack@google.com    y_copyCacheStateToDir;
246214184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
246314184Sgabeblack@google.com    s_deallocateTBE;
246414184Sgabeblack@google.com    uu_profileHit;
246514184Sgabeblack@google.com    o_popL1RequestQueue;
246614184Sgabeblack@google.com  }
246714184Sgabeblack@google.com
246814184Sgabeblack@google.com  transition(MM, Exclusive_Unblock, ILX) {
246914184Sgabeblack@google.com    g_recordLocalExclusive;
247014184Sgabeblack@google.com    n_popResponseQueue;
247114184Sgabeblack@google.com    wa_wakeUpDependents;
247214184Sgabeblack@google.com  }
247314184Sgabeblack@google.com
247414184Sgabeblack@google.com  transition(M, L1_GETS, OO) {
247514184Sgabeblack@google.com    i_allocateTBE;
247614184Sgabeblack@google.com    // should count 0 of course
247714184Sgabeblack@google.com    h_countLocalSharersExceptRequestor;
247814184Sgabeblack@google.com    d_sendDataToL1GETX;
247914184Sgabeblack@google.com    r_setMRU;
248014184Sgabeblack@google.com    s_deallocateTBE;
248114184Sgabeblack@google.com    uu_profileHit;
248214184Sgabeblack@google.com    o_popL1RequestQueue;
248314184Sgabeblack@google.com  }
248414184Sgabeblack@google.com
248514184Sgabeblack@google.com  transition(S, L1_GETS, SS) {
248614184Sgabeblack@google.com    d_sendDataToL1GETS;
248714184Sgabeblack@google.com    r_setMRU;
248814184Sgabeblack@google.com    uu_profileHit;
248914184Sgabeblack@google.com    o_popL1RequestQueue;
249014184Sgabeblack@google.com  }
249114184Sgabeblack@google.com
249214184Sgabeblack@google.com  transition(SS, Unblock, SLS) {
249314184Sgabeblack@google.com    g_recordLocalSharer;
249414184Sgabeblack@google.com    n_popResponseQueue;
249514184Sgabeblack@google.com    wa_wakeUpDependents;
249614184Sgabeblack@google.com  }
249714184Sgabeblack@google.com
249814184Sgabeblack@google.com  transition(O, L1_GETS, OO) {
249914184Sgabeblack@google.com    d_sendDataToL1GETS;
250014184Sgabeblack@google.com    r_setMRU;
250114184Sgabeblack@google.com    uu_profileHit;
250214184Sgabeblack@google.com    o_popL1RequestQueue;
250314184Sgabeblack@google.com  }
250414184Sgabeblack@google.com
250514184Sgabeblack@google.com  transition(OO, Unblock, OLS) {
250614184Sgabeblack@google.com    g_recordLocalSharer;
250714184Sgabeblack@google.com    n_popResponseQueue;
250814184Sgabeblack@google.com    wa_wakeUpDependents;
250914184Sgabeblack@google.com  }
251014184Sgabeblack@google.com
251114184Sgabeblack@google.com  transition(OO, Exclusive_Unblock, ILX) {
251214184Sgabeblack@google.com    g_recordLocalExclusive
251314184Sgabeblack@google.com    y_copyCacheStateToDir;
251414184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
251514184Sgabeblack@google.com    n_popResponseQueue;
251614184Sgabeblack@google.com    wa_wakeUpDependents;
251714184Sgabeblack@google.com  }
251814184Sgabeblack@google.com
251914184Sgabeblack@google.com
252014184Sgabeblack@google.com  // L1 WRITEBACKS
252114184Sgabeblack@google.com  transition(ILO, L1_PUTO, ILOW) {
252214184Sgabeblack@google.com    l_writebackAckNeedData;
252314184Sgabeblack@google.com    o_popL1RequestQueue;
252414184Sgabeblack@google.com  }
252514184Sgabeblack@google.com
252614184Sgabeblack@google.com  transition(ILOX, L1_PUTO, ILOXW) {
252714184Sgabeblack@google.com    l_writebackAckNeedData;
252814184Sgabeblack@google.com    o_popL1RequestQueue;
252914184Sgabeblack@google.com  }
253014184Sgabeblack@google.com
253114184Sgabeblack@google.com
253214184Sgabeblack@google.com  transition(ILOS, L1_PUTO, ILOSW) {
253314184Sgabeblack@google.com    l_writebackAckNeedData;
253414184Sgabeblack@google.com    o_popL1RequestQueue;
253514184Sgabeblack@google.com  }
253614184Sgabeblack@google.com
253714184Sgabeblack@google.com  transition(ILOSX, L1_PUTO, ILOSXW) {
253814184Sgabeblack@google.com    l_writebackAckNeedData;
253914184Sgabeblack@google.com    o_popL1RequestQueue;
254014184Sgabeblack@google.com  }
254114184Sgabeblack@google.com
254214184Sgabeblack@google.com
254314184Sgabeblack@google.com  // hmmm...keep data or drop.  Just drop for now
254414184Sgabeblack@google.com  transition(ILOS, L1_PUTS_only, ILOW) {
254514184Sgabeblack@google.com    l_writebackAckDropData;
254614184Sgabeblack@google.com    o_popL1RequestQueue;
254714184Sgabeblack@google.com  }
254814184Sgabeblack@google.com
254914184Sgabeblack@google.com  transition(ILSW, Unblock, ILS) {
255014184Sgabeblack@google.com    gg_clearSharerFromL1Response;
255114184Sgabeblack@google.com    n_popResponseQueue;
255214184Sgabeblack@google.com    wa_wakeUpDependents;
255314184Sgabeblack@google.com  }
255414184Sgabeblack@google.com
255514184Sgabeblack@google.com  transition(ILOW, Unblock, ILO) {
255614184Sgabeblack@google.com    gg_clearSharerFromL1Response;
255714184Sgabeblack@google.com    n_popResponseQueue;
255814184Sgabeblack@google.com    wa_wakeUpDependents;
255914184Sgabeblack@google.com  }
256014184Sgabeblack@google.com
256114184Sgabeblack@google.com  transition(ILOSX, L1_PUTS_only, ILOXW) {
256214184Sgabeblack@google.com    l_writebackAckDropData;
256314184Sgabeblack@google.com    o_popL1RequestQueue;
256414184Sgabeblack@google.com  }
256514184Sgabeblack@google.com
256614184Sgabeblack@google.com  transition(ILOXW, Unblock, ILOX) {
256714184Sgabeblack@google.com    gg_clearSharerFromL1Response;
256814184Sgabeblack@google.com    n_popResponseQueue;
256914184Sgabeblack@google.com    wa_wakeUpDependents;
257014184Sgabeblack@google.com  }
257114184Sgabeblack@google.com
257214184Sgabeblack@google.com  // hmmm...keep data or drop.  Just drop for now
257314184Sgabeblack@google.com  transition(ILOS, L1_PUTS, ILOSW) {
257414184Sgabeblack@google.com    l_writebackAckDropData;
257514184Sgabeblack@google.com    o_popL1RequestQueue;
257614184Sgabeblack@google.com  }
257714184Sgabeblack@google.com
257814184Sgabeblack@google.com  transition(ILOSX, L1_PUTS, ILOSXW) {
257914184Sgabeblack@google.com    l_writebackAckDropData;
258014184Sgabeblack@google.com    o_popL1RequestQueue;
258114184Sgabeblack@google.com  }
258214184Sgabeblack@google.com
258314184Sgabeblack@google.com  transition(ILOSW, Unblock, ILOS) {
258414184Sgabeblack@google.com    gg_clearSharerFromL1Response;
258514184Sgabeblack@google.com    n_popResponseQueue;
258614184Sgabeblack@google.com    wa_wakeUpDependents;
258714184Sgabeblack@google.com  }
258814184Sgabeblack@google.com
258914184Sgabeblack@google.com  transition(ILOSXW, Unblock, ILOSX) {
259014184Sgabeblack@google.com    gg_clearSharerFromL1Response;
259114184Sgabeblack@google.com    n_popResponseQueue;
259214184Sgabeblack@google.com    wa_wakeUpDependents;
259314184Sgabeblack@google.com  }
259414184Sgabeblack@google.com
259514184Sgabeblack@google.com  transition(SLS, L1_PUTS, SLSW) {
259614184Sgabeblack@google.com    l_writebackAckDropData;
259714184Sgabeblack@google.com    o_popL1RequestQueue;
259814184Sgabeblack@google.com  }
259914184Sgabeblack@google.com
260014184Sgabeblack@google.com  transition(SLS, L1_PUTS_only, SW) {
260114184Sgabeblack@google.com    l_writebackAckDropData;
260214184Sgabeblack@google.com    o_popL1RequestQueue;
260314184Sgabeblack@google.com  }
260414184Sgabeblack@google.com
260514184Sgabeblack@google.com  transition(SW, {Unblock}, S) {
260614184Sgabeblack@google.com    gg_clearSharerFromL1Response;
260714184Sgabeblack@google.com    n_popResponseQueue;
260814184Sgabeblack@google.com    wa_wakeUpDependents;
260914184Sgabeblack@google.com  }
261014184Sgabeblack@google.com
261114184Sgabeblack@google.com  transition(OLS, L1_PUTS, OLSW) {
261214184Sgabeblack@google.com    l_writebackAckDropData;
261314184Sgabeblack@google.com    o_popL1RequestQueue;
261414184Sgabeblack@google.com  }
261514184Sgabeblack@google.com
261614184Sgabeblack@google.com  transition(ILS, L1_PUTS, ILSW) {
261714184Sgabeblack@google.com    l_writebackAckNeedData;
261814184Sgabeblack@google.com    o_popL1RequestQueue;
261914184Sgabeblack@google.com  }
262014184Sgabeblack@google.com
262114184Sgabeblack@google.com  transition(ILS, L1_PUTS_only, IW) {
262214184Sgabeblack@google.com    l_writebackAckNeedData;
262314184Sgabeblack@google.com    o_popL1RequestQueue;
262414184Sgabeblack@google.com  }
262514184Sgabeblack@google.com
262614184Sgabeblack@google.com   transition(OLS, L1_PUTS_only, OW) {
262714184Sgabeblack@google.com    l_writebackAckDropData;
262814184Sgabeblack@google.com    o_popL1RequestQueue;
262914184Sgabeblack@google.com  }
263014184Sgabeblack@google.com
263114184Sgabeblack@google.com  transition(OLSX, L1_PUTS_only, OXW) {
263214184Sgabeblack@google.com    l_writebackAckDropData;
263314184Sgabeblack@google.com    o_popL1RequestQueue;
263414184Sgabeblack@google.com  }
263514184Sgabeblack@google.com
263614184Sgabeblack@google.com  transition(OLSX, L1_PUTS, OLSXW) {
263714184Sgabeblack@google.com    l_writebackAckDropData;
263814184Sgabeblack@google.com    o_popL1RequestQueue;
263914184Sgabeblack@google.com  }
264014184Sgabeblack@google.com
264114184Sgabeblack@google.com  transition(OLSXW, {Unblock}, OLSX) {
264214184Sgabeblack@google.com    gg_clearSharerFromL1Response;
264314184Sgabeblack@google.com    n_popResponseQueue;
264414184Sgabeblack@google.com    wa_wakeUpDependents;
264514184Sgabeblack@google.com  }
264614184Sgabeblack@google.com
264714184Sgabeblack@google.com  transition(OW, {Unblock}, O) {
264814184Sgabeblack@google.com    gg_clearSharerFromL1Response;
264914184Sgabeblack@google.com    n_popResponseQueue;
265014184Sgabeblack@google.com    wa_wakeUpDependents;
265114184Sgabeblack@google.com  }
265214184Sgabeblack@google.com
265314184Sgabeblack@google.com  transition(OXW, {Unblock}, M) {
265414184Sgabeblack@google.com    gg_clearSharerFromL1Response;
265514184Sgabeblack@google.com    n_popResponseQueue;
265614184Sgabeblack@google.com    wa_wakeUpDependents;
265714184Sgabeblack@google.com  }
265814184Sgabeblack@google.com
265914184Sgabeblack@google.com  transition(ILX, L1_PUTX, ILXW ) {
266014184Sgabeblack@google.com    l_writebackAckNeedData;
266114184Sgabeblack@google.com    o_popL1RequestQueue;
266214184Sgabeblack@google.com  }
266314184Sgabeblack@google.com
266414184Sgabeblack@google.com  transition(ILXW, L1_WBDIRTYDATA, M) {
266514184Sgabeblack@google.com    gg_clearLocalSharers;
266614184Sgabeblack@google.com    vv_allocateL2CacheBlock;
266714184Sgabeblack@google.com    y_copyDirToCacheAndRemove;
266814184Sgabeblack@google.com    u_writeDirtyDataToCache;
266914184Sgabeblack@google.com    o_popL1RequestQueue;
267014184Sgabeblack@google.com    wa_wakeUpDependents;
267114184Sgabeblack@google.com  }
267214184Sgabeblack@google.com
267314184Sgabeblack@google.com  // clean writeback
267414184Sgabeblack@google.com  transition(ILXW, L1_WBCLEANDATA, M) {
267514184Sgabeblack@google.com    gg_clearLocalSharers;
267614184Sgabeblack@google.com    vv_allocateL2CacheBlock;
267714184Sgabeblack@google.com    y_copyDirToCacheAndRemove;
267814184Sgabeblack@google.com    u_writeCleanDataToCache;
267914184Sgabeblack@google.com    o_popL1RequestQueue;
268014184Sgabeblack@google.com    wa_wakeUpDependents;
268114184Sgabeblack@google.com  }
268214184Sgabeblack@google.com
268314184Sgabeblack@google.com  transition(ILXW, Unblock, ILX) {
268414184Sgabeblack@google.com    // writeback canceled because L1 invalidated
268514184Sgabeblack@google.com    n_popResponseQueue;
268614184Sgabeblack@google.com    wa_wakeUpDependents;
268714184Sgabeblack@google.com  }
268814184Sgabeblack@google.com
268914184Sgabeblack@google.com  transition(ILSW, L1_WBCLEANDATA, SLS) {
269014184Sgabeblack@google.com    vv_allocateL2CacheBlock;
269114184Sgabeblack@google.com    y_copyDirToCacheAndRemove;
269214184Sgabeblack@google.com    u_writeCleanDataToCache;
269314184Sgabeblack@google.com    gg_clearSharerFromL1Request;
269414184Sgabeblack@google.com    o_popL1RequestQueue;
269514184Sgabeblack@google.com    wa_wakeUpDependents;
269614184Sgabeblack@google.com  }
269714184Sgabeblack@google.com
269814184Sgabeblack@google.com  transition(IW, L1_WBCLEANDATA, S) {
269914184Sgabeblack@google.com    vv_allocateL2CacheBlock;
270014184Sgabeblack@google.com    y_copyDirToCacheAndRemove;
270114184Sgabeblack@google.com    u_writeCleanDataToCache;
270214184Sgabeblack@google.com    gg_clearSharerFromL1Request;
270314184Sgabeblack@google.com    o_popL1RequestQueue;
270414184Sgabeblack@google.com    wa_wakeUpDependents;
270514184Sgabeblack@google.com  }
270614184Sgabeblack@google.com
270714184Sgabeblack@google.com  // Owner can have dirty data
270814184Sgabeblack@google.com  transition(ILOW, L1_WBDIRTYDATA, O) {
270914184Sgabeblack@google.com    vv_allocateL2CacheBlock;
271014184Sgabeblack@google.com    y_copyDirToCacheAndRemove;
271114184Sgabeblack@google.com    gg_clearOwnerFromL1Request;
271214184Sgabeblack@google.com    u_writeDirtyDataToCache;
271314184Sgabeblack@google.com    o_popL1RequestQueue;
271414184Sgabeblack@google.com    wa_wakeUpDependents;
271514184Sgabeblack@google.com  }
271614184Sgabeblack@google.com
271714184Sgabeblack@google.com  transition(ILOW, L1_WBCLEANDATA, O) {
271814184Sgabeblack@google.com    vv_allocateL2CacheBlock;
271914184Sgabeblack@google.com    y_copyDirToCacheAndRemove;
272014184Sgabeblack@google.com    gg_clearOwnerFromL1Request;
272114184Sgabeblack@google.com    u_writeCleanDataToCache;
272214184Sgabeblack@google.com    o_popL1RequestQueue;
272314184Sgabeblack@google.com    wa_wakeUpDependents;
272414184Sgabeblack@google.com  }
272514184Sgabeblack@google.com
272614184Sgabeblack@google.com  transition(ILOXW, L1_WBDIRTYDATA, M) {
272714184Sgabeblack@google.com    vv_allocateL2CacheBlock;
272814184Sgabeblack@google.com    y_copyDirToCacheAndRemove;
272914184Sgabeblack@google.com    gg_clearOwnerFromL1Request;
273014184Sgabeblack@google.com    u_writeDirtyDataToCache;
273114184Sgabeblack@google.com    o_popL1RequestQueue;
273214184Sgabeblack@google.com    wa_wakeUpDependents;
273314184Sgabeblack@google.com  }
273414184Sgabeblack@google.com
273514184Sgabeblack@google.com  transition(ILOXW, L1_WBCLEANDATA, M) {
273614184Sgabeblack@google.com    vv_allocateL2CacheBlock;
273714184Sgabeblack@google.com    y_copyDirToCacheAndRemove;
273814184Sgabeblack@google.com    gg_clearOwnerFromL1Request;
273914184Sgabeblack@google.com    u_writeCleanDataToCache;
274014184Sgabeblack@google.com    o_popL1RequestQueue;
274114184Sgabeblack@google.com    wa_wakeUpDependents;
274214184Sgabeblack@google.com  }
274314184Sgabeblack@google.com
274414184Sgabeblack@google.com  transition(ILOSW, L1_WBDIRTYDATA, OLS) {
274514184Sgabeblack@google.com    vv_allocateL2CacheBlock;
274614184Sgabeblack@google.com    y_copyDirToCacheAndRemove;
274714184Sgabeblack@google.com    gg_clearOwnerFromL1Request;
274814184Sgabeblack@google.com    u_writeDirtyDataToCache;
274914184Sgabeblack@google.com    o_popL1RequestQueue;
275014184Sgabeblack@google.com    wa_wakeUpDependents;
275114184Sgabeblack@google.com  }
275214184Sgabeblack@google.com
275314184Sgabeblack@google.com  transition(ILOSW, L1_WBCLEANDATA, OLS) {
275414184Sgabeblack@google.com    vv_allocateL2CacheBlock;
275514184Sgabeblack@google.com    y_copyDirToCacheAndRemove;
275614184Sgabeblack@google.com    gg_clearOwnerFromL1Request;
275714184Sgabeblack@google.com    u_writeCleanDataToCache;
275814184Sgabeblack@google.com    o_popL1RequestQueue;
275914184Sgabeblack@google.com    wa_wakeUpDependents;
276014184Sgabeblack@google.com  }
276114184Sgabeblack@google.com
276214184Sgabeblack@google.com  transition(ILOSXW, L1_WBDIRTYDATA, OLSX) {
276314184Sgabeblack@google.com    vv_allocateL2CacheBlock;
276414184Sgabeblack@google.com    y_copyDirToCacheAndRemove;
276514184Sgabeblack@google.com    gg_clearOwnerFromL1Request;
276614184Sgabeblack@google.com    u_writeDirtyDataToCache;
276714184Sgabeblack@google.com    o_popL1RequestQueue;
276814184Sgabeblack@google.com    wa_wakeUpDependents;
276914184Sgabeblack@google.com  }
277014184Sgabeblack@google.com
277114184Sgabeblack@google.com  transition(ILOSXW, L1_WBCLEANDATA, OLSX) {
277214184Sgabeblack@google.com    vv_allocateL2CacheBlock;
277314184Sgabeblack@google.com    y_copyDirToCacheAndRemove;
277414184Sgabeblack@google.com    gg_clearOwnerFromL1Request;
277514184Sgabeblack@google.com    u_writeCleanDataToCache;
277614184Sgabeblack@google.com    o_popL1RequestQueue;
277714184Sgabeblack@google.com    wa_wakeUpDependents;
277814184Sgabeblack@google.com  }
277914184Sgabeblack@google.com
278014184Sgabeblack@google.com  transition(SLSW, {Unblock}, SLS) {
278114184Sgabeblack@google.com    gg_clearSharerFromL1Response;
278214184Sgabeblack@google.com    n_popResponseQueue;
278314184Sgabeblack@google.com    wa_wakeUpDependents;
278414184Sgabeblack@google.com  }
278514184Sgabeblack@google.com
278614184Sgabeblack@google.com  transition(OLSW, {Unblock}, OLS) {
278714184Sgabeblack@google.com    gg_clearSharerFromL1Response;
278814184Sgabeblack@google.com    n_popResponseQueue;
278914184Sgabeblack@google.com    wa_wakeUpDependents;
279014184Sgabeblack@google.com  }
279114184Sgabeblack@google.com
279214184Sgabeblack@google.com
279314184Sgabeblack@google.com  // L2 WRITEBACKS
279414184Sgabeblack@google.com  transition({I, S}, L2_Replacement, I) {
279514184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
279614184Sgabeblack@google.com  }
279714184Sgabeblack@google.com
279814184Sgabeblack@google.com  transition(ILS, L2_Replacement) {
279914184Sgabeblack@google.com    y_copyCacheStateToDir;
280014184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
280114184Sgabeblack@google.com  }
280214184Sgabeblack@google.com
280314184Sgabeblack@google.com  transition(ILX, L2_Replacement )  {
280414184Sgabeblack@google.com    y_copyCacheStateToDir;
280514184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
280614184Sgabeblack@google.com  }
280714184Sgabeblack@google.com
280814184Sgabeblack@google.com  transition({ILO, ILOS}, L2_Replacement )  {
280914184Sgabeblack@google.com    y_copyCacheStateToDir;
281014184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
281114184Sgabeblack@google.com  }
281214184Sgabeblack@google.com
281314184Sgabeblack@google.com  transition(SLS, L2_Replacement, ILS) {
281414184Sgabeblack@google.com    y_copyCacheStateToDir;
281514184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
281614184Sgabeblack@google.com  }
281714184Sgabeblack@google.com
281814184Sgabeblack@google.com  transition({OLS, OLSX}, L2_Replacement, OLSI) {
281914184Sgabeblack@google.com    y_copyCacheStateToDir;
282014184Sgabeblack@google.com    b_issuePUTO_ls;
282114184Sgabeblack@google.com    i_allocateTBE;
282214184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
282314184Sgabeblack@google.com  }
282414184Sgabeblack@google.com
282514184Sgabeblack@google.com
282614184Sgabeblack@google.com  transition(O, L2_Replacement, OI) {
282714184Sgabeblack@google.com    b_issuePUTO;
282814184Sgabeblack@google.com    i_allocateTBE;
282914184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
283014184Sgabeblack@google.com  }
283114184Sgabeblack@google.com
283214184Sgabeblack@google.com  transition(M, L2_Replacement, MI) {
283314184Sgabeblack@google.com    b_issuePUTX;
283414184Sgabeblack@google.com    i_allocateTBE;
283514184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
283614184Sgabeblack@google.com  }
283714184Sgabeblack@google.com
283814184Sgabeblack@google.com  transition(OLSI, Fwd_GETX, ILSI) {
283914184Sgabeblack@google.com    t_recordFwdXID;
284014184Sgabeblack@google.com    ee_sendLocalInv;
284114184Sgabeblack@google.com    m_popRequestQueue;
284214184Sgabeblack@google.com  }
284314184Sgabeblack@google.com
284414184Sgabeblack@google.com  transition(ILSI, IntAck) {
284514184Sgabeblack@google.com    m_decrementNumberOfMessagesInt;
284614184Sgabeblack@google.com    o_checkForIntCompletion;
284714184Sgabeblack@google.com    n_popResponseQueue;
284814184Sgabeblack@google.com  }
284914184Sgabeblack@google.com
285014184Sgabeblack@google.com  transition(ILSI, All_Acks, MII) {
285114184Sgabeblack@google.com    gg_clearLocalSharers;
285214184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETX;
285314184Sgabeblack@google.com    n_popTriggerQueue;
285414184Sgabeblack@google.com  }
285514184Sgabeblack@google.com
285614184Sgabeblack@google.com  transition(OLSI, Fwd_GETS) {
285714184Sgabeblack@google.com    t_recordFwdSID;
285814184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETS;
285914184Sgabeblack@google.com    m_popRequestQueue;
286014184Sgabeblack@google.com  }
286114184Sgabeblack@google.com
286214184Sgabeblack@google.com  transition({MI, OI}, Fwd_GETS, OI) {
286314184Sgabeblack@google.com    t_recordFwdSID;
286414184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETS;
286514184Sgabeblack@google.com    m_popRequestQueue;
286614184Sgabeblack@google.com  }
286714184Sgabeblack@google.com
286814184Sgabeblack@google.com  transition({MI, OI}, Fwd_DMA, OI) {
286914184Sgabeblack@google.com    cd_sendDataFromTBEToFwdDma;
287014184Sgabeblack@google.com    da_sendDmaAckUnblock;
287114184Sgabeblack@google.com    m_popRequestQueue;
287214184Sgabeblack@google.com  }
287314184Sgabeblack@google.com
287414184Sgabeblack@google.com  transition(OLSI, Fwd_DMA) {
287514184Sgabeblack@google.com    cd_sendDataFromTBEToFwdDma;
287614184Sgabeblack@google.com    da_sendDmaAckUnblock;
287714184Sgabeblack@google.com    m_popRequestQueue;
287814184Sgabeblack@google.com  }
287914184Sgabeblack@google.com
288014184Sgabeblack@google.com  transition({MI, OI}, Fwd_GETX, MII) {
288114184Sgabeblack@google.com    t_recordFwdXID;
288214184Sgabeblack@google.com    c_sendDataFromTBEToFwdGETX;
288314184Sgabeblack@google.com    m_popRequestQueue;
288414184Sgabeblack@google.com  }
288514184Sgabeblack@google.com
288614184Sgabeblack@google.com  transition({MI, OI}, Writeback_Ack, I) {
288714184Sgabeblack@google.com    qq_sendDataFromTBEToMemory;
288814184Sgabeblack@google.com    s_deallocateTBE;
288914184Sgabeblack@google.com    n_popResponseQueue;
289014184Sgabeblack@google.com    wa_wakeUpDependents;
289114184Sgabeblack@google.com  }
289214184Sgabeblack@google.com
289314184Sgabeblack@google.com  transition(MII, Writeback_Nack, I) {
289414184Sgabeblack@google.com    s_deallocateTBE;
289514184Sgabeblack@google.com    n_popResponseQueue;
289614184Sgabeblack@google.com    wa_wakeUpDependents;
289714184Sgabeblack@google.com  }
289814184Sgabeblack@google.com
289914184Sgabeblack@google.com  transition(OI, Writeback_Nack) {
290014184Sgabeblack@google.com    b_issuePUTO;
290114184Sgabeblack@google.com    n_popResponseQueue;
290214184Sgabeblack@google.com  }
290314184Sgabeblack@google.com
290414184Sgabeblack@google.com  transition(OLSI, Writeback_Ack, ILS) {
290514184Sgabeblack@google.com    qq_sendDataFromTBEToMemory;
290614184Sgabeblack@google.com    s_deallocateTBE;
290714184Sgabeblack@google.com    n_popResponseQueue;
290814184Sgabeblack@google.com    wa_wakeUpDependents;
290914184Sgabeblack@google.com  }
291014184Sgabeblack@google.com
291114184Sgabeblack@google.com  transition(MII, Writeback_Ack, I) {
291214184Sgabeblack@google.com    f_sendUnblock;
291314184Sgabeblack@google.com    s_deallocateTBE;
291414184Sgabeblack@google.com    n_popResponseQueue;
291514184Sgabeblack@google.com    wa_wakeUpDependents;
291614184Sgabeblack@google.com  }
291714184Sgabeblack@google.com
291814184Sgabeblack@google.com  transition(ILSI, Writeback_Ack, ILS) {
291914184Sgabeblack@google.com    f_sendUnblock;
292014184Sgabeblack@google.com    s_deallocateTBE;
292114184Sgabeblack@google.com    n_popResponseQueue;
292214184Sgabeblack@google.com    wa_wakeUpDependents;
292314184Sgabeblack@google.com  }
292414184Sgabeblack@google.com}
2925