114184Sgabeblack@google.com/*
214184Sgabeblack@google.com * Copyright (c) 2013-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: Lisa Hsu,
3414184Sgabeblack@google.com *          Sooraj Puthoor
3514184Sgabeblack@google.com */
3614184Sgabeblack@google.com
3714184Sgabeblack@google.com/*
3814184Sgabeblack@google.com * This file is based on MOESI_AMD_Base.sm
3914184Sgabeblack@google.com * Differences with AMD base protocol
4014184Sgabeblack@google.com * -- Uses a probe filter memory to track sharers.
4114184Sgabeblack@google.com * -- The probe filter can be inclusive or non-inclusive
4214184Sgabeblack@google.com * -- Only two sharers tracked. Sharers are a) GPU or/and  b) CPU
4314184Sgabeblack@google.com * -- If sharer information available, the sharer is probed
4414184Sgabeblack@google.com * -- If sharer information not available, probes are broadcasted
4514184Sgabeblack@google.com */
4614184Sgabeblack@google.com
4714184Sgabeblack@google.commachine(MachineType:Directory, "AMD Baseline protocol")
4814184Sgabeblack@google.com: DirectoryMemory * directory;
4914184Sgabeblack@google.com  CacheMemory * L3CacheMemory;
5014184Sgabeblack@google.com  CacheMemory * ProbeFilterMemory;
5114184Sgabeblack@google.com  Cycles response_latency := 5;
5214184Sgabeblack@google.com  Cycles l3_hit_latency := 50;
5314184Sgabeblack@google.com  bool noTCCdir := "False";
5414184Sgabeblack@google.com  bool CAB_TCC := "False";
5514184Sgabeblack@google.com  int TCC_select_num_bits:=1;
5614184Sgabeblack@google.com  bool useL3OnWT := "False";
5714184Sgabeblack@google.com  bool inclusiveDir := "True";
5814184Sgabeblack@google.com  Cycles to_memory_controller_latency := 1;
5914184Sgabeblack@google.com
6014184Sgabeblack@google.com  // From the Cores
6114184Sgabeblack@google.com  MessageBuffer * requestFromCores, network="From", virtual_network="0", ordered="false", vnet_type="request";
6214184Sgabeblack@google.com  MessageBuffer * responseFromCores, network="From", virtual_network="2", ordered="false", vnet_type="response";
6314184Sgabeblack@google.com  MessageBuffer * unblockFromCores, network="From", virtual_network="4", ordered="false", vnet_type="unblock";
6414184Sgabeblack@google.com
6514184Sgabeblack@google.com  MessageBuffer * probeToCore, network="To", virtual_network="0", ordered="false", vnet_type="request";
6614184Sgabeblack@google.com  MessageBuffer * responseToCore, network="To", virtual_network="2", ordered="false", vnet_type="response";
6714184Sgabeblack@google.com
6814184Sgabeblack@google.com  MessageBuffer * triggerQueue, ordered="true";
6914184Sgabeblack@google.com  MessageBuffer * L3triggerQueue, ordered="true";
7014184Sgabeblack@google.com  MessageBuffer * responseFromMemory;
7114184Sgabeblack@google.com{
7214184Sgabeblack@google.com  // STATES
7314184Sgabeblack@google.com  state_declaration(State, desc="Directory states", default="Directory_State_U") {
7414184Sgabeblack@google.com    U, AccessPermission:Backing_Store,                 desc="unblocked";
7514184Sgabeblack@google.com    BL, AccessPermission:Busy,                  desc="got L3 WB request";
7614184Sgabeblack@google.com    // BL is Busy because it is busy waiting for the data
7714184Sgabeblack@google.com    // which is possibly in the network. The cache which evicted the data
7814184Sgabeblack@google.com    // might have moved to some other state after doing the eviction
7914184Sgabeblack@google.com    // BS==> Received a read request; has not requested ownership
8014184Sgabeblack@google.com    // B==> Received a read request; has requested ownership
8114184Sgabeblack@google.com    // BM==> Received a modification request
8214184Sgabeblack@google.com    B_P, AccessPermission:Backing_Store,      desc="Back invalidation, waiting for probes";
8314184Sgabeblack@google.com    BS_M, AccessPermission:Backing_Store,     desc="blocked waiting for memory";
8414184Sgabeblack@google.com    BM_M, AccessPermission:Backing_Store,     desc="blocked waiting for memory";
8514184Sgabeblack@google.com    B_M, AccessPermission:Backing_Store,      desc="blocked waiting for memory";
8614184Sgabeblack@google.com    BP, AccessPermission:Backing_Store,       desc="blocked waiting for probes, no need for memory";
8714184Sgabeblack@google.com    BS_PM, AccessPermission:Backing_Store,    desc="blocked waiting for probes and Memory";
8814184Sgabeblack@google.com    BM_PM, AccessPermission:Backing_Store,    desc="blocked waiting for probes and Memory";
8914184Sgabeblack@google.com    B_PM, AccessPermission:Backing_Store,     desc="blocked waiting for probes and Memory";
9014184Sgabeblack@google.com    BS_Pm, AccessPermission:Backing_Store,    desc="blocked waiting for probes, already got memory";
9114184Sgabeblack@google.com    BM_Pm, AccessPermission:Backing_Store,    desc="blocked waiting for probes, already got memory";
9214184Sgabeblack@google.com    B_Pm, AccessPermission:Backing_Store,     desc="blocked waiting for probes, already got memory";
9314184Sgabeblack@google.com    B, AccessPermission:Backing_Store,        desc="sent response, Blocked til ack";
9414184Sgabeblack@google.com  }
9514184Sgabeblack@google.com
9614184Sgabeblack@google.com  // Events
9714184Sgabeblack@google.com  enumeration(Event, desc="Directory events") {
9814184Sgabeblack@google.com    // CPU requests
9914184Sgabeblack@google.com    RdBlkS,             desc="...";
10014184Sgabeblack@google.com    RdBlkM,             desc="...";
10114184Sgabeblack@google.com    RdBlk,              desc="...";
10214184Sgabeblack@google.com    CtoD,               desc="...";
10314184Sgabeblack@google.com    WriteThrough,       desc="WriteThrough Message";
10414184Sgabeblack@google.com    Atomic,             desc="Atomic Message";
10514184Sgabeblack@google.com
10614184Sgabeblack@google.com    // writebacks
10714184Sgabeblack@google.com    VicDirty,           desc="...";
10814184Sgabeblack@google.com    VicClean,           desc="...";
10914184Sgabeblack@google.com    CPUData,            desc="WB data from CPU";
11014184Sgabeblack@google.com    StaleWB,         desc="Notification that WB has been superceded by a probe";
11114184Sgabeblack@google.com
11214184Sgabeblack@google.com    // probe responses
11314184Sgabeblack@google.com    CPUPrbResp,            desc="Probe Response Msg";
11414184Sgabeblack@google.com
11514184Sgabeblack@google.com    ProbeAcksComplete,  desc="Probe Acks Complete";
11614184Sgabeblack@google.com
11714184Sgabeblack@google.com    L3Hit,              desc="Hit in L3 return data to core";
11814184Sgabeblack@google.com
11914184Sgabeblack@google.com    // Replacement
12014184Sgabeblack@google.com    PF_Repl,            desc="Replace address from probe filter";
12114184Sgabeblack@google.com
12214184Sgabeblack@google.com    // Memory Controller
12314184Sgabeblack@google.com    MemData, desc="Fetched data from memory arrives";
12414184Sgabeblack@google.com    WBAck, desc="Writeback Ack from memory arrives";
12514184Sgabeblack@google.com
12614184Sgabeblack@google.com    CoreUnblock,            desc="Core received data, unblock";
12714184Sgabeblack@google.com    UnblockWriteThrough,    desc="Unblock because of writethrough request finishing";
12814184Sgabeblack@google.com
12914184Sgabeblack@google.com    StaleVicDirty,        desc="Core invalidated before VicDirty processed";
13014184Sgabeblack@google.com  }
13114184Sgabeblack@google.com
13214184Sgabeblack@google.com  enumeration(RequestType, desc="To communicate stats from transitions to recordStats") {
13314184Sgabeblack@google.com    L3DataArrayRead,    desc="Read the data array";
13414184Sgabeblack@google.com    L3DataArrayWrite,   desc="Write the data array";
13514184Sgabeblack@google.com    L3TagArrayRead,     desc="Read the data array";
13614184Sgabeblack@google.com    L3TagArrayWrite,    desc="Write the data array";
13714184Sgabeblack@google.com
13814184Sgabeblack@google.com    PFTagArrayRead,     desc="Read the data array";
13914184Sgabeblack@google.com    PFTagArrayWrite,    desc="Write the data array";
14014184Sgabeblack@google.com  }
14114184Sgabeblack@google.com
14214184Sgabeblack@google.com  // TYPES
14314184Sgabeblack@google.com
14414184Sgabeblack@google.com  enumeration(ProbeFilterState, desc="") {
14514184Sgabeblack@google.com    T,  desc="Tracked";
14614184Sgabeblack@google.com    NT, desc="Not tracked";
14714184Sgabeblack@google.com    B, desc="Blocked, This entry is being replaced";
14814184Sgabeblack@google.com  }
14914184Sgabeblack@google.com
15014184Sgabeblack@google.com  // DirectoryEntry
15114184Sgabeblack@google.com  structure(Entry, desc="...", interface="AbstractEntry") {
15214184Sgabeblack@google.com    State DirectoryState,          desc="Directory state";
15314184Sgabeblack@google.com    DataBlock DataBlk,             desc="data for the block";
15414184Sgabeblack@google.com    NetDest VicDirtyIgnore,  desc="VicDirty coming from whom to ignore";
15514184Sgabeblack@google.com  }
15614184Sgabeblack@google.com
15714184Sgabeblack@google.com  structure(CacheEntry, desc="...", interface="AbstractCacheEntry") {
15814184Sgabeblack@google.com    DataBlock DataBlk,          desc="data for the block";
15914184Sgabeblack@google.com    MachineID LastSender,       desc="Mach which this block came from";
16014184Sgabeblack@google.com    ProbeFilterState pfState,   desc="ProbeFilter state",default="Directory_ProbeFilterState_NT";
16114184Sgabeblack@google.com    bool isOnCPU,               desc="Block valid in the CPU complex",default="false";
16214184Sgabeblack@google.com    bool isOnGPU,               desc="Block valid in the GPU complex",default="false";
16314184Sgabeblack@google.com  }
16414184Sgabeblack@google.com
16514184Sgabeblack@google.com  structure(TBE, desc="...") {
16614184Sgabeblack@google.com    State TBEState,     desc="Transient state";
16714184Sgabeblack@google.com    DataBlock DataBlk,  desc="data for the block";
16814184Sgabeblack@google.com    bool Dirty,         desc="Is the data dirty?";
16914184Sgabeblack@google.com    int NumPendingAcks,        desc="num acks expected";
17014184Sgabeblack@google.com    MachineID OriginalRequestor,        desc="Original Requestor";
17114184Sgabeblack@google.com    MachineID WTRequestor,        desc="WT Requestor";
17214184Sgabeblack@google.com    bool Cached,        desc="data hit in Cache";
17314184Sgabeblack@google.com    bool MemData,       desc="Got MemData?",default="false";
17414184Sgabeblack@google.com    bool wtData,       desc="Got write through data?",default="false";
17514184Sgabeblack@google.com    bool atomicData,   desc="Got Atomic op?",default="false";
17614184Sgabeblack@google.com    Cycles InitialRequestTime, desc="...";
17714184Sgabeblack@google.com    Cycles ForwardRequestTime, desc="...";
17814184Sgabeblack@google.com    Cycles ProbeRequestStartTime, desc="...";
17914184Sgabeblack@google.com    MachineID LastSender, desc="Mach which this block came from";
18014184Sgabeblack@google.com    bool L3Hit, default="false", desc="Was this an L3 hit?";
18114184Sgabeblack@google.com    uint64_t probe_id,        desc="probe id for lifetime profiling";
18214184Sgabeblack@google.com    WriteMask writeMask,    desc="outstanding write through mask";
18314184Sgabeblack@google.com    Addr demandAddress,  desc="Address of demand request which caused probe filter eviction";
18414184Sgabeblack@google.com  }
18514184Sgabeblack@google.com
18614184Sgabeblack@google.com  structure(TBETable, external="yes") {
18714184Sgabeblack@google.com    TBE lookup(Addr);
18814184Sgabeblack@google.com    void allocate(Addr);
18914184Sgabeblack@google.com    void deallocate(Addr);
19014184Sgabeblack@google.com    bool isPresent(Addr);
19114184Sgabeblack@google.com  }
19214184Sgabeblack@google.com
19314184Sgabeblack@google.com  TBETable TBEs, template="<Directory_TBE>", constructor="m_number_of_TBEs";
19414184Sgabeblack@google.com
19514184Sgabeblack@google.com  int TCC_select_low_bit, default="RubySystem::getBlockSizeBits()";
19614184Sgabeblack@google.com
19714184Sgabeblack@google.com  Tick clockEdge();
19814184Sgabeblack@google.com  Tick cyclesToTicks(Cycles c);
19914184Sgabeblack@google.com
20014184Sgabeblack@google.com  void set_tbe(TBE a);
20114184Sgabeblack@google.com  void unset_tbe();
20214184Sgabeblack@google.com  void wakeUpAllBuffers();
20314184Sgabeblack@google.com  void wakeUpBuffers(Addr a);
20414184Sgabeblack@google.com  Cycles curCycle();
20514184Sgabeblack@google.com  MachineID mapAddressToMachine(Addr addr, MachineType mtype);
20614184Sgabeblack@google.com
20714184Sgabeblack@google.com  Entry getDirectoryEntry(Addr addr), return_by_pointer="yes" {
20814184Sgabeblack@google.com    Entry dir_entry := static_cast(Entry, "pointer", directory.lookup(addr));
20914184Sgabeblack@google.com
21014184Sgabeblack@google.com    if (is_valid(dir_entry)) {
21114184Sgabeblack@google.com      //DPRINTF(RubySlicc, "Getting entry %s: %s\n", addr, dir_entry.DataBlk);
21214184Sgabeblack@google.com      return dir_entry;
21314184Sgabeblack@google.com    }
21414184Sgabeblack@google.com
21514184Sgabeblack@google.com    dir_entry :=  static_cast(Entry, "pointer",
21614184Sgabeblack@google.com                              directory.allocate(addr, new Entry));
21714184Sgabeblack@google.com    return dir_entry;
21814184Sgabeblack@google.com  }
21914184Sgabeblack@google.com
22014184Sgabeblack@google.com  DataBlock getDataBlock(Addr addr), return_by_ref="yes" {
22114184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
22214184Sgabeblack@google.com    if (is_valid(tbe) && tbe.MemData) {
22314184Sgabeblack@google.com      DPRINTF(RubySlicc, "Returning DataBlk from TBE %s:%s\n", addr, tbe);
22414184Sgabeblack@google.com      return tbe.DataBlk;
22514184Sgabeblack@google.com    }
22614184Sgabeblack@google.com    DPRINTF(RubySlicc, "Returning DataBlk from Dir %s:%s\n", addr, getDirectoryEntry(addr));
22714184Sgabeblack@google.com    return getDirectoryEntry(addr).DataBlk;
22814184Sgabeblack@google.com  }
22914184Sgabeblack@google.com
23014184Sgabeblack@google.com  State getState(TBE tbe, CacheEntry entry, Addr addr) {
23114184Sgabeblack@google.com    CacheEntry probeFilterEntry := static_cast(CacheEntry, "pointer", ProbeFilterMemory.lookup(addr));
23214184Sgabeblack@google.com    if (inclusiveDir) {
23314184Sgabeblack@google.com      if (is_valid(probeFilterEntry) && probeFilterEntry.pfState == ProbeFilterState:B) {
23414184Sgabeblack@google.com        return State:B_P;
23514184Sgabeblack@google.com      }
23614184Sgabeblack@google.com    }
23714184Sgabeblack@google.com    return getDirectoryEntry(addr).DirectoryState;
23814184Sgabeblack@google.com  }
23914184Sgabeblack@google.com
24014184Sgabeblack@google.com  void setState(TBE tbe, CacheEntry entry, Addr addr, State state) {
24114184Sgabeblack@google.com    getDirectoryEntry(addr).DirectoryState := state;
24214184Sgabeblack@google.com  }
24314184Sgabeblack@google.com
24414184Sgabeblack@google.com  void functionalRead(Addr addr, Packet *pkt) {
24514184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
24614184Sgabeblack@google.com    if(is_valid(tbe)) {
24714184Sgabeblack@google.com      testAndRead(addr, tbe.DataBlk, pkt);
24814184Sgabeblack@google.com    } else {
24914184Sgabeblack@google.com      functionalMemoryRead(pkt);
25014184Sgabeblack@google.com    }
25114184Sgabeblack@google.com  }
25214184Sgabeblack@google.com
25314184Sgabeblack@google.com  int functionalWrite(Addr addr, Packet *pkt) {
25414184Sgabeblack@google.com    int num_functional_writes := 0;
25514184Sgabeblack@google.com
25614184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
25714184Sgabeblack@google.com    if(is_valid(tbe)) {
25814184Sgabeblack@google.com      num_functional_writes := num_functional_writes +
25914184Sgabeblack@google.com            testAndWrite(addr, tbe.DataBlk, pkt);
26014184Sgabeblack@google.com    }
26114184Sgabeblack@google.com
26214184Sgabeblack@google.com    num_functional_writes := num_functional_writes +
26314184Sgabeblack@google.com        functionalMemoryWrite(pkt);
26414184Sgabeblack@google.com    return num_functional_writes;
26514184Sgabeblack@google.com  }
26614184Sgabeblack@google.com
26714184Sgabeblack@google.com  AccessPermission getAccessPermission(Addr addr) {
26814184Sgabeblack@google.com    // For this Directory, all permissions are just tracked in Directory, since
26914184Sgabeblack@google.com    // it's not possible to have something in TBE but not Dir, just keep track
27014184Sgabeblack@google.com    // of state all in one place.
27114184Sgabeblack@google.com    if (directory.isPresent(addr)) {
27214184Sgabeblack@google.com      return Directory_State_to_permission(getDirectoryEntry(addr).DirectoryState);
27314184Sgabeblack@google.com    }
27414184Sgabeblack@google.com
27514184Sgabeblack@google.com    return AccessPermission:NotPresent;
27614184Sgabeblack@google.com  }
27714184Sgabeblack@google.com
27814184Sgabeblack@google.com  void setAccessPermission(CacheEntry entry, Addr addr, State state) {
27914184Sgabeblack@google.com    getDirectoryEntry(addr).changePermission(Directory_State_to_permission(state));
28014184Sgabeblack@google.com  }
28114184Sgabeblack@google.com
28214184Sgabeblack@google.com  void recordRequestType(RequestType request_type, Addr addr) {
28314184Sgabeblack@google.com    if (request_type == RequestType:L3DataArrayRead) {
28414184Sgabeblack@google.com      L3CacheMemory.recordRequestType(CacheRequestType:DataArrayRead, addr);
28514184Sgabeblack@google.com    } else if (request_type == RequestType:L3DataArrayWrite) {
28614184Sgabeblack@google.com      L3CacheMemory.recordRequestType(CacheRequestType:DataArrayWrite, addr);
28714184Sgabeblack@google.com    } else if (request_type == RequestType:L3TagArrayRead) {
28814184Sgabeblack@google.com      L3CacheMemory.recordRequestType(CacheRequestType:TagArrayRead, addr);
28914184Sgabeblack@google.com    } else if (request_type == RequestType:L3TagArrayWrite) {
29014184Sgabeblack@google.com      L3CacheMemory.recordRequestType(CacheRequestType:TagArrayWrite, addr);
29114184Sgabeblack@google.com    } else if (request_type == RequestType:PFTagArrayRead) {
29214184Sgabeblack@google.com      ProbeFilterMemory.recordRequestType(CacheRequestType:TagArrayRead, addr);
29314184Sgabeblack@google.com    } else if (request_type == RequestType:PFTagArrayWrite) {
29414184Sgabeblack@google.com      ProbeFilterMemory.recordRequestType(CacheRequestType:TagArrayWrite, addr);
29514184Sgabeblack@google.com    }
29614184Sgabeblack@google.com  }
29714184Sgabeblack@google.com
29814184Sgabeblack@google.com  bool checkResourceAvailable(RequestType request_type, Addr addr) {
29914184Sgabeblack@google.com    if (request_type == RequestType:L3DataArrayRead) {
30014184Sgabeblack@google.com      return L3CacheMemory.checkResourceAvailable(CacheResourceType:DataArray, addr);
30114184Sgabeblack@google.com    } else if (request_type == RequestType:L3DataArrayWrite) {
30214184Sgabeblack@google.com      return L3CacheMemory.checkResourceAvailable(CacheResourceType:DataArray, addr);
30314184Sgabeblack@google.com    } else if (request_type == RequestType:L3TagArrayRead) {
30414184Sgabeblack@google.com      return L3CacheMemory.checkResourceAvailable(CacheResourceType:TagArray, addr);
30514184Sgabeblack@google.com    } else if (request_type == RequestType:L3TagArrayWrite) {
30614184Sgabeblack@google.com      return L3CacheMemory.checkResourceAvailable(CacheResourceType:TagArray, addr);
30714184Sgabeblack@google.com    } else if (request_type == RequestType:PFTagArrayRead) {
30814184Sgabeblack@google.com      return ProbeFilterMemory.checkResourceAvailable(CacheResourceType:TagArray, addr);
30914184Sgabeblack@google.com    } else if (request_type == RequestType:PFTagArrayWrite) {
31014184Sgabeblack@google.com      return ProbeFilterMemory.checkResourceAvailable(CacheResourceType:TagArray, addr);
31114184Sgabeblack@google.com    } else {
31214184Sgabeblack@google.com      error("Invalid RequestType type in checkResourceAvailable");
31314184Sgabeblack@google.com      return true;
31414184Sgabeblack@google.com    }
31514184Sgabeblack@google.com  }
31614184Sgabeblack@google.com
31714184Sgabeblack@google.com  bool isNotPresentProbeFilter(Addr address) {
31814184Sgabeblack@google.com    if (ProbeFilterMemory.isTagPresent(address) ||
31914184Sgabeblack@google.com        ProbeFilterMemory.cacheAvail(address)) {
32014184Sgabeblack@google.com        return false;
32114184Sgabeblack@google.com    }
32214184Sgabeblack@google.com    return true;
32314184Sgabeblack@google.com  }
32414184Sgabeblack@google.com
32514184Sgabeblack@google.com  bool isGPUSharer(Addr address) {
32614184Sgabeblack@google.com    assert(ProbeFilterMemory.isTagPresent(address));
32714184Sgabeblack@google.com    CacheEntry entry := static_cast(CacheEntry, "pointer", ProbeFilterMemory.lookup(address));
32814184Sgabeblack@google.com    if (entry.pfState == ProbeFilterState:NT) {
32914184Sgabeblack@google.com       return true;
33014184Sgabeblack@google.com    } else if (entry.isOnGPU){
33114184Sgabeblack@google.com       return true;
33214184Sgabeblack@google.com    }
33314184Sgabeblack@google.com    return false;
33414184Sgabeblack@google.com  }
33514184Sgabeblack@google.com
33614184Sgabeblack@google.com  bool isCPUSharer(Addr address) {
33714184Sgabeblack@google.com    assert(ProbeFilterMemory.isTagPresent(address));
33814184Sgabeblack@google.com    CacheEntry entry := static_cast(CacheEntry, "pointer", ProbeFilterMemory.lookup(address));
33914184Sgabeblack@google.com    if (entry.pfState == ProbeFilterState:NT) {
34014184Sgabeblack@google.com       return true;
34114184Sgabeblack@google.com    } else if (entry.isOnCPU){
34214184Sgabeblack@google.com       return true;
34314184Sgabeblack@google.com    }
34414184Sgabeblack@google.com    return false;
34514184Sgabeblack@google.com  }
34614184Sgabeblack@google.com
34714184Sgabeblack@google.com
34814184Sgabeblack@google.com  // ** OUT_PORTS **
34914184Sgabeblack@google.com  out_port(probeNetwork_out, NBProbeRequestMsg, probeToCore);
35014184Sgabeblack@google.com  out_port(responseNetwork_out, ResponseMsg, responseToCore);
35114184Sgabeblack@google.com
35214184Sgabeblack@google.com  out_port(triggerQueue_out, TriggerMsg, triggerQueue);
35314184Sgabeblack@google.com  out_port(L3TriggerQueue_out, TriggerMsg, L3triggerQueue);
35414184Sgabeblack@google.com
35514184Sgabeblack@google.com  // ** IN_PORTS **
35614184Sgabeblack@google.com
35714184Sgabeblack@google.com  // Trigger Queue
35814184Sgabeblack@google.com  in_port(triggerQueue_in, TriggerMsg, triggerQueue, rank=5) {
35914184Sgabeblack@google.com    if (triggerQueue_in.isReady(clockEdge())) {
36014184Sgabeblack@google.com      peek(triggerQueue_in, TriggerMsg) {
36114184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
36214184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(in_msg.addr));
36314184Sgabeblack@google.com        if (in_msg.Type == TriggerType:AcksComplete) {
36414184Sgabeblack@google.com          trigger(Event:ProbeAcksComplete, in_msg.addr, entry, tbe);
36514184Sgabeblack@google.com        }else if (in_msg.Type == TriggerType:UnblockWriteThrough) {
36614184Sgabeblack@google.com          trigger(Event:UnblockWriteThrough, in_msg.addr, entry, tbe);
36714184Sgabeblack@google.com        } else {
36814184Sgabeblack@google.com          error("Unknown trigger msg");
36914184Sgabeblack@google.com        }
37014184Sgabeblack@google.com      }
37114184Sgabeblack@google.com    }
37214184Sgabeblack@google.com  }
37314184Sgabeblack@google.com
37414184Sgabeblack@google.com  in_port(L3TriggerQueue_in, TriggerMsg, L3triggerQueue, rank=4) {
37514184Sgabeblack@google.com    if (L3TriggerQueue_in.isReady(clockEdge())) {
37614184Sgabeblack@google.com      peek(L3TriggerQueue_in, TriggerMsg) {
37714184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
37814184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(in_msg.addr));
37914184Sgabeblack@google.com        if (in_msg.Type == TriggerType:L3Hit) {
38014184Sgabeblack@google.com          trigger(Event:L3Hit, in_msg.addr, entry, tbe);
38114184Sgabeblack@google.com        } else {
38214184Sgabeblack@google.com          error("Unknown trigger msg");
38314184Sgabeblack@google.com        }
38414184Sgabeblack@google.com      }
38514184Sgabeblack@google.com    }
38614184Sgabeblack@google.com  }
38714184Sgabeblack@google.com
38814184Sgabeblack@google.com  // Unblock Network
38914184Sgabeblack@google.com  in_port(unblockNetwork_in, UnblockMsg, unblockFromCores, rank=3) {
39014184Sgabeblack@google.com    if (unblockNetwork_in.isReady(clockEdge())) {
39114184Sgabeblack@google.com      peek(unblockNetwork_in, UnblockMsg) {
39214184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
39314184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(in_msg.addr));
39414184Sgabeblack@google.com        trigger(Event:CoreUnblock, in_msg.addr, entry, tbe);
39514184Sgabeblack@google.com      }
39614184Sgabeblack@google.com    }
39714184Sgabeblack@google.com  }
39814184Sgabeblack@google.com
39914184Sgabeblack@google.com  // Core response network
40014184Sgabeblack@google.com  in_port(responseNetwork_in, ResponseMsg, responseFromCores, rank=2) {
40114184Sgabeblack@google.com    if (responseNetwork_in.isReady(clockEdge())) {
40214184Sgabeblack@google.com      peek(responseNetwork_in, ResponseMsg) {
40314184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
40414184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(in_msg.addr));
40514184Sgabeblack@google.com        if (in_msg.Type == CoherenceResponseType:CPUPrbResp) {
40614184Sgabeblack@google.com          trigger(Event:CPUPrbResp, in_msg.addr, entry, tbe);
40714184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:CPUData) {
40814184Sgabeblack@google.com          trigger(Event:CPUData, in_msg.addr, entry, tbe);
40914184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:StaleNotif) {
41014184Sgabeblack@google.com            trigger(Event:StaleWB, in_msg.addr, entry, tbe);
41114184Sgabeblack@google.com        } else {
41214184Sgabeblack@google.com          error("Unexpected response type");
41314184Sgabeblack@google.com        }
41414184Sgabeblack@google.com      }
41514184Sgabeblack@google.com    }
41614184Sgabeblack@google.com  }
41714184Sgabeblack@google.com
41814184Sgabeblack@google.com  // off-chip memory request/response is done
41914184Sgabeblack@google.com  in_port(memQueue_in, MemoryMsg, responseFromMemory, rank=1) {
42014184Sgabeblack@google.com    if (memQueue_in.isReady(clockEdge())) {
42114184Sgabeblack@google.com      peek(memQueue_in, MemoryMsg) {
42214184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
42314184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(in_msg.addr));
42414184Sgabeblack@google.com        if (in_msg.Type == MemoryRequestType:MEMORY_READ) {
42514184Sgabeblack@google.com          trigger(Event:MemData, in_msg.addr, entry, tbe);
42614184Sgabeblack@google.com          DPRINTF(RubySlicc, "%s\n", in_msg);
42714184Sgabeblack@google.com        } else if (in_msg.Type == MemoryRequestType:MEMORY_WB) {
42814184Sgabeblack@google.com          trigger(Event:WBAck, in_msg.addr, entry, tbe); // ignore WBAcks, don't care about them.
42914184Sgabeblack@google.com        } else {
43014184Sgabeblack@google.com          DPRINTF(RubySlicc, "%s\n", in_msg.Type);
43114184Sgabeblack@google.com          error("Invalid message");
43214184Sgabeblack@google.com        }
43314184Sgabeblack@google.com      }
43414184Sgabeblack@google.com    }
43514184Sgabeblack@google.com  }
43614184Sgabeblack@google.com
43714184Sgabeblack@google.com  in_port(requestNetwork_in, CPURequestMsg, requestFromCores, rank=0) {
43814184Sgabeblack@google.com    if (requestNetwork_in.isReady(clockEdge())) {
43914184Sgabeblack@google.com      peek(requestNetwork_in, CPURequestMsg) {
44014184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
44114184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(in_msg.addr));
44214184Sgabeblack@google.com        if (inclusiveDir && isNotPresentProbeFilter(in_msg.addr)) {
44314184Sgabeblack@google.com            Addr victim := ProbeFilterMemory.cacheProbe(in_msg.addr);
44414184Sgabeblack@google.com            tbe := TBEs.lookup(victim);
44514184Sgabeblack@google.com            entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(victim));
44614184Sgabeblack@google.com            trigger(Event:PF_Repl, victim, entry, tbe);
44714184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:RdBlk) {
44814184Sgabeblack@google.com          trigger(Event:RdBlk, in_msg.addr, entry, tbe);
44914184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:RdBlkS) {
45014184Sgabeblack@google.com          trigger(Event:RdBlkS, in_msg.addr, entry, tbe);
45114184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:RdBlkM) {
45214184Sgabeblack@google.com          trigger(Event:RdBlkM, in_msg.addr, entry, tbe);
45314184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:WriteThrough) {
45414184Sgabeblack@google.com          trigger(Event:WriteThrough, in_msg.addr, entry, tbe);
45514184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:Atomic) {
45614184Sgabeblack@google.com          trigger(Event:Atomic, in_msg.addr, entry, tbe);
45714184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:VicDirty) {
45814184Sgabeblack@google.com          if (getDirectoryEntry(in_msg.addr).VicDirtyIgnore.isElement(in_msg.Requestor)) {
45914184Sgabeblack@google.com            DPRINTF(RubySlicc, "Dropping VicDirty for address %s\n", in_msg.addr);
46014184Sgabeblack@google.com            trigger(Event:StaleVicDirty, in_msg.addr, entry, tbe);
46114184Sgabeblack@google.com          } else {
46214184Sgabeblack@google.com            DPRINTF(RubySlicc, "Got VicDirty from %s on %s\n", in_msg.Requestor, in_msg.addr);
46314184Sgabeblack@google.com            trigger(Event:VicDirty, in_msg.addr, entry, tbe);
46414184Sgabeblack@google.com          }
46514184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:VicClean) {
46614184Sgabeblack@google.com          if (getDirectoryEntry(in_msg.addr).VicDirtyIgnore.isElement(in_msg.Requestor)) {
46714184Sgabeblack@google.com            DPRINTF(RubySlicc, "Dropping VicClean for address %s\n", in_msg.addr);
46814184Sgabeblack@google.com            trigger(Event:StaleVicDirty, in_msg.addr, entry, tbe);
46914184Sgabeblack@google.com          } else {
47014184Sgabeblack@google.com            DPRINTF(RubySlicc, "Got VicClean from %s on %s\n", in_msg.Requestor, in_msg.addr);
47114184Sgabeblack@google.com            trigger(Event:VicClean, in_msg.addr, entry, tbe);
47214184Sgabeblack@google.com          }
47314184Sgabeblack@google.com        } else {
47414184Sgabeblack@google.com          error("Bad request message type");
47514184Sgabeblack@google.com        }
47614184Sgabeblack@google.com      }
47714184Sgabeblack@google.com    }
47814184Sgabeblack@google.com  }
47914184Sgabeblack@google.com
48014184Sgabeblack@google.com  // Actions
48114184Sgabeblack@google.com  action(s_sendResponseS, "s", desc="send Shared response") {
48214184Sgabeblack@google.com    enqueue(responseNetwork_out, ResponseMsg, response_latency) {
48314184Sgabeblack@google.com      out_msg.addr := address;
48414184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:NBSysResp;
48514184Sgabeblack@google.com      if (tbe.L3Hit) {
48614184Sgabeblack@google.com        out_msg.Sender := createMachineID(MachineType:L3Cache, intToID(0));
48714184Sgabeblack@google.com      } else {
48814184Sgabeblack@google.com        out_msg.Sender := machineID;
48914184Sgabeblack@google.com      }
49014184Sgabeblack@google.com      out_msg.Destination.add(tbe.OriginalRequestor);
49114184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
49214184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
49314184Sgabeblack@google.com      out_msg.Dirty := false;
49414184Sgabeblack@google.com      out_msg.State := CoherenceState:Shared;
49514184Sgabeblack@google.com      out_msg.InitialRequestTime := tbe.InitialRequestTime;
49614184Sgabeblack@google.com      out_msg.ForwardRequestTime := tbe.ForwardRequestTime;
49714184Sgabeblack@google.com      out_msg.ProbeRequestStartTime := tbe.ProbeRequestStartTime;
49814184Sgabeblack@google.com      out_msg.OriginalResponder := tbe.LastSender;
49914184Sgabeblack@google.com      out_msg.L3Hit := tbe.L3Hit;
50014184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", out_msg);
50114184Sgabeblack@google.com    }
50214184Sgabeblack@google.com  }
50314184Sgabeblack@google.com
50414184Sgabeblack@google.com  action(es_sendResponseES, "es", desc="send Exclusive or Shared response") {
50514184Sgabeblack@google.com    enqueue(responseNetwork_out, ResponseMsg, response_latency) {
50614184Sgabeblack@google.com      out_msg.addr := address;
50714184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:NBSysResp;
50814184Sgabeblack@google.com      if (tbe.L3Hit) {
50914184Sgabeblack@google.com        out_msg.Sender := createMachineID(MachineType:L3Cache, intToID(0));
51014184Sgabeblack@google.com      } else {
51114184Sgabeblack@google.com        out_msg.Sender := machineID;
51214184Sgabeblack@google.com      }
51314184Sgabeblack@google.com      out_msg.Destination.add(tbe.OriginalRequestor);
51414184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
51514184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
51614184Sgabeblack@google.com      out_msg.Dirty := tbe.Dirty;
51714184Sgabeblack@google.com      if (tbe.Cached) {
51814184Sgabeblack@google.com        out_msg.State := CoherenceState:Shared;
51914184Sgabeblack@google.com      } else {
52014184Sgabeblack@google.com        out_msg.State := CoherenceState:Exclusive;
52114184Sgabeblack@google.com      }
52214184Sgabeblack@google.com      out_msg.InitialRequestTime := tbe.InitialRequestTime;
52314184Sgabeblack@google.com      out_msg.ForwardRequestTime := tbe.ForwardRequestTime;
52414184Sgabeblack@google.com      out_msg.ProbeRequestStartTime := tbe.ProbeRequestStartTime;
52514184Sgabeblack@google.com      out_msg.OriginalResponder := tbe.LastSender;
52614184Sgabeblack@google.com      out_msg.L3Hit := tbe.L3Hit;
52714184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", out_msg);
52814184Sgabeblack@google.com    }
52914184Sgabeblack@google.com  }
53014184Sgabeblack@google.com
53114184Sgabeblack@google.com  // write-through and atomics do not send an unblock ack back to the
53214184Sgabeblack@google.com  // directory. Hence, directory has to generate a self unblocking
53314184Sgabeblack@google.com  // message. Additionally, write through's does not require data
53414184Sgabeblack@google.com  // in its response. Hence, write through is treated seperately from
53514184Sgabeblack@google.com  // write-back and atomics
53614184Sgabeblack@google.com  action(m_sendResponseM, "m", desc="send Modified response") {
53714184Sgabeblack@google.com    if (tbe.wtData) {
53814184Sgabeblack@google.com      enqueue(triggerQueue_out, TriggerMsg, 1) {
53914184Sgabeblack@google.com        out_msg.addr := address;
54014184Sgabeblack@google.com        out_msg.Type := TriggerType:UnblockWriteThrough;
54114184Sgabeblack@google.com      }
54214184Sgabeblack@google.com    }else{
54314184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, response_latency) {
54414184Sgabeblack@google.com        out_msg.addr := address;
54514184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:NBSysResp;
54614184Sgabeblack@google.com        if (tbe.L3Hit) {
54714184Sgabeblack@google.com          out_msg.Sender := createMachineID(MachineType:L3Cache, intToID(0));
54814184Sgabeblack@google.com        } else {
54914184Sgabeblack@google.com          out_msg.Sender := machineID;
55014184Sgabeblack@google.com        }
55114184Sgabeblack@google.com        out_msg.Destination.add(tbe.OriginalRequestor);
55214184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
55314184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
55414184Sgabeblack@google.com        out_msg.Dirty := tbe.Dirty;
55514184Sgabeblack@google.com        out_msg.State := CoherenceState:Modified;
55614184Sgabeblack@google.com        out_msg.CtoD := false;
55714184Sgabeblack@google.com        out_msg.InitialRequestTime := tbe.InitialRequestTime;
55814184Sgabeblack@google.com        out_msg.ForwardRequestTime := tbe.ForwardRequestTime;
55914184Sgabeblack@google.com        out_msg.ProbeRequestStartTime := tbe.ProbeRequestStartTime;
56014184Sgabeblack@google.com        out_msg.OriginalResponder := tbe.LastSender;
56114184Sgabeblack@google.com        if(tbe.atomicData){
56214184Sgabeblack@google.com          out_msg.WTRequestor := tbe.WTRequestor;
56314184Sgabeblack@google.com        }
56414184Sgabeblack@google.com        out_msg.L3Hit := tbe.L3Hit;
56514184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
56614184Sgabeblack@google.com      }
56714184Sgabeblack@google.com      if (tbe.atomicData) {
56814184Sgabeblack@google.com        enqueue(triggerQueue_out, TriggerMsg, 1) {
56914184Sgabeblack@google.com          out_msg.addr := address;
57014184Sgabeblack@google.com          out_msg.Type := TriggerType:UnblockWriteThrough;
57114184Sgabeblack@google.com        }
57214184Sgabeblack@google.com      }
57314184Sgabeblack@google.com    }
57414184Sgabeblack@google.com  }
57514184Sgabeblack@google.com
57614184Sgabeblack@google.com  action(c_sendResponseCtoD, "c", desc="send CtoD Ack") {
57714184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, response_latency) {
57814184Sgabeblack@google.com        out_msg.addr := address;
57914184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:NBSysResp;
58014184Sgabeblack@google.com        out_msg.Sender := machineID;
58114184Sgabeblack@google.com        out_msg.Destination.add(tbe.OriginalRequestor);
58214184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Control;
58314184Sgabeblack@google.com        out_msg.Dirty := false;
58414184Sgabeblack@google.com        out_msg.State := CoherenceState:Modified;
58514184Sgabeblack@google.com        out_msg.CtoD := true;
58614184Sgabeblack@google.com        out_msg.InitialRequestTime := tbe.InitialRequestTime;
58714184Sgabeblack@google.com        out_msg.ForwardRequestTime := curCycle();
58814184Sgabeblack@google.com        out_msg.ProbeRequestStartTime := tbe.ProbeRequestStartTime;
58914184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
59014184Sgabeblack@google.com      }
59114184Sgabeblack@google.com  }
59214184Sgabeblack@google.com
59314184Sgabeblack@google.com  action(w_sendResponseWBAck, "w", desc="send WB Ack") {
59414184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
59514184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, 1) {
59614184Sgabeblack@google.com        out_msg.addr := address;
59714184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:NBSysWBAck;
59814184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
59914184Sgabeblack@google.com        out_msg.WTRequestor := in_msg.WTRequestor;
60014184Sgabeblack@google.com        out_msg.Sender := machineID;
60114184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Control;
60214184Sgabeblack@google.com        out_msg.InitialRequestTime := in_msg.InitialRequestTime;
60314184Sgabeblack@google.com        out_msg.ForwardRequestTime := curCycle();
60414184Sgabeblack@google.com        out_msg.ProbeRequestStartTime := curCycle();
60514184Sgabeblack@google.com      }
60614184Sgabeblack@google.com    }
60714184Sgabeblack@google.com  }
60814184Sgabeblack@google.com
60914184Sgabeblack@google.com  action(l_queueMemWBReq, "lq", desc="Write WB data to memory") {
61014184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
61114184Sgabeblack@google.com      queueMemoryWrite(machineID, address, to_memory_controller_latency,
61214184Sgabeblack@google.com                       in_msg.DataBlk);
61314184Sgabeblack@google.com    }
61414184Sgabeblack@google.com  }
61514184Sgabeblack@google.com
61614184Sgabeblack@google.com  action(l_queueMemRdReq, "lr", desc="Read data from memory") {
61714184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
61814184Sgabeblack@google.com      if (L3CacheMemory.isTagPresent(address)) {
61914184Sgabeblack@google.com        enqueue(L3TriggerQueue_out, TriggerMsg, l3_hit_latency) {
62014184Sgabeblack@google.com          out_msg.addr := address;
62114184Sgabeblack@google.com          out_msg.Type := TriggerType:L3Hit;
62214184Sgabeblack@google.com          DPRINTF(RubySlicc, "%s\n", out_msg);
62314184Sgabeblack@google.com        }
62414184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(address));
62514184Sgabeblack@google.com        tbe.DataBlk := entry.DataBlk;
62614184Sgabeblack@google.com        tbe.LastSender := entry.LastSender;
62714184Sgabeblack@google.com        tbe.L3Hit := true;
62814184Sgabeblack@google.com        tbe.MemData := true;
62914184Sgabeblack@google.com        L3CacheMemory.deallocate(address);
63014184Sgabeblack@google.com      } else {
63114184Sgabeblack@google.com        queueMemoryRead(machineID, address, to_memory_controller_latency);
63214184Sgabeblack@google.com      }
63314184Sgabeblack@google.com    }
63414184Sgabeblack@google.com  }
63514184Sgabeblack@google.com
63614184Sgabeblack@google.com  action(dc_probeInvCoreData, "dc", desc="probe inv cores, return data") {
63714184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
63814184Sgabeblack@google.com      enqueue(probeNetwork_out, NBProbeRequestMsg, response_latency) {
63914184Sgabeblack@google.com        out_msg.addr := address;
64014184Sgabeblack@google.com        out_msg.Type := ProbeRequestType:PrbInv;
64114184Sgabeblack@google.com        out_msg.ReturnData := true;
64214184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
64314184Sgabeblack@google.com        if(isCPUSharer(address)) {
64414184Sgabeblack@google.com          out_msg.Destination.broadcast(MachineType:CorePair);  // won't be realistic for multisocket
64514184Sgabeblack@google.com        }
64614184Sgabeblack@google.com
64714184Sgabeblack@google.com        // add relevant TCC node to list. This replaces all TCPs and SQCs
64814184Sgabeblack@google.com        if(isGPUSharer(address)) {
64914184Sgabeblack@google.com          if ((in_msg.Type == CoherenceRequestType:WriteThrough ||
65014184Sgabeblack@google.com               in_msg.Type == CoherenceRequestType:Atomic) &&
65114184Sgabeblack@google.com               in_msg.NoWriteConflict) {
65214184Sgabeblack@google.com          // Don't Include TCCs unless there was write-CAB conflict in the TCC
65314184Sgabeblack@google.com          } else if(noTCCdir) {
65414184Sgabeblack@google.com            out_msg.Destination.add(mapAddressToRange(address,MachineType:TCC,
65514184Sgabeblack@google.com                                    TCC_select_low_bit, TCC_select_num_bits));
65614184Sgabeblack@google.com          } else {
65714184Sgabeblack@google.com                out_msg.Destination.add(mapAddressToMachine(address, MachineType:TCCdir));
65814184Sgabeblack@google.com          }
65914184Sgabeblack@google.com        }
66014184Sgabeblack@google.com        out_msg.Destination.remove(in_msg.Requestor);
66114184Sgabeblack@google.com        tbe.NumPendingAcks := out_msg.Destination.count();
66214184Sgabeblack@google.com        if (tbe.NumPendingAcks == 0) {
66314184Sgabeblack@google.com          enqueue(triggerQueue_out, TriggerMsg, 1) {
66414184Sgabeblack@google.com            out_msg.addr := address;
66514184Sgabeblack@google.com            out_msg.Type := TriggerType:AcksComplete;
66614184Sgabeblack@google.com          }
66714184Sgabeblack@google.com        }
66814184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
66914184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(" dc: Acks remaining: ");
67014184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(tbe.NumPendingAcks);
67114184Sgabeblack@google.com        tbe.ProbeRequestStartTime := curCycle();
67214184Sgabeblack@google.com      }
67314184Sgabeblack@google.com    }
67414184Sgabeblack@google.com  }
67514184Sgabeblack@google.com
67614184Sgabeblack@google.com  action(bp_backProbe, "bp", desc="back probe") {
67714184Sgabeblack@google.com    enqueue(probeNetwork_out, NBProbeRequestMsg, response_latency) {
67814184Sgabeblack@google.com      out_msg.addr := address;
67914184Sgabeblack@google.com      out_msg.Type := ProbeRequestType:PrbInv;
68014184Sgabeblack@google.com      out_msg.ReturnData := true;
68114184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Control;
68214184Sgabeblack@google.com      if(isCPUSharer(address)) {
68314184Sgabeblack@google.com        // won't be realistic for multisocket
68414184Sgabeblack@google.com        out_msg.Destination.broadcast(MachineType:CorePair);
68514184Sgabeblack@google.com      }
68614184Sgabeblack@google.com      // add relevant TCC node to the list. This replaces all TCPs and SQCs
68714184Sgabeblack@google.com      if(isGPUSharer(address)) {
68814184Sgabeblack@google.com        if (noTCCdir) {
68914184Sgabeblack@google.com          //Don't need to notify TCC about reads
69014184Sgabeblack@google.com        } else {
69114184Sgabeblack@google.com          out_msg.Destination.add(mapAddressToMachine(address, MachineType:TCCdir));
69214184Sgabeblack@google.com          tbe.NumPendingAcks := tbe.NumPendingAcks + 1;
69314184Sgabeblack@google.com        }
69414184Sgabeblack@google.com        if (noTCCdir && CAB_TCC) {
69514184Sgabeblack@google.com          out_msg.Destination.add(mapAddressToRange(address,MachineType:TCC,
69614184Sgabeblack@google.com                                  TCC_select_low_bit, TCC_select_num_bits));
69714184Sgabeblack@google.com        }
69814184Sgabeblack@google.com      }
69914184Sgabeblack@google.com      tbe.NumPendingAcks := out_msg.Destination.count();
70014184Sgabeblack@google.com      if (tbe.NumPendingAcks == 0) {
70114184Sgabeblack@google.com        enqueue(triggerQueue_out, TriggerMsg, 1) {
70214184Sgabeblack@google.com          out_msg.addr := address;
70314184Sgabeblack@google.com          out_msg.Type := TriggerType:AcksComplete;
70414184Sgabeblack@google.com        }
70514184Sgabeblack@google.com      }
70614184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", (out_msg));
70714184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(" sc: Acks remaining: ");
70814184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(tbe.NumPendingAcks);
70914184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(" - back probe");
71014184Sgabeblack@google.com      tbe.ProbeRequestStartTime := curCycle();
71114184Sgabeblack@google.com    }
71214184Sgabeblack@google.com  }
71314184Sgabeblack@google.com
71414184Sgabeblack@google.com  action(sc_probeShrCoreData, "sc", desc="probe shared cores, return data") {
71514184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) { // not the right network?
71614184Sgabeblack@google.com      enqueue(probeNetwork_out, NBProbeRequestMsg, response_latency) {
71714184Sgabeblack@google.com        out_msg.addr := address;
71814184Sgabeblack@google.com        out_msg.Type := ProbeRequestType:PrbDowngrade;
71914184Sgabeblack@google.com        out_msg.ReturnData := true;
72014184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
72114184Sgabeblack@google.com        if(isCPUSharer(address)) {
72214184Sgabeblack@google.com          out_msg.Destination.broadcast(MachineType:CorePair);  // won't be realistic for multisocket
72314184Sgabeblack@google.com        }
72414184Sgabeblack@google.com        // add relevant TCC node to the list. This replaces all TCPs and SQCs
72514184Sgabeblack@google.com        if(isGPUSharer(address)) {
72614184Sgabeblack@google.com          if (noTCCdir) {
72714184Sgabeblack@google.com            //Don't need to notify TCC about reads
72814184Sgabeblack@google.com          } else {
72914184Sgabeblack@google.com            out_msg.Destination.add(mapAddressToMachine(address, MachineType:TCCdir));
73014184Sgabeblack@google.com            tbe.NumPendingAcks := tbe.NumPendingAcks + 1;
73114184Sgabeblack@google.com          }
73214184Sgabeblack@google.com          if (noTCCdir && CAB_TCC) {
73314184Sgabeblack@google.com            out_msg.Destination.add(mapAddressToRange(address,MachineType:TCC,
73414184Sgabeblack@google.com                                    TCC_select_low_bit, TCC_select_num_bits));
73514184Sgabeblack@google.com          }
73614184Sgabeblack@google.com        }
73714184Sgabeblack@google.com        out_msg.Destination.remove(in_msg.Requestor);
73814184Sgabeblack@google.com        tbe.NumPendingAcks := out_msg.Destination.count();
73914184Sgabeblack@google.com        if (tbe.NumPendingAcks == 0) {
74014184Sgabeblack@google.com          enqueue(triggerQueue_out, TriggerMsg, 1) {
74114184Sgabeblack@google.com            out_msg.addr := address;
74214184Sgabeblack@google.com            out_msg.Type := TriggerType:AcksComplete;
74314184Sgabeblack@google.com          }
74414184Sgabeblack@google.com        }
74514184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", (out_msg));
74614184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(" sc: Acks remaining: ");
74714184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(tbe.NumPendingAcks);
74814184Sgabeblack@google.com        tbe.ProbeRequestStartTime := curCycle();
74914184Sgabeblack@google.com      }
75014184Sgabeblack@google.com    }
75114184Sgabeblack@google.com  }
75214184Sgabeblack@google.com
75314184Sgabeblack@google.com  action(ic_probeInvCore, "ic", desc="probe invalidate core, no return data needed") {
75414184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) { // not the right network?
75514184Sgabeblack@google.com      enqueue(probeNetwork_out, NBProbeRequestMsg, response_latency) {
75614184Sgabeblack@google.com        out_msg.addr := address;
75714184Sgabeblack@google.com        out_msg.Type := ProbeRequestType:PrbInv;
75814184Sgabeblack@google.com        out_msg.ReturnData := false;
75914184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
76014184Sgabeblack@google.com        if(isCPUSharer(address)) {
76114184Sgabeblack@google.com          out_msg.Destination.broadcast(MachineType:CorePair);  // won't be realistic for multisocket
76214184Sgabeblack@google.com        }
76314184Sgabeblack@google.com
76414184Sgabeblack@google.com        // add relevant TCC node to the list. This replaces all TCPs and SQCs
76514184Sgabeblack@google.com        if(isGPUSharer(address)) {
76614184Sgabeblack@google.com          if (noTCCdir) {
76714184Sgabeblack@google.com              out_msg.Destination.add(mapAddressToRange(address,MachineType:TCC,
76814184Sgabeblack@google.com                                TCC_select_low_bit, TCC_select_num_bits));
76914184Sgabeblack@google.com          } else {
77014184Sgabeblack@google.com              out_msg.Destination.add(mapAddressToMachine(address, MachineType:TCCdir));
77114184Sgabeblack@google.com          }
77214184Sgabeblack@google.com        }
77314184Sgabeblack@google.com        out_msg.Destination.remove(in_msg.Requestor);
77414184Sgabeblack@google.com        tbe.NumPendingAcks := out_msg.Destination.count();
77514184Sgabeblack@google.com        if (tbe.NumPendingAcks == 0) {
77614184Sgabeblack@google.com          enqueue(triggerQueue_out, TriggerMsg, 1) {
77714184Sgabeblack@google.com            out_msg.addr := address;
77814184Sgabeblack@google.com            out_msg.Type := TriggerType:AcksComplete;
77914184Sgabeblack@google.com          }
78014184Sgabeblack@google.com        }
78114184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(" ic: Acks remaining: ");
78214184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(tbe.NumPendingAcks);
78314184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
78414184Sgabeblack@google.com        tbe.ProbeRequestStartTime := curCycle();
78514184Sgabeblack@google.com      }
78614184Sgabeblack@google.com    }
78714184Sgabeblack@google.com  }
78814184Sgabeblack@google.com
78914184Sgabeblack@google.com  action(sm_setMRU, "sm", desc="set probe filter entry as MRU") {
79014184Sgabeblack@google.com    ProbeFilterMemory.setMRU(address);
79114184Sgabeblack@google.com  }
79214184Sgabeblack@google.com
79314184Sgabeblack@google.com  action(d_writeDataToMemory, "d", desc="Write data to memory") {
79414184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
79514184Sgabeblack@google.com      getDirectoryEntry(address).DataBlk := in_msg.DataBlk;
79614184Sgabeblack@google.com      DPRINTF(RubySlicc, "Writing Data: %s to address %s\n", in_msg.DataBlk,
79714184Sgabeblack@google.com              in_msg.addr);
79814184Sgabeblack@google.com    }
79914184Sgabeblack@google.com  }
80014184Sgabeblack@google.com
80114184Sgabeblack@google.com  action(te_allocateTBEForEviction, "te", desc="allocate TBE Entry") {
80214184Sgabeblack@google.com    check_allocate(TBEs);
80314184Sgabeblack@google.com    TBEs.allocate(address);
80414184Sgabeblack@google.com    set_tbe(TBEs.lookup(address));
80514184Sgabeblack@google.com      tbe.writeMask.clear();
80614184Sgabeblack@google.com      tbe.wtData := false;
80714184Sgabeblack@google.com      tbe.atomicData := false;
80814184Sgabeblack@google.com      tbe.DataBlk := getDirectoryEntry(address).DataBlk; // Data only for WBs
80914184Sgabeblack@google.com      tbe.Dirty := false;
81014184Sgabeblack@google.com      tbe.NumPendingAcks := 0;
81114184Sgabeblack@google.com  }
81214184Sgabeblack@google.com
81314184Sgabeblack@google.com  action(t_allocateTBE, "t", desc="allocate TBE Entry") {
81414184Sgabeblack@google.com    check_allocate(TBEs);
81514184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
81614184Sgabeblack@google.com      TBEs.allocate(address);
81714184Sgabeblack@google.com      set_tbe(TBEs.lookup(address));
81814184Sgabeblack@google.com      if (in_msg.Type == CoherenceRequestType:WriteThrough) {
81914184Sgabeblack@google.com        tbe.writeMask.clear();
82014184Sgabeblack@google.com        tbe.writeMask.orMask(in_msg.writeMask);
82114184Sgabeblack@google.com        tbe.wtData := true;
82214184Sgabeblack@google.com        tbe.WTRequestor := in_msg.WTRequestor;
82314184Sgabeblack@google.com        tbe.LastSender := in_msg.Requestor;
82414184Sgabeblack@google.com      }
82514184Sgabeblack@google.com      if (in_msg.Type == CoherenceRequestType:Atomic) {
82614184Sgabeblack@google.com        tbe.writeMask.clear();
82714184Sgabeblack@google.com        tbe.writeMask.orMask(in_msg.writeMask);
82814184Sgabeblack@google.com        tbe.atomicData := true;
82914184Sgabeblack@google.com        tbe.WTRequestor := in_msg.WTRequestor;
83014184Sgabeblack@google.com        tbe.LastSender := in_msg.Requestor;
83114184Sgabeblack@google.com      }
83214184Sgabeblack@google.com      tbe.DataBlk := getDirectoryEntry(address).DataBlk; // Data only for WBs
83314184Sgabeblack@google.com      tbe.Dirty := false;
83414184Sgabeblack@google.com      if (in_msg.Type == CoherenceRequestType:WriteThrough) {
83514184Sgabeblack@google.com        tbe.DataBlk.copyPartial(in_msg.DataBlk,tbe.writeMask);
83614184Sgabeblack@google.com        tbe.Dirty := false;
83714184Sgabeblack@google.com      }
83814184Sgabeblack@google.com      tbe.OriginalRequestor := in_msg.Requestor;
83914184Sgabeblack@google.com      tbe.NumPendingAcks := 0;
84014184Sgabeblack@google.com      tbe.Cached := in_msg.ForceShared;
84114184Sgabeblack@google.com      tbe.InitialRequestTime := in_msg.InitialRequestTime;
84214184Sgabeblack@google.com    }
84314184Sgabeblack@google.com  }
84414184Sgabeblack@google.com
84514184Sgabeblack@google.com  action(dt_deallocateTBE, "dt", desc="deallocate TBE Entry") {
84614184Sgabeblack@google.com    if (tbe.Dirty == false) {
84714184Sgabeblack@google.com        getDirectoryEntry(address).DataBlk := tbe.DataBlk;
84814184Sgabeblack@google.com    }
84914184Sgabeblack@google.com    TBEs.deallocate(address);
85014184Sgabeblack@google.com    unset_tbe();
85114184Sgabeblack@google.com  }
85214184Sgabeblack@google.com
85314184Sgabeblack@google.com  action(wd_writeBackData, "wd", desc="Write back data if needed") {
85414184Sgabeblack@google.com    if (tbe.wtData) {
85514184Sgabeblack@google.com      DataBlock tmp := getDirectoryEntry(address).DataBlk;
85614184Sgabeblack@google.com      tmp.copyPartial(tbe.DataBlk,tbe.writeMask);
85714184Sgabeblack@google.com      tbe.DataBlk := tmp;
85814184Sgabeblack@google.com      getDirectoryEntry(address).DataBlk := tbe.DataBlk;
85914184Sgabeblack@google.com    } else if (tbe.atomicData) {
86014184Sgabeblack@google.com      tbe.DataBlk.atomicPartial(getDirectoryEntry(address).DataBlk,
86114184Sgabeblack@google.com                                tbe.writeMask);
86214184Sgabeblack@google.com      getDirectoryEntry(address).DataBlk := tbe.DataBlk;
86314184Sgabeblack@google.com    } else if (tbe.Dirty == false) {
86414184Sgabeblack@google.com      getDirectoryEntry(address).DataBlk := tbe.DataBlk;
86514184Sgabeblack@google.com    }
86614184Sgabeblack@google.com  }
86714184Sgabeblack@google.com
86814184Sgabeblack@google.com  action(mt_writeMemDataToTBE, "mt", desc="write Mem data to TBE") {
86914184Sgabeblack@google.com    peek(memQueue_in, MemoryMsg) {
87014184Sgabeblack@google.com      if (tbe.wtData == true) {
87114184Sgabeblack@google.com        // DO Nothing (already have the directory data)
87214184Sgabeblack@google.com      } else if (tbe.Dirty == false) {
87314184Sgabeblack@google.com        tbe.DataBlk := getDirectoryEntry(address).DataBlk;
87414184Sgabeblack@google.com      }
87514184Sgabeblack@google.com      tbe.MemData := true;
87614184Sgabeblack@google.com    }
87714184Sgabeblack@google.com  }
87814184Sgabeblack@google.com
87914184Sgabeblack@google.com  action(y_writeProbeDataToTBE, "y", desc="write Probe Data to TBE") {
88014184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
88114184Sgabeblack@google.com      if (in_msg.Dirty) {
88214184Sgabeblack@google.com        DPRINTF(RubySlicc, "Got dirty data for %s from %s\n", address, in_msg.Sender);
88314184Sgabeblack@google.com        DPRINTF(RubySlicc, "Data is %s\n", in_msg.DataBlk);
88414184Sgabeblack@google.com        if (tbe.wtData) {
88514184Sgabeblack@google.com          DataBlock tmp := in_msg.DataBlk;
88614184Sgabeblack@google.com          tmp.copyPartial(tbe.DataBlk,tbe.writeMask);
88714184Sgabeblack@google.com          tbe.DataBlk := tmp;
88814184Sgabeblack@google.com        } else if (tbe.Dirty) {
88914184Sgabeblack@google.com          if(tbe.atomicData == false && tbe.wtData == false) {
89014184Sgabeblack@google.com            DPRINTF(RubySlicc, "Got double data for %s from %s\n", address, in_msg.Sender);
89114184Sgabeblack@google.com            assert(tbe.DataBlk == in_msg.DataBlk);  // in case of double data
89214184Sgabeblack@google.com          }
89314184Sgabeblack@google.com        } else {
89414184Sgabeblack@google.com          tbe.DataBlk := in_msg.DataBlk;
89514184Sgabeblack@google.com          tbe.Dirty := in_msg.Dirty;
89614184Sgabeblack@google.com          tbe.LastSender := in_msg.Sender;
89714184Sgabeblack@google.com        }
89814184Sgabeblack@google.com      }
89914184Sgabeblack@google.com      if (in_msg.Hit) {
90014184Sgabeblack@google.com        tbe.Cached := true;
90114184Sgabeblack@google.com      }
90214184Sgabeblack@google.com    }
90314184Sgabeblack@google.com  }
90414184Sgabeblack@google.com
90514184Sgabeblack@google.com  action(mwc_markSinkWriteCancel, "mwc", desc="Mark to sink impending VicDirty") {
90614184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
90714184Sgabeblack@google.com      DPRINTF(RubySlicc, "Write cancel bit set on address %s\n", address);
90814184Sgabeblack@google.com      getDirectoryEntry(address).VicDirtyIgnore.add(in_msg.Sender);
90914184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(" setting bit to sink VicDirty ");
91014184Sgabeblack@google.com    }
91114184Sgabeblack@google.com  }
91214184Sgabeblack@google.com
91314184Sgabeblack@google.com  action(x_decrementAcks, "x", desc="decrement Acks pending") {
91414184Sgabeblack@google.com    tbe.NumPendingAcks := tbe.NumPendingAcks - 1;
91514184Sgabeblack@google.com    APPEND_TRANSITION_COMMENT(" Acks remaining: ");
91614184Sgabeblack@google.com    APPEND_TRANSITION_COMMENT(tbe.NumPendingAcks);
91714184Sgabeblack@google.com  }
91814184Sgabeblack@google.com
91914184Sgabeblack@google.com  action(o_checkForCompletion, "o", desc="check for ack completion") {
92014184Sgabeblack@google.com    if (tbe.NumPendingAcks == 0) {
92114184Sgabeblack@google.com      enqueue(triggerQueue_out, TriggerMsg, 1) {
92214184Sgabeblack@google.com        out_msg.addr := address;
92314184Sgabeblack@google.com        out_msg.Type := TriggerType:AcksComplete;
92414184Sgabeblack@google.com      }
92514184Sgabeblack@google.com    }
92614184Sgabeblack@google.com    APPEND_TRANSITION_COMMENT(" Check: Acks remaining: ");
92714184Sgabeblack@google.com    APPEND_TRANSITION_COMMENT(tbe.NumPendingAcks);
92814184Sgabeblack@google.com  }
92914184Sgabeblack@google.com
93014184Sgabeblack@google.com  action(rv_removeVicDirtyIgnore, "rv", desc="Remove ignored core") {
93114184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
93214184Sgabeblack@google.com      getDirectoryEntry(address).VicDirtyIgnore.remove(in_msg.Requestor);
93314184Sgabeblack@google.com    }
93414184Sgabeblack@google.com  }
93514184Sgabeblack@google.com
93614184Sgabeblack@google.com  action(al_allocateL3Block, "al", desc="allocate the L3 block on WB") {
93714184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
93814184Sgabeblack@google.com      if (L3CacheMemory.isTagPresent(address)) {
93914184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(address));
94014184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(" al wrote data to L3 (hit) ");
94114184Sgabeblack@google.com        entry.DataBlk := in_msg.DataBlk;
94214184Sgabeblack@google.com        entry.LastSender := in_msg.Sender;
94314184Sgabeblack@google.com      } else {
94414184Sgabeblack@google.com        if (L3CacheMemory.cacheAvail(address) == false) {
94514184Sgabeblack@google.com          Addr victim := L3CacheMemory.cacheProbe(address);
94614184Sgabeblack@google.com          CacheEntry victim_entry := static_cast(CacheEntry, "pointer",
94714184Sgabeblack@google.com                                                 L3CacheMemory.lookup(victim));
94814184Sgabeblack@google.com          queueMemoryWrite(machineID, victim, to_memory_controller_latency,
94914184Sgabeblack@google.com                           victim_entry.DataBlk);
95014184Sgabeblack@google.com          L3CacheMemory.deallocate(victim);
95114184Sgabeblack@google.com        }
95214184Sgabeblack@google.com        assert(L3CacheMemory.cacheAvail(address));
95314184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.allocate(address, new CacheEntry));
95414184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(" al wrote data to L3 ");
95514184Sgabeblack@google.com        entry.DataBlk := in_msg.DataBlk;
95614184Sgabeblack@google.com
95714184Sgabeblack@google.com        entry.LastSender := in_msg.Sender;
95814184Sgabeblack@google.com      }
95914184Sgabeblack@google.com    }
96014184Sgabeblack@google.com  }
96114184Sgabeblack@google.com
96214184Sgabeblack@google.com  action(alwt_allocateL3BlockOnWT, "alwt", desc="allocate the L3 block on WT") {
96314184Sgabeblack@google.com    if ((tbe.wtData || tbe.atomicData) && useL3OnWT) {
96414184Sgabeblack@google.com      if (L3CacheMemory.isTagPresent(address)) {
96514184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(address));
96614184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(" al wrote data to L3 (hit) ");
96714184Sgabeblack@google.com        entry.DataBlk := tbe.DataBlk;
96814184Sgabeblack@google.com        entry.LastSender := tbe.LastSender;
96914184Sgabeblack@google.com      } else {
97014184Sgabeblack@google.com        if (L3CacheMemory.cacheAvail(address) == false) {
97114184Sgabeblack@google.com          Addr victim := L3CacheMemory.cacheProbe(address);
97214184Sgabeblack@google.com          CacheEntry victim_entry := static_cast(CacheEntry, "pointer",
97314184Sgabeblack@google.com                                                 L3CacheMemory.lookup(victim));
97414184Sgabeblack@google.com          queueMemoryWrite(machineID, victim, to_memory_controller_latency,
97514184Sgabeblack@google.com                           victim_entry.DataBlk);
97614184Sgabeblack@google.com          L3CacheMemory.deallocate(victim);
97714184Sgabeblack@google.com        }
97814184Sgabeblack@google.com        assert(L3CacheMemory.cacheAvail(address));
97914184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.allocate(address, new CacheEntry));
98014184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(" al wrote data to L3 ");
98114184Sgabeblack@google.com        entry.DataBlk := tbe.DataBlk;
98214184Sgabeblack@google.com        entry.LastSender := tbe.LastSender;
98314184Sgabeblack@google.com      }
98414184Sgabeblack@google.com    }
98514184Sgabeblack@google.com  }
98614184Sgabeblack@google.com
98714184Sgabeblack@google.com  action(apf_allocateProbeFilterEntry, "apf", desc="Allocate probe filte entry") {
98814184Sgabeblack@google.com    if (!ProbeFilterMemory.isTagPresent(address)) {
98914184Sgabeblack@google.com        if (inclusiveDir) {
99014184Sgabeblack@google.com            assert(ProbeFilterMemory.cacheAvail(address));
99114184Sgabeblack@google.com        } else if (ProbeFilterMemory.cacheAvail(address) == false) {
99214184Sgabeblack@google.com          Addr victim := ProbeFilterMemory.cacheProbe(address);
99314184Sgabeblack@google.com          ProbeFilterMemory.deallocate(victim);
99414184Sgabeblack@google.com        }
99514184Sgabeblack@google.com        assert(ProbeFilterMemory.cacheAvail(address));
99614184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", ProbeFilterMemory.allocate(address, new CacheEntry));
99714184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(" allocating a new probe filter entry");
99814184Sgabeblack@google.com        entry.pfState := ProbeFilterState:NT;
99914184Sgabeblack@google.com        if (inclusiveDir) {
100014184Sgabeblack@google.com          entry.pfState := ProbeFilterState:T;
100114184Sgabeblack@google.com        }
100214184Sgabeblack@google.com        entry.isOnCPU := false;
100314184Sgabeblack@google.com        entry.isOnGPU := false;
100414184Sgabeblack@google.com    }
100514184Sgabeblack@google.com  }
100614184Sgabeblack@google.com
100714184Sgabeblack@google.com  action(mpfe_markPFEntryForEviction, "mpfe", desc="Mark this PF entry is being evicted") {
100814184Sgabeblack@google.com    assert(ProbeFilterMemory.isTagPresent(address));
100914184Sgabeblack@google.com    CacheEntry entry := static_cast(CacheEntry, "pointer", ProbeFilterMemory.lookup(address));
101014184Sgabeblack@google.com    entry.pfState := ProbeFilterState:B;
101114184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
101214184Sgabeblack@google.com      tbe.demandAddress := in_msg.addr;
101314184Sgabeblack@google.com    }
101414184Sgabeblack@google.com  }
101514184Sgabeblack@google.com
101614184Sgabeblack@google.com  action(we_wakeUpEvictionDependents, "we", desc="Wake up requests waiting for demand address and victim address") {
101714184Sgabeblack@google.com    wakeUpBuffers(address);
101814184Sgabeblack@google.com    wakeUpBuffers(tbe.demandAddress);
101914184Sgabeblack@google.com  }
102014184Sgabeblack@google.com
102114184Sgabeblack@google.com  action(dpf_deallocateProbeFilter, "dpf", desc="deallocate PF entry") {
102214184Sgabeblack@google.com    assert(ProbeFilterMemory.isTagPresent(address));
102314184Sgabeblack@google.com    ProbeFilterMemory.deallocate(address);
102414184Sgabeblack@google.com  }
102514184Sgabeblack@google.com
102614184Sgabeblack@google.com  action(upf_updateProbeFilter, "upf", desc="") {
102714184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
102814184Sgabeblack@google.com      assert(ProbeFilterMemory.isTagPresent(address));
102914184Sgabeblack@google.com      CacheEntry entry := static_cast(CacheEntry, "pointer", ProbeFilterMemory.lookup(address));
103014184Sgabeblack@google.com      if (in_msg.Type == CoherenceRequestType:WriteThrough) {
103114184Sgabeblack@google.com        entry.pfState := ProbeFilterState:T;
103214184Sgabeblack@google.com        entry.isOnCPU := false;
103314184Sgabeblack@google.com        entry.isOnGPU := false;
103414184Sgabeblack@google.com      } else if (in_msg.Type == CoherenceRequestType:Atomic) {
103514184Sgabeblack@google.com        entry.pfState := ProbeFilterState:T;
103614184Sgabeblack@google.com        entry.isOnCPU := false;
103714184Sgabeblack@google.com        entry.isOnGPU := false;
103814184Sgabeblack@google.com      } else if (in_msg.Type == CoherenceRequestType:RdBlkM) {
103914184Sgabeblack@google.com        entry.pfState := ProbeFilterState:T;
104014184Sgabeblack@google.com        entry.isOnCPU := false;
104114184Sgabeblack@google.com        entry.isOnGPU := false;
104214184Sgabeblack@google.com      } else if (in_msg.Type == CoherenceRequestType:CtoD) {
104314184Sgabeblack@google.com        entry.pfState := ProbeFilterState:T;
104414184Sgabeblack@google.com        entry.isOnCPU := false;
104514184Sgabeblack@google.com        entry.isOnGPU := false;
104614184Sgabeblack@google.com      }
104714184Sgabeblack@google.com      if(machineIDToMachineType(in_msg.Requestor) == MachineType:CorePair) {
104814184Sgabeblack@google.com        entry.isOnCPU := true;
104914184Sgabeblack@google.com      } else {
105014184Sgabeblack@google.com        entry.isOnGPU := true;
105114184Sgabeblack@google.com      }
105214184Sgabeblack@google.com    }
105314184Sgabeblack@google.com  }
105414184Sgabeblack@google.com
105514184Sgabeblack@google.com  action(rmcd_removeSharerConditional, "rmcd", desc="remove sharer from probe Filter, conditional") {
105614184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
105714184Sgabeblack@google.com      if (ProbeFilterMemory.isTagPresent(address)) {
105814184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", ProbeFilterMemory.lookup(address));
105914184Sgabeblack@google.com        if(machineIDToMachineType(in_msg.Requestor) == MachineType:CorePair) {//CorePair has inclusive L2
106014184Sgabeblack@google.com          if (in_msg.Type == CoherenceRequestType:VicDirty) {
106114184Sgabeblack@google.com            entry.isOnCPU := false;
106214184Sgabeblack@google.com          } else if (in_msg.Type == CoherenceRequestType:VicClean) {
106314184Sgabeblack@google.com            entry.isOnCPU := false;
106414184Sgabeblack@google.com          }
106514184Sgabeblack@google.com        }
106614184Sgabeblack@google.com      }
106714184Sgabeblack@google.com    }
106814184Sgabeblack@google.com  }
106914184Sgabeblack@google.com
107014184Sgabeblack@google.com  action(sf_setForwardReqTime, "sf", desc="...") {
107114184Sgabeblack@google.com    tbe.ForwardRequestTime := curCycle();
107214184Sgabeblack@google.com  }
107314184Sgabeblack@google.com
107414184Sgabeblack@google.com  action(dl_deallocateL3, "dl", desc="deallocate the L3 block") {
107514184Sgabeblack@google.com    L3CacheMemory.deallocate(address);
107614184Sgabeblack@google.com  }
107714184Sgabeblack@google.com
107814184Sgabeblack@google.com  action(p_popRequestQueue, "p", desc="pop request queue") {
107914184Sgabeblack@google.com    requestNetwork_in.dequeue(clockEdge());
108014184Sgabeblack@google.com  }
108114184Sgabeblack@google.com
108214184Sgabeblack@google.com  action(pr_popResponseQueue, "pr", desc="pop response queue") {
108314184Sgabeblack@google.com    responseNetwork_in.dequeue(clockEdge());
108414184Sgabeblack@google.com  }
108514184Sgabeblack@google.com
108614184Sgabeblack@google.com  action(pm_popMemQueue, "pm", desc="pop mem queue") {
108714184Sgabeblack@google.com    memQueue_in.dequeue(clockEdge());
108814184Sgabeblack@google.com  }
108914184Sgabeblack@google.com
109014184Sgabeblack@google.com  action(pt_popTriggerQueue, "pt", desc="pop trigger queue") {
109114184Sgabeblack@google.com    triggerQueue_in.dequeue(clockEdge());
109214184Sgabeblack@google.com  }
109314184Sgabeblack@google.com
109414184Sgabeblack@google.com  action(ptl_popTriggerQueue, "ptl", desc="pop L3 trigger queue") {
109514184Sgabeblack@google.com    L3TriggerQueue_in.dequeue(clockEdge());
109614184Sgabeblack@google.com  }
109714184Sgabeblack@google.com
109814184Sgabeblack@google.com  action(pu_popUnblockQueue, "pu", desc="pop unblock queue") {
109914184Sgabeblack@google.com    unblockNetwork_in.dequeue(clockEdge());
110014184Sgabeblack@google.com  }
110114184Sgabeblack@google.com
110214184Sgabeblack@google.com  action(zz_recycleRequestQueue, "zz", desc="recycle request queue") {
110314184Sgabeblack@google.com    requestNetwork_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
110414184Sgabeblack@google.com  }
110514184Sgabeblack@google.com
110614184Sgabeblack@google.com  action(yy_recycleResponseQueue, "yy", desc="recycle response queue") {
110714184Sgabeblack@google.com    responseNetwork_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
110814184Sgabeblack@google.com  }
110914184Sgabeblack@google.com
111014184Sgabeblack@google.com  action(st_stallAndWaitRequest, "st", desc="Stall and wait on the address") {
111114184Sgabeblack@google.com    stall_and_wait(requestNetwork_in, address);
111214184Sgabeblack@google.com  }
111314184Sgabeblack@google.com
111414184Sgabeblack@google.com  action(wa_wakeUpDependents, "wa", desc="Wake up any requests waiting for this address") {
111514184Sgabeblack@google.com    wakeUpBuffers(address);
111614184Sgabeblack@google.com  }
111714184Sgabeblack@google.com
111814184Sgabeblack@google.com  action(wa_wakeUpAllDependents, "waa", desc="Wake up any requests waiting for this region") {
111914184Sgabeblack@google.com    wakeUpAllBuffers();
112014184Sgabeblack@google.com  }
112114184Sgabeblack@google.com
112214184Sgabeblack@google.com  action(z_stall, "z", desc="...") {
112314184Sgabeblack@google.com  }
112414184Sgabeblack@google.com
112514184Sgabeblack@google.com  // TRANSITIONS
112614184Sgabeblack@google.com  transition({BL, BS_M, BM_M, B_M, BP, BS_PM, BM_PM, B_PM, BS_Pm, BM_Pm, B_Pm, B_P, B}, {RdBlkS, RdBlkM, RdBlk, CtoD}) {
112714184Sgabeblack@google.com    st_stallAndWaitRequest;
112814184Sgabeblack@google.com  }
112914184Sgabeblack@google.com
113014184Sgabeblack@google.com  // It may be possible to save multiple invalidations here!
113114184Sgabeblack@google.com  transition({BL, BS_M, BM_M, B_M, BP, BS_PM, BM_PM, B_PM, BS_Pm, BM_Pm, B_Pm, B_P, B}, {Atomic, WriteThrough}) {
113214184Sgabeblack@google.com    st_stallAndWaitRequest;
113314184Sgabeblack@google.com  }
113414184Sgabeblack@google.com
113514184Sgabeblack@google.com
113614184Sgabeblack@google.com  // transitions from U
113714184Sgabeblack@google.com  transition(U, PF_Repl, B_P) {PFTagArrayRead, PFTagArrayWrite}{
113814184Sgabeblack@google.com    te_allocateTBEForEviction;
113914184Sgabeblack@google.com    apf_allocateProbeFilterEntry;
114014184Sgabeblack@google.com    bp_backProbe;
114114184Sgabeblack@google.com    sm_setMRU;
114214184Sgabeblack@google.com    mpfe_markPFEntryForEviction;
114314184Sgabeblack@google.com  }
114414184Sgabeblack@google.com
114514184Sgabeblack@google.com  transition(U, {RdBlkS}, BS_PM) {L3TagArrayRead, PFTagArrayRead, PFTagArrayWrite} {
114614184Sgabeblack@google.com    t_allocateTBE;
114714184Sgabeblack@google.com    apf_allocateProbeFilterEntry;
114814184Sgabeblack@google.com    l_queueMemRdReq;
114914184Sgabeblack@google.com    sc_probeShrCoreData;
115014184Sgabeblack@google.com    sm_setMRU;
115114184Sgabeblack@google.com    upf_updateProbeFilter;
115214184Sgabeblack@google.com    p_popRequestQueue;
115314184Sgabeblack@google.com  }
115414184Sgabeblack@google.com
115514184Sgabeblack@google.com  transition(U, WriteThrough, BM_PM) {L3TagArrayRead, L3TagArrayWrite, PFTagArrayRead, PFTagArrayWrite} {
115614184Sgabeblack@google.com    t_allocateTBE;
115714184Sgabeblack@google.com    apf_allocateProbeFilterEntry;
115814184Sgabeblack@google.com    w_sendResponseWBAck;
115914184Sgabeblack@google.com    l_queueMemRdReq;
116014184Sgabeblack@google.com    dc_probeInvCoreData;
116114184Sgabeblack@google.com    sm_setMRU;
116214184Sgabeblack@google.com    upf_updateProbeFilter;
116314184Sgabeblack@google.com    p_popRequestQueue;
116414184Sgabeblack@google.com  }
116514184Sgabeblack@google.com
116614184Sgabeblack@google.com  transition(U, Atomic, BM_PM) {L3TagArrayRead, L3TagArrayWrite, PFTagArrayRead, PFTagArrayWrite} {
116714184Sgabeblack@google.com    t_allocateTBE;
116814184Sgabeblack@google.com    apf_allocateProbeFilterEntry;
116914184Sgabeblack@google.com    l_queueMemRdReq;
117014184Sgabeblack@google.com    dc_probeInvCoreData;
117114184Sgabeblack@google.com    sm_setMRU;
117214184Sgabeblack@google.com    upf_updateProbeFilter;
117314184Sgabeblack@google.com    p_popRequestQueue;
117414184Sgabeblack@google.com  }
117514184Sgabeblack@google.com
117614184Sgabeblack@google.com  transition(U, {RdBlkM}, BM_PM) {L3TagArrayRead, PFTagArrayRead, PFTagArrayWrite} {
117714184Sgabeblack@google.com    t_allocateTBE;
117814184Sgabeblack@google.com    apf_allocateProbeFilterEntry;
117914184Sgabeblack@google.com    l_queueMemRdReq;
118014184Sgabeblack@google.com    dc_probeInvCoreData;
118114184Sgabeblack@google.com    sm_setMRU;
118214184Sgabeblack@google.com    upf_updateProbeFilter;
118314184Sgabeblack@google.com    p_popRequestQueue;
118414184Sgabeblack@google.com  }
118514184Sgabeblack@google.com
118614184Sgabeblack@google.com  transition(U, RdBlk, B_PM) {L3TagArrayRead, PFTagArrayRead, PFTagArrayWrite}{
118714184Sgabeblack@google.com    t_allocateTBE;
118814184Sgabeblack@google.com    apf_allocateProbeFilterEntry;
118914184Sgabeblack@google.com    l_queueMemRdReq;
119014184Sgabeblack@google.com    sc_probeShrCoreData;
119114184Sgabeblack@google.com    sm_setMRU;
119214184Sgabeblack@google.com    upf_updateProbeFilter;
119314184Sgabeblack@google.com    p_popRequestQueue;
119414184Sgabeblack@google.com  }
119514184Sgabeblack@google.com
119614184Sgabeblack@google.com  transition(U, CtoD, BP) {L3TagArrayRead, PFTagArrayRead, PFTagArrayWrite} {
119714184Sgabeblack@google.com    t_allocateTBE;
119814184Sgabeblack@google.com    apf_allocateProbeFilterEntry;
119914184Sgabeblack@google.com    ic_probeInvCore;
120014184Sgabeblack@google.com    sm_setMRU;
120114184Sgabeblack@google.com    upf_updateProbeFilter;
120214184Sgabeblack@google.com    p_popRequestQueue;
120314184Sgabeblack@google.com  }
120414184Sgabeblack@google.com
120514184Sgabeblack@google.com  transition(U, VicDirty, BL) {L3TagArrayRead} {
120614184Sgabeblack@google.com    t_allocateTBE;
120714184Sgabeblack@google.com    w_sendResponseWBAck;
120814184Sgabeblack@google.com    rmcd_removeSharerConditional;
120914184Sgabeblack@google.com    p_popRequestQueue;
121014184Sgabeblack@google.com  }
121114184Sgabeblack@google.com
121214184Sgabeblack@google.com  transition(U, VicClean, BL) {L3TagArrayRead} {
121314184Sgabeblack@google.com    t_allocateTBE;
121414184Sgabeblack@google.com    w_sendResponseWBAck;
121514184Sgabeblack@google.com    rmcd_removeSharerConditional;
121614184Sgabeblack@google.com    p_popRequestQueue;
121714184Sgabeblack@google.com  }
121814184Sgabeblack@google.com
121914184Sgabeblack@google.com  transition(BL, {VicDirty, VicClean}) {
122014184Sgabeblack@google.com    zz_recycleRequestQueue;
122114184Sgabeblack@google.com  }
122214184Sgabeblack@google.com
122314184Sgabeblack@google.com  transition(BL, CPUData, U) {L3TagArrayWrite, L3DataArrayWrite} {
122414184Sgabeblack@google.com    d_writeDataToMemory;
122514184Sgabeblack@google.com    al_allocateL3Block;
122614184Sgabeblack@google.com    wa_wakeUpDependents;
122714184Sgabeblack@google.com    dt_deallocateTBE;
122814184Sgabeblack@google.com    //l_queueMemWBReq;  // why need an ack?  esp. with DRAMSim, just put it in queue no ack needed
122914184Sgabeblack@google.com    pr_popResponseQueue;
123014184Sgabeblack@google.com  }
123114184Sgabeblack@google.com
123214184Sgabeblack@google.com  transition(BL, StaleWB, U) {L3TagArrayWrite} {
123314184Sgabeblack@google.com    dt_deallocateTBE;
123414184Sgabeblack@google.com    wa_wakeUpAllDependents;
123514184Sgabeblack@google.com    pr_popResponseQueue;
123614184Sgabeblack@google.com  }
123714184Sgabeblack@google.com
123814184Sgabeblack@google.com  transition({B, BS_M, BM_M, B_M, BP, BS_PM, BM_PM, B_PM, BS_Pm, BM_Pm, B_Pm, B_P}, {VicDirty, VicClean}) {
123914184Sgabeblack@google.com    z_stall;
124014184Sgabeblack@google.com  }
124114184Sgabeblack@google.com
124214184Sgabeblack@google.com  transition({U, BL, BS_M, BM_M, B_M, BP, BS_PM, BM_PM, B_PM, BS_Pm, BM_Pm, B_Pm, B_P, B}, WBAck) {
124314184Sgabeblack@google.com    pm_popMemQueue;
124414184Sgabeblack@google.com  }
124514184Sgabeblack@google.com
124614184Sgabeblack@google.com  transition({BL, BS_M, BM_M, B_M, BP, BS_PM, BM_PM, B_PM, BS_Pm, BM_Pm, B_Pm, B_P, B}, PF_Repl) {
124714184Sgabeblack@google.com    zz_recycleRequestQueue;
124814184Sgabeblack@google.com  }
124914184Sgabeblack@google.com
125014184Sgabeblack@google.com  transition({U, BL, BS_M, BM_M, B_M, BP, BS_PM, BM_PM, B_PM, BS_Pm, BM_Pm, B_Pm, B_P, B}, StaleVicDirty) {
125114184Sgabeblack@google.com    rv_removeVicDirtyIgnore;
125214184Sgabeblack@google.com    w_sendResponseWBAck;
125314184Sgabeblack@google.com    p_popRequestQueue;
125414184Sgabeblack@google.com  }
125514184Sgabeblack@google.com
125614184Sgabeblack@google.com  transition({B}, CoreUnblock, U) {
125714184Sgabeblack@google.com    wa_wakeUpDependents;
125814184Sgabeblack@google.com    pu_popUnblockQueue;
125914184Sgabeblack@google.com  }
126014184Sgabeblack@google.com
126114184Sgabeblack@google.com  transition(B, UnblockWriteThrough, U) {
126214184Sgabeblack@google.com    wa_wakeUpDependents;
126314184Sgabeblack@google.com    pt_popTriggerQueue;
126414184Sgabeblack@google.com  }
126514184Sgabeblack@google.com
126614184Sgabeblack@google.com  transition(BS_PM, MemData, BS_Pm) {} {
126714184Sgabeblack@google.com    mt_writeMemDataToTBE;
126814184Sgabeblack@google.com    pm_popMemQueue;
126914184Sgabeblack@google.com  }
127014184Sgabeblack@google.com
127114184Sgabeblack@google.com  transition(BM_PM, MemData, BM_Pm){} {
127214184Sgabeblack@google.com    mt_writeMemDataToTBE;
127314184Sgabeblack@google.com    pm_popMemQueue;
127414184Sgabeblack@google.com  }
127514184Sgabeblack@google.com
127614184Sgabeblack@google.com  transition(B_PM, MemData, B_Pm){} {
127714184Sgabeblack@google.com    mt_writeMemDataToTBE;
127814184Sgabeblack@google.com    pm_popMemQueue;
127914184Sgabeblack@google.com  }
128014184Sgabeblack@google.com
128114184Sgabeblack@google.com  transition(BS_PM, L3Hit, BS_Pm) {} {
128214184Sgabeblack@google.com    ptl_popTriggerQueue;
128314184Sgabeblack@google.com  }
128414184Sgabeblack@google.com
128514184Sgabeblack@google.com  transition(BM_PM, L3Hit, BM_Pm) {} {
128614184Sgabeblack@google.com    ptl_popTriggerQueue;
128714184Sgabeblack@google.com  }
128814184Sgabeblack@google.com
128914184Sgabeblack@google.com  transition(B_PM, L3Hit, B_Pm) {} {
129014184Sgabeblack@google.com    ptl_popTriggerQueue;
129114184Sgabeblack@google.com  }
129214184Sgabeblack@google.com
129314184Sgabeblack@google.com  transition(BS_M, MemData, B){L3TagArrayWrite, L3DataArrayWrite} {
129414184Sgabeblack@google.com    mt_writeMemDataToTBE;
129514184Sgabeblack@google.com    s_sendResponseS;
129614184Sgabeblack@google.com    wd_writeBackData;
129714184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
129814184Sgabeblack@google.com    dt_deallocateTBE;
129914184Sgabeblack@google.com    pm_popMemQueue;
130014184Sgabeblack@google.com  }
130114184Sgabeblack@google.com
130214184Sgabeblack@google.com  transition(BM_M, MemData, B){L3TagArrayWrite, L3DataArrayWrite} {
130314184Sgabeblack@google.com    mt_writeMemDataToTBE;
130414184Sgabeblack@google.com    m_sendResponseM;
130514184Sgabeblack@google.com    wd_writeBackData;
130614184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
130714184Sgabeblack@google.com    dt_deallocateTBE;
130814184Sgabeblack@google.com    pm_popMemQueue;
130914184Sgabeblack@google.com  }
131014184Sgabeblack@google.com
131114184Sgabeblack@google.com  transition(B_M, MemData, B){L3TagArrayWrite, L3DataArrayWrite} {
131214184Sgabeblack@google.com    mt_writeMemDataToTBE;
131314184Sgabeblack@google.com    es_sendResponseES;
131414184Sgabeblack@google.com    wd_writeBackData;
131514184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
131614184Sgabeblack@google.com    dt_deallocateTBE;
131714184Sgabeblack@google.com    pm_popMemQueue;
131814184Sgabeblack@google.com  }
131914184Sgabeblack@google.com
132014184Sgabeblack@google.com  transition(BS_M, L3Hit, B) {L3TagArrayWrite, L3DataArrayWrite} {
132114184Sgabeblack@google.com    s_sendResponseS;
132214184Sgabeblack@google.com    wd_writeBackData;
132314184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
132414184Sgabeblack@google.com    dt_deallocateTBE;
132514184Sgabeblack@google.com    ptl_popTriggerQueue;
132614184Sgabeblack@google.com  }
132714184Sgabeblack@google.com
132814184Sgabeblack@google.com  transition(BM_M, L3Hit, B) {L3DataArrayWrite, L3TagArrayWrite} {
132914184Sgabeblack@google.com    m_sendResponseM;
133014184Sgabeblack@google.com    wd_writeBackData;
133114184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
133214184Sgabeblack@google.com    dt_deallocateTBE;
133314184Sgabeblack@google.com    ptl_popTriggerQueue;
133414184Sgabeblack@google.com  }
133514184Sgabeblack@google.com
133614184Sgabeblack@google.com  transition(B_M, L3Hit, B) {L3DataArrayWrite, L3TagArrayWrite} {
133714184Sgabeblack@google.com    es_sendResponseES;
133814184Sgabeblack@google.com    wd_writeBackData;
133914184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
134014184Sgabeblack@google.com    dt_deallocateTBE;
134114184Sgabeblack@google.com    ptl_popTriggerQueue;
134214184Sgabeblack@google.com  }
134314184Sgabeblack@google.com
134414184Sgabeblack@google.com  transition({BS_PM, BM_PM, B_PM, BS_Pm, BM_Pm, B_Pm, B_P, BP}, CPUPrbResp) {
134514184Sgabeblack@google.com    y_writeProbeDataToTBE;
134614184Sgabeblack@google.com    x_decrementAcks;
134714184Sgabeblack@google.com    o_checkForCompletion;
134814184Sgabeblack@google.com    pr_popResponseQueue;
134914184Sgabeblack@google.com  }
135014184Sgabeblack@google.com
135114184Sgabeblack@google.com  transition(BS_PM, ProbeAcksComplete, BS_M) {} {
135214184Sgabeblack@google.com    sf_setForwardReqTime;
135314184Sgabeblack@google.com    pt_popTriggerQueue;
135414184Sgabeblack@google.com  }
135514184Sgabeblack@google.com
135614184Sgabeblack@google.com  transition(BM_PM, ProbeAcksComplete, BM_M) {} {
135714184Sgabeblack@google.com    sf_setForwardReqTime;
135814184Sgabeblack@google.com    pt_popTriggerQueue;
135914184Sgabeblack@google.com  }
136014184Sgabeblack@google.com
136114184Sgabeblack@google.com  transition(B_PM, ProbeAcksComplete, B_M){} {
136214184Sgabeblack@google.com    sf_setForwardReqTime;
136314184Sgabeblack@google.com    pt_popTriggerQueue;
136414184Sgabeblack@google.com  }
136514184Sgabeblack@google.com
136614184Sgabeblack@google.com  transition(BS_Pm, ProbeAcksComplete, B){L3DataArrayWrite, L3TagArrayWrite} {
136714184Sgabeblack@google.com    sf_setForwardReqTime;
136814184Sgabeblack@google.com    s_sendResponseS;
136914184Sgabeblack@google.com    wd_writeBackData;
137014184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
137114184Sgabeblack@google.com    dt_deallocateTBE;
137214184Sgabeblack@google.com    pt_popTriggerQueue;
137314184Sgabeblack@google.com  }
137414184Sgabeblack@google.com
137514184Sgabeblack@google.com  transition(BM_Pm, ProbeAcksComplete, B){L3DataArrayWrite, L3TagArrayWrite} {
137614184Sgabeblack@google.com    sf_setForwardReqTime;
137714184Sgabeblack@google.com    m_sendResponseM;
137814184Sgabeblack@google.com    wd_writeBackData;
137914184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
138014184Sgabeblack@google.com    dt_deallocateTBE;
138114184Sgabeblack@google.com    pt_popTriggerQueue;
138214184Sgabeblack@google.com  }
138314184Sgabeblack@google.com
138414184Sgabeblack@google.com  transition(B_Pm, ProbeAcksComplete, B){L3DataArrayWrite, L3TagArrayWrite} {
138514184Sgabeblack@google.com    sf_setForwardReqTime;
138614184Sgabeblack@google.com    es_sendResponseES;
138714184Sgabeblack@google.com    wd_writeBackData;
138814184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
138914184Sgabeblack@google.com    dt_deallocateTBE;
139014184Sgabeblack@google.com    pt_popTriggerQueue;
139114184Sgabeblack@google.com  }
139214184Sgabeblack@google.com
139314184Sgabeblack@google.com  transition(B_P, ProbeAcksComplete, U) {
139414184Sgabeblack@google.com    wd_writeBackData;
139514184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
139614184Sgabeblack@google.com    we_wakeUpEvictionDependents;
139714184Sgabeblack@google.com    dpf_deallocateProbeFilter;
139814184Sgabeblack@google.com    dt_deallocateTBE;
139914184Sgabeblack@google.com    pt_popTriggerQueue;
140014184Sgabeblack@google.com  }
140114184Sgabeblack@google.com
140214184Sgabeblack@google.com  transition(BP, ProbeAcksComplete, B){L3TagArrayWrite, L3TagArrayWrite} {
140314184Sgabeblack@google.com    sf_setForwardReqTime;
140414184Sgabeblack@google.com    c_sendResponseCtoD;
140514184Sgabeblack@google.com    wd_writeBackData;
140614184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
140714184Sgabeblack@google.com    dt_deallocateTBE;
140814184Sgabeblack@google.com    pt_popTriggerQueue;
140914184Sgabeblack@google.com  }
141014184Sgabeblack@google.com}
1411