114184Sgabeblack@google.com/*
214184Sgabeblack@google.com * Copyright (c) 2012-2015 Advanced Micro Devices, Inc.
314184Sgabeblack@google.com * All rights reserved.
414184Sgabeblack@google.com *
514184Sgabeblack@google.com * For use for simulation and test purposes only
614184Sgabeblack@google.com *
714184Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
814184Sgabeblack@google.com * modification, are permitted provided that the following conditions are met:
914184Sgabeblack@google.com *
1014184Sgabeblack@google.com * 1. Redistributions of source code must retain the above copyright notice,
1114184Sgabeblack@google.com * this list of conditions and the following disclaimer.
1214184Sgabeblack@google.com *
1314184Sgabeblack@google.com * 2. Redistributions in binary form must reproduce the above copyright notice,
1414184Sgabeblack@google.com * this list of conditions and the following disclaimer in the documentation
1514184Sgabeblack@google.com * and/or other materials provided with the distribution.
1614184Sgabeblack@google.com *
1714184Sgabeblack@google.com * 3. Neither the name of the copyright holder nor the names of its
1814184Sgabeblack@google.com * contributors may be used to endorse or promote products derived from this
1914184Sgabeblack@google.com * software without specific prior written permission.
2014184Sgabeblack@google.com *
2114184Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2214184Sgabeblack@google.com * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2314184Sgabeblack@google.com * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2414184Sgabeblack@google.com * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
2514184Sgabeblack@google.com * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2614184Sgabeblack@google.com * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2714184Sgabeblack@google.com * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2814184Sgabeblack@google.com * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2914184Sgabeblack@google.com * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3014184Sgabeblack@google.com * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3114184Sgabeblack@google.com * POSSIBILITY OF SUCH DAMAGE.
3214184Sgabeblack@google.com *
3314184Sgabeblack@google.com * Authors: Mithuna Thottethodi
3414184Sgabeblack@google.com */
3514184Sgabeblack@google.com
3614184Sgabeblack@google.commachine(MachineType:TCCdir, "AMD read-for-ownership directory for TCC (aka GPU L2)")
3714184Sgabeblack@google.com:  CacheMemory * directory;
3814184Sgabeblack@google.com  // Convention: wire buffers are prefixed with "w_" for clarity
3914184Sgabeblack@google.com  WireBuffer * w_reqToTCCDir;
4014184Sgabeblack@google.com  WireBuffer * w_respToTCCDir;
4114184Sgabeblack@google.com  WireBuffer * w_TCCUnblockToTCCDir;
4214184Sgabeblack@google.com  WireBuffer * w_reqToTCC;
4314184Sgabeblack@google.com  WireBuffer * w_probeToTCC;
4414184Sgabeblack@google.com  WireBuffer * w_respToTCC;
4514184Sgabeblack@google.com  int TCC_select_num_bits;
4614184Sgabeblack@google.com  Cycles response_latency := 5;
4714184Sgabeblack@google.com  Cycles directory_latency := 6;
4814184Sgabeblack@google.com  Cycles issue_latency := 120;
4914184Sgabeblack@google.com
5014184Sgabeblack@google.com  // From the TCPs or SQCs
5114184Sgabeblack@google.com  MessageBuffer * requestFromTCP, network="From", virtual_network="1", vnet_type="request";
5214184Sgabeblack@google.com  MessageBuffer * responseFromTCP, network="From", virtual_network="3", vnet_type="response";
5314184Sgabeblack@google.com  MessageBuffer * unblockFromTCP, network="From", virtual_network="5", vnet_type="unblock";
5414184Sgabeblack@google.com
5514184Sgabeblack@google.com  // To the Cores. TCC deals only with TCPs/SQCs. CP cores do not communicate directly with TCC.
5614184Sgabeblack@google.com  MessageBuffer * probeToCore, network="To", virtual_network="1", vnet_type="request";
5714184Sgabeblack@google.com  MessageBuffer * responseToCore, network="To", virtual_network="3", vnet_type="response";
5814184Sgabeblack@google.com
5914184Sgabeblack@google.com  // From the NB
6014184Sgabeblack@google.com  MessageBuffer * probeFromNB, network="From", virtual_network="0", vnet_type="request";
6114184Sgabeblack@google.com  MessageBuffer * responseFromNB, network="From", virtual_network="2", vnet_type="response";
6214184Sgabeblack@google.com  // To the NB
6314184Sgabeblack@google.com  MessageBuffer * requestToNB, network="To", virtual_network="0", vnet_type="request";
6414184Sgabeblack@google.com  MessageBuffer * responseToNB, network="To", virtual_network="2", vnet_type="response";
6514184Sgabeblack@google.com  MessageBuffer * unblockToNB, network="To", virtual_network="4", vnet_type="unblock";
6614184Sgabeblack@google.com
6714184Sgabeblack@google.com  MessageBuffer * triggerQueue, random="false";
6814184Sgabeblack@google.com{
6914184Sgabeblack@google.com  // STATES
7014184Sgabeblack@google.com  state_declaration(State, desc="Directory states", default="TCCdir_State_I") {
7114184Sgabeblack@google.com    // Base states
7214184Sgabeblack@google.com    I, AccessPermission:Invalid, desc="Invalid";
7314184Sgabeblack@google.com    S, AccessPermission:Invalid, desc="Shared";
7414184Sgabeblack@google.com    E, AccessPermission:Invalid, desc="Shared";
7514184Sgabeblack@google.com    O, AccessPermission:Invalid, desc="Owner";
7614184Sgabeblack@google.com    M, AccessPermission:Invalid, desc="Modified";
7714184Sgabeblack@google.com
7814184Sgabeblack@google.com    CP_I, AccessPermission:Invalid, desc="Blocked, must send data after acks are in, going to invalid";
7914184Sgabeblack@google.com    B_I, AccessPermission:Invalid, desc="Blocked, need not send data after acks are in, going to invalid";
8014184Sgabeblack@google.com    CP_O, AccessPermission:Invalid, desc="Blocked, must send data after acks are in, going to owned";
8114184Sgabeblack@google.com    CP_S, AccessPermission:Invalid, desc="Blocked, must send data after acks are in, going to shared";
8214184Sgabeblack@google.com    CP_OM, AccessPermission:Invalid, desc="Blocked, must send data after acks are in, going to O_M";
8314184Sgabeblack@google.com    CP_SM, AccessPermission:Invalid, desc="Blocked, must send data after acks are in, going to S_M";
8414184Sgabeblack@google.com    CP_ISM, AccessPermission:Invalid, desc="Blocked, must send data after acks are in, going to I_M";
8514184Sgabeblack@google.com    CP_IOM, AccessPermission:Invalid, desc="Blocked, must send data after acks are in, going to I_M";
8614184Sgabeblack@google.com    CP_OSIW, AccessPermission:Invalid, desc="Blocked, must send data after acks+CancelWB are in, going to I_C";
8714184Sgabeblack@google.com
8814184Sgabeblack@google.com
8914184Sgabeblack@google.com    // Transient states and busy states used for handling side (TCC-facing) interactions
9014184Sgabeblack@google.com    BW_S, AccessPermission:Invalid, desc="Blocked, Awaiting TCC unblock";
9114184Sgabeblack@google.com    BW_E, AccessPermission:Invalid, desc="Blocked, Awaiting TCC unblock";
9214184Sgabeblack@google.com    BW_O, AccessPermission:Invalid, desc="Blocked, Awaiting TCC unblock";
9314184Sgabeblack@google.com    BW_M, AccessPermission:Invalid, desc="Blocked, Awaiting TCC unblock";
9414184Sgabeblack@google.com
9514184Sgabeblack@google.com    // Transient states and busy states used for handling upward (TCP-facing) interactions
9614184Sgabeblack@google.com    I_M, AccessPermission:Invalid, desc="Invalid, issued RdBlkM, have not seen response yet";
9714184Sgabeblack@google.com    I_ES, AccessPermission:Invalid, desc="Invalid, issued RdBlk, have not seen response yet";
9814184Sgabeblack@google.com    I_S, AccessPermission:Invalid, desc="Invalid, issued RdBlkS, have not seen response yet";
9914184Sgabeblack@google.com    BBS_S, AccessPermission:Invalid, desc="Blocked, going from S to S";
10014184Sgabeblack@google.com    BBO_O, AccessPermission:Invalid, desc="Blocked, going from O to O";
10114184Sgabeblack@google.com    BBM_M, AccessPermission:Invalid, desc="Blocked, going from M to M, waiting for data to forward";
10214184Sgabeblack@google.com    BBM_O, AccessPermission:Invalid, desc="Blocked, going from M to O, waiting for data to forward";
10314184Sgabeblack@google.com    BB_M, AccessPermission:Invalid, desc="Blocked, going from M to M, waiting for unblock";
10414184Sgabeblack@google.com    BB_O, AccessPermission:Invalid, desc="Blocked, going from M to O, waiting for unblock";
10514184Sgabeblack@google.com    BB_OO, AccessPermission:Invalid, desc="Blocked, going from O to O (adding sharers), waiting for unblock";
10614184Sgabeblack@google.com    BB_S, AccessPermission:Invalid, desc="Blocked, going to S, waiting for (possible multiple) unblock(s)";
10714184Sgabeblack@google.com    BBS_M, AccessPermission:Invalid, desc="Blocked, going from S or O to M";
10814184Sgabeblack@google.com    BBO_M, AccessPermission:Invalid, desc="Blocked, going from S or O to M";
10914184Sgabeblack@google.com    BBS_UM, AccessPermission:Invalid, desc="Blocked, going from S or O to M via upgrade";
11014184Sgabeblack@google.com    BBO_UM, AccessPermission:Invalid, desc="Blocked, going from S or O to M via upgrade";
11114184Sgabeblack@google.com    S_M, AccessPermission:Invalid, desc="Shared, issued CtoD, have not seen response yet";
11214184Sgabeblack@google.com    O_M, AccessPermission:Invalid, desc="Shared, issued CtoD, have not seen response yet";
11314184Sgabeblack@google.com
11414184Sgabeblack@google.com    //
11514184Sgabeblack@google.com    BBB_S, AccessPermission:Invalid, desc="Blocked, going to S after core unblock";
11614184Sgabeblack@google.com    BBB_M, AccessPermission:Invalid, desc="Blocked, going to M after core unblock";
11714184Sgabeblack@google.com    BBB_E, AccessPermission:Invalid, desc="Blocked, going to E after core unblock";
11814184Sgabeblack@google.com
11914184Sgabeblack@google.com    VES_I, AccessPermission:Invalid, desc="TCC replacement, waiting for clean WB ack";
12014184Sgabeblack@google.com    VM_I, AccessPermission:Invalid, desc="TCC replacement, waiting for dirty WB ack";
12114184Sgabeblack@google.com    VO_I, AccessPermission:Invalid, desc="TCC replacement, waiting for dirty WB ack";
12214184Sgabeblack@google.com    VO_S, AccessPermission:Invalid, desc="TCC owner replacement, waiting for dirty WB ack";
12314184Sgabeblack@google.com
12414184Sgabeblack@google.com    ES_I, AccessPermission:Invalid, desc="L1 replacement, waiting for clean WB ack";
12514184Sgabeblack@google.com    MO_I, AccessPermission:Invalid, desc="L1 replacement, waiting for dirty WB ack";
12614184Sgabeblack@google.com
12714184Sgabeblack@google.com    I_C, AccessPermission:Invalid, desc="Invalid, waiting for WBAck from NB for canceled WB";
12814184Sgabeblack@google.com    I_W, AccessPermission:Invalid, desc="Invalid, waiting for WBAck from NB; canceled WB raced with directory invalidation";
12914184Sgabeblack@google.com
13014184Sgabeblack@google.com    // Recall States
13114184Sgabeblack@google.com    BRWD_I, AccessPermission:Invalid, desc="Recalling, waiting for WBAck and Probe Data responses";
13214184Sgabeblack@google.com    BRW_I, AccessPermission:Read_Write, desc="Recalling, waiting for WBAck";
13314184Sgabeblack@google.com    BRD_I, AccessPermission:Invalid, desc="Recalling, waiting for Probe Data responses";
13414184Sgabeblack@google.com
13514184Sgabeblack@google.com  }
13614184Sgabeblack@google.com
13714184Sgabeblack@google.com enumeration(RequestType, desc="To communicate stats from transitions to recordStats") {
13814184Sgabeblack@google.com    DataArrayRead,    desc="Read the data array";
13914184Sgabeblack@google.com    DataArrayWrite,   desc="Write the data array";
14014184Sgabeblack@google.com    TagArrayRead,     desc="Read the data array";
14114184Sgabeblack@google.com    TagArrayWrite,    desc="Write the data array";
14214184Sgabeblack@google.com  }
14314184Sgabeblack@google.com
14414184Sgabeblack@google.com
14514184Sgabeblack@google.com
14614184Sgabeblack@google.com  // EVENTS
14714184Sgabeblack@google.com  enumeration(Event, desc="TCC Directory Events") {
14814184Sgabeblack@google.com    // Upward facing events (TCCdir w.r.t. TCP/SQC and TCC behaves like NBdir behaves with TCP/SQC and L3
14914184Sgabeblack@google.com
15014184Sgabeblack@google.com    // Directory Recall
15114184Sgabeblack@google.com    Recall,              desc="directory cache is full";
15214184Sgabeblack@google.com    // CPU requests
15314184Sgabeblack@google.com    CPUWrite,           desc="Initial req from core, sent to TCC";
15414184Sgabeblack@google.com    NoCPUWrite,           desc="Initial req from core, but non-exclusive clean data; can be discarded";
15514184Sgabeblack@google.com    CPUWriteCancel,           desc="Initial req from core, sent to TCC";
15614184Sgabeblack@google.com
15714184Sgabeblack@google.com    // Requests from the TCPs
15814184Sgabeblack@google.com    RdBlk,                  desc="RdBlk event";
15914184Sgabeblack@google.com    RdBlkM,                 desc="RdBlkM event";
16014184Sgabeblack@google.com    RdBlkS,                 desc="RdBlkS event";
16114184Sgabeblack@google.com    CtoD,                   desc="Change to Dirty request";
16214184Sgabeblack@google.com
16314184Sgabeblack@google.com    // TCC writebacks
16414184Sgabeblack@google.com    VicDirty,           desc="...";
16514184Sgabeblack@google.com    VicDirtyLast,           desc="...";
16614184Sgabeblack@google.com    VicClean,           desc="...";
16714184Sgabeblack@google.com    NoVic,           desc="...";
16814184Sgabeblack@google.com    StaleVic,           desc="...";
16914184Sgabeblack@google.com    CancelWB,           desc="TCC got invalidating probe, canceled WB";
17014184Sgabeblack@google.com
17114184Sgabeblack@google.com    // Probe Responses from TCP/SQCs
17214184Sgabeblack@google.com    CPUPrbResp,     desc="Probe response from TCP/SQC";
17314184Sgabeblack@google.com    TCCPrbResp,     desc="Probe response from TCC";
17414184Sgabeblack@google.com
17514184Sgabeblack@google.com    ProbeAcksComplete,	desc="All acks received";
17614184Sgabeblack@google.com    ProbeAcksCompleteReissue,	desc="All acks received, changing CtoD to reissue";
17714184Sgabeblack@google.com
17814184Sgabeblack@google.com    CoreUnblock,		desc="unblock from TCP/SQC";
17914184Sgabeblack@google.com    LastCoreUnblock,		desc="Last unblock from TCP/SQC";
18014184Sgabeblack@google.com    TCCUnblock,			desc="unblock from TCC (current owner)";
18114184Sgabeblack@google.com    TCCUnblock_Sharer,  desc="unblock from TCC (a sharer, not owner)";
18214184Sgabeblack@google.com    TCCUnblock_NotValid,desc="unblock from TCC (not valid...caused by stale writebacks)";
18314184Sgabeblack@google.com
18414184Sgabeblack@google.com    // Downward facing events
18514184Sgabeblack@google.com
18614184Sgabeblack@google.com    // NB initiated
18714184Sgabeblack@google.com    NB_AckS,        desc="NB Ack to TCC Request";
18814184Sgabeblack@google.com    NB_AckE,        desc="NB Ack to TCC Request";
18914184Sgabeblack@google.com    NB_AckM,        desc="NB Ack to TCC Request";
19014184Sgabeblack@google.com    NB_AckCtoD,     desc="NB Ack to TCC Request";
19114184Sgabeblack@google.com    NB_AckWB,       desc="NB Ack for clean WB";
19214184Sgabeblack@google.com
19314184Sgabeblack@google.com
19414184Sgabeblack@google.com    // Incoming Probes from NB
19514184Sgabeblack@google.com    PrbInvData,         desc="Invalidating probe, return dirty data";
19614184Sgabeblack@google.com    PrbInv,             desc="Invalidating probe, no need to return data";
19714184Sgabeblack@google.com    PrbShrData,         desc="Downgrading probe, return data";
19814184Sgabeblack@google.com  }
19914184Sgabeblack@google.com
20014184Sgabeblack@google.com
20114184Sgabeblack@google.com  // TYPES
20214184Sgabeblack@google.com
20314184Sgabeblack@google.com  // Entry for directory
20414184Sgabeblack@google.com  structure(Entry, desc="...", interface='AbstractCacheEntry') {
20514184Sgabeblack@google.com    State CacheState,          desc="Cache state (Cache of directory entries)";
20614184Sgabeblack@google.com    DataBlock DataBlk,             desc="data for the block";
20714184Sgabeblack@google.com    NetDest Sharers,                   desc="Sharers for this block";
20814184Sgabeblack@google.com    NetDest Owner,                     desc="Owner of this block";
20914184Sgabeblack@google.com    NetDest MergedSharers,             desc="Read sharers who are merged on a request";
21014184Sgabeblack@google.com    int WaitingUnblocks,           desc="Number of acks we're waiting for";
21114184Sgabeblack@google.com  }
21214184Sgabeblack@google.com
21314184Sgabeblack@google.com  structure(TBE, desc="...") {
21414184Sgabeblack@google.com    State TBEState,    desc="Transient state";
21514184Sgabeblack@google.com    DataBlock DataBlk, desc="DataBlk";
21614184Sgabeblack@google.com    bool Dirty,        desc="Is the data dirty?";
21714184Sgabeblack@google.com    MachineID Requestor, desc="requestor";
21814184Sgabeblack@google.com    int NumPendingAcks,        desc="num acks expected";
21914184Sgabeblack@google.com    MachineID OriginalRequestor,        desc="Original Requestor";
22014184Sgabeblack@google.com    MachineID UntransferredOwner,    desc = "Untransferred owner for an upgrade transaction";
22114184Sgabeblack@google.com    bool UntransferredOwnerExists,    desc = "1 if Untransferred owner exists for an upgrade transaction";
22214184Sgabeblack@google.com    bool Cached,        desc="data hit in Cache";
22314184Sgabeblack@google.com    bool Shared,	desc="victim hit by shared probe";
22414184Sgabeblack@google.com    bool Upgrade,	desc="An upgrade request in progress";
22514184Sgabeblack@google.com    bool CtoD,	desc="Saved sysack info";
22614184Sgabeblack@google.com    CoherenceState CohState, desc="Saved sysack info";
22714184Sgabeblack@google.com    MessageSizeType MessageSize, desc="Saved sysack info";
22814184Sgabeblack@google.com    MachineID Sender, desc="sender";
22914184Sgabeblack@google.com  }
23014184Sgabeblack@google.com
23114184Sgabeblack@google.com  structure(TBETable, external = "yes") {
23214184Sgabeblack@google.com    TBE lookup(Addr);
23314184Sgabeblack@google.com    void allocate(Addr);
23414184Sgabeblack@google.com    void deallocate(Addr);
23514184Sgabeblack@google.com    bool isPresent(Addr);
23614184Sgabeblack@google.com  }
23714184Sgabeblack@google.com
23814184Sgabeblack@google.com  // ** OBJECTS **
23914184Sgabeblack@google.com  TBETable TBEs, template="<TCCdir_TBE>", constructor="m_number_of_TBEs";
24014184Sgabeblack@google.com  int TCC_select_low_bit, default="RubySystem::getBlockSizeBits()";
24114184Sgabeblack@google.com  NetDest TCC_dir_subtree;
24214184Sgabeblack@google.com  NetDest temp;
24314184Sgabeblack@google.com
24414184Sgabeblack@google.com  Tick clockEdge();
24514184Sgabeblack@google.com  Tick cyclesToTicks(Cycles c);
24614184Sgabeblack@google.com
24714184Sgabeblack@google.com  void set_cache_entry(AbstractCacheEntry b);
24814184Sgabeblack@google.com  void unset_cache_entry();
24914184Sgabeblack@google.com  void set_tbe(TBE b);
25014184Sgabeblack@google.com  void unset_tbe();
25114184Sgabeblack@google.com  MachineID mapAddressToMachine(Addr addr, MachineType mtype);
25214184Sgabeblack@google.com
25314184Sgabeblack@google.com  bool presentOrAvail(Addr addr) {
25414184Sgabeblack@google.com    return directory.isTagPresent(addr) || directory.cacheAvail(addr);
25514184Sgabeblack@google.com  }
25614184Sgabeblack@google.com
25714184Sgabeblack@google.com  Entry getCacheEntry(Addr addr), return_by_pointer="yes" {
25814184Sgabeblack@google.com    return static_cast(Entry, "pointer", directory.lookup(addr));
25914184Sgabeblack@google.com  }
26014184Sgabeblack@google.com
26114184Sgabeblack@google.com  DataBlock getDataBlock(Addr addr), return_by_ref="yes" {
26214184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
26314184Sgabeblack@google.com    if(is_valid(tbe)) {
26414184Sgabeblack@google.com      return tbe.DataBlk;
26514184Sgabeblack@google.com    } else {
26614184Sgabeblack@google.com      assert(false);
26714184Sgabeblack@google.com      return getCacheEntry(addr).DataBlk;
26814184Sgabeblack@google.com    }
26914184Sgabeblack@google.com  }
27014184Sgabeblack@google.com
27114184Sgabeblack@google.com  State getState(TBE tbe, Entry cache_entry, Addr addr) {
27214184Sgabeblack@google.com    if(is_valid(tbe)) {
27314184Sgabeblack@google.com      return tbe.TBEState;
27414184Sgabeblack@google.com    } else if (is_valid(cache_entry)) {
27514184Sgabeblack@google.com      return cache_entry.CacheState;
27614184Sgabeblack@google.com    }
27714184Sgabeblack@google.com    return State:I;
27814184Sgabeblack@google.com  }
27914184Sgabeblack@google.com
28014184Sgabeblack@google.com void setAccessPermission(Entry cache_entry, Addr addr, State state) {
28114184Sgabeblack@google.com    if (is_valid(cache_entry)) {
28214184Sgabeblack@google.com      cache_entry.changePermission(TCCdir_State_to_permission(state));
28314184Sgabeblack@google.com    }
28414184Sgabeblack@google.com  }
28514184Sgabeblack@google.com
28614184Sgabeblack@google.com AccessPermission getAccessPermission(Addr addr) {
28714184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
28814184Sgabeblack@google.com    if(is_valid(tbe)) {
28914184Sgabeblack@google.com      return TCCdir_State_to_permission(tbe.TBEState);
29014184Sgabeblack@google.com    }
29114184Sgabeblack@google.com
29214184Sgabeblack@google.com    Entry cache_entry := getCacheEntry(addr);
29314184Sgabeblack@google.com    if(is_valid(cache_entry)) {
29414184Sgabeblack@google.com      return TCCdir_State_to_permission(cache_entry.CacheState);
29514184Sgabeblack@google.com    }
29614184Sgabeblack@google.com
29714184Sgabeblack@google.com    return AccessPermission:NotPresent;
29814184Sgabeblack@google.com  }
29914184Sgabeblack@google.com
30014184Sgabeblack@google.com  void functionalRead(Addr addr, Packet *pkt) {
30114184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
30214184Sgabeblack@google.com    if(is_valid(tbe)) {
30314184Sgabeblack@google.com      testAndRead(addr, tbe.DataBlk, pkt);
30414184Sgabeblack@google.com    } else {
30514184Sgabeblack@google.com      functionalMemoryRead(pkt);
30614184Sgabeblack@google.com    }
30714184Sgabeblack@google.com  }
30814184Sgabeblack@google.com
30914184Sgabeblack@google.com  int functionalWrite(Addr addr, Packet *pkt) {
31014184Sgabeblack@google.com    int num_functional_writes := 0;
31114184Sgabeblack@google.com
31214184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
31314184Sgabeblack@google.com    if(is_valid(tbe)) {
31414184Sgabeblack@google.com      num_functional_writes := num_functional_writes +
31514184Sgabeblack@google.com            testAndWrite(addr, tbe.DataBlk, pkt);
31614184Sgabeblack@google.com    }
31714184Sgabeblack@google.com
31814184Sgabeblack@google.com    num_functional_writes := num_functional_writes + functionalMemoryWrite(pkt);
31914184Sgabeblack@google.com    return num_functional_writes;
32014184Sgabeblack@google.com  }
32114184Sgabeblack@google.com
32214184Sgabeblack@google.com  void setState(TBE tbe, Entry cache_entry, Addr addr, State state) {
32314184Sgabeblack@google.com    if (is_valid(tbe)) {
32414184Sgabeblack@google.com      tbe.TBEState := state;
32514184Sgabeblack@google.com    }
32614184Sgabeblack@google.com
32714184Sgabeblack@google.com    if (is_valid(cache_entry)) {
32814184Sgabeblack@google.com      cache_entry.CacheState := state;
32914184Sgabeblack@google.com
33014184Sgabeblack@google.com      if (state == State:S) {
33114184Sgabeblack@google.com        assert(cache_entry.Owner.count() == 0);
33214184Sgabeblack@google.com      }
33314184Sgabeblack@google.com
33414184Sgabeblack@google.com      if (state == State:O) {
33514184Sgabeblack@google.com        assert(cache_entry.Owner.count() == 1);
33614184Sgabeblack@google.com        assert(cache_entry.Sharers.isSuperset(cache_entry.Owner) == false);
33714184Sgabeblack@google.com      }
33814184Sgabeblack@google.com
33914184Sgabeblack@google.com      if (state == State:M) {
34014184Sgabeblack@google.com        assert(cache_entry.Owner.count() == 1);
34114184Sgabeblack@google.com        assert(cache_entry.Sharers.count() == 0);
34214184Sgabeblack@google.com      }
34314184Sgabeblack@google.com
34414184Sgabeblack@google.com      if (state == State:E) {
34514184Sgabeblack@google.com        assert(cache_entry.Owner.count() == 0);
34614184Sgabeblack@google.com        assert(cache_entry.Sharers.count() == 1);
34714184Sgabeblack@google.com      }
34814184Sgabeblack@google.com    }
34914184Sgabeblack@google.com  }
35014184Sgabeblack@google.com
35114184Sgabeblack@google.com
35214184Sgabeblack@google.com
35314184Sgabeblack@google.com void recordRequestType(RequestType request_type, Addr addr) {
35414184Sgabeblack@google.com    if (request_type == RequestType:DataArrayRead) {
35514184Sgabeblack@google.com        directory.recordRequestType(CacheRequestType:DataArrayRead, addr);
35614184Sgabeblack@google.com    } else if (request_type == RequestType:DataArrayWrite) {
35714184Sgabeblack@google.com        directory.recordRequestType(CacheRequestType:DataArrayWrite, addr);
35814184Sgabeblack@google.com    } else if (request_type == RequestType:TagArrayRead) {
35914184Sgabeblack@google.com        directory.recordRequestType(CacheRequestType:TagArrayRead, addr);
36014184Sgabeblack@google.com    } else if (request_type == RequestType:TagArrayWrite) {
36114184Sgabeblack@google.com        directory.recordRequestType(CacheRequestType:TagArrayWrite, addr);
36214184Sgabeblack@google.com    }
36314184Sgabeblack@google.com  }
36414184Sgabeblack@google.com
36514184Sgabeblack@google.com  bool checkResourceAvailable(RequestType request_type, Addr addr) {
36614184Sgabeblack@google.com    if (request_type == RequestType:DataArrayRead) {
36714184Sgabeblack@google.com      return directory.checkResourceAvailable(CacheResourceType:DataArray, addr);
36814184Sgabeblack@google.com    } else if (request_type == RequestType:DataArrayWrite) {
36914184Sgabeblack@google.com      return directory.checkResourceAvailable(CacheResourceType:DataArray, addr);
37014184Sgabeblack@google.com    } else if (request_type == RequestType:TagArrayRead) {
37114184Sgabeblack@google.com      return directory.checkResourceAvailable(CacheResourceType:TagArray, addr);
37214184Sgabeblack@google.com    } else if (request_type == RequestType:TagArrayWrite) {
37314184Sgabeblack@google.com      return directory.checkResourceAvailable(CacheResourceType:TagArray, addr);
37414184Sgabeblack@google.com    } else {
37514184Sgabeblack@google.com      error("Invalid RequestType type in checkResourceAvailable");
37614184Sgabeblack@google.com      return true;
37714184Sgabeblack@google.com    }
37814184Sgabeblack@google.com  }
37914184Sgabeblack@google.com
38014184Sgabeblack@google.com  // ** OUT_PORTS **
38114184Sgabeblack@google.com
38214184Sgabeblack@google.com  // Three classes of ports
38314184Sgabeblack@google.com  // Class 1: downward facing network links to NB
38414184Sgabeblack@google.com  out_port(requestToNB_out, CPURequestMsg, requestToNB);
38514184Sgabeblack@google.com  out_port(responseToNB_out, ResponseMsg, responseToNB);
38614184Sgabeblack@google.com  out_port(unblockToNB_out, UnblockMsg, unblockToNB);
38714184Sgabeblack@google.com
38814184Sgabeblack@google.com
38914184Sgabeblack@google.com  // Class 2: upward facing ports to GPU cores
39014184Sgabeblack@google.com  out_port(probeToCore_out, TDProbeRequestMsg, probeToCore);
39114184Sgabeblack@google.com  out_port(responseToCore_out, ResponseMsg, responseToCore);
39214184Sgabeblack@google.com
39314184Sgabeblack@google.com  // Class 3: sideward facing ports (on "wirebuffer" links) to TCC
39414184Sgabeblack@google.com  out_port(w_requestTCC_out, CPURequestMsg, w_reqToTCC);
39514184Sgabeblack@google.com  out_port(w_probeTCC_out, NBProbeRequestMsg, w_probeToTCC);
39614184Sgabeblack@google.com  out_port(w_respTCC_out, ResponseMsg, w_respToTCC);
39714184Sgabeblack@google.com
39814184Sgabeblack@google.com
39914184Sgabeblack@google.com  // local trigger port
40014184Sgabeblack@google.com  out_port(triggerQueue_out, TriggerMsg, triggerQueue);
40114184Sgabeblack@google.com
40214184Sgabeblack@google.com  //
40314184Sgabeblack@google.com  // request queue going to NB
40414184Sgabeblack@google.com  //
40514184Sgabeblack@google.com
40614184Sgabeblack@google.com  // ** IN_PORTS **
40714184Sgabeblack@google.com
40814184Sgabeblack@google.com  // Trigger Queue
40914184Sgabeblack@google.com  in_port(triggerQueue_in, TriggerMsg, triggerQueue, rank=8) {
41014184Sgabeblack@google.com    if (triggerQueue_in.isReady(clockEdge())) {
41114184Sgabeblack@google.com      peek(triggerQueue_in, TriggerMsg) {
41214184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
41314184Sgabeblack@google.com        assert(is_valid(tbe));
41414184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
41514184Sgabeblack@google.com        if ((in_msg.Type == TriggerType:AcksComplete) && (tbe.Upgrade == false))  {
41614184Sgabeblack@google.com          trigger(Event:ProbeAcksComplete, in_msg.addr, cache_entry, tbe);
41714184Sgabeblack@google.com        } else if ((in_msg.Type == TriggerType:AcksComplete) && (tbe.Upgrade == true))  {
41814184Sgabeblack@google.com          trigger(Event:ProbeAcksCompleteReissue, in_msg.addr, cache_entry, tbe);
41914184Sgabeblack@google.com        }
42014184Sgabeblack@google.com      }
42114184Sgabeblack@google.com    }
42214184Sgabeblack@google.com  }
42314184Sgabeblack@google.com
42414184Sgabeblack@google.com  // Unblock Networks (TCCdir can receive unblocks from TCC, TCPs)
42514184Sgabeblack@google.com  // Port on first (of three) wire buffers from TCC
42614184Sgabeblack@google.com  in_port(w_TCCUnblock_in, UnblockMsg, w_TCCUnblockToTCCDir, rank=7) {
42714184Sgabeblack@google.com    if (w_TCCUnblock_in.isReady(clockEdge())) {
42814184Sgabeblack@google.com      peek(w_TCCUnblock_in, UnblockMsg) {
42914184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
43014184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
43114184Sgabeblack@google.com        if (in_msg.currentOwner) {
43214184Sgabeblack@google.com            trigger(Event:TCCUnblock, in_msg.addr, cache_entry, tbe);
43314184Sgabeblack@google.com        } else if (in_msg.valid) {
43414184Sgabeblack@google.com            trigger(Event:TCCUnblock_Sharer, in_msg.addr, cache_entry, tbe);
43514184Sgabeblack@google.com        } else {
43614184Sgabeblack@google.com            trigger(Event:TCCUnblock_NotValid, in_msg.addr, cache_entry, tbe);
43714184Sgabeblack@google.com        }
43814184Sgabeblack@google.com      }
43914184Sgabeblack@google.com    }
44014184Sgabeblack@google.com  }
44114184Sgabeblack@google.com
44214184Sgabeblack@google.com  in_port(unblockNetwork_in, UnblockMsg, unblockFromTCP, rank=6) {
44314184Sgabeblack@google.com    if (unblockNetwork_in.isReady(clockEdge())) {
44414184Sgabeblack@google.com      peek(unblockNetwork_in, UnblockMsg) {
44514184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
44614184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
44714184Sgabeblack@google.com        if(cache_entry.WaitingUnblocks == 1) {
44814184Sgabeblack@google.com          trigger(Event:LastCoreUnblock, in_msg.addr, cache_entry, tbe);
44914184Sgabeblack@google.com        }
45014184Sgabeblack@google.com        else {
45114184Sgabeblack@google.com          trigger(Event:CoreUnblock, in_msg.addr, cache_entry, tbe);
45214184Sgabeblack@google.com        }
45314184Sgabeblack@google.com      }
45414184Sgabeblack@google.com    }
45514184Sgabeblack@google.com  }
45614184Sgabeblack@google.com
45714184Sgabeblack@google.com
45814184Sgabeblack@google.com  //Responses from TCC, and Cores
45914184Sgabeblack@google.com  // Port on second (of three) wire buffers from TCC
46014184Sgabeblack@google.com  in_port(w_TCCResponse_in, ResponseMsg, w_respToTCCDir, rank=5) {
46114184Sgabeblack@google.com    if (w_TCCResponse_in.isReady(clockEdge())) {
46214184Sgabeblack@google.com      peek(w_TCCResponse_in, ResponseMsg) {
46314184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
46414184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
46514184Sgabeblack@google.com        if (in_msg.Type == CoherenceResponseType:CPUPrbResp) {
46614184Sgabeblack@google.com          trigger(Event:TCCPrbResp, in_msg.addr, cache_entry, tbe);
46714184Sgabeblack@google.com        }
46814184Sgabeblack@google.com      }
46914184Sgabeblack@google.com    }
47014184Sgabeblack@google.com  }
47114184Sgabeblack@google.com
47214184Sgabeblack@google.com  in_port(responseNetwork_in, ResponseMsg, responseFromTCP, rank=4) {
47314184Sgabeblack@google.com    if (responseNetwork_in.isReady(clockEdge())) {
47414184Sgabeblack@google.com      peek(responseNetwork_in, ResponseMsg) {
47514184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
47614184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
47714184Sgabeblack@google.com        if (in_msg.Type == CoherenceResponseType:CPUPrbResp) {
47814184Sgabeblack@google.com          trigger(Event:CPUPrbResp, in_msg.addr, cache_entry, tbe);
47914184Sgabeblack@google.com        }
48014184Sgabeblack@google.com      }
48114184Sgabeblack@google.com    }
48214184Sgabeblack@google.com  }
48314184Sgabeblack@google.com
48414184Sgabeblack@google.com
48514184Sgabeblack@google.com  // Port on third (of three) wire buffers from TCC
48614184Sgabeblack@google.com  in_port(w_TCCRequest_in, CPURequestMsg, w_reqToTCCDir, rank=3) {
48714184Sgabeblack@google.com      if(w_TCCRequest_in.isReady(clockEdge())) {
48814184Sgabeblack@google.com          peek(w_TCCRequest_in, CPURequestMsg) {
48914184Sgabeblack@google.com              TBE tbe := TBEs.lookup(in_msg.addr);
49014184Sgabeblack@google.com              Entry cache_entry := getCacheEntry(in_msg.addr);
49114184Sgabeblack@google.com              if (in_msg.Type == CoherenceRequestType:WrCancel) {
49214184Sgabeblack@google.com                  trigger(Event:CancelWB, in_msg.addr, cache_entry, tbe);
49314184Sgabeblack@google.com              } else if (in_msg.Type == CoherenceRequestType:VicDirty) {
49414184Sgabeblack@google.com                  if (is_valid(cache_entry) && cache_entry.Owner.isElement(in_msg.Requestor)) {
49514184Sgabeblack@google.com                      // if modified, or owner with no other sharers
49614184Sgabeblack@google.com                      if ((cache_entry.CacheState == State:M) || (cache_entry.Sharers.count() == 0)) {
49714184Sgabeblack@google.com                          assert(cache_entry.Owner.count()==1);
49814184Sgabeblack@google.com                          trigger(Event:VicDirtyLast, in_msg.addr, cache_entry, tbe);
49914184Sgabeblack@google.com                      } else {
50014184Sgabeblack@google.com                          trigger(Event:VicDirty, in_msg.addr, cache_entry, tbe);
50114184Sgabeblack@google.com                      }
50214184Sgabeblack@google.com                  } else {
50314184Sgabeblack@google.com                      trigger(Event:StaleVic, in_msg.addr, cache_entry, tbe);
50414184Sgabeblack@google.com                  }
50514184Sgabeblack@google.com              } else {
50614184Sgabeblack@google.com                  if (in_msg.Type == CoherenceRequestType:VicClean) {
50714184Sgabeblack@google.com                      if (is_valid(cache_entry) && cache_entry.Sharers.isElement(in_msg.Requestor)) {
50814184Sgabeblack@google.com                          if (cache_entry.Sharers.count() == 1) {
50914184Sgabeblack@google.com                              // Last copy, victimize to L3
51014184Sgabeblack@google.com                              trigger(Event:VicClean, in_msg.addr, cache_entry, tbe);
51114184Sgabeblack@google.com                          } else {
51214184Sgabeblack@google.com                              // Either not the last copy or stall. No need to victimmize
51314184Sgabeblack@google.com                              // remove sharer from sharer list
51414184Sgabeblack@google.com                              assert(cache_entry.Sharers.count() > 1);
51514184Sgabeblack@google.com                              trigger(Event:NoVic, in_msg.addr, cache_entry, tbe);
51614184Sgabeblack@google.com                          }
51714184Sgabeblack@google.com                      } else {
51814184Sgabeblack@google.com                          trigger(Event:StaleVic, in_msg.addr, cache_entry, tbe);
51914184Sgabeblack@google.com                      }
52014184Sgabeblack@google.com                  }
52114184Sgabeblack@google.com              }
52214184Sgabeblack@google.com          }
52314184Sgabeblack@google.com      }
52414184Sgabeblack@google.com    }
52514184Sgabeblack@google.com
52614184Sgabeblack@google.com  in_port(responseFromNB_in, ResponseMsg, responseFromNB, rank=2) {
52714184Sgabeblack@google.com    if (responseFromNB_in.isReady(clockEdge())) {
52814184Sgabeblack@google.com      peek(responseFromNB_in, ResponseMsg, block_on="addr") {
52914184Sgabeblack@google.com
53014184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
53114184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
53214184Sgabeblack@google.com        if (in_msg.Type == CoherenceResponseType:NBSysResp) {
53314184Sgabeblack@google.com          if (in_msg.State == CoherenceState:Modified) {
53414184Sgabeblack@google.com            if (in_msg.CtoD) {
53514184Sgabeblack@google.com              trigger(Event:NB_AckCtoD, in_msg.addr, cache_entry, tbe);
53614184Sgabeblack@google.com            } else {
53714184Sgabeblack@google.com              trigger(Event:NB_AckM, in_msg.addr, cache_entry, tbe);
53814184Sgabeblack@google.com            }
53914184Sgabeblack@google.com          } else if (in_msg.State == CoherenceState:Shared) {
54014184Sgabeblack@google.com            trigger(Event:NB_AckS, in_msg.addr, cache_entry, tbe);
54114184Sgabeblack@google.com          } else if (in_msg.State == CoherenceState:Exclusive) {
54214184Sgabeblack@google.com            trigger(Event:NB_AckE, in_msg.addr, cache_entry, tbe);
54314184Sgabeblack@google.com          }
54414184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:NBSysWBAck) {
54514184Sgabeblack@google.com          trigger(Event:NB_AckWB, in_msg.addr, cache_entry, tbe);
54614184Sgabeblack@google.com        } else {
54714184Sgabeblack@google.com          error("Unexpected Response Message to Core");
54814184Sgabeblack@google.com        }
54914184Sgabeblack@google.com      }
55014184Sgabeblack@google.com    }
55114184Sgabeblack@google.com  }
55214184Sgabeblack@google.com
55314184Sgabeblack@google.com  // Finally handling incoming requests (from TCP) and probes (from NB).
55414184Sgabeblack@google.com
55514184Sgabeblack@google.com  in_port(probeNetwork_in, NBProbeRequestMsg, probeFromNB, rank=1) {
55614184Sgabeblack@google.com    if (probeNetwork_in.isReady(clockEdge())) {
55714184Sgabeblack@google.com      peek(probeNetwork_in, NBProbeRequestMsg) {
55814184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", in_msg);
55914184Sgabeblack@google.com        DPRINTF(RubySlicc, "machineID: %s\n", machineID);
56014184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
56114184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
56214184Sgabeblack@google.com
56314184Sgabeblack@google.com        if (in_msg.Type == ProbeRequestType:PrbInv) {
56414184Sgabeblack@google.com          if (in_msg.ReturnData) {
56514184Sgabeblack@google.com            trigger(Event:PrbInvData, in_msg.addr, cache_entry, tbe);
56614184Sgabeblack@google.com          } else {
56714184Sgabeblack@google.com            trigger(Event:PrbInv, in_msg.addr, cache_entry, tbe);
56814184Sgabeblack@google.com          }
56914184Sgabeblack@google.com        } else if (in_msg.Type == ProbeRequestType:PrbDowngrade) {
57014184Sgabeblack@google.com          assert(in_msg.ReturnData);
57114184Sgabeblack@google.com          trigger(Event:PrbShrData, in_msg.addr, cache_entry, tbe);
57214184Sgabeblack@google.com        }
57314184Sgabeblack@google.com      }
57414184Sgabeblack@google.com    }
57514184Sgabeblack@google.com  }
57614184Sgabeblack@google.com
57714184Sgabeblack@google.com
57814184Sgabeblack@google.com  in_port(coreRequestNetwork_in, CPURequestMsg, requestFromTCP, rank=0) {
57914184Sgabeblack@google.com    if (coreRequestNetwork_in.isReady(clockEdge())) {
58014184Sgabeblack@google.com      peek(coreRequestNetwork_in, CPURequestMsg) {
58114184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
58214184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
58314184Sgabeblack@google.com        if (presentOrAvail(in_msg.addr)) {
58414184Sgabeblack@google.com          if (in_msg.Type == CoherenceRequestType:VicDirty) {
58514184Sgabeblack@google.com            trigger(Event:CPUWrite, in_msg.addr, cache_entry, tbe);
58614184Sgabeblack@google.com          } else if (in_msg.Type == CoherenceRequestType:VicClean) {
58714184Sgabeblack@google.com              if (is_valid(cache_entry) && cache_entry.Owner.isElement(in_msg.Requestor)) {
58814184Sgabeblack@google.com                  trigger(Event:CPUWrite, in_msg.addr, cache_entry, tbe);
58914184Sgabeblack@google.com              } else if(is_valid(cache_entry) && (cache_entry.Sharers.count() + cache_entry.Owner.count() ) >1) {
59014184Sgabeblack@google.com                  trigger(Event:NoCPUWrite, in_msg.addr, cache_entry, tbe);
59114184Sgabeblack@google.com              } else {
59214184Sgabeblack@google.com                  trigger(Event:CPUWrite, in_msg.addr, cache_entry, tbe);
59314184Sgabeblack@google.com              }
59414184Sgabeblack@google.com          } else if (in_msg.Type == CoherenceRequestType:RdBlk) {
59514184Sgabeblack@google.com            trigger(Event:RdBlk, in_msg.addr, cache_entry, tbe);
59614184Sgabeblack@google.com          } else if (in_msg.Type == CoherenceRequestType:RdBlkS) {
59714184Sgabeblack@google.com            trigger(Event:RdBlkS, in_msg.addr, cache_entry, tbe);
59814184Sgabeblack@google.com          } else if (in_msg.Type == CoherenceRequestType:RdBlkM) {
59914184Sgabeblack@google.com            trigger(Event:RdBlkM, in_msg.addr, cache_entry, tbe);
60014184Sgabeblack@google.com          } else if (in_msg.Type == CoherenceRequestType:WrCancel) {
60114184Sgabeblack@google.com            trigger(Event:CPUWriteCancel, in_msg.addr, cache_entry, tbe);
60214184Sgabeblack@google.com          }
60314184Sgabeblack@google.com        } else {
60414184Sgabeblack@google.com          // All requests require a directory entry
60514184Sgabeblack@google.com          Addr victim := directory.cacheProbe(in_msg.addr);
60614184Sgabeblack@google.com          trigger(Event:Recall, victim, getCacheEntry(victim), TBEs.lookup(victim));
60714184Sgabeblack@google.com        }
60814184Sgabeblack@google.com      }
60914184Sgabeblack@google.com    }
61014184Sgabeblack@google.com  }
61114184Sgabeblack@google.com
61214184Sgabeblack@google.com
61314184Sgabeblack@google.com
61414184Sgabeblack@google.com
61514184Sgabeblack@google.com  // Actions
61614184Sgabeblack@google.com
61714184Sgabeblack@google.com  //Downward facing actions
61814184Sgabeblack@google.com
61914184Sgabeblack@google.com  action(c_clearOwner, "c", desc="Clear the owner field") {
62014184Sgabeblack@google.com    cache_entry.Owner.clear();
62114184Sgabeblack@google.com  }
62214184Sgabeblack@google.com
62314184Sgabeblack@google.com  action(rS_removeRequesterFromSharers, "rS", desc="Remove unblocker from sharer list") {
62414184Sgabeblack@google.com    peek(unblockNetwork_in, UnblockMsg) {
62514184Sgabeblack@google.com      cache_entry.Sharers.remove(in_msg.Sender);
62614184Sgabeblack@google.com    }
62714184Sgabeblack@google.com  }
62814184Sgabeblack@google.com
62914184Sgabeblack@google.com  action(rT_removeTCCFromSharers, "rT", desc="Remove  TCC from sharer list") {
63014184Sgabeblack@google.com    peek(w_TCCRequest_in, CPURequestMsg) {
63114184Sgabeblack@google.com      cache_entry.Sharers.remove(in_msg.Requestor);
63214184Sgabeblack@google.com    }
63314184Sgabeblack@google.com  }
63414184Sgabeblack@google.com
63514184Sgabeblack@google.com  action(rO_removeOriginalRequestorFromSharers, "rO", desc="Remove replacing core from sharer list") {
63614184Sgabeblack@google.com    peek(coreRequestNetwork_in, CPURequestMsg) {
63714184Sgabeblack@google.com      cache_entry.Sharers.remove(in_msg.Requestor);
63814184Sgabeblack@google.com    }
63914184Sgabeblack@google.com  }
64014184Sgabeblack@google.com
64114184Sgabeblack@google.com  action(rC_removeCoreFromSharers, "rC", desc="Remove replacing core from sharer list") {
64214184Sgabeblack@google.com    peek(coreRequestNetwork_in, CPURequestMsg) {
64314184Sgabeblack@google.com      cache_entry.Sharers.remove(in_msg.Requestor);
64414184Sgabeblack@google.com    }
64514184Sgabeblack@google.com  }
64614184Sgabeblack@google.com
64714184Sgabeblack@google.com  action(rCo_removeCoreFromOwner, "rCo", desc="Remove replacing core from sharer list") {
64814184Sgabeblack@google.com    // Note that under some cases this action will try to remove a stale owner
64914184Sgabeblack@google.com    peek(coreRequestNetwork_in, CPURequestMsg) {
65014184Sgabeblack@google.com      cache_entry.Owner.remove(in_msg.Requestor);
65114184Sgabeblack@google.com    }
65214184Sgabeblack@google.com  }
65314184Sgabeblack@google.com
65414184Sgabeblack@google.com  action(rR_removeResponderFromSharers, "rR", desc="Remove responder from sharer list") {
65514184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
65614184Sgabeblack@google.com      cache_entry.Sharers.remove(in_msg.Sender);
65714184Sgabeblack@google.com    }
65814184Sgabeblack@google.com  }
65914184Sgabeblack@google.com
66014184Sgabeblack@google.com  action(nC_sendNullWBAckToCore, "nC", desc = "send a null WB Ack to release core") {
66114184Sgabeblack@google.com    peek(coreRequestNetwork_in, CPURequestMsg) {
66214184Sgabeblack@google.com      enqueue(responseToCore_out, ResponseMsg, 1) {
66314184Sgabeblack@google.com        out_msg.addr := address;
66414184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:TDSysWBNack;
66514184Sgabeblack@google.com        out_msg.Sender := machineID;
66614184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
66714184Sgabeblack@google.com        out_msg.MessageSize := in_msg.MessageSize;
66814184Sgabeblack@google.com      }
66914184Sgabeblack@google.com   }
67014184Sgabeblack@google.com  }
67114184Sgabeblack@google.com
67214184Sgabeblack@google.com  action(nT_sendNullWBAckToTCC, "nT", desc = "send a null WB Ack to release TCC") {
67314184Sgabeblack@google.com    peek(w_TCCRequest_in, CPURequestMsg) {
67414184Sgabeblack@google.com      enqueue(w_respTCC_out, ResponseMsg, 1) {
67514184Sgabeblack@google.com        out_msg.addr := address;
67614184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:TDSysWBAck;
67714184Sgabeblack@google.com        out_msg.Sender := machineID;
67814184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
67914184Sgabeblack@google.com        out_msg.MessageSize := in_msg.MessageSize;
68014184Sgabeblack@google.com      }
68114184Sgabeblack@google.com    }
68214184Sgabeblack@google.com  }
68314184Sgabeblack@google.com
68414184Sgabeblack@google.com  action(eto_moveExSharerToOwner, "eto", desc="move the current exclusive sharer to owner") {
68514184Sgabeblack@google.com      assert(cache_entry.Sharers.count() == 1);
68614184Sgabeblack@google.com      assert(cache_entry.Owner.count() == 0);
68714184Sgabeblack@google.com      cache_entry.Owner := cache_entry.Sharers;
68814184Sgabeblack@google.com      cache_entry.Sharers.clear();
68914184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(" new owner ");
69014184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(cache_entry.Owner);
69114184Sgabeblack@google.com  }
69214184Sgabeblack@google.com
69314184Sgabeblack@google.com  action(aT_addTCCToSharers, "aT", desc="Add TCC to sharer list") {
69414184Sgabeblack@google.com    peek(w_TCCUnblock_in, UnblockMsg) {
69514184Sgabeblack@google.com      cache_entry.Sharers.add(in_msg.Sender);
69614184Sgabeblack@google.com    }
69714184Sgabeblack@google.com  }
69814184Sgabeblack@google.com
69914184Sgabeblack@google.com  action(as_addToSharers, "as", desc="Add unblocker to sharer list") {
70014184Sgabeblack@google.com    peek(unblockNetwork_in, UnblockMsg) {
70114184Sgabeblack@google.com      cache_entry.Sharers.add(in_msg.Sender);
70214184Sgabeblack@google.com    }
70314184Sgabeblack@google.com  }
70414184Sgabeblack@google.com
70514184Sgabeblack@google.com  action(c_moveOwnerToSharer, "cc", desc="Move owner to sharers") {
70614184Sgabeblack@google.com    cache_entry.Sharers.addNetDest(cache_entry.Owner);
70714184Sgabeblack@google.com    cache_entry.Owner.clear();
70814184Sgabeblack@google.com  }
70914184Sgabeblack@google.com
71014184Sgabeblack@google.com  action(cc_clearSharers, "\c", desc="Clear the sharers field") {
71114184Sgabeblack@google.com    cache_entry.Sharers.clear();
71214184Sgabeblack@google.com  }
71314184Sgabeblack@google.com
71414184Sgabeblack@google.com  action(e_ownerIsUnblocker, "e", desc="The owner is now the unblocker") {
71514184Sgabeblack@google.com    peek(unblockNetwork_in, UnblockMsg) {
71614184Sgabeblack@google.com      cache_entry.Owner.clear();
71714184Sgabeblack@google.com      cache_entry.Owner.add(in_msg.Sender);
71814184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(" tcp_ub owner ");
71914184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(cache_entry.Owner);
72014184Sgabeblack@google.com    }
72114184Sgabeblack@google.com  }
72214184Sgabeblack@google.com
72314184Sgabeblack@google.com  action(eT_ownerIsUnblocker, "eT", desc="TCC (unblocker) is now owner") {
72414184Sgabeblack@google.com    peek(w_TCCUnblock_in, UnblockMsg) {
72514184Sgabeblack@google.com      cache_entry.Owner.clear();
72614184Sgabeblack@google.com      cache_entry.Owner.add(in_msg.Sender);
72714184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(" tcc_ub owner ");
72814184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(cache_entry.Owner);
72914184Sgabeblack@google.com    }
73014184Sgabeblack@google.com  }
73114184Sgabeblack@google.com
73214184Sgabeblack@google.com  action(ctr_copyTCCResponseToTBE, "ctr", desc="Copy TCC probe response data to TBE") {
73314184Sgabeblack@google.com    peek(w_TCCResponse_in, ResponseMsg) {
73414184Sgabeblack@google.com      // Overwrite data if tbe does not hold dirty data. Stop once it is dirty.
73514184Sgabeblack@google.com      if(tbe.Dirty == false) {
73614184Sgabeblack@google.com        tbe.DataBlk := in_msg.DataBlk;
73714184Sgabeblack@google.com        tbe.Dirty := in_msg.Dirty;
73814184Sgabeblack@google.com        tbe.Sender := in_msg.Sender;
73914184Sgabeblack@google.com      }
74014184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", (tbe.DataBlk));
74114184Sgabeblack@google.com    }
74214184Sgabeblack@google.com  }
74314184Sgabeblack@google.com
74414184Sgabeblack@google.com  action(ccr_copyCoreResponseToTBE, "ccr", desc="Copy core probe response data to TBE") {
74514184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
74614184Sgabeblack@google.com      // Overwrite data if tbe does not hold dirty data. Stop once it is dirty.
74714184Sgabeblack@google.com      if(tbe.Dirty == false) {
74814184Sgabeblack@google.com          tbe.DataBlk := in_msg.DataBlk;
74914184Sgabeblack@google.com          tbe.Dirty := in_msg.Dirty;
75014184Sgabeblack@google.com
75114184Sgabeblack@google.com          if(tbe.Sender == machineID) {
75214184Sgabeblack@google.com              tbe.Sender := in_msg.Sender;
75314184Sgabeblack@google.com          }
75414184Sgabeblack@google.com      }
75514184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", (tbe.DataBlk));
75614184Sgabeblack@google.com    }
75714184Sgabeblack@google.com  }
75814184Sgabeblack@google.com
75914184Sgabeblack@google.com  action(cd_clearDirtyBitTBE, "cd", desc="Clear Dirty bit in TBE") {
76014184Sgabeblack@google.com      tbe.Dirty := false;
76114184Sgabeblack@google.com  }
76214184Sgabeblack@google.com
76314184Sgabeblack@google.com  action(n_issueRdBlk, "n-", desc="Issue RdBlk") {
76414184Sgabeblack@google.com    enqueue(requestToNB_out, CPURequestMsg, issue_latency) {
76514184Sgabeblack@google.com      out_msg.addr := address;
76614184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:RdBlk;
76714184Sgabeblack@google.com      out_msg.Requestor := machineID;
76814184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
76914184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Request_Control;
77014184Sgabeblack@google.com    }
77114184Sgabeblack@google.com  }
77214184Sgabeblack@google.com
77314184Sgabeblack@google.com  action(nS_issueRdBlkS, "nS", desc="Issue RdBlkS") {
77414184Sgabeblack@google.com    enqueue(requestToNB_out, CPURequestMsg, issue_latency) {
77514184Sgabeblack@google.com      out_msg.addr := address;
77614184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:RdBlkS;
77714184Sgabeblack@google.com      out_msg.Requestor := machineID;
77814184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
77914184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Request_Control;
78014184Sgabeblack@google.com    }
78114184Sgabeblack@google.com  }
78214184Sgabeblack@google.com
78314184Sgabeblack@google.com  action(nM_issueRdBlkM, "nM", desc="Issue RdBlkM") {
78414184Sgabeblack@google.com    enqueue(requestToNB_out, CPURequestMsg, issue_latency) {
78514184Sgabeblack@google.com      out_msg.addr := address;
78614184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:RdBlkM;
78714184Sgabeblack@google.com      out_msg.Requestor := machineID;
78814184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
78914184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Request_Control;
79014184Sgabeblack@google.com    }
79114184Sgabeblack@google.com  }
79214184Sgabeblack@google.com
79314184Sgabeblack@google.com  action(rU_rememberUpgrade, "rU", desc="Remember that this was an upgrade") {
79414184Sgabeblack@google.com      tbe.Upgrade := true;
79514184Sgabeblack@google.com  }
79614184Sgabeblack@google.com
79714184Sgabeblack@google.com  action(ruo_rememberUntransferredOwner, "ruo", desc="Remember the untransferred owner") {
79814184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
79914184Sgabeblack@google.com      if(in_msg.UntransferredOwner == true) {
80014184Sgabeblack@google.com        tbe.UntransferredOwner := in_msg.Sender;
80114184Sgabeblack@google.com        tbe.UntransferredOwnerExists := true;
80214184Sgabeblack@google.com      }
80314184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", (in_msg));
80414184Sgabeblack@google.com    }
80514184Sgabeblack@google.com  }
80614184Sgabeblack@google.com
80714184Sgabeblack@google.com  action(ruoT_rememberUntransferredOwnerTCC, "ruoT", desc="Remember the untransferred owner") {
80814184Sgabeblack@google.com    peek(w_TCCResponse_in, ResponseMsg) {
80914184Sgabeblack@google.com      if(in_msg.UntransferredOwner == true) {
81014184Sgabeblack@google.com        tbe.UntransferredOwner := in_msg.Sender;
81114184Sgabeblack@google.com        tbe.UntransferredOwnerExists := true;
81214184Sgabeblack@google.com      }
81314184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", (in_msg));
81414184Sgabeblack@google.com    }
81514184Sgabeblack@google.com  }
81614184Sgabeblack@google.com
81714184Sgabeblack@google.com action(vd_victim, "vd", desc="Victimize M/O Data") {
81814184Sgabeblack@google.com   enqueue(requestToNB_out, CPURequestMsg, issue_latency) {
81914184Sgabeblack@google.com     out_msg.addr := address;
82014184Sgabeblack@google.com     out_msg.Requestor := machineID;
82114184Sgabeblack@google.com     out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
82214184Sgabeblack@google.com     out_msg.MessageSize := MessageSizeType:Request_Control;
82314184Sgabeblack@google.com     out_msg.Type := CoherenceRequestType:VicDirty;
82414184Sgabeblack@google.com     if (cache_entry.CacheState == State:O) {
82514184Sgabeblack@google.com       out_msg.Shared := true;
82614184Sgabeblack@google.com     } else {
82714184Sgabeblack@google.com       out_msg.Shared := false;
82814184Sgabeblack@google.com     }
82914184Sgabeblack@google.com     out_msg.Dirty := true;
83014184Sgabeblack@google.com   }
83114184Sgabeblack@google.com }
83214184Sgabeblack@google.com
83314184Sgabeblack@google.com  action(vc_victim, "vc", desc="Victimize E/S Data") {
83414184Sgabeblack@google.com    enqueue(requestToNB_out, CPURequestMsg, issue_latency) {
83514184Sgabeblack@google.com      out_msg.addr := address;
83614184Sgabeblack@google.com      out_msg.Requestor := machineID;
83714184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
83814184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Request_Control;
83914184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:VicClean;
84014184Sgabeblack@google.com      if (cache_entry.CacheState == State:S) {
84114184Sgabeblack@google.com        out_msg.Shared := true;
84214184Sgabeblack@google.com      } else {
84314184Sgabeblack@google.com        out_msg.Shared := false;
84414184Sgabeblack@google.com      }
84514184Sgabeblack@google.com      out_msg.Dirty := false;
84614184Sgabeblack@google.com    }
84714184Sgabeblack@google.com  }
84814184Sgabeblack@google.com
84914184Sgabeblack@google.com
85014184Sgabeblack@google.com  action(sT_sendRequestToTCC, "sT", desc="send request to TCC") {
85114184Sgabeblack@google.com    peek(coreRequestNetwork_in, CPURequestMsg) {
85214184Sgabeblack@google.com      enqueue(w_requestTCC_out, CPURequestMsg, 1) {
85314184Sgabeblack@google.com        out_msg.addr := address;
85414184Sgabeblack@google.com        out_msg.Type := in_msg.Type;
85514184Sgabeblack@google.com        out_msg.Requestor := in_msg.Requestor;
85614184Sgabeblack@google.com        out_msg.DataBlk := in_msg.DataBlk;
85714184Sgabeblack@google.com        out_msg.Destination.add(mapAddressToRange(address,MachineType:TCC,
85814184Sgabeblack@google.com                                TCC_select_low_bit, TCC_select_num_bits));
85914184Sgabeblack@google.com        out_msg.Shared := in_msg.Shared;
86014184Sgabeblack@google.com        out_msg.MessageSize := in_msg.MessageSize;
86114184Sgabeblack@google.com      }
86214184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(" requestor ");
86314184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(in_msg.Requestor);
86414184Sgabeblack@google.com
86514184Sgabeblack@google.com    }
86614184Sgabeblack@google.com  }
86714184Sgabeblack@google.com
86814184Sgabeblack@google.com
86914184Sgabeblack@google.com  action(sc_probeShrCoreData, "sc", desc="probe shared cores, return data") {
87014184Sgabeblack@google.com    MachineID tcc := mapAddressToRange(address,MachineType:TCC,
87114184Sgabeblack@google.com                                       TCC_select_low_bit, TCC_select_num_bits);
87214184Sgabeblack@google.com
87314184Sgabeblack@google.com    temp := cache_entry.Sharers;
87414184Sgabeblack@google.com    temp.addNetDest(cache_entry.Owner);
87514184Sgabeblack@google.com    if (temp.isElement(tcc)) {
87614184Sgabeblack@google.com        temp.remove(tcc);
87714184Sgabeblack@google.com    }
87814184Sgabeblack@google.com    if (temp.count() > 0) {
87914184Sgabeblack@google.com      enqueue(probeToCore_out, TDProbeRequestMsg, response_latency) {
88014184Sgabeblack@google.com        out_msg.addr := address;
88114184Sgabeblack@google.com        out_msg.Type := ProbeRequestType:PrbDowngrade;
88214184Sgabeblack@google.com        out_msg.ReturnData := true;
88314184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
88414184Sgabeblack@google.com        out_msg.Destination := temp;
88514184Sgabeblack@google.com        tbe.NumPendingAcks := temp.count();
88614184Sgabeblack@google.com        if(cache_entry.CacheState == State:M) {
88714184Sgabeblack@google.com            assert(tbe.NumPendingAcks == 1);
88814184Sgabeblack@google.com        }
88914184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", (out_msg));
89014184Sgabeblack@google.com      }
89114184Sgabeblack@google.com    }
89214184Sgabeblack@google.com  }
89314184Sgabeblack@google.com
89414184Sgabeblack@google.com  action(ls2_probeShrL2Data, "ls2", desc="local probe downgrade L2, return data") {
89514184Sgabeblack@google.com    MachineID tcc := mapAddressToRange(address,MachineType:TCC,
89614184Sgabeblack@google.com                                       TCC_select_low_bit, TCC_select_num_bits);
89714184Sgabeblack@google.com    if ((cache_entry.Sharers.isElement(tcc)) || (cache_entry.Owner.isElement(tcc))) {
89814184Sgabeblack@google.com      enqueue(w_probeTCC_out, TDProbeRequestMsg, 1) {
89914184Sgabeblack@google.com          out_msg.addr := address;
90014184Sgabeblack@google.com          out_msg.Type := ProbeRequestType:PrbDowngrade;
90114184Sgabeblack@google.com          out_msg.ReturnData := true;
90214184Sgabeblack@google.com          out_msg.MessageSize := MessageSizeType:Control;
90314184Sgabeblack@google.com          out_msg.Destination.add(tcc);
90414184Sgabeblack@google.com          tbe.NumPendingAcks := tbe.NumPendingAcks + 1;
90514184Sgabeblack@google.com          DPRINTF(RubySlicc, "%s\n", out_msg);
90614184Sgabeblack@google.com
90714184Sgabeblack@google.com      }
90814184Sgabeblack@google.com    }
90914184Sgabeblack@google.com  }
91014184Sgabeblack@google.com
91114184Sgabeblack@google.com  action(s2_probeShrL2Data, "s2", desc="probe shared L2, return data") {
91214184Sgabeblack@google.com    MachineID tcc := mapAddressToRange(address,MachineType:TCC,
91314184Sgabeblack@google.com                                       TCC_select_low_bit, TCC_select_num_bits);
91414184Sgabeblack@google.com    if ((cache_entry.Sharers.isElement(tcc)) || (cache_entry.Owner.isElement(tcc))) {
91514184Sgabeblack@google.com      enqueue(w_probeTCC_out, TDProbeRequestMsg, 1) {
91614184Sgabeblack@google.com          out_msg.addr := address;
91714184Sgabeblack@google.com          out_msg.Type := ProbeRequestType:PrbDowngrade;
91814184Sgabeblack@google.com          out_msg.ReturnData := true;
91914184Sgabeblack@google.com          out_msg.MessageSize := MessageSizeType:Control;
92014184Sgabeblack@google.com          out_msg.Destination.add(tcc);
92114184Sgabeblack@google.com          tbe.NumPendingAcks := tbe.NumPendingAcks + 1;
92214184Sgabeblack@google.com          DPRINTF(RubySlicc, "%s\n", out_msg);
92314184Sgabeblack@google.com
92414184Sgabeblack@google.com      }
92514184Sgabeblack@google.com    }
92614184Sgabeblack@google.com  }
92714184Sgabeblack@google.com
92814184Sgabeblack@google.com  action(ldc_probeInvCoreData, "ldc", desc="local probe  to inv cores, return data") {
92914184Sgabeblack@google.com    MachineID tcc := mapAddressToRange(address,MachineType:TCC,
93014184Sgabeblack@google.com                                       TCC_select_low_bit, TCC_select_num_bits);
93114184Sgabeblack@google.com    peek(coreRequestNetwork_in, CPURequestMsg) {
93214184Sgabeblack@google.com        NetDest dest:= cache_entry.Sharers;
93314184Sgabeblack@google.com        dest.addNetDest(cache_entry.Owner);
93414184Sgabeblack@google.com        if(dest.isElement(tcc)){
93514184Sgabeblack@google.com         dest.remove(tcc);
93614184Sgabeblack@google.com        }
93714184Sgabeblack@google.com        dest.remove(in_msg.Requestor);
93814184Sgabeblack@google.com        tbe.NumPendingAcks := dest.count();
93914184Sgabeblack@google.com        if (dest.count()>0){
94014184Sgabeblack@google.com        enqueue(probeToCore_out, TDProbeRequestMsg, response_latency) {
94114184Sgabeblack@google.com        out_msg.addr := address;
94214184Sgabeblack@google.com        out_msg.Type := ProbeRequestType:PrbInv;
94314184Sgabeblack@google.com        out_msg.ReturnData := true;
94414184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
94514184Sgabeblack@google.com
94614184Sgabeblack@google.com        out_msg.Destination.addNetDest(dest);
94714184Sgabeblack@google.com        if(cache_entry.CacheState == State:M) {
94814184Sgabeblack@google.com		assert(tbe.NumPendingAcks == 1);
94914184Sgabeblack@google.com        }
95014184Sgabeblack@google.com
95114184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", (out_msg));
95214184Sgabeblack@google.com       }
95314184Sgabeblack@google.com      }
95414184Sgabeblack@google.com    }
95514184Sgabeblack@google.com  }
95614184Sgabeblack@google.com
95714184Sgabeblack@google.com  action(ld2_probeInvL2Data, "ld2", desc="local probe inv L2, return data") {
95814184Sgabeblack@google.com    MachineID tcc := mapAddressToRange(address,MachineType:TCC,
95914184Sgabeblack@google.com                                       TCC_select_low_bit, TCC_select_num_bits);
96014184Sgabeblack@google.com    if ((cache_entry.Sharers.isElement(tcc)) || (cache_entry.Owner.isElement(tcc))) {
96114184Sgabeblack@google.com      enqueue(w_probeTCC_out, TDProbeRequestMsg, 1) {
96214184Sgabeblack@google.com          out_msg.addr := address;
96314184Sgabeblack@google.com          out_msg.Type := ProbeRequestType:PrbInv;
96414184Sgabeblack@google.com          out_msg.ReturnData := true;
96514184Sgabeblack@google.com          out_msg.MessageSize := MessageSizeType:Control;
96614184Sgabeblack@google.com          out_msg.Destination.add(tcc);
96714184Sgabeblack@google.com          tbe.NumPendingAcks := tbe.NumPendingAcks + 1;
96814184Sgabeblack@google.com          DPRINTF(RubySlicc, "%s\n", out_msg);
96914184Sgabeblack@google.com
97014184Sgabeblack@google.com      }
97114184Sgabeblack@google.com    }
97214184Sgabeblack@google.com  }
97314184Sgabeblack@google.com
97414184Sgabeblack@google.com  action(dc_probeInvCoreData, "dc", desc="probe  inv cores + TCC, return data") {
97514184Sgabeblack@google.com    MachineID tcc := mapAddressToRange(address,MachineType:TCC,
97614184Sgabeblack@google.com                                       TCC_select_low_bit, TCC_select_num_bits);
97714184Sgabeblack@google.com    enqueue(probeToCore_out, TDProbeRequestMsg, response_latency) {
97814184Sgabeblack@google.com      out_msg.addr := address;
97914184Sgabeblack@google.com      out_msg.Type := ProbeRequestType:PrbInv;
98014184Sgabeblack@google.com      out_msg.ReturnData := true;
98114184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Control;
98214184Sgabeblack@google.com
98314184Sgabeblack@google.com      out_msg.Destination.addNetDest(cache_entry.Sharers);
98414184Sgabeblack@google.com      out_msg.Destination.addNetDest(cache_entry.Owner);
98514184Sgabeblack@google.com      tbe.NumPendingAcks := cache_entry.Sharers.count() + cache_entry.Owner.count();
98614184Sgabeblack@google.com      if(cache_entry.CacheState == State:M) {
98714184Sgabeblack@google.com	  assert(tbe.NumPendingAcks == 1);
98814184Sgabeblack@google.com      }
98914184Sgabeblack@google.com      if (out_msg.Destination.isElement(tcc)) {
99014184Sgabeblack@google.com          out_msg.Destination.remove(tcc);
99114184Sgabeblack@google.com          tbe.NumPendingAcks := tbe.NumPendingAcks - 1;
99214184Sgabeblack@google.com      }
99314184Sgabeblack@google.com
99414184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", (out_msg));
99514184Sgabeblack@google.com    }
99614184Sgabeblack@google.com  }
99714184Sgabeblack@google.com
99814184Sgabeblack@google.com  action(d2_probeInvL2Data, "d2", desc="probe inv L2, return data") {
99914184Sgabeblack@google.com    MachineID tcc := mapAddressToRange(address,MachineType:TCC,
100014184Sgabeblack@google.com                                       TCC_select_low_bit, TCC_select_num_bits);
100114184Sgabeblack@google.com    if ((cache_entry.Sharers.isElement(tcc)) || (cache_entry.Owner.isElement(tcc))) {
100214184Sgabeblack@google.com      enqueue(w_probeTCC_out, TDProbeRequestMsg, 1) {
100314184Sgabeblack@google.com          out_msg.addr := address;
100414184Sgabeblack@google.com          out_msg.Type := ProbeRequestType:PrbInv;
100514184Sgabeblack@google.com          out_msg.ReturnData := true;
100614184Sgabeblack@google.com          out_msg.MessageSize := MessageSizeType:Control;
100714184Sgabeblack@google.com          out_msg.Destination.add(tcc);
100814184Sgabeblack@google.com          tbe.NumPendingAcks := tbe.NumPendingAcks + 1;
100914184Sgabeblack@google.com          DPRINTF(RubySlicc, "%s\n", out_msg);
101014184Sgabeblack@google.com
101114184Sgabeblack@google.com      }
101214184Sgabeblack@google.com    }
101314184Sgabeblack@google.com  }
101414184Sgabeblack@google.com
101514184Sgabeblack@google.com  action(lpc_probeInvCore, "lpc", desc="local probe inv cores, no data") {
101614184Sgabeblack@google.com    peek(coreRequestNetwork_in, CPURequestMsg) {
101714184Sgabeblack@google.com      TCC_dir_subtree.broadcast(MachineType:TCP);
101814184Sgabeblack@google.com      TCC_dir_subtree.broadcast(MachineType:SQC);
101914184Sgabeblack@google.com
102014184Sgabeblack@google.com      temp := cache_entry.Sharers;
102114184Sgabeblack@google.com      temp := temp.OR(cache_entry.Owner);
102214184Sgabeblack@google.com      TCC_dir_subtree := TCC_dir_subtree.AND(temp);
102314184Sgabeblack@google.com      tbe.NumPendingAcks := TCC_dir_subtree.count();
102414184Sgabeblack@google.com      if(cache_entry.CacheState == State:M) {
102514184Sgabeblack@google.com	   assert(tbe.NumPendingAcks == 1);
102614184Sgabeblack@google.com      }
102714184Sgabeblack@google.com      if(TCC_dir_subtree.isElement(in_msg.Requestor)) {
102814184Sgabeblack@google.com         TCC_dir_subtree.remove(in_msg.Requestor);
102914184Sgabeblack@google.com         tbe.NumPendingAcks := tbe.NumPendingAcks - 1;
103014184Sgabeblack@google.com      }
103114184Sgabeblack@google.com
103214184Sgabeblack@google.com      if(TCC_dir_subtree.count() > 0) {
103314184Sgabeblack@google.com         enqueue(probeToCore_out, TDProbeRequestMsg, response_latency) {
103414184Sgabeblack@google.com           out_msg.addr := address;
103514184Sgabeblack@google.com           out_msg.Type := ProbeRequestType:PrbInv;
103614184Sgabeblack@google.com           out_msg.ReturnData := false;
103714184Sgabeblack@google.com           out_msg.MessageSize := MessageSizeType:Control;
103814184Sgabeblack@google.com           out_msg.localCtoD := true;
103914184Sgabeblack@google.com
104014184Sgabeblack@google.com           out_msg.Destination.addNetDest(TCC_dir_subtree);
104114184Sgabeblack@google.com
104214184Sgabeblack@google.com           DPRINTF(RubySlicc, "%s\n", (out_msg));
104314184Sgabeblack@google.com         }
104414184Sgabeblack@google.com       }
104514184Sgabeblack@google.com    }
104614184Sgabeblack@google.com  }
104714184Sgabeblack@google.com
104814184Sgabeblack@google.com  action(ipc_probeInvCore, "ipc", desc="probe inv cores, no data") {
104914184Sgabeblack@google.com    TCC_dir_subtree.broadcast(MachineType:TCP);
105014184Sgabeblack@google.com    TCC_dir_subtree.broadcast(MachineType:SQC);
105114184Sgabeblack@google.com
105214184Sgabeblack@google.com    temp := cache_entry.Sharers;
105314184Sgabeblack@google.com    temp := temp.OR(cache_entry.Owner);
105414184Sgabeblack@google.com    TCC_dir_subtree := TCC_dir_subtree.AND(temp);
105514184Sgabeblack@google.com    tbe.NumPendingAcks := TCC_dir_subtree.count();
105614184Sgabeblack@google.com    if(TCC_dir_subtree.count() > 0) {
105714184Sgabeblack@google.com
105814184Sgabeblack@google.com      enqueue(probeToCore_out, TDProbeRequestMsg, response_latency) {
105914184Sgabeblack@google.com        out_msg.addr := address;
106014184Sgabeblack@google.com        out_msg.Type := ProbeRequestType:PrbInv;
106114184Sgabeblack@google.com        out_msg.ReturnData := false;
106214184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
106314184Sgabeblack@google.com
106414184Sgabeblack@google.com        out_msg.Destination.addNetDest(TCC_dir_subtree);
106514184Sgabeblack@google.com        if(cache_entry.CacheState == State:M) {
106614184Sgabeblack@google.com          assert(tbe.NumPendingAcks == 1);
106714184Sgabeblack@google.com        }
106814184Sgabeblack@google.com
106914184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", (out_msg));
107014184Sgabeblack@google.com      }
107114184Sgabeblack@google.com    }
107214184Sgabeblack@google.com  }
107314184Sgabeblack@google.com
107414184Sgabeblack@google.com  action(i2_probeInvL2, "i2", desc="probe inv L2, no data") {
107514184Sgabeblack@google.com    MachineID tcc := mapAddressToRange(address,MachineType:TCC,
107614184Sgabeblack@google.com                                       TCC_select_low_bit, TCC_select_num_bits);
107714184Sgabeblack@google.com    if ((cache_entry.Sharers.isElement(tcc)) || (cache_entry.Owner.isElement(tcc))) {
107814184Sgabeblack@google.com      enqueue(w_probeTCC_out, TDProbeRequestMsg, 1) {
107914184Sgabeblack@google.com          tbe.NumPendingAcks := tbe.NumPendingAcks + 1;
108014184Sgabeblack@google.com          out_msg.addr := address;
108114184Sgabeblack@google.com          out_msg.Type := ProbeRequestType:PrbInv;
108214184Sgabeblack@google.com          out_msg.ReturnData := false;
108314184Sgabeblack@google.com          out_msg.MessageSize := MessageSizeType:Control;
108414184Sgabeblack@google.com          out_msg.Destination.add(tcc);
108514184Sgabeblack@google.com          DPRINTF(RubySlicc, "%s\n", out_msg);
108614184Sgabeblack@google.com
108714184Sgabeblack@google.com      }
108814184Sgabeblack@google.com    }
108914184Sgabeblack@google.com  }
109014184Sgabeblack@google.com
109114184Sgabeblack@google.com  action(pi_sendProbeResponseInv, "pi", desc="send probe ack inv, no data") {
109214184Sgabeblack@google.com    enqueue(responseToNB_out, ResponseMsg, issue_latency) {
109314184Sgabeblack@google.com      out_msg.addr := address;
109414184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:CPUPrbResp;  // TCC, L3  respond in same way to probes
109514184Sgabeblack@google.com      out_msg.Sender := machineID;
109614184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
109714184Sgabeblack@google.com      out_msg.Dirty := false;
109814184Sgabeblack@google.com      out_msg.Hit := false;
109914184Sgabeblack@google.com      out_msg.Ntsl := true;
110014184Sgabeblack@google.com      out_msg.State := CoherenceState:NA;
110114184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Control;
110214184Sgabeblack@google.com    }
110314184Sgabeblack@google.com  }
110414184Sgabeblack@google.com
110514184Sgabeblack@google.com  action(pim_sendProbeResponseInvMs, "pim", desc="send probe ack inv, no data") {
110614184Sgabeblack@google.com    enqueue(responseToNB_out, ResponseMsg, issue_latency) {
110714184Sgabeblack@google.com      out_msg.addr := address;
110814184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:CPUPrbResp;  // L3 and TCC respond in same way to probes
110914184Sgabeblack@google.com      out_msg.Sender := machineID;
111014184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
111114184Sgabeblack@google.com      out_msg.Dirty := false;
111214184Sgabeblack@google.com      out_msg.Ntsl := true;
111314184Sgabeblack@google.com      out_msg.Hit := false;
111414184Sgabeblack@google.com      out_msg.State := CoherenceState:NA;
111514184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Control;
111614184Sgabeblack@google.com    }
111714184Sgabeblack@google.com  }
111814184Sgabeblack@google.com
111914184Sgabeblack@google.com  action(prm_sendProbeResponseMiss, "prm", desc="send probe ack PrbShrData, no data") {
112014184Sgabeblack@google.com    enqueue(responseToNB_out, ResponseMsg, issue_latency) {
112114184Sgabeblack@google.com      out_msg.addr := address;
112214184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:CPUPrbResp;  // L3 and TCC respond in same way to probes
112314184Sgabeblack@google.com      out_msg.Sender := machineID;
112414184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
112514184Sgabeblack@google.com      out_msg.Dirty := false;  // only true if sending back data i think
112614184Sgabeblack@google.com      out_msg.Hit := false;
112714184Sgabeblack@google.com      out_msg.Ntsl := false;
112814184Sgabeblack@google.com      out_msg.State := CoherenceState:NA;
112914184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Control;
113014184Sgabeblack@google.com    }
113114184Sgabeblack@google.com  }
113214184Sgabeblack@google.com
113314184Sgabeblack@google.com
113414184Sgabeblack@google.com
113514184Sgabeblack@google.com  action(pd_sendProbeResponseData, "pd", desc="send probe ack, with data") {
113614184Sgabeblack@google.com    enqueue(responseToNB_out, ResponseMsg, issue_latency) {
113714184Sgabeblack@google.com      assert(is_valid(cache_entry) || is_valid(tbe));
113814184Sgabeblack@google.com      out_msg.addr := address;
113914184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:CPUPrbResp;
114014184Sgabeblack@google.com      out_msg.Sender := machineID;
114114184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
114214184Sgabeblack@google.com      out_msg.DataBlk := getDataBlock(address);
114314184Sgabeblack@google.com      if (is_valid(tbe)) {
114414184Sgabeblack@google.com        out_msg.Dirty := tbe.Dirty;
114514184Sgabeblack@google.com      }
114614184Sgabeblack@google.com      out_msg.Hit := true;
114714184Sgabeblack@google.com      out_msg.State := CoherenceState:NA;
114814184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
114914184Sgabeblack@google.com    }
115014184Sgabeblack@google.com  }
115114184Sgabeblack@google.com
115214184Sgabeblack@google.com
115314184Sgabeblack@google.com  action(pdm_sendProbeResponseDataMs, "pdm", desc="send probe ack, with data") {
115414184Sgabeblack@google.com    enqueue(responseToNB_out, ResponseMsg, issue_latency) {
115514184Sgabeblack@google.com      assert(is_valid(cache_entry) || is_valid(tbe));
115614184Sgabeblack@google.com      assert(is_valid(cache_entry));
115714184Sgabeblack@google.com      out_msg.addr := address;
115814184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:CPUPrbResp;
115914184Sgabeblack@google.com      out_msg.Sender := machineID;
116014184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
116114184Sgabeblack@google.com      out_msg.DataBlk := getDataBlock(address);
116214184Sgabeblack@google.com      if (is_valid(tbe)) {
116314184Sgabeblack@google.com        out_msg.Dirty := tbe.Dirty;
116414184Sgabeblack@google.com      }
116514184Sgabeblack@google.com      out_msg.Hit := true;
116614184Sgabeblack@google.com      out_msg.State := CoherenceState:NA;
116714184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
116814184Sgabeblack@google.com    }
116914184Sgabeblack@google.com  }
117014184Sgabeblack@google.com
117114184Sgabeblack@google.com  action(mc_cancelWB, "mc", desc="send writeback cancel to NB directory") {
117214184Sgabeblack@google.com    enqueue(requestToNB_out, CPURequestMsg, issue_latency) {
117314184Sgabeblack@google.com      out_msg.addr := address;
117414184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:WrCancel;
117514184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
117614184Sgabeblack@google.com      out_msg.Requestor := machineID;
117714184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Request_Control;
117814184Sgabeblack@google.com    }
117914184Sgabeblack@google.com  }
118014184Sgabeblack@google.com
118114184Sgabeblack@google.com action(sCS_sendCollectiveResponseS, "sCS", desc="send shared response to all merged TCP/SQC") {
118214184Sgabeblack@google.com      enqueue(responseToCore_out, ResponseMsg, 1) {
118314184Sgabeblack@google.com        out_msg.addr := address;
118414184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:TDSysResp;
118514184Sgabeblack@google.com        out_msg.Sender := tbe.Sender;
118614184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
118714184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
118814184Sgabeblack@google.com        out_msg.CtoD := false;
118914184Sgabeblack@google.com        out_msg.State := CoherenceState:Shared;
119014184Sgabeblack@google.com        out_msg.Destination.addNetDest(cache_entry.MergedSharers);
119114184Sgabeblack@google.com        out_msg.Shared := tbe.Shared;
119214184Sgabeblack@google.com        out_msg.Dirty := tbe.Dirty;
119314184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
119414184Sgabeblack@google.com      }
119514184Sgabeblack@google.com  }
119614184Sgabeblack@google.com
119714184Sgabeblack@google.com action(sS_sendResponseS, "sS", desc="send shared response to TCP/SQC") {
119814184Sgabeblack@google.com      enqueue(responseToCore_out, ResponseMsg, 1) {
119914184Sgabeblack@google.com        out_msg.addr := address;
120014184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:TDSysResp;
120114184Sgabeblack@google.com        out_msg.Sender := tbe.Sender;
120214184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
120314184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
120414184Sgabeblack@google.com        out_msg.CtoD := false;
120514184Sgabeblack@google.com        out_msg.State := CoherenceState:Shared;
120614184Sgabeblack@google.com        out_msg.Destination.add(tbe.OriginalRequestor);
120714184Sgabeblack@google.com        out_msg.Shared := tbe.Shared;
120814184Sgabeblack@google.com        out_msg.Dirty := tbe.Dirty;
120914184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
121014184Sgabeblack@google.com      }
121114184Sgabeblack@google.com  }
121214184Sgabeblack@google.com
121314184Sgabeblack@google.com action(sM_sendResponseM, "sM", desc="send response to TCP/SQC") {
121414184Sgabeblack@google.com      enqueue(responseToCore_out, ResponseMsg, 1) {
121514184Sgabeblack@google.com        out_msg.addr := address;
121614184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:TDSysResp;
121714184Sgabeblack@google.com        out_msg.Sender := tbe.Sender;
121814184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
121914184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
122014184Sgabeblack@google.com        out_msg.CtoD := false;
122114184Sgabeblack@google.com        out_msg.State := CoherenceState:Modified;
122214184Sgabeblack@google.com        out_msg.Destination.add(tbe.OriginalRequestor);
122314184Sgabeblack@google.com        out_msg.Shared := tbe.Shared;
122414184Sgabeblack@google.com        out_msg.Dirty := tbe.Dirty;
122514184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
122614184Sgabeblack@google.com      }
122714184Sgabeblack@google.com  }
122814184Sgabeblack@google.com
122914184Sgabeblack@google.com
123014184Sgabeblack@google.com
123114184Sgabeblack@google.com action(fw2_forwardWBAck, "fw2", desc="forward WBAck to TCC") {
123214184Sgabeblack@google.com    peek(responseFromNB_in, ResponseMsg) {
123314184Sgabeblack@google.com      if(tbe.OriginalRequestor != machineID) {
123414184Sgabeblack@google.com        enqueue(w_respTCC_out, ResponseMsg, 1) {
123514184Sgabeblack@google.com          out_msg.addr := address;
123614184Sgabeblack@google.com          out_msg.Type := CoherenceResponseType:TDSysWBAck;
123714184Sgabeblack@google.com          out_msg.Sender := machineID;
123814184Sgabeblack@google.com          //out_msg.DataBlk := tbe.DataBlk;
123914184Sgabeblack@google.com          out_msg.Destination.add(tbe.OriginalRequestor);
124014184Sgabeblack@google.com          out_msg.MessageSize := in_msg.MessageSize;
124114184Sgabeblack@google.com        }
124214184Sgabeblack@google.com      }
124314184Sgabeblack@google.com    }
124414184Sgabeblack@google.com  }
124514184Sgabeblack@google.com
124614184Sgabeblack@google.com action(sa_saveSysAck, "sa", desc="Save SysAck ") {
124714184Sgabeblack@google.com    peek(responseFromNB_in, ResponseMsg) {
124814184Sgabeblack@google.com        tbe.Dirty := in_msg.Dirty;
124914184Sgabeblack@google.com        if (tbe.Dirty == false) {
125014184Sgabeblack@google.com           tbe.DataBlk := in_msg.DataBlk;
125114184Sgabeblack@google.com        }
125214184Sgabeblack@google.com        else {
125314184Sgabeblack@google.com           tbe.DataBlk := tbe.DataBlk;
125414184Sgabeblack@google.com        }
125514184Sgabeblack@google.com        tbe.CtoD := in_msg.CtoD;
125614184Sgabeblack@google.com        tbe.CohState := in_msg.State;
125714184Sgabeblack@google.com        tbe.Shared := in_msg.Shared;
125814184Sgabeblack@google.com        tbe.MessageSize := in_msg.MessageSize;
125914184Sgabeblack@google.com    }
126014184Sgabeblack@google.com  }
126114184Sgabeblack@google.com
126214184Sgabeblack@google.com action(fsa_forwardSavedAck, "fsa", desc="forward saved SysAck to TCP or SQC") {
126314184Sgabeblack@google.com      enqueue(responseToCore_out, ResponseMsg, 1) {
126414184Sgabeblack@google.com        out_msg.addr := address;
126514184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:TDSysResp;
126614184Sgabeblack@google.com        out_msg.Sender := machineID;
126714184Sgabeblack@google.com        if (tbe.Dirty == false) {
126814184Sgabeblack@google.com           out_msg.DataBlk := tbe.DataBlk;
126914184Sgabeblack@google.com        }
127014184Sgabeblack@google.com        else {
127114184Sgabeblack@google.com           out_msg.DataBlk := tbe.DataBlk;
127214184Sgabeblack@google.com        }
127314184Sgabeblack@google.com        out_msg.CtoD := tbe.CtoD;
127414184Sgabeblack@google.com        out_msg.State := tbe.CohState;
127514184Sgabeblack@google.com        out_msg.Destination.add(tbe.OriginalRequestor);
127614184Sgabeblack@google.com        out_msg.Shared := tbe.Shared;
127714184Sgabeblack@google.com        out_msg.MessageSize := tbe.MessageSize;
127814184Sgabeblack@google.com        out_msg.Dirty := tbe.Dirty;
127914184Sgabeblack@google.com        out_msg.Sender := tbe.Sender;
128014184Sgabeblack@google.com      }
128114184Sgabeblack@google.com  }
128214184Sgabeblack@google.com
128314184Sgabeblack@google.com action(fa_forwardSysAck, "fa", desc="forward SysAck to TCP or SQC") {
128414184Sgabeblack@google.com    peek(responseFromNB_in, ResponseMsg) {
128514184Sgabeblack@google.com      enqueue(responseToCore_out, ResponseMsg, 1) {
128614184Sgabeblack@google.com        out_msg.addr := address;
128714184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:TDSysResp;
128814184Sgabeblack@google.com        out_msg.Sender := machineID;
128914184Sgabeblack@google.com        if (tbe.Dirty == false) {
129014184Sgabeblack@google.com           out_msg.DataBlk := in_msg.DataBlk;
129114184Sgabeblack@google.com           tbe.Sender := machineID;
129214184Sgabeblack@google.com        }
129314184Sgabeblack@google.com        else {
129414184Sgabeblack@google.com           out_msg.DataBlk := tbe.DataBlk;
129514184Sgabeblack@google.com        }
129614184Sgabeblack@google.com        out_msg.CtoD := in_msg.CtoD;
129714184Sgabeblack@google.com        out_msg.State := in_msg.State;
129814184Sgabeblack@google.com        out_msg.Destination.add(tbe.OriginalRequestor);
129914184Sgabeblack@google.com        out_msg.Shared := in_msg.Shared;
130014184Sgabeblack@google.com        out_msg.MessageSize := in_msg.MessageSize;
130114184Sgabeblack@google.com        out_msg.Dirty := in_msg.Dirty;
130214184Sgabeblack@google.com        out_msg.Sender := tbe.Sender;
130314184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", (out_msg.DataBlk));
130414184Sgabeblack@google.com      }
130514184Sgabeblack@google.com    }
130614184Sgabeblack@google.com  }
130714184Sgabeblack@google.com
130814184Sgabeblack@google.com action(pso_probeSharedDataOwner, "pso", desc="probe shared data at owner") {
130914184Sgabeblack@google.com    MachineID tcc := mapAddressToRange(address,MachineType:TCC,
131014184Sgabeblack@google.com                                       TCC_select_low_bit, TCC_select_num_bits);
131114184Sgabeblack@google.com    if (cache_entry.Owner.isElement(tcc)) {
131214184Sgabeblack@google.com      enqueue(w_probeTCC_out, TDProbeRequestMsg, 1) {
131314184Sgabeblack@google.com        out_msg.addr := address;
131414184Sgabeblack@google.com        out_msg.Type := ProbeRequestType:PrbDowngrade;
131514184Sgabeblack@google.com        out_msg.ReturnData := true;
131614184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
131714184Sgabeblack@google.com        out_msg.Destination.add(tcc);
131814184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
131914184Sgabeblack@google.com      }
132014184Sgabeblack@google.com    }
132114184Sgabeblack@google.com    else { // i.e., owner is a core
132214184Sgabeblack@google.com      enqueue(probeToCore_out, TDProbeRequestMsg, response_latency) {
132314184Sgabeblack@google.com        out_msg.addr := address;
132414184Sgabeblack@google.com        out_msg.Type := ProbeRequestType:PrbDowngrade;
132514184Sgabeblack@google.com        out_msg.ReturnData := true;
132614184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
132714184Sgabeblack@google.com        out_msg.Destination.addNetDest(cache_entry.Owner);
132814184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
132914184Sgabeblack@google.com      }
133014184Sgabeblack@google.com    }
133114184Sgabeblack@google.com    tbe.NumPendingAcks := 1;
133214184Sgabeblack@google.com  }
133314184Sgabeblack@google.com
133414184Sgabeblack@google.com  action(i_popIncomingRequestQueue, "i", desc="Pop incoming request queue") {
133514184Sgabeblack@google.com    coreRequestNetwork_in.dequeue(clockEdge());
133614184Sgabeblack@google.com  }
133714184Sgabeblack@google.com
133814184Sgabeblack@google.com  action(j_popIncomingUnblockQueue, "j", desc="Pop incoming unblock queue") {
133914184Sgabeblack@google.com    unblockNetwork_in.dequeue(clockEdge());
134014184Sgabeblack@google.com  }
134114184Sgabeblack@google.com
134214184Sgabeblack@google.com  action(pk_popResponseQueue, "pk", desc="Pop response queue") {
134314184Sgabeblack@google.com    responseNetwork_in.dequeue(clockEdge());
134414184Sgabeblack@google.com  }
134514184Sgabeblack@google.com
134614184Sgabeblack@google.com  action(pp_popProbeQueue, "pp", desc="Pop incoming probe queue") {
134714184Sgabeblack@google.com    probeNetwork_in.dequeue(clockEdge());
134814184Sgabeblack@google.com  }
134914184Sgabeblack@google.com
135014184Sgabeblack@google.com  action(pR_popResponseFromNBQueue, "pR", desc="Pop incoming Response queue From NB") {
135114184Sgabeblack@google.com    responseFromNB_in.dequeue(clockEdge());
135214184Sgabeblack@google.com  }
135314184Sgabeblack@google.com
135414184Sgabeblack@google.com  action(pt_popTriggerQueue, "pt", desc="pop trigger queue") {
135514184Sgabeblack@google.com    triggerQueue_in.dequeue(clockEdge());
135614184Sgabeblack@google.com  }
135714184Sgabeblack@google.com
135814184Sgabeblack@google.com  action(pl_popTCCRequestQueue, "pl", desc="pop TCC request queue") {
135914184Sgabeblack@google.com    w_TCCRequest_in.dequeue(clockEdge());
136014184Sgabeblack@google.com  }
136114184Sgabeblack@google.com
136214184Sgabeblack@google.com  action(plr_popTCCResponseQueue, "plr", desc="pop TCC response queue") {
136314184Sgabeblack@google.com    w_TCCResponse_in.dequeue(clockEdge());
136414184Sgabeblack@google.com  }
136514184Sgabeblack@google.com
136614184Sgabeblack@google.com  action(plu_popTCCUnblockQueue, "plu", desc="pop TCC unblock queue") {
136714184Sgabeblack@google.com    w_TCCUnblock_in.dequeue(clockEdge());
136814184Sgabeblack@google.com  }
136914184Sgabeblack@google.com
137014184Sgabeblack@google.com
137114184Sgabeblack@google.com  action(m_addUnlockerToSharers, "m", desc="Add the unlocker to the sharer list") {
137214184Sgabeblack@google.com    peek(unblockNetwork_in, UnblockMsg) {
137314184Sgabeblack@google.com      cache_entry.Sharers.add(in_msg.Sender);
137414184Sgabeblack@google.com      cache_entry.MergedSharers.remove(in_msg.Sender);
137514184Sgabeblack@google.com      assert(cache_entry.WaitingUnblocks >= 0);
137614184Sgabeblack@google.com      cache_entry.WaitingUnblocks := cache_entry.WaitingUnblocks - 1;
137714184Sgabeblack@google.com    }
137814184Sgabeblack@google.com  }
137914184Sgabeblack@google.com
138014184Sgabeblack@google.com  action(q_addOutstandingMergedSharer, "q", desc="Increment outstanding requests") {
138114184Sgabeblack@google.com    peek(coreRequestNetwork_in, CPURequestMsg) {
138214184Sgabeblack@google.com      cache_entry.MergedSharers.add(in_msg.Requestor);
138314184Sgabeblack@google.com      cache_entry.WaitingUnblocks := cache_entry.WaitingUnblocks + 1;
138414184Sgabeblack@google.com    }
138514184Sgabeblack@google.com  }
138614184Sgabeblack@google.com
138714184Sgabeblack@google.com  action(uu_sendUnblock, "uu", desc="state changed, unblock") {
138814184Sgabeblack@google.com    enqueue(unblockToNB_out, UnblockMsg, issue_latency) {
138914184Sgabeblack@google.com      out_msg.addr := address;
139014184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
139114184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Unblock_Control;
139214184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", out_msg);
139314184Sgabeblack@google.com    }
139414184Sgabeblack@google.com  }
139514184Sgabeblack@google.com
139614184Sgabeblack@google.com  action(zz_recycleRequest, "\z", desc="Recycle the request queue") {
139714184Sgabeblack@google.com    coreRequestNetwork_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
139814184Sgabeblack@google.com  }
139914184Sgabeblack@google.com
140014184Sgabeblack@google.com  action(yy_recycleTCCRequestQueue, "yy", desc="recycle yy request queue") {
140114184Sgabeblack@google.com    w_TCCRequest_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
140214184Sgabeblack@google.com  }
140314184Sgabeblack@google.com
140414184Sgabeblack@google.com  action(xz_recycleResponseQueue, "xz", desc="recycle response queue") {
140514184Sgabeblack@google.com    responseNetwork_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
140614184Sgabeblack@google.com  }
140714184Sgabeblack@google.com
140814184Sgabeblack@google.com  action(xx_recycleTCCResponseQueue, "xx", desc="recycle TCC response queue") {
140914184Sgabeblack@google.com    w_TCCResponse_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
141014184Sgabeblack@google.com  }
141114184Sgabeblack@google.com
141214184Sgabeblack@google.com  action(vv_recycleTCCUnblockQueue, "vv", desc="Recycle the probe request queue") {
141314184Sgabeblack@google.com    w_TCCUnblock_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
141414184Sgabeblack@google.com  }
141514184Sgabeblack@google.com
141614184Sgabeblack@google.com  action(xy_recycleUnblockQueue, "xy", desc="Recycle the probe request queue") {
141714184Sgabeblack@google.com    w_TCCUnblock_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
141814184Sgabeblack@google.com  }
141914184Sgabeblack@google.com
142014184Sgabeblack@google.com  action(ww_recycleProbeRequest, "ww", desc="Recycle the probe request queue") {
142114184Sgabeblack@google.com    probeNetwork_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
142214184Sgabeblack@google.com  }
142314184Sgabeblack@google.com
142414184Sgabeblack@google.com  action(x_decrementAcks, "x", desc="decrement Acks pending") {
142514184Sgabeblack@google.com    tbe.NumPendingAcks := tbe.NumPendingAcks - 1;
142614184Sgabeblack@google.com  }
142714184Sgabeblack@google.com
142814184Sgabeblack@google.com  action(o_checkForAckCompletion, "o", desc="check for ack completion") {
142914184Sgabeblack@google.com    if (tbe.NumPendingAcks == 0) {
143014184Sgabeblack@google.com      enqueue(triggerQueue_out, TriggerMsg, 1) {
143114184Sgabeblack@google.com        out_msg.addr := address;
143214184Sgabeblack@google.com        out_msg.Type := TriggerType:AcksComplete;
143314184Sgabeblack@google.com      }
143414184Sgabeblack@google.com    }
143514184Sgabeblack@google.com    APPEND_TRANSITION_COMMENT(" tbe acks ");
143614184Sgabeblack@google.com    APPEND_TRANSITION_COMMENT(tbe.NumPendingAcks);
143714184Sgabeblack@google.com  }
143814184Sgabeblack@google.com
143914184Sgabeblack@google.com  action(tp_allocateTBE, "tp", desc="allocate TBE Entry for upward transactions") {
144014184Sgabeblack@google.com    check_allocate(TBEs);
144114184Sgabeblack@google.com    peek(probeNetwork_in, NBProbeRequestMsg) {
144214184Sgabeblack@google.com      TBEs.allocate(address);
144314184Sgabeblack@google.com      set_tbe(TBEs.lookup(address));
144414184Sgabeblack@google.com      tbe.Dirty := false;
144514184Sgabeblack@google.com      tbe.NumPendingAcks := 0;
144614184Sgabeblack@google.com      tbe.UntransferredOwnerExists := false;
144714184Sgabeblack@google.com    }
144814184Sgabeblack@google.com  }
144914184Sgabeblack@google.com
145014184Sgabeblack@google.com  action(tv_allocateTBE, "tv", desc="allocate TBE Entry for TCC transactions") {
145114184Sgabeblack@google.com      check_allocate(TBEs);
145214184Sgabeblack@google.com    peek(w_TCCRequest_in, CPURequestMsg) {
145314184Sgabeblack@google.com      TBEs.allocate(address);
145414184Sgabeblack@google.com      set_tbe(TBEs.lookup(address));
145514184Sgabeblack@google.com      tbe.DataBlk := in_msg.DataBlk; // Data only for WBs
145614184Sgabeblack@google.com      tbe.Dirty := false;
145714184Sgabeblack@google.com      tbe.OriginalRequestor := in_msg.Requestor;
145814184Sgabeblack@google.com      tbe.NumPendingAcks := 0;
145914184Sgabeblack@google.com      tbe.UntransferredOwnerExists := false;
146014184Sgabeblack@google.com    }
146114184Sgabeblack@google.com  }
146214184Sgabeblack@google.com
146314184Sgabeblack@google.com  action(t_allocateTBE, "t", desc="allocate TBE Entry") {
146414184Sgabeblack@google.com      check_allocate(TBEs);//check whether resources are full
146514184Sgabeblack@google.com    peek(coreRequestNetwork_in, CPURequestMsg) {
146614184Sgabeblack@google.com      TBEs.allocate(address);
146714184Sgabeblack@google.com      set_tbe(TBEs.lookup(address));
146814184Sgabeblack@google.com      tbe.DataBlk := cache_entry.DataBlk; // Data only for WBs
146914184Sgabeblack@google.com      tbe.Dirty := false;
147014184Sgabeblack@google.com      tbe.Upgrade := false;
147114184Sgabeblack@google.com      tbe.OriginalRequestor := in_msg.Requestor;
147214184Sgabeblack@google.com      tbe.NumPendingAcks := 0;
147314184Sgabeblack@google.com      tbe.UntransferredOwnerExists := false;
147414184Sgabeblack@google.com      tbe.Sender := machineID;
147514184Sgabeblack@google.com    }
147614184Sgabeblack@google.com  }
147714184Sgabeblack@google.com
147814184Sgabeblack@google.com  action(tr_allocateTBE, "tr", desc="allocate TBE Entry for recall") {
147914184Sgabeblack@google.com      check_allocate(TBEs);//check whether resources are full
148014184Sgabeblack@google.com      TBEs.allocate(address);
148114184Sgabeblack@google.com      set_tbe(TBEs.lookup(address));
148214184Sgabeblack@google.com      tbe.DataBlk := cache_entry.DataBlk; // Data only for WBs
148314184Sgabeblack@google.com      tbe.Dirty := false;
148414184Sgabeblack@google.com      tbe.Upgrade := false;
148514184Sgabeblack@google.com      tbe.OriginalRequestor := machineID; //Recall request, Self initiated
148614184Sgabeblack@google.com      tbe.NumPendingAcks := 0;
148714184Sgabeblack@google.com      tbe.UntransferredOwnerExists := false;
148814184Sgabeblack@google.com  }
148914184Sgabeblack@google.com
149014184Sgabeblack@google.com  action(dt_deallocateTBE, "dt", desc="Deallocate TBE entry") {
149114184Sgabeblack@google.com    TBEs.deallocate(address);
149214184Sgabeblack@google.com    unset_tbe();
149314184Sgabeblack@google.com  }
149414184Sgabeblack@google.com
149514184Sgabeblack@google.com
149614184Sgabeblack@google.com  action(d_allocateDir, "d", desc="allocate Directory Cache") {
149714184Sgabeblack@google.com    if (is_invalid(cache_entry)) {
149814184Sgabeblack@google.com      set_cache_entry(directory.allocate(address, new Entry));
149914184Sgabeblack@google.com    }
150014184Sgabeblack@google.com  }
150114184Sgabeblack@google.com
150214184Sgabeblack@google.com  action(dd_deallocateDir, "dd", desc="deallocate Directory Cache") {
150314184Sgabeblack@google.com    if (is_valid(cache_entry)) {
150414184Sgabeblack@google.com        directory.deallocate(address);
150514184Sgabeblack@google.com    }
150614184Sgabeblack@google.com    unset_cache_entry();
150714184Sgabeblack@google.com  }
150814184Sgabeblack@google.com
150914184Sgabeblack@google.com  action(ss_sendStaleNotification, "ss", desc="stale data; nothing to writeback") {
151014184Sgabeblack@google.com     enqueue(responseToNB_out, ResponseMsg, issue_latency) {
151114184Sgabeblack@google.com         out_msg.addr := address;
151214184Sgabeblack@google.com         out_msg.Type := CoherenceResponseType:StaleNotif;
151314184Sgabeblack@google.com         out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
151414184Sgabeblack@google.com         out_msg.Sender := machineID;
151514184Sgabeblack@google.com         out_msg.MessageSize := MessageSizeType:Response_Control;
151614184Sgabeblack@google.com     }
151714184Sgabeblack@google.com  }
151814184Sgabeblack@google.com
151914184Sgabeblack@google.com  action(wb_data, "wb", desc="write back data") {
152014184Sgabeblack@google.com    enqueue(responseToNB_out, ResponseMsg, issue_latency) {
152114184Sgabeblack@google.com      out_msg.addr := address;
152214184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:CPUData;
152314184Sgabeblack@google.com      out_msg.Sender := machineID;
152414184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
152514184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
152614184Sgabeblack@google.com      out_msg.Dirty := tbe.Dirty;
152714184Sgabeblack@google.com      if (tbe.Shared) {
152814184Sgabeblack@google.com        out_msg.NbReqShared := true;
152914184Sgabeblack@google.com      } else {
153014184Sgabeblack@google.com        out_msg.NbReqShared := false;
153114184Sgabeblack@google.com      }
153214184Sgabeblack@google.com      out_msg.State := CoherenceState:Shared; // faux info
153314184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Writeback_Data;
153414184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", out_msg);
153514184Sgabeblack@google.com    }
153614184Sgabeblack@google.com  }
153714184Sgabeblack@google.com
153814184Sgabeblack@google.com  action(sf_setSharedFlip, "sf", desc="hit by shared probe, status may be different") {
153914184Sgabeblack@google.com    assert(is_valid(tbe));
154014184Sgabeblack@google.com    tbe.Shared := true;
154114184Sgabeblack@google.com  }
154214184Sgabeblack@google.com
154314184Sgabeblack@google.com  action(y_writeDataToTBE, "y", desc="write Probe Data to TBE") {
154414184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
154514184Sgabeblack@google.com      if (!tbe.Dirty || in_msg.Dirty) {
154614184Sgabeblack@google.com        tbe.DataBlk := in_msg.DataBlk;
154714184Sgabeblack@google.com        tbe.Dirty := in_msg.Dirty;
154814184Sgabeblack@google.com      }
154914184Sgabeblack@google.com      if (in_msg.Hit) {
155014184Sgabeblack@google.com        tbe.Cached := true;
155114184Sgabeblack@google.com      }
155214184Sgabeblack@google.com    }
155314184Sgabeblack@google.com  }
155414184Sgabeblack@google.com
155514184Sgabeblack@google.com  action(ty_writeTCCDataToTBE, "ty", desc="write TCC Probe Data to TBE") {
155614184Sgabeblack@google.com    peek(w_TCCResponse_in, ResponseMsg) {
155714184Sgabeblack@google.com      if (!tbe.Dirty || in_msg.Dirty) {
155814184Sgabeblack@google.com        tbe.DataBlk := in_msg.DataBlk;
155914184Sgabeblack@google.com        tbe.Dirty := in_msg.Dirty;
156014184Sgabeblack@google.com      }
156114184Sgabeblack@google.com      if (in_msg.Hit) {
156214184Sgabeblack@google.com        tbe.Cached := true;
156314184Sgabeblack@google.com      }
156414184Sgabeblack@google.com    }
156514184Sgabeblack@google.com  }
156614184Sgabeblack@google.com
156714184Sgabeblack@google.com
156814184Sgabeblack@google.com  action(ut_updateTag, "ut", desc="update Tag (i.e. set MRU)") {
156914184Sgabeblack@google.com    directory.setMRU(address);
157014184Sgabeblack@google.com  }
157114184Sgabeblack@google.com
157214184Sgabeblack@google.com  // TRANSITIONS
157314184Sgabeblack@google.com
157414184Sgabeblack@google.com  // Handling TCP/SQC requests (similar to how NB dir handles TCC events with some changes to account for stateful directory).
157514184Sgabeblack@google.com
157614184Sgabeblack@google.com
157714184Sgabeblack@google.com  // transitions from base
157814184Sgabeblack@google.com  transition(I, RdBlk, I_ES){TagArrayRead} {
157914184Sgabeblack@google.com    d_allocateDir;
158014184Sgabeblack@google.com    t_allocateTBE;
158114184Sgabeblack@google.com    n_issueRdBlk;
158214184Sgabeblack@google.com    i_popIncomingRequestQueue;
158314184Sgabeblack@google.com  }
158414184Sgabeblack@google.com
158514184Sgabeblack@google.com  transition(I, RdBlkS, I_S){TagArrayRead} {
158614184Sgabeblack@google.com    d_allocateDir;
158714184Sgabeblack@google.com    t_allocateTBE;
158814184Sgabeblack@google.com    nS_issueRdBlkS;
158914184Sgabeblack@google.com    i_popIncomingRequestQueue;
159014184Sgabeblack@google.com  }
159114184Sgabeblack@google.com
159214184Sgabeblack@google.com
159314184Sgabeblack@google.com  transition(I_S, NB_AckS, BBB_S) {
159414184Sgabeblack@google.com    fa_forwardSysAck;
159514184Sgabeblack@google.com    pR_popResponseFromNBQueue;
159614184Sgabeblack@google.com  }
159714184Sgabeblack@google.com
159814184Sgabeblack@google.com  transition(I_ES, NB_AckS, BBB_S) {
159914184Sgabeblack@google.com    fa_forwardSysAck;
160014184Sgabeblack@google.com    pR_popResponseFromNBQueue;
160114184Sgabeblack@google.com  }
160214184Sgabeblack@google.com
160314184Sgabeblack@google.com transition(I_ES, NB_AckE, BBB_E) {
160414184Sgabeblack@google.com    fa_forwardSysAck;
160514184Sgabeblack@google.com    pR_popResponseFromNBQueue;
160614184Sgabeblack@google.com  }
160714184Sgabeblack@google.com
160814184Sgabeblack@google.com  transition({S_M, O_M}, {NB_AckCtoD,NB_AckM}, BBB_M) {
160914184Sgabeblack@google.com    fa_forwardSysAck;
161014184Sgabeblack@google.com    pR_popResponseFromNBQueue;
161114184Sgabeblack@google.com  }
161214184Sgabeblack@google.com
161314184Sgabeblack@google.com  transition(I_M, NB_AckM, BBB_M) {
161414184Sgabeblack@google.com    fa_forwardSysAck;
161514184Sgabeblack@google.com    pR_popResponseFromNBQueue;
161614184Sgabeblack@google.com  }
161714184Sgabeblack@google.com
161814184Sgabeblack@google.com  transition(BBB_M, CoreUnblock, M){TagArrayWrite} {
161914184Sgabeblack@google.com    c_clearOwner;
162014184Sgabeblack@google.com    cc_clearSharers;
162114184Sgabeblack@google.com    e_ownerIsUnblocker;
162214184Sgabeblack@google.com    uu_sendUnblock;
162314184Sgabeblack@google.com    dt_deallocateTBE;
162414184Sgabeblack@google.com    j_popIncomingUnblockQueue;
162514184Sgabeblack@google.com  }
162614184Sgabeblack@google.com
162714184Sgabeblack@google.com  transition(BBB_S, CoreUnblock, S){TagArrayWrite}  {
162814184Sgabeblack@google.com    as_addToSharers;
162914184Sgabeblack@google.com    uu_sendUnblock;
163014184Sgabeblack@google.com    dt_deallocateTBE;
163114184Sgabeblack@google.com    j_popIncomingUnblockQueue;
163214184Sgabeblack@google.com  }
163314184Sgabeblack@google.com
163414184Sgabeblack@google.com  transition(BBB_E, CoreUnblock, E){TagArrayWrite}  {
163514184Sgabeblack@google.com    as_addToSharers;
163614184Sgabeblack@google.com    uu_sendUnblock;
163714184Sgabeblack@google.com    dt_deallocateTBE;
163814184Sgabeblack@google.com    j_popIncomingUnblockQueue;
163914184Sgabeblack@google.com  }
164014184Sgabeblack@google.com
164114184Sgabeblack@google.com
164214184Sgabeblack@google.com  transition(I, RdBlkM, I_M){TagArrayRead}  {
164314184Sgabeblack@google.com    d_allocateDir;
164414184Sgabeblack@google.com    t_allocateTBE;
164514184Sgabeblack@google.com    nM_issueRdBlkM;
164614184Sgabeblack@google.com    i_popIncomingRequestQueue;
164714184Sgabeblack@google.com  }
164814184Sgabeblack@google.com
164914184Sgabeblack@google.com  //
165014184Sgabeblack@google.com  transition(S, {RdBlk, RdBlkS}, BBS_S){TagArrayRead} {
165114184Sgabeblack@google.com    t_allocateTBE;
165214184Sgabeblack@google.com    sc_probeShrCoreData;
165314184Sgabeblack@google.com    s2_probeShrL2Data;
165414184Sgabeblack@google.com    q_addOutstandingMergedSharer;
165514184Sgabeblack@google.com    i_popIncomingRequestQueue;
165614184Sgabeblack@google.com  }
165714184Sgabeblack@google.com  // Merging of read sharing into a single request
165814184Sgabeblack@google.com  transition(BBS_S, {RdBlk, RdBlkS}) {
165914184Sgabeblack@google.com    q_addOutstandingMergedSharer;
166014184Sgabeblack@google.com    i_popIncomingRequestQueue;
166114184Sgabeblack@google.com  }
166214184Sgabeblack@google.com  // Wait for probe acks to be complete
166314184Sgabeblack@google.com  transition(BBS_S, CPUPrbResp) {
166414184Sgabeblack@google.com    ccr_copyCoreResponseToTBE;
166514184Sgabeblack@google.com    x_decrementAcks;
166614184Sgabeblack@google.com    o_checkForAckCompletion;
166714184Sgabeblack@google.com    pk_popResponseQueue;
166814184Sgabeblack@google.com  }
166914184Sgabeblack@google.com
167014184Sgabeblack@google.com  transition(BBS_S, TCCPrbResp) {
167114184Sgabeblack@google.com    ctr_copyTCCResponseToTBE;
167214184Sgabeblack@google.com    x_decrementAcks;
167314184Sgabeblack@google.com    o_checkForAckCompletion;
167414184Sgabeblack@google.com    plr_popTCCResponseQueue;
167514184Sgabeblack@google.com  }
167614184Sgabeblack@google.com
167714184Sgabeblack@google.com  // Window for merging complete with this transition
167814184Sgabeblack@google.com  // Send responses to all outstanding
167914184Sgabeblack@google.com  transition(BBS_S, ProbeAcksComplete, BB_S) {
168014184Sgabeblack@google.com    sCS_sendCollectiveResponseS;
168114184Sgabeblack@google.com    pt_popTriggerQueue;
168214184Sgabeblack@google.com  }
168314184Sgabeblack@google.com
168414184Sgabeblack@google.com  transition(BB_S, CoreUnblock, BB_S) {
168514184Sgabeblack@google.com    m_addUnlockerToSharers;
168614184Sgabeblack@google.com    j_popIncomingUnblockQueue;
168714184Sgabeblack@google.com  }
168814184Sgabeblack@google.com
168914184Sgabeblack@google.com  transition(BB_S, LastCoreUnblock, S) {
169014184Sgabeblack@google.com    m_addUnlockerToSharers;
169114184Sgabeblack@google.com    dt_deallocateTBE;
169214184Sgabeblack@google.com    j_popIncomingUnblockQueue;
169314184Sgabeblack@google.com  }
169414184Sgabeblack@google.com
169514184Sgabeblack@google.com  transition(O, {RdBlk, RdBlkS}, BBO_O){TagArrayRead} {
169614184Sgabeblack@google.com    t_allocateTBE;
169714184Sgabeblack@google.com    pso_probeSharedDataOwner;
169814184Sgabeblack@google.com    q_addOutstandingMergedSharer;
169914184Sgabeblack@google.com    i_popIncomingRequestQueue;
170014184Sgabeblack@google.com  }
170114184Sgabeblack@google.com  // Merging of read sharing into a single request
170214184Sgabeblack@google.com  transition(BBO_O, {RdBlk, RdBlkS}) {
170314184Sgabeblack@google.com    q_addOutstandingMergedSharer;
170414184Sgabeblack@google.com    i_popIncomingRequestQueue;
170514184Sgabeblack@google.com  }
170614184Sgabeblack@google.com
170714184Sgabeblack@google.com  // Wait for probe acks to be complete
170814184Sgabeblack@google.com  transition(BBO_O, CPUPrbResp) {
170914184Sgabeblack@google.com    ccr_copyCoreResponseToTBE;
171014184Sgabeblack@google.com    x_decrementAcks;
171114184Sgabeblack@google.com    o_checkForAckCompletion;
171214184Sgabeblack@google.com    pk_popResponseQueue;
171314184Sgabeblack@google.com  }
171414184Sgabeblack@google.com
171514184Sgabeblack@google.com  transition(BBO_O, TCCPrbResp) {
171614184Sgabeblack@google.com    ctr_copyTCCResponseToTBE;
171714184Sgabeblack@google.com    x_decrementAcks;
171814184Sgabeblack@google.com    o_checkForAckCompletion;
171914184Sgabeblack@google.com    plr_popTCCResponseQueue;
172014184Sgabeblack@google.com  }
172114184Sgabeblack@google.com
172214184Sgabeblack@google.com  // Window for merging complete with this transition
172314184Sgabeblack@google.com  // Send responses to all outstanding
172414184Sgabeblack@google.com  transition(BBO_O, ProbeAcksComplete, BB_OO) {
172514184Sgabeblack@google.com    sCS_sendCollectiveResponseS;
172614184Sgabeblack@google.com    pt_popTriggerQueue;
172714184Sgabeblack@google.com  }
172814184Sgabeblack@google.com
172914184Sgabeblack@google.com  transition(BB_OO, CoreUnblock) {
173014184Sgabeblack@google.com    m_addUnlockerToSharers;
173114184Sgabeblack@google.com    j_popIncomingUnblockQueue;
173214184Sgabeblack@google.com  }
173314184Sgabeblack@google.com
173414184Sgabeblack@google.com  transition(BB_OO, LastCoreUnblock, O){TagArrayWrite} {
173514184Sgabeblack@google.com    m_addUnlockerToSharers;
173614184Sgabeblack@google.com    dt_deallocateTBE;
173714184Sgabeblack@google.com    j_popIncomingUnblockQueue;
173814184Sgabeblack@google.com  }
173914184Sgabeblack@google.com
174014184Sgabeblack@google.com  transition(S, CPUWrite, BW_S){TagArrayRead} {
174114184Sgabeblack@google.com    t_allocateTBE;
174214184Sgabeblack@google.com    rC_removeCoreFromSharers;
174314184Sgabeblack@google.com    sT_sendRequestToTCC;
174414184Sgabeblack@google.com    i_popIncomingRequestQueue;
174514184Sgabeblack@google.com  }
174614184Sgabeblack@google.com
174714184Sgabeblack@google.com  transition(E, CPUWrite, BW_E){TagArrayRead} {
174814184Sgabeblack@google.com    t_allocateTBE;
174914184Sgabeblack@google.com    rC_removeCoreFromSharers;
175014184Sgabeblack@google.com    sT_sendRequestToTCC;
175114184Sgabeblack@google.com    i_popIncomingRequestQueue;
175214184Sgabeblack@google.com  }
175314184Sgabeblack@google.com
175414184Sgabeblack@google.com  transition(O, CPUWrite, BW_O){TagArrayRead} {
175514184Sgabeblack@google.com    t_allocateTBE;
175614184Sgabeblack@google.com    rCo_removeCoreFromOwner;
175714184Sgabeblack@google.com    rC_removeCoreFromSharers;
175814184Sgabeblack@google.com    sT_sendRequestToTCC;
175914184Sgabeblack@google.com    i_popIncomingRequestQueue;
176014184Sgabeblack@google.com  }
176114184Sgabeblack@google.com
176214184Sgabeblack@google.com  transition(M, CPUWrite, BW_M){TagArrayRead} {
176314184Sgabeblack@google.com    t_allocateTBE;
176414184Sgabeblack@google.com    rCo_removeCoreFromOwner;
176514184Sgabeblack@google.com    rC_removeCoreFromSharers;
176614184Sgabeblack@google.com    sT_sendRequestToTCC;
176714184Sgabeblack@google.com    i_popIncomingRequestQueue;
176814184Sgabeblack@google.com  }
176914184Sgabeblack@google.com
177014184Sgabeblack@google.com  transition(BW_S, TCCUnblock_Sharer, S){TagArrayWrite} {
177114184Sgabeblack@google.com    aT_addTCCToSharers;
177214184Sgabeblack@google.com    dt_deallocateTBE;
177314184Sgabeblack@google.com    plu_popTCCUnblockQueue;
177414184Sgabeblack@google.com  }
177514184Sgabeblack@google.com
177614184Sgabeblack@google.com  transition(BW_S, TCCUnblock_NotValid, S){TagArrayWrite} {
177714184Sgabeblack@google.com    dt_deallocateTBE;
177814184Sgabeblack@google.com    plu_popTCCUnblockQueue;
177914184Sgabeblack@google.com  }
178014184Sgabeblack@google.com
178114184Sgabeblack@google.com  transition(BW_E, TCCUnblock, E){TagArrayWrite} {
178214184Sgabeblack@google.com    cc_clearSharers;
178314184Sgabeblack@google.com    aT_addTCCToSharers;
178414184Sgabeblack@google.com    dt_deallocateTBE;
178514184Sgabeblack@google.com    plu_popTCCUnblockQueue;
178614184Sgabeblack@google.com  }
178714184Sgabeblack@google.com
178814184Sgabeblack@google.com  transition(BW_E, TCCUnblock_NotValid, E) {
178914184Sgabeblack@google.com    dt_deallocateTBE;
179014184Sgabeblack@google.com    plu_popTCCUnblockQueue;
179114184Sgabeblack@google.com  }
179214184Sgabeblack@google.com
179314184Sgabeblack@google.com  transition(BW_M, TCCUnblock, M) {
179414184Sgabeblack@google.com    c_clearOwner;
179514184Sgabeblack@google.com    cc_clearSharers;
179614184Sgabeblack@google.com    eT_ownerIsUnblocker;
179714184Sgabeblack@google.com    dt_deallocateTBE;
179814184Sgabeblack@google.com    plu_popTCCUnblockQueue;
179914184Sgabeblack@google.com  }
180014184Sgabeblack@google.com
180114184Sgabeblack@google.com  transition(BW_M, TCCUnblock_NotValid, M) {
180214184Sgabeblack@google.com    // Note this transition should only be executed if we received a stale wb
180314184Sgabeblack@google.com    dt_deallocateTBE;
180414184Sgabeblack@google.com    plu_popTCCUnblockQueue;
180514184Sgabeblack@google.com  }
180614184Sgabeblack@google.com
180714184Sgabeblack@google.com  transition(BW_O, TCCUnblock, O) {
180814184Sgabeblack@google.com    c_clearOwner;
180914184Sgabeblack@google.com    eT_ownerIsUnblocker;
181014184Sgabeblack@google.com    dt_deallocateTBE;
181114184Sgabeblack@google.com    plu_popTCCUnblockQueue;
181214184Sgabeblack@google.com  }
181314184Sgabeblack@google.com
181414184Sgabeblack@google.com  transition(BW_O, TCCUnblock_NotValid, O) {
181514184Sgabeblack@google.com    // Note this transition should only be executed if we received a stale wb
181614184Sgabeblack@google.com    dt_deallocateTBE;
181714184Sgabeblack@google.com    plu_popTCCUnblockQueue;
181814184Sgabeblack@google.com  }
181914184Sgabeblack@google.com
182014184Sgabeblack@google.com  // We lost the owner likely do to an invalidation racing with a 'O' wb
182114184Sgabeblack@google.com  transition(BW_O, TCCUnblock_Sharer, S) {
182214184Sgabeblack@google.com    c_clearOwner;
182314184Sgabeblack@google.com    aT_addTCCToSharers;
182414184Sgabeblack@google.com    dt_deallocateTBE;
182514184Sgabeblack@google.com    plu_popTCCUnblockQueue;
182614184Sgabeblack@google.com  }
182714184Sgabeblack@google.com
182814184Sgabeblack@google.com  transition({BW_M, BW_S, BW_E, BW_O}, {PrbInv,PrbInvData,PrbShrData}) {
182914184Sgabeblack@google.com    ww_recycleProbeRequest;
183014184Sgabeblack@google.com  }
183114184Sgabeblack@google.com
183214184Sgabeblack@google.com  transition(BRWD_I, {PrbInvData, PrbInv, PrbShrData}) {
183314184Sgabeblack@google.com    ww_recycleProbeRequest;
183414184Sgabeblack@google.com  }
183514184Sgabeblack@google.com
183614184Sgabeblack@google.com  // Three step process: locally invalidate others, issue CtoD, wait for NB_AckCtoD
183714184Sgabeblack@google.com  transition(S, CtoD, BBS_UM) {TagArrayRead} {
183814184Sgabeblack@google.com    t_allocateTBE;
183914184Sgabeblack@google.com    lpc_probeInvCore;
184014184Sgabeblack@google.com    i2_probeInvL2;
184114184Sgabeblack@google.com    o_checkForAckCompletion;
184214184Sgabeblack@google.com    i_popIncomingRequestQueue;
184314184Sgabeblack@google.com  }
184414184Sgabeblack@google.com
184514184Sgabeblack@google.com  transition(BBS_UM, CPUPrbResp, BBS_UM) {
184614184Sgabeblack@google.com    x_decrementAcks;
184714184Sgabeblack@google.com    o_checkForAckCompletion;
184814184Sgabeblack@google.com    pk_popResponseQueue;
184914184Sgabeblack@google.com  }
185014184Sgabeblack@google.com
185114184Sgabeblack@google.com  transition(BBS_UM, TCCPrbResp) {
185214184Sgabeblack@google.com    x_decrementAcks;
185314184Sgabeblack@google.com    o_checkForAckCompletion;
185414184Sgabeblack@google.com    plr_popTCCResponseQueue;
185514184Sgabeblack@google.com  }
185614184Sgabeblack@google.com
185714184Sgabeblack@google.com  transition(BBS_UM, ProbeAcksComplete, S_M) {
185814184Sgabeblack@google.com    rU_rememberUpgrade;
185914184Sgabeblack@google.com    nM_issueRdBlkM;
186014184Sgabeblack@google.com    pt_popTriggerQueue;
186114184Sgabeblack@google.com  }
186214184Sgabeblack@google.com
186314184Sgabeblack@google.com  // Three step process: locally invalidate others, issue CtoD, wait for NB_AckCtoD
186414184Sgabeblack@google.com  transition(O, CtoD, BBO_UM){TagArrayRead} {
186514184Sgabeblack@google.com    t_allocateTBE;
186614184Sgabeblack@google.com    lpc_probeInvCore;
186714184Sgabeblack@google.com    i2_probeInvL2;
186814184Sgabeblack@google.com    o_checkForAckCompletion;
186914184Sgabeblack@google.com    i_popIncomingRequestQueue;
187014184Sgabeblack@google.com  }
187114184Sgabeblack@google.com
187214184Sgabeblack@google.com  transition(BBO_UM, CPUPrbResp, BBO_UM) {
187314184Sgabeblack@google.com    ruo_rememberUntransferredOwner;
187414184Sgabeblack@google.com    x_decrementAcks;
187514184Sgabeblack@google.com    o_checkForAckCompletion;
187614184Sgabeblack@google.com    pk_popResponseQueue;
187714184Sgabeblack@google.com  }
187814184Sgabeblack@google.com
187914184Sgabeblack@google.com  transition(BBO_UM, TCCPrbResp) {
188014184Sgabeblack@google.com    ruoT_rememberUntransferredOwnerTCC;
188114184Sgabeblack@google.com    x_decrementAcks;
188214184Sgabeblack@google.com    o_checkForAckCompletion;
188314184Sgabeblack@google.com    plr_popTCCResponseQueue;
188414184Sgabeblack@google.com  }
188514184Sgabeblack@google.com
188614184Sgabeblack@google.com  transition(BBO_UM, ProbeAcksComplete, O_M) {
188714184Sgabeblack@google.com    rU_rememberUpgrade;
188814184Sgabeblack@google.com    nM_issueRdBlkM;
188914184Sgabeblack@google.com    pt_popTriggerQueue;
189014184Sgabeblack@google.com  }
189114184Sgabeblack@google.com
189214184Sgabeblack@google.com  transition({S,E}, RdBlkM, BBS_M){TagArrayWrite} {
189314184Sgabeblack@google.com    t_allocateTBE;
189414184Sgabeblack@google.com    ldc_probeInvCoreData;
189514184Sgabeblack@google.com    ld2_probeInvL2Data;
189614184Sgabeblack@google.com    o_checkForAckCompletion;
189714184Sgabeblack@google.com    i_popIncomingRequestQueue;
189814184Sgabeblack@google.com  }
189914184Sgabeblack@google.com
190014184Sgabeblack@google.com  transition(BBS_M, CPUPrbResp) {
190114184Sgabeblack@google.com    ccr_copyCoreResponseToTBE;
190214184Sgabeblack@google.com    rR_removeResponderFromSharers;
190314184Sgabeblack@google.com    x_decrementAcks;
190414184Sgabeblack@google.com    o_checkForAckCompletion;
190514184Sgabeblack@google.com    pk_popResponseQueue;
190614184Sgabeblack@google.com  }
190714184Sgabeblack@google.com
190814184Sgabeblack@google.com  transition(BBS_M, TCCPrbResp) {
190914184Sgabeblack@google.com    ctr_copyTCCResponseToTBE;
191014184Sgabeblack@google.com    x_decrementAcks;
191114184Sgabeblack@google.com    o_checkForAckCompletion;
191214184Sgabeblack@google.com    plr_popTCCResponseQueue;
191314184Sgabeblack@google.com  }
191414184Sgabeblack@google.com
191514184Sgabeblack@google.com  transition(BBS_M, ProbeAcksComplete, S_M) {
191614184Sgabeblack@google.com    nM_issueRdBlkM;
191714184Sgabeblack@google.com    pt_popTriggerQueue;
191814184Sgabeblack@google.com  }
191914184Sgabeblack@google.com
192014184Sgabeblack@google.com  transition(O, RdBlkM, BBO_M){TagArrayRead} {
192114184Sgabeblack@google.com    t_allocateTBE;
192214184Sgabeblack@google.com    ldc_probeInvCoreData;
192314184Sgabeblack@google.com    ld2_probeInvL2Data;
192414184Sgabeblack@google.com    o_checkForAckCompletion;
192514184Sgabeblack@google.com    i_popIncomingRequestQueue;
192614184Sgabeblack@google.com  }
192714184Sgabeblack@google.com
192814184Sgabeblack@google.com  transition(BBO_M, CPUPrbResp) {
192914184Sgabeblack@google.com    ccr_copyCoreResponseToTBE;
193014184Sgabeblack@google.com    rR_removeResponderFromSharers;
193114184Sgabeblack@google.com    x_decrementAcks;
193214184Sgabeblack@google.com    o_checkForAckCompletion;
193314184Sgabeblack@google.com    pk_popResponseQueue;
193414184Sgabeblack@google.com  }
193514184Sgabeblack@google.com
193614184Sgabeblack@google.com  transition(BBO_M, TCCPrbResp) {
193714184Sgabeblack@google.com    ctr_copyTCCResponseToTBE;
193814184Sgabeblack@google.com    x_decrementAcks;
193914184Sgabeblack@google.com    o_checkForAckCompletion;
194014184Sgabeblack@google.com    plr_popTCCResponseQueue;
194114184Sgabeblack@google.com  }
194214184Sgabeblack@google.com
194314184Sgabeblack@google.com  transition(BBO_M, ProbeAcksComplete, O_M) {
194414184Sgabeblack@google.com    nM_issueRdBlkM;
194514184Sgabeblack@google.com    pt_popTriggerQueue;
194614184Sgabeblack@google.com  }
194714184Sgabeblack@google.com
194814184Sgabeblack@google.com  //
194914184Sgabeblack@google.com  transition(M, RdBlkM, BBM_M){TagArrayRead} {
195014184Sgabeblack@google.com    t_allocateTBE;
195114184Sgabeblack@google.com    ldc_probeInvCoreData;
195214184Sgabeblack@google.com    ld2_probeInvL2Data;
195314184Sgabeblack@google.com    i_popIncomingRequestQueue;
195414184Sgabeblack@google.com  }
195514184Sgabeblack@google.com
195614184Sgabeblack@google.com  transition(BBM_M, CPUPrbResp) {
195714184Sgabeblack@google.com    ccr_copyCoreResponseToTBE;
195814184Sgabeblack@google.com    x_decrementAcks;
195914184Sgabeblack@google.com    o_checkForAckCompletion;
196014184Sgabeblack@google.com    pk_popResponseQueue;
196114184Sgabeblack@google.com  }
196214184Sgabeblack@google.com
196314184Sgabeblack@google.com  // TCP recalled block before receiving probe
196414184Sgabeblack@google.com  transition({BBM_M, BBS_M, BBO_M}, {CPUWrite,NoCPUWrite}) {
196514184Sgabeblack@google.com    zz_recycleRequest;
196614184Sgabeblack@google.com  }
196714184Sgabeblack@google.com
196814184Sgabeblack@google.com  transition(BBM_M, TCCPrbResp) {
196914184Sgabeblack@google.com    ctr_copyTCCResponseToTBE;
197014184Sgabeblack@google.com    x_decrementAcks;
197114184Sgabeblack@google.com    o_checkForAckCompletion;
197214184Sgabeblack@google.com    plr_popTCCResponseQueue;
197314184Sgabeblack@google.com  }
197414184Sgabeblack@google.com
197514184Sgabeblack@google.com  transition(BBM_M, ProbeAcksComplete, BB_M) {
197614184Sgabeblack@google.com    sM_sendResponseM;
197714184Sgabeblack@google.com    pt_popTriggerQueue;
197814184Sgabeblack@google.com  }
197914184Sgabeblack@google.com
198014184Sgabeblack@google.com  transition(BB_M, CoreUnblock, M){TagArrayWrite} {
198114184Sgabeblack@google.com    e_ownerIsUnblocker;
198214184Sgabeblack@google.com    dt_deallocateTBE;
198314184Sgabeblack@google.com    j_popIncomingUnblockQueue;
198414184Sgabeblack@google.com  }
198514184Sgabeblack@google.com
198614184Sgabeblack@google.com  transition(M, {RdBlkS, RdBlk}, BBM_O){TagArrayRead} {
198714184Sgabeblack@google.com    t_allocateTBE;
198814184Sgabeblack@google.com    sc_probeShrCoreData;
198914184Sgabeblack@google.com    s2_probeShrL2Data;
199014184Sgabeblack@google.com    i_popIncomingRequestQueue;
199114184Sgabeblack@google.com  }
199214184Sgabeblack@google.com
199314184Sgabeblack@google.com  transition(E, {RdBlkS, RdBlk}, BBM_O){TagArrayRead} {
199414184Sgabeblack@google.com    t_allocateTBE;
199514184Sgabeblack@google.com    eto_moveExSharerToOwner;
199614184Sgabeblack@google.com    sc_probeShrCoreData;
199714184Sgabeblack@google.com    s2_probeShrL2Data;
199814184Sgabeblack@google.com    i_popIncomingRequestQueue;
199914184Sgabeblack@google.com  }
200014184Sgabeblack@google.com
200114184Sgabeblack@google.com  transition(BBM_O, CPUPrbResp) {
200214184Sgabeblack@google.com    ccr_copyCoreResponseToTBE;
200314184Sgabeblack@google.com    x_decrementAcks;
200414184Sgabeblack@google.com    o_checkForAckCompletion;
200514184Sgabeblack@google.com    pk_popResponseQueue;
200614184Sgabeblack@google.com  }
200714184Sgabeblack@google.com  transition(BBM_O, TCCPrbResp) {
200814184Sgabeblack@google.com    ctr_copyTCCResponseToTBE;
200914184Sgabeblack@google.com    x_decrementAcks;
201014184Sgabeblack@google.com    o_checkForAckCompletion;
201114184Sgabeblack@google.com    plr_popTCCResponseQueue;
201214184Sgabeblack@google.com  }
201314184Sgabeblack@google.com  transition(BBM_O, ProbeAcksComplete, BB_O) {
201414184Sgabeblack@google.com    sS_sendResponseS;
201514184Sgabeblack@google.com    pt_popTriggerQueue;
201614184Sgabeblack@google.com  }
201714184Sgabeblack@google.com
201814184Sgabeblack@google.com  transition(BB_O, CoreUnblock, O){TagArrayWrite} {
201914184Sgabeblack@google.com    as_addToSharers;
202014184Sgabeblack@google.com    dt_deallocateTBE;
202114184Sgabeblack@google.com    j_popIncomingUnblockQueue;
202214184Sgabeblack@google.com  }
202314184Sgabeblack@google.com
202414184Sgabeblack@google.com  transition({BBO_O, BBM_M, BBS_S, BBM_O, BB_M, BB_O, BB_S, BBO_UM, BBS_UM, BBS_M, BBO_M, BB_OO}, {PrbInvData, PrbInv,PrbShrData}) {
202514184Sgabeblack@google.com    ww_recycleProbeRequest;
202614184Sgabeblack@google.com  }
202714184Sgabeblack@google.com
202814184Sgabeblack@google.com  transition({BBM_O, BBS_S, CP_S, CP_O, CP_SM, CP_OM, BBO_O}, {CPUWrite,NoCPUWrite}) {
202914184Sgabeblack@google.com    zz_recycleRequest;
203014184Sgabeblack@google.com  }
203114184Sgabeblack@google.com
203214184Sgabeblack@google.com  // stale CtoD raced with external invalidation
203314184Sgabeblack@google.com  transition({I, CP_I, B_I, CP_IOM, CP_ISM, CP_OSIW, BRWD_I, BRW_I, BRD_I}, CtoD) {
203414184Sgabeblack@google.com    i_popIncomingRequestQueue;
203514184Sgabeblack@google.com  }
203614184Sgabeblack@google.com
203714184Sgabeblack@google.com  // stale CtoD raced with internal RdBlkM
203814184Sgabeblack@google.com  transition({BBM_M, BBS_M, BBO_M, BBB_M, BBS_UM, BBO_UM}, CtoD) {
203914184Sgabeblack@google.com    i_popIncomingRequestQueue;
204014184Sgabeblack@google.com  }
204114184Sgabeblack@google.com
204214184Sgabeblack@google.com  transition({E, M}, CtoD) {
204314184Sgabeblack@google.com    i_popIncomingRequestQueue;
204414184Sgabeblack@google.com  }
204514184Sgabeblack@google.com
204614184Sgabeblack@google.com
204714184Sgabeblack@google.com  // TCC-directory has sent out (And potentially received acks for) probes.
204814184Sgabeblack@google.com  // TCP/SQC replacement (known to be stale subsequent) are popped off.
204914184Sgabeblack@google.com  transition({BBO_UM, BBS_UM}, {CPUWrite,NoCPUWrite}) {
205014184Sgabeblack@google.com    nC_sendNullWBAckToCore;
205114184Sgabeblack@google.com    i_popIncomingRequestQueue;
205214184Sgabeblack@google.com  }
205314184Sgabeblack@google.com
205414184Sgabeblack@google.com  transition(S_M, {NoCPUWrite, CPUWrite}) {
205514184Sgabeblack@google.com    zz_recycleRequest;
205614184Sgabeblack@google.com  }
205714184Sgabeblack@google.com
205814184Sgabeblack@google.com  transition(O_M, {NoCPUWrite, CPUWrite}) {
205914184Sgabeblack@google.com    zz_recycleRequest;
206014184Sgabeblack@google.com  }
206114184Sgabeblack@google.com
206214184Sgabeblack@google.com
206314184Sgabeblack@google.com  transition({BBM_M, BBS_M, BBO_M, BBO_UM, BBS_UM}, {VicDirty, VicClean, VicDirtyLast, NoVic}) {
206414184Sgabeblack@google.com    nT_sendNullWBAckToTCC;
206514184Sgabeblack@google.com    pl_popTCCRequestQueue;
206614184Sgabeblack@google.com  }
206714184Sgabeblack@google.com
206814184Sgabeblack@google.com  transition({CP_S, CP_O, CP_OM, CP_SM}, {VicDirty, VicClean, VicDirtyLast, CancelWB, NoVic}) {
206914184Sgabeblack@google.com    yy_recycleTCCRequestQueue;
207014184Sgabeblack@google.com  }
207114184Sgabeblack@google.com
207214184Sgabeblack@google.com  // However, when TCCdir has sent out PrbSharedData, one cannot ignore.
207314184Sgabeblack@google.com  transition({BBS_S, BBO_O, BBM_O, S_M, O_M, BBB_M, BBB_S, BBB_E}, {VicDirty, VicClean, VicDirtyLast,CancelWB}) {
207414184Sgabeblack@google.com    yy_recycleTCCRequestQueue;
207514184Sgabeblack@google.com  }
207614184Sgabeblack@google.com
207714184Sgabeblack@google.com  transition({BW_S,BW_E,BW_O, BW_M}, {VicDirty, VicClean, VicDirtyLast, NoVic}) {
207814184Sgabeblack@google.com    yy_recycleTCCRequestQueue;
207914184Sgabeblack@google.com  }
208014184Sgabeblack@google.com
208114184Sgabeblack@google.com  transition({BW_S,BW_E,BW_O, BW_M}, CancelWB) {
208214184Sgabeblack@google.com   nT_sendNullWBAckToTCC;
208314184Sgabeblack@google.com   pl_popTCCRequestQueue;
208414184Sgabeblack@google.com  }
208514184Sgabeblack@google.com
208614184Sgabeblack@google.com
208714184Sgabeblack@google.com  /// recycle if waiting for unblocks.
208814184Sgabeblack@google.com  transition({BB_M,BB_O,BB_S,BB_OO}, {VicDirty, VicClean, VicDirtyLast,NoVic,CancelWB}) {
208914184Sgabeblack@google.com    yy_recycleTCCRequestQueue;
209014184Sgabeblack@google.com  }
209114184Sgabeblack@google.com
209214184Sgabeblack@google.com  transition({BBS_S, BBO_O}, NoVic) {
209314184Sgabeblack@google.com   rT_removeTCCFromSharers;
209414184Sgabeblack@google.com   nT_sendNullWBAckToTCC;
209514184Sgabeblack@google.com   pl_popTCCRequestQueue;
209614184Sgabeblack@google.com  }
209714184Sgabeblack@google.com
209814184Sgabeblack@google.com  // stale. Pop message and send dummy ack.
209914184Sgabeblack@google.com  transition({I_S, I_ES, I_M}, {VicDirty, VicClean, VicDirtyLast, NoVic}) {
210014184Sgabeblack@google.com    nT_sendNullWBAckToTCC;
210114184Sgabeblack@google.com    pl_popTCCRequestQueue;
210214184Sgabeblack@google.com  }
210314184Sgabeblack@google.com
210414184Sgabeblack@google.com  transition(M,  VicDirtyLast, VM_I){TagArrayRead} {
210514184Sgabeblack@google.com    tv_allocateTBE;
210614184Sgabeblack@google.com    vd_victim;
210714184Sgabeblack@google.com    pl_popTCCRequestQueue;
210814184Sgabeblack@google.com  }
210914184Sgabeblack@google.com
211014184Sgabeblack@google.com  transition(E,  VicDirty, VM_I){TagArrayRead} {
211114184Sgabeblack@google.com    tv_allocateTBE;
211214184Sgabeblack@google.com    vd_victim;
211314184Sgabeblack@google.com    pl_popTCCRequestQueue;
211414184Sgabeblack@google.com  }
211514184Sgabeblack@google.com
211614184Sgabeblack@google.com  transition(O, VicDirty, VO_S){TagArrayRead} {
211714184Sgabeblack@google.com    tv_allocateTBE;
211814184Sgabeblack@google.com    vd_victim;
211914184Sgabeblack@google.com    pl_popTCCRequestQueue;
212014184Sgabeblack@google.com  }
212114184Sgabeblack@google.com
212214184Sgabeblack@google.com  transition(O, {VicDirtyLast, VicClean}, VO_I){TagArrayRead} {
212314184Sgabeblack@google.com    tv_allocateTBE;
212414184Sgabeblack@google.com    vd_victim;
212514184Sgabeblack@google.com    pl_popTCCRequestQueue;
212614184Sgabeblack@google.com  }
212714184Sgabeblack@google.com
212814184Sgabeblack@google.com  transition({E, S}, VicClean, VES_I){TagArrayRead} {
212914184Sgabeblack@google.com    tv_allocateTBE;
213014184Sgabeblack@google.com    vc_victim;
213114184Sgabeblack@google.com    pl_popTCCRequestQueue;
213214184Sgabeblack@google.com  }
213314184Sgabeblack@google.com
213414184Sgabeblack@google.com  transition({O, S}, NoVic){TagArrayRead} {
213514184Sgabeblack@google.com    rT_removeTCCFromSharers;
213614184Sgabeblack@google.com    nT_sendNullWBAckToTCC;
213714184Sgabeblack@google.com    pl_popTCCRequestQueue;
213814184Sgabeblack@google.com  }
213914184Sgabeblack@google.com
214014184Sgabeblack@google.com  transition({O,S}, NoCPUWrite){TagArrayRead} {
214114184Sgabeblack@google.com    rC_removeCoreFromSharers;
214214184Sgabeblack@google.com    nC_sendNullWBAckToCore;
214314184Sgabeblack@google.com    i_popIncomingRequestQueue;
214414184Sgabeblack@google.com  }
214514184Sgabeblack@google.com
214614184Sgabeblack@google.com  transition({M,E}, NoCPUWrite){TagArrayRead} {
214714184Sgabeblack@google.com    rC_removeCoreFromSharers;
214814184Sgabeblack@google.com    nC_sendNullWBAckToCore;
214914184Sgabeblack@google.com    i_popIncomingRequestQueue;
215014184Sgabeblack@google.com  }
215114184Sgabeblack@google.com
215214184Sgabeblack@google.com  // This can only happen if it is  race. (TCCdir sent out probes which caused this cancel in the first place.)
215314184Sgabeblack@google.com  transition({VM_I, VES_I, VO_I}, CancelWB) {
215414184Sgabeblack@google.com    pl_popTCCRequestQueue;
215514184Sgabeblack@google.com  }
215614184Sgabeblack@google.com
215714184Sgabeblack@google.com  transition({VM_I, VES_I, VO_I}, NB_AckWB, I){TagArrayWrite} {
215814184Sgabeblack@google.com    c_clearOwner;
215914184Sgabeblack@google.com    cc_clearSharers;
216014184Sgabeblack@google.com    wb_data;
216114184Sgabeblack@google.com    fw2_forwardWBAck;
216214184Sgabeblack@google.com    dt_deallocateTBE;
216314184Sgabeblack@google.com    dd_deallocateDir;
216414184Sgabeblack@google.com    pR_popResponseFromNBQueue;
216514184Sgabeblack@google.com  }
216614184Sgabeblack@google.com
216714184Sgabeblack@google.com  transition(VO_S, NB_AckWB, S){TagArrayWrite}  {
216814184Sgabeblack@google.com    c_clearOwner;
216914184Sgabeblack@google.com    wb_data;
217014184Sgabeblack@google.com    fw2_forwardWBAck;
217114184Sgabeblack@google.com    dt_deallocateTBE;
217214184Sgabeblack@google.com    pR_popResponseFromNBQueue;
217314184Sgabeblack@google.com  }
217414184Sgabeblack@google.com
217514184Sgabeblack@google.com  transition(I_C, NB_AckWB, I){TagArrayWrite}  {
217614184Sgabeblack@google.com    c_clearOwner;
217714184Sgabeblack@google.com    cc_clearSharers;
217814184Sgabeblack@google.com    ss_sendStaleNotification;
217914184Sgabeblack@google.com    fw2_forwardWBAck;
218014184Sgabeblack@google.com    dt_deallocateTBE;
218114184Sgabeblack@google.com    dd_deallocateDir;
218214184Sgabeblack@google.com    pR_popResponseFromNBQueue;
218314184Sgabeblack@google.com  }
218414184Sgabeblack@google.com
218514184Sgabeblack@google.com  transition(I_W, NB_AckWB, I) {
218614184Sgabeblack@google.com    ss_sendStaleNotification;
218714184Sgabeblack@google.com    dt_deallocateTBE;
218814184Sgabeblack@google.com    dd_deallocateDir;
218914184Sgabeblack@google.com    pR_popResponseFromNBQueue;
219014184Sgabeblack@google.com  }
219114184Sgabeblack@google.com
219214184Sgabeblack@google.com
219314184Sgabeblack@google.com
219414184Sgabeblack@google.com  // Do not handle replacements, reads of any kind or writebacks from transients; recycle
219514184Sgabeblack@google.com  transition({I_M, I_ES, I_S, MO_I, ES_I, S_M, O_M, VES_I, VO_I, VO_S, VM_I, I_C, I_W}, {RdBlkS,RdBlkM,RdBlk,CtoD}) {
219614184Sgabeblack@google.com    zz_recycleRequest;
219714184Sgabeblack@google.com  }
219814184Sgabeblack@google.com
219914184Sgabeblack@google.com  transition( VO_S, NoCPUWrite) {
220014184Sgabeblack@google.com    zz_recycleRequest;
220114184Sgabeblack@google.com  }
220214184Sgabeblack@google.com
220314184Sgabeblack@google.com  transition({BW_M, BW_S, BW_O, BW_E}, {RdBlkS,RdBlkM,RdBlk,CtoD,NoCPUWrite, CPUWrite}) {
220414184Sgabeblack@google.com    zz_recycleRequest;
220514184Sgabeblack@google.com  }
220614184Sgabeblack@google.com
220714184Sgabeblack@google.com  transition({BBB_M, BBB_S, BBB_E, BB_O, BB_M, BB_S, BB_OO}, { RdBlk, RdBlkS, RdBlkM, CPUWrite, NoCPUWrite}) {
220814184Sgabeblack@google.com    zz_recycleRequest;
220914184Sgabeblack@google.com  }
221014184Sgabeblack@google.com
221114184Sgabeblack@google.com  transition({BBB_S, BBB_E, BB_O, BB_S, BB_OO}, { CtoD}) {
221214184Sgabeblack@google.com    zz_recycleRequest;
221314184Sgabeblack@google.com  }
221414184Sgabeblack@google.com
221514184Sgabeblack@google.com  transition({BBS_UM, BBO_UM, BBM_M, BBM_O, BBS_M, BBO_M}, { RdBlk, RdBlkS, RdBlkM}) {
221614184Sgabeblack@google.com    zz_recycleRequest;
221714184Sgabeblack@google.com  }
221814184Sgabeblack@google.com
221914184Sgabeblack@google.com  transition(BBM_O, CtoD) {
222014184Sgabeblack@google.com    zz_recycleRequest;
222114184Sgabeblack@google.com  }
222214184Sgabeblack@google.com
222314184Sgabeblack@google.com  transition({BBS_S, BBO_O}, {RdBlkM, CtoD}) {
222414184Sgabeblack@google.com    zz_recycleRequest;
222514184Sgabeblack@google.com  }
222614184Sgabeblack@google.com
222714184Sgabeblack@google.com  transition({B_I, CP_I, CP_S, CP_O, CP_OM, CP_SM, CP_IOM, CP_ISM, CP_OSIW, BRWD_I, BRW_I, BRD_I}, {RdBlk, RdBlkS, RdBlkM}) {
222814184Sgabeblack@google.com    zz_recycleRequest;
222914184Sgabeblack@google.com  }
223014184Sgabeblack@google.com
223114184Sgabeblack@google.com  transition({CP_O, CP_S, CP_OM}, CtoD) {
223214184Sgabeblack@google.com    zz_recycleRequest;
223314184Sgabeblack@google.com  }
223414184Sgabeblack@google.com
223514184Sgabeblack@google.com  // Ignore replacement related messages after probe got in.
223614184Sgabeblack@google.com  transition({CP_I, B_I, CP_IOM, CP_ISM, CP_OSIW, BRWD_I, BRW_I, BRD_I}, {CPUWrite, NoCPUWrite}) {
223714184Sgabeblack@google.com    zz_recycleRequest;
223814184Sgabeblack@google.com  }
223914184Sgabeblack@google.com
224014184Sgabeblack@google.com  // Ignore replacement related messages after probes processed
224114184Sgabeblack@google.com  transition({I, I_S, I_ES, I_M, I_C, I_W}, {CPUWrite,NoCPUWrite}) {
224214184Sgabeblack@google.com      nC_sendNullWBAckToCore;
224314184Sgabeblack@google.com    i_popIncomingRequestQueue;
224414184Sgabeblack@google.com  }
224514184Sgabeblack@google.com  // cannot ignore cancel... otherwise TCP/SQC will be stuck in I_C
224614184Sgabeblack@google.com  transition({I, I_S, I_ES, I_M, I_C, I_W, S_M, M, O, E, S}, CPUWriteCancel){TagArrayRead}  {
224714184Sgabeblack@google.com    nC_sendNullWBAckToCore;
224814184Sgabeblack@google.com    i_popIncomingRequestQueue;
224914184Sgabeblack@google.com  }
225014184Sgabeblack@google.com
225114184Sgabeblack@google.com  transition({CP_I, B_I, CP_IOM, CP_ISM, BRWD_I, BRW_I, BRD_I}, {NoVic, VicClean, VicDirty, VicDirtyLast}){
225214184Sgabeblack@google.com    nT_sendNullWBAckToTCC;
225314184Sgabeblack@google.com    pl_popTCCRequestQueue;
225414184Sgabeblack@google.com  }
225514184Sgabeblack@google.com
225614184Sgabeblack@google.com  // Handling Probes from NB (General process: (1) propagate up, go to blocking state (2) process acks (3) on last ack downward.)
225714184Sgabeblack@google.com
225814184Sgabeblack@google.com  // step 1
225914184Sgabeblack@google.com  transition({M, O, E, S}, PrbInvData, CP_I){TagArrayRead} {
226014184Sgabeblack@google.com    tp_allocateTBE;
226114184Sgabeblack@google.com    dc_probeInvCoreData;
226214184Sgabeblack@google.com    d2_probeInvL2Data;
226314184Sgabeblack@google.com    pp_popProbeQueue;
226414184Sgabeblack@google.com  }
226514184Sgabeblack@google.com  // step 2a
226614184Sgabeblack@google.com  transition(CP_I, CPUPrbResp) {
226714184Sgabeblack@google.com    y_writeDataToTBE;
226814184Sgabeblack@google.com    x_decrementAcks;
226914184Sgabeblack@google.com    o_checkForAckCompletion;
227014184Sgabeblack@google.com    pk_popResponseQueue;
227114184Sgabeblack@google.com  }
227214184Sgabeblack@google.com  // step 2b
227314184Sgabeblack@google.com  transition(CP_I, TCCPrbResp) {
227414184Sgabeblack@google.com    ty_writeTCCDataToTBE;
227514184Sgabeblack@google.com    x_decrementAcks;
227614184Sgabeblack@google.com    o_checkForAckCompletion;
227714184Sgabeblack@google.com    plr_popTCCResponseQueue;
227814184Sgabeblack@google.com  }
227914184Sgabeblack@google.com  // step 3
228014184Sgabeblack@google.com  transition(CP_I, ProbeAcksComplete, I){TagArrayWrite} {
228114184Sgabeblack@google.com    pd_sendProbeResponseData;
228214184Sgabeblack@google.com    c_clearOwner;
228314184Sgabeblack@google.com    cc_clearSharers;
228414184Sgabeblack@google.com    dt_deallocateTBE;
228514184Sgabeblack@google.com    dd_deallocateDir;
228614184Sgabeblack@google.com    pt_popTriggerQueue;
228714184Sgabeblack@google.com  }
228814184Sgabeblack@google.com
228914184Sgabeblack@google.com  // step 1
229014184Sgabeblack@google.com  transition({M, O, E, S}, PrbInv, B_I){TagArrayWrite} {
229114184Sgabeblack@google.com    tp_allocateTBE;
229214184Sgabeblack@google.com    ipc_probeInvCore;
229314184Sgabeblack@google.com    i2_probeInvL2;
229414184Sgabeblack@google.com    pp_popProbeQueue;
229514184Sgabeblack@google.com  }
229614184Sgabeblack@google.com  // step 2
229714184Sgabeblack@google.com  transition(B_I, CPUPrbResp) {
229814184Sgabeblack@google.com    x_decrementAcks;
229914184Sgabeblack@google.com    o_checkForAckCompletion;
230014184Sgabeblack@google.com    pk_popResponseQueue;
230114184Sgabeblack@google.com  }
230214184Sgabeblack@google.com  // step 2b
230314184Sgabeblack@google.com  transition(B_I, TCCPrbResp) {
230414184Sgabeblack@google.com    x_decrementAcks;
230514184Sgabeblack@google.com    o_checkForAckCompletion;
230614184Sgabeblack@google.com    plr_popTCCResponseQueue;
230714184Sgabeblack@google.com  }
230814184Sgabeblack@google.com  // step 3
230914184Sgabeblack@google.com  transition(B_I, ProbeAcksComplete, I){TagArrayWrite} {
231014184Sgabeblack@google.com    // send response down to NB
231114184Sgabeblack@google.com    pi_sendProbeResponseInv;
231214184Sgabeblack@google.com    c_clearOwner;
231314184Sgabeblack@google.com    cc_clearSharers;
231414184Sgabeblack@google.com    dt_deallocateTBE;
231514184Sgabeblack@google.com    dd_deallocateDir;
231614184Sgabeblack@google.com    pt_popTriggerQueue;
231714184Sgabeblack@google.com  }
231814184Sgabeblack@google.com
231914184Sgabeblack@google.com
232014184Sgabeblack@google.com  // step 1
232114184Sgabeblack@google.com  transition({M, O}, PrbShrData, CP_O){TagArrayRead} {
232214184Sgabeblack@google.com    tp_allocateTBE;
232314184Sgabeblack@google.com    sc_probeShrCoreData;
232414184Sgabeblack@google.com    s2_probeShrL2Data;
232514184Sgabeblack@google.com    pp_popProbeQueue;
232614184Sgabeblack@google.com  }
232714184Sgabeblack@google.com
232814184Sgabeblack@google.com  transition(E, PrbShrData, CP_O){TagArrayRead} {
232914184Sgabeblack@google.com    tp_allocateTBE;
233014184Sgabeblack@google.com    eto_moveExSharerToOwner;
233114184Sgabeblack@google.com    sc_probeShrCoreData;
233214184Sgabeblack@google.com    s2_probeShrL2Data;
233314184Sgabeblack@google.com    pp_popProbeQueue;
233414184Sgabeblack@google.com  }
233514184Sgabeblack@google.com  // step 2
233614184Sgabeblack@google.com  transition(CP_O, CPUPrbResp) {
233714184Sgabeblack@google.com    y_writeDataToTBE;
233814184Sgabeblack@google.com    x_decrementAcks;
233914184Sgabeblack@google.com    o_checkForAckCompletion;
234014184Sgabeblack@google.com    pk_popResponseQueue;
234114184Sgabeblack@google.com  }
234214184Sgabeblack@google.com  // step 2b
234314184Sgabeblack@google.com  transition(CP_O, TCCPrbResp) {
234414184Sgabeblack@google.com    ty_writeTCCDataToTBE;
234514184Sgabeblack@google.com    x_decrementAcks;
234614184Sgabeblack@google.com    o_checkForAckCompletion;
234714184Sgabeblack@google.com    plr_popTCCResponseQueue;
234814184Sgabeblack@google.com  }
234914184Sgabeblack@google.com  // step 3
235014184Sgabeblack@google.com  transition(CP_O, ProbeAcksComplete, O){TagArrayWrite} {
235114184Sgabeblack@google.com    // send response down to NB
235214184Sgabeblack@google.com    pd_sendProbeResponseData;
235314184Sgabeblack@google.com    dt_deallocateTBE;
235414184Sgabeblack@google.com    pt_popTriggerQueue;
235514184Sgabeblack@google.com  }
235614184Sgabeblack@google.com
235714184Sgabeblack@google.com  //step 1
235814184Sgabeblack@google.com  transition(S, PrbShrData, CP_S) {
235914184Sgabeblack@google.com    tp_allocateTBE;
236014184Sgabeblack@google.com    sc_probeShrCoreData;
236114184Sgabeblack@google.com    s2_probeShrL2Data;
236214184Sgabeblack@google.com    pp_popProbeQueue;
236314184Sgabeblack@google.com  }
236414184Sgabeblack@google.com  // step 2
236514184Sgabeblack@google.com  transition(CP_S, CPUPrbResp) {
236614184Sgabeblack@google.com    y_writeDataToTBE;
236714184Sgabeblack@google.com    x_decrementAcks;
236814184Sgabeblack@google.com    o_checkForAckCompletion;
236914184Sgabeblack@google.com    pk_popResponseQueue;
237014184Sgabeblack@google.com  }
237114184Sgabeblack@google.com  // step 2b
237214184Sgabeblack@google.com  transition(CP_S, TCCPrbResp) {
237314184Sgabeblack@google.com    ty_writeTCCDataToTBE;
237414184Sgabeblack@google.com    x_decrementAcks;
237514184Sgabeblack@google.com    o_checkForAckCompletion;
237614184Sgabeblack@google.com    plr_popTCCResponseQueue;
237714184Sgabeblack@google.com  }
237814184Sgabeblack@google.com  // step 3
237914184Sgabeblack@google.com  transition(CP_S, ProbeAcksComplete, S) {
238014184Sgabeblack@google.com    // send response down to NB
238114184Sgabeblack@google.com    pd_sendProbeResponseData;
238214184Sgabeblack@google.com    dt_deallocateTBE;
238314184Sgabeblack@google.com    pt_popTriggerQueue;
238414184Sgabeblack@google.com  }
238514184Sgabeblack@google.com
238614184Sgabeblack@google.com  // step 1
238714184Sgabeblack@google.com  transition(O_M, PrbInvData, CP_IOM) {
238814184Sgabeblack@google.com    dc_probeInvCoreData;
238914184Sgabeblack@google.com    d2_probeInvL2Data;
239014184Sgabeblack@google.com    pp_popProbeQueue;
239114184Sgabeblack@google.com  }
239214184Sgabeblack@google.com  // step 2a
239314184Sgabeblack@google.com  transition(CP_IOM, CPUPrbResp) {
239414184Sgabeblack@google.com    y_writeDataToTBE;
239514184Sgabeblack@google.com    x_decrementAcks;
239614184Sgabeblack@google.com    o_checkForAckCompletion;
239714184Sgabeblack@google.com    pk_popResponseQueue;
239814184Sgabeblack@google.com  }
239914184Sgabeblack@google.com  // step 2b
240014184Sgabeblack@google.com  transition(CP_IOM, TCCPrbResp) {
240114184Sgabeblack@google.com    ty_writeTCCDataToTBE;
240214184Sgabeblack@google.com    x_decrementAcks;
240314184Sgabeblack@google.com    o_checkForAckCompletion;
240414184Sgabeblack@google.com    plr_popTCCResponseQueue;
240514184Sgabeblack@google.com  }
240614184Sgabeblack@google.com  // step 3
240714184Sgabeblack@google.com  transition(CP_IOM, ProbeAcksComplete, I_M) {
240814184Sgabeblack@google.com    pdm_sendProbeResponseDataMs;
240914184Sgabeblack@google.com    c_clearOwner;
241014184Sgabeblack@google.com    cc_clearSharers;
241114184Sgabeblack@google.com    cd_clearDirtyBitTBE;
241214184Sgabeblack@google.com    pt_popTriggerQueue;
241314184Sgabeblack@google.com  }
241414184Sgabeblack@google.com
241514184Sgabeblack@google.com  transition(CP_IOM, ProbeAcksCompleteReissue, I){TagArrayWrite} {
241614184Sgabeblack@google.com    pdm_sendProbeResponseDataMs;
241714184Sgabeblack@google.com    c_clearOwner;
241814184Sgabeblack@google.com    cc_clearSharers;
241914184Sgabeblack@google.com    dt_deallocateTBE;
242014184Sgabeblack@google.com    dd_deallocateDir;
242114184Sgabeblack@google.com    pt_popTriggerQueue;
242214184Sgabeblack@google.com  }
242314184Sgabeblack@google.com
242414184Sgabeblack@google.com  // step 1
242514184Sgabeblack@google.com  transition(S_M, PrbInvData, CP_ISM) {
242614184Sgabeblack@google.com    dc_probeInvCoreData;
242714184Sgabeblack@google.com    d2_probeInvL2Data;
242814184Sgabeblack@google.com    o_checkForAckCompletion;
242914184Sgabeblack@google.com    pp_popProbeQueue;
243014184Sgabeblack@google.com  }
243114184Sgabeblack@google.com  // step 2a
243214184Sgabeblack@google.com  transition(CP_ISM, CPUPrbResp) {
243314184Sgabeblack@google.com    y_writeDataToTBE;
243414184Sgabeblack@google.com    x_decrementAcks;
243514184Sgabeblack@google.com    o_checkForAckCompletion;
243614184Sgabeblack@google.com    pk_popResponseQueue;
243714184Sgabeblack@google.com  }
243814184Sgabeblack@google.com  // step 2b
243914184Sgabeblack@google.com  transition(CP_ISM, TCCPrbResp) {
244014184Sgabeblack@google.com    ty_writeTCCDataToTBE;
244114184Sgabeblack@google.com    x_decrementAcks;
244214184Sgabeblack@google.com    o_checkForAckCompletion;
244314184Sgabeblack@google.com    plr_popTCCResponseQueue;
244414184Sgabeblack@google.com  }
244514184Sgabeblack@google.com  // step 3
244614184Sgabeblack@google.com  transition(CP_ISM, ProbeAcksComplete, I_M) {
244714184Sgabeblack@google.com    pdm_sendProbeResponseDataMs;
244814184Sgabeblack@google.com    c_clearOwner;
244914184Sgabeblack@google.com    cc_clearSharers;
245014184Sgabeblack@google.com    cd_clearDirtyBitTBE;
245114184Sgabeblack@google.com
245214184Sgabeblack@google.com    //dt_deallocateTBE;
245314184Sgabeblack@google.com    pt_popTriggerQueue;
245414184Sgabeblack@google.com  }
245514184Sgabeblack@google.com  transition(CP_ISM, ProbeAcksCompleteReissue, I){TagArrayWrite} {
245614184Sgabeblack@google.com    pim_sendProbeResponseInvMs;
245714184Sgabeblack@google.com    c_clearOwner;
245814184Sgabeblack@google.com    cc_clearSharers;
245914184Sgabeblack@google.com    dt_deallocateTBE;
246014184Sgabeblack@google.com    dd_deallocateDir;
246114184Sgabeblack@google.com    pt_popTriggerQueue;
246214184Sgabeblack@google.com  }
246314184Sgabeblack@google.com
246414184Sgabeblack@google.com  // step 1
246514184Sgabeblack@google.com  transition({S_M, O_M}, {PrbInv}, CP_ISM) {
246614184Sgabeblack@google.com    dc_probeInvCoreData;
246714184Sgabeblack@google.com    d2_probeInvL2Data;
246814184Sgabeblack@google.com    pp_popProbeQueue;
246914184Sgabeblack@google.com  }
247014184Sgabeblack@google.com  // next steps inherited from BS_ISM
247114184Sgabeblack@google.com
247214184Sgabeblack@google.com  // Simpler cases
247314184Sgabeblack@google.com
247414184Sgabeblack@google.com  transition({I_C, I_W}, {PrbInvData, PrbInv, PrbShrData}) {
247514184Sgabeblack@google.com    pi_sendProbeResponseInv;
247614184Sgabeblack@google.com    pp_popProbeQueue;
247714184Sgabeblack@google.com  }
247814184Sgabeblack@google.com
247914184Sgabeblack@google.com  //If the directory is certain that the block is not present, one can send an acknowledgement right away.
248014184Sgabeblack@google.com  // No need for three step process.
248114184Sgabeblack@google.com  transition(I, {PrbInv,PrbShrData,PrbInvData}){TagArrayRead} {
248214184Sgabeblack@google.com    pi_sendProbeResponseInv;
248314184Sgabeblack@google.com    pp_popProbeQueue;
248414184Sgabeblack@google.com  }
248514184Sgabeblack@google.com
248614184Sgabeblack@google.com  transition({I_M, I_ES, I_S}, {PrbInv, PrbInvData}) {
248714184Sgabeblack@google.com    pi_sendProbeResponseInv;
248814184Sgabeblack@google.com    pp_popProbeQueue;
248914184Sgabeblack@google.com  }
249014184Sgabeblack@google.com
249114184Sgabeblack@google.com  transition({I_M, I_ES, I_S}, PrbShrData) {
249214184Sgabeblack@google.com    prm_sendProbeResponseMiss;
249314184Sgabeblack@google.com    pp_popProbeQueue;
249414184Sgabeblack@google.com  }
249514184Sgabeblack@google.com
249614184Sgabeblack@google.com  //step 1
249714184Sgabeblack@google.com  transition(S_M, PrbShrData, CP_SM) {
249814184Sgabeblack@google.com    sc_probeShrCoreData;
249914184Sgabeblack@google.com    s2_probeShrL2Data;
250014184Sgabeblack@google.com    o_checkForAckCompletion;
250114184Sgabeblack@google.com    pp_popProbeQueue;
250214184Sgabeblack@google.com  }
250314184Sgabeblack@google.com  // step 2
250414184Sgabeblack@google.com  transition(CP_SM, CPUPrbResp) {
250514184Sgabeblack@google.com    y_writeDataToTBE;
250614184Sgabeblack@google.com    x_decrementAcks;
250714184Sgabeblack@google.com    o_checkForAckCompletion;
250814184Sgabeblack@google.com    pk_popResponseQueue;
250914184Sgabeblack@google.com  }
251014184Sgabeblack@google.com  // step 2b
251114184Sgabeblack@google.com  transition(CP_SM, TCCPrbResp) {
251214184Sgabeblack@google.com    ty_writeTCCDataToTBE;
251314184Sgabeblack@google.com    x_decrementAcks;
251414184Sgabeblack@google.com    o_checkForAckCompletion;
251514184Sgabeblack@google.com    plr_popTCCResponseQueue;
251614184Sgabeblack@google.com  }
251714184Sgabeblack@google.com  // step 3
251814184Sgabeblack@google.com  transition(CP_SM, {ProbeAcksComplete,ProbeAcksCompleteReissue}, S_M){DataArrayRead} {
251914184Sgabeblack@google.com    // send response down to NB
252014184Sgabeblack@google.com    pd_sendProbeResponseData;
252114184Sgabeblack@google.com    pt_popTriggerQueue;
252214184Sgabeblack@google.com  }
252314184Sgabeblack@google.com
252414184Sgabeblack@google.com  //step 1
252514184Sgabeblack@google.com  transition(O_M, PrbShrData, CP_OM) {
252614184Sgabeblack@google.com    sc_probeShrCoreData;
252714184Sgabeblack@google.com    s2_probeShrL2Data;
252814184Sgabeblack@google.com    pp_popProbeQueue;
252914184Sgabeblack@google.com  }
253014184Sgabeblack@google.com  // step 2
253114184Sgabeblack@google.com  transition(CP_OM, CPUPrbResp) {
253214184Sgabeblack@google.com    y_writeDataToTBE;
253314184Sgabeblack@google.com    x_decrementAcks;
253414184Sgabeblack@google.com    o_checkForAckCompletion;
253514184Sgabeblack@google.com    pk_popResponseQueue;
253614184Sgabeblack@google.com  }
253714184Sgabeblack@google.com  // step 2b
253814184Sgabeblack@google.com  transition(CP_OM, TCCPrbResp) {
253914184Sgabeblack@google.com    ty_writeTCCDataToTBE;
254014184Sgabeblack@google.com    x_decrementAcks;
254114184Sgabeblack@google.com    o_checkForAckCompletion;
254214184Sgabeblack@google.com    plr_popTCCResponseQueue;
254314184Sgabeblack@google.com  }
254414184Sgabeblack@google.com  // step 3
254514184Sgabeblack@google.com  transition(CP_OM, {ProbeAcksComplete,ProbeAcksCompleteReissue}, O_M) {
254614184Sgabeblack@google.com    // send response down to NB
254714184Sgabeblack@google.com    pd_sendProbeResponseData;
254814184Sgabeblack@google.com    pt_popTriggerQueue;
254914184Sgabeblack@google.com  }
255014184Sgabeblack@google.com
255114184Sgabeblack@google.com  transition(BRW_I, PrbInvData, I_W) {
255214184Sgabeblack@google.com     pd_sendProbeResponseData;
255314184Sgabeblack@google.com     pp_popProbeQueue;
255414184Sgabeblack@google.com   }
255514184Sgabeblack@google.com
255614184Sgabeblack@google.com  transition({VM_I,VO_I}, PrbInvData, I_C) {
255714184Sgabeblack@google.com    pd_sendProbeResponseData;
255814184Sgabeblack@google.com    pp_popProbeQueue;
255914184Sgabeblack@google.com  }
256014184Sgabeblack@google.com
256114184Sgabeblack@google.com  transition(VES_I, {PrbInvData,PrbInv}, I_C) {
256214184Sgabeblack@google.com    pi_sendProbeResponseInv;
256314184Sgabeblack@google.com    pp_popProbeQueue;
256414184Sgabeblack@google.com  }
256514184Sgabeblack@google.com
256614184Sgabeblack@google.com  transition({VM_I, VO_I, BRW_I}, PrbInv, I_W) {
256714184Sgabeblack@google.com    pi_sendProbeResponseInv;
256814184Sgabeblack@google.com    pp_popProbeQueue;
256914184Sgabeblack@google.com  }
257014184Sgabeblack@google.com
257114184Sgabeblack@google.com  transition({VM_I, VO_I, VO_S, VES_I, BRW_I}, PrbShrData) {
257214184Sgabeblack@google.com    pd_sendProbeResponseData;
257314184Sgabeblack@google.com    sf_setSharedFlip;
257414184Sgabeblack@google.com    pp_popProbeQueue;
257514184Sgabeblack@google.com  }
257614184Sgabeblack@google.com
257714184Sgabeblack@google.com  transition(VO_S, PrbInvData, CP_OSIW) {
257814184Sgabeblack@google.com    dc_probeInvCoreData;
257914184Sgabeblack@google.com    d2_probeInvL2Data;
258014184Sgabeblack@google.com    pp_popProbeQueue;
258114184Sgabeblack@google.com  }
258214184Sgabeblack@google.com
258314184Sgabeblack@google.com  transition(CP_OSIW, TCCPrbResp) {
258414184Sgabeblack@google.com    x_decrementAcks;
258514184Sgabeblack@google.com    o_checkForAckCompletion;
258614184Sgabeblack@google.com    plr_popTCCResponseQueue;
258714184Sgabeblack@google.com  }
258814184Sgabeblack@google.com  transition(CP_OSIW, CPUPrbResp) {
258914184Sgabeblack@google.com    x_decrementAcks;
259014184Sgabeblack@google.com    o_checkForAckCompletion;
259114184Sgabeblack@google.com    pk_popResponseQueue;
259214184Sgabeblack@google.com  }
259314184Sgabeblack@google.com
259414184Sgabeblack@google.com  transition(CP_OSIW, ProbeAcksComplete, I_C) {
259514184Sgabeblack@google.com    pd_sendProbeResponseData;
259614184Sgabeblack@google.com    cd_clearDirtyBitTBE;
259714184Sgabeblack@google.com    pt_popTriggerQueue;
259814184Sgabeblack@google.com  }
259914184Sgabeblack@google.com
260014184Sgabeblack@google.com  transition({I, S, E, O, M, CP_O, CP_S, CP_OM, CP_SM, CP_OSIW, BW_S, BW_E, BW_O, BW_M, I_M, I_ES, I_S, BBS_S, BBO_O, BBM_M, BBM_O, BB_M, BB_O, BB_OO, BB_S, BBS_M, BBO_M, BBO_UM, BBS_UM, S_M, O_M, BBB_S, BBB_M, BBB_E, VES_I, VM_I, VO_I, VO_S, ES_I, MO_I, I_C, I_W}, StaleVic) {
260114184Sgabeblack@google.com      nT_sendNullWBAckToTCC;
260214184Sgabeblack@google.com      pl_popTCCRequestQueue;
260314184Sgabeblack@google.com  }
260414184Sgabeblack@google.com
260514184Sgabeblack@google.com  transition({CP_I, B_I, CP_IOM, CP_ISM, BRWD_I, BRW_I, BRD_I}, StaleVic) {
260614184Sgabeblack@google.com      nT_sendNullWBAckToTCC;
260714184Sgabeblack@google.com      pl_popTCCRequestQueue;
260814184Sgabeblack@google.com  }
260914184Sgabeblack@google.com
261014184Sgabeblack@google.com  // Recall Transistions
261114184Sgabeblack@google.com  // transient states still require the directory state
261214184Sgabeblack@google.com  transition({M, O}, Recall, BRWD_I) {
261314184Sgabeblack@google.com    tr_allocateTBE;
261414184Sgabeblack@google.com    vd_victim;
261514184Sgabeblack@google.com    dc_probeInvCoreData;
261614184Sgabeblack@google.com    d2_probeInvL2Data;
261714184Sgabeblack@google.com  }
261814184Sgabeblack@google.com
261914184Sgabeblack@google.com  transition({E, S}, Recall, BRWD_I) {
262014184Sgabeblack@google.com    tr_allocateTBE;
262114184Sgabeblack@google.com    vc_victim;
262214184Sgabeblack@google.com    dc_probeInvCoreData;
262314184Sgabeblack@google.com    d2_probeInvL2Data;
262414184Sgabeblack@google.com  }
262514184Sgabeblack@google.com
262614184Sgabeblack@google.com  transition(I, Recall) {
262714184Sgabeblack@google.com    dd_deallocateDir;
262814184Sgabeblack@google.com  }
262914184Sgabeblack@google.com
263014184Sgabeblack@google.com  transition({BRWD_I, BRD_I}, CPUPrbResp) {
263114184Sgabeblack@google.com    y_writeDataToTBE;
263214184Sgabeblack@google.com    x_decrementAcks;
263314184Sgabeblack@google.com    o_checkForAckCompletion;
263414184Sgabeblack@google.com    pk_popResponseQueue;
263514184Sgabeblack@google.com  }
263614184Sgabeblack@google.com
263714184Sgabeblack@google.com  transition({BRWD_I, BRD_I}, TCCPrbResp) {
263814184Sgabeblack@google.com    ty_writeTCCDataToTBE;
263914184Sgabeblack@google.com    x_decrementAcks;
264014184Sgabeblack@google.com    o_checkForAckCompletion;
264114184Sgabeblack@google.com    plr_popTCCResponseQueue;
264214184Sgabeblack@google.com  }
264314184Sgabeblack@google.com
264414184Sgabeblack@google.com  transition(BRWD_I, NB_AckWB, BRD_I) {
264514184Sgabeblack@google.com    pR_popResponseFromNBQueue;
264614184Sgabeblack@google.com  }
264714184Sgabeblack@google.com
264814184Sgabeblack@google.com  transition(BRWD_I, ProbeAcksComplete, BRW_I) {
264914184Sgabeblack@google.com    pt_popTriggerQueue;
265014184Sgabeblack@google.com  }
265114184Sgabeblack@google.com
265214184Sgabeblack@google.com  transition(BRW_I, NB_AckWB, I) {
265314184Sgabeblack@google.com    wb_data;
265414184Sgabeblack@google.com    dt_deallocateTBE;
265514184Sgabeblack@google.com    dd_deallocateDir;
265614184Sgabeblack@google.com    pR_popResponseFromNBQueue;
265714184Sgabeblack@google.com  }
265814184Sgabeblack@google.com
265914184Sgabeblack@google.com  transition(BRD_I, ProbeAcksComplete, I) {
266014184Sgabeblack@google.com    wb_data;
266114184Sgabeblack@google.com    dt_deallocateTBE;
266214184Sgabeblack@google.com    dd_deallocateDir;
266314184Sgabeblack@google.com    pt_popTriggerQueue;
266414184Sgabeblack@google.com  }
266514184Sgabeblack@google.com
266614184Sgabeblack@google.com  // wait for stable state for Recall
266714184Sgabeblack@google.com  transition({BRWD_I,BRD_I,BRW_I,CP_O, CP_S, CP_OM, CP_SM, CP_OSIW, BW_S, BW_E, BW_O, BW_M, I_M, I_ES, I_S, BBS_S, BBO_O, BBM_M, BBM_O, BB_M, BB_O, BB_OO, BB_S, BBS_M, BBO_M, BBO_UM, BBS_UM, S_M, O_M, BBB_S, BBB_M, BBB_E, VES_I, VM_I, VO_I, VO_S, ES_I, MO_I, I_C, I_W, CP_I}, Recall) {
266814184Sgabeblack@google.com    zz_recycleRequest; // stall and wait would be for the wrong address
266914184Sgabeblack@google.com    ut_updateTag; // try to find an easier recall
267014184Sgabeblack@google.com  }
267114184Sgabeblack@google.com
267214184Sgabeblack@google.com}
2673