114184Sgabeblack@google.com/*
214184Sgabeblack@google.com * Copyright (c) 2010-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 */
3514184Sgabeblack@google.com
3614184Sgabeblack@google.commachine(MachineType:Directory, "AMD Baseline protocol")
3714184Sgabeblack@google.com: DirectoryMemory * directory;
3814184Sgabeblack@google.com  CacheMemory * L3CacheMemory;
3914184Sgabeblack@google.com  Cycles response_latency := 5;
4014184Sgabeblack@google.com  Cycles l3_hit_latency := 50;
4114184Sgabeblack@google.com  bool noTCCdir := "False";
4214184Sgabeblack@google.com  bool CPUonly := "False";
4314184Sgabeblack@google.com  int TCC_select_num_bits;
4414184Sgabeblack@google.com  bool useL3OnWT := "False";
4514184Sgabeblack@google.com  Cycles to_memory_controller_latency := 1;
4614184Sgabeblack@google.com
4714184Sgabeblack@google.com  // From the Cores
4814184Sgabeblack@google.com  MessageBuffer * requestFromCores, network="From", virtual_network="0", vnet_type="request";
4914184Sgabeblack@google.com  MessageBuffer * responseFromCores, network="From", virtual_network="2", vnet_type="response";
5014184Sgabeblack@google.com  MessageBuffer * unblockFromCores, network="From", virtual_network="4", vnet_type="unblock";
5114184Sgabeblack@google.com
5214184Sgabeblack@google.com  MessageBuffer * probeToCore, network="To", virtual_network="0", vnet_type="request";
5314184Sgabeblack@google.com  MessageBuffer * responseToCore, network="To", virtual_network="2", vnet_type="response";
5414184Sgabeblack@google.com
5514184Sgabeblack@google.com  MessageBuffer * triggerQueue;
5614184Sgabeblack@google.com  MessageBuffer * L3triggerQueue;
5714184Sgabeblack@google.com  MessageBuffer * responseFromMemory;
5814184Sgabeblack@google.com{
5914184Sgabeblack@google.com  // STATES
6014184Sgabeblack@google.com  state_declaration(State, desc="Directory states", default="Directory_State_U") {
6114184Sgabeblack@google.com    U, AccessPermission:Backing_Store,                 desc="unblocked";
6214184Sgabeblack@google.com    BL, AccessPermission:Busy,                  desc="got L3 WB request";
6314184Sgabeblack@google.com    // BL is Busy because it's possible for the data only to be in the network
6414184Sgabeblack@google.com    // in the WB, L3 has sent it and gone on with its business in possibly I
6514184Sgabeblack@google.com    // state.
6614184Sgabeblack@google.com    BS_M, AccessPermission:Backing_Store,                 desc="blocked waiting for memory";
6714184Sgabeblack@google.com    BM_M, AccessPermission:Backing_Store,                 desc="blocked waiting for memory";
6814184Sgabeblack@google.com    B_M, AccessPermission:Backing_Store,                 desc="blocked waiting for memory";
6914184Sgabeblack@google.com    BP, AccessPermission:Backing_Store,                 desc="blocked waiting for probes, no need for memory";
7014184Sgabeblack@google.com    BS_PM, AccessPermission:Backing_Store,                desc="blocked waiting for probes and Memory";
7114184Sgabeblack@google.com    BM_PM, AccessPermission:Backing_Store,                desc="blocked waiting for probes and Memory";
7214184Sgabeblack@google.com    B_PM, AccessPermission:Backing_Store,                desc="blocked waiting for probes and Memory";
7314184Sgabeblack@google.com    BS_Pm, AccessPermission:Backing_Store,                desc="blocked waiting for probes, already got memory";
7414184Sgabeblack@google.com    BM_Pm, AccessPermission:Backing_Store,                desc="blocked waiting for probes, already got memory";
7514184Sgabeblack@google.com    B_Pm, AccessPermission:Backing_Store,                desc="blocked waiting for probes, already got memory";
7614184Sgabeblack@google.com    B, AccessPermission:Backing_Store,                  desc="sent response, Blocked til ack";
7714184Sgabeblack@google.com  }
7814184Sgabeblack@google.com
7914184Sgabeblack@google.com  // Events
8014184Sgabeblack@google.com  enumeration(Event, desc="Directory events") {
8114184Sgabeblack@google.com    // CPU requests
8214184Sgabeblack@google.com    RdBlkS,             desc="...";
8314184Sgabeblack@google.com    RdBlkM,             desc="...";
8414184Sgabeblack@google.com    RdBlk,              desc="...";
8514184Sgabeblack@google.com    CtoD,               desc="...";
8614184Sgabeblack@google.com    WriteThrough,       desc="WriteThrough Message";
8714184Sgabeblack@google.com    Atomic,             desc="Atomic Message";
8814184Sgabeblack@google.com
8914184Sgabeblack@google.com    // writebacks
9014184Sgabeblack@google.com    VicDirty,           desc="...";
9114184Sgabeblack@google.com    VicClean,           desc="...";
9214184Sgabeblack@google.com    CPUData,            desc="WB data from CPU";
9314184Sgabeblack@google.com    StaleWB,         desc="Notification that WB has been superceded by a probe";
9414184Sgabeblack@google.com
9514184Sgabeblack@google.com    // probe responses
9614184Sgabeblack@google.com    CPUPrbResp,            desc="Probe Response Msg";
9714184Sgabeblack@google.com
9814184Sgabeblack@google.com    ProbeAcksComplete,  desc="Probe Acks Complete";
9914184Sgabeblack@google.com
10014184Sgabeblack@google.com    L3Hit,              desc="Hit in L3 return data to core";
10114184Sgabeblack@google.com
10214184Sgabeblack@google.com    // Memory Controller
10314184Sgabeblack@google.com    MemData, desc="Fetched data from memory arrives";
10414184Sgabeblack@google.com    WBAck, desc="Writeback Ack from memory arrives";
10514184Sgabeblack@google.com
10614184Sgabeblack@google.com    CoreUnblock,            desc="Core received data, unblock";
10714184Sgabeblack@google.com    UnblockWriteThrough,    desc="Unblock because of writethrough request finishing";
10814184Sgabeblack@google.com
10914184Sgabeblack@google.com    StaleVicDirty,        desc="Core invalidated before VicDirty processed";
11014184Sgabeblack@google.com  }
11114184Sgabeblack@google.com
11214184Sgabeblack@google.com  enumeration(RequestType, desc="To communicate stats from transitions to recordStats") {
11314184Sgabeblack@google.com    L3DataArrayRead,    desc="Read the data array";
11414184Sgabeblack@google.com    L3DataArrayWrite,   desc="Write the data array";
11514184Sgabeblack@google.com    L3TagArrayRead,     desc="Read the data array";
11614184Sgabeblack@google.com    L3TagArrayWrite,    desc="Write the data array";
11714184Sgabeblack@google.com  }
11814184Sgabeblack@google.com
11914184Sgabeblack@google.com  // TYPES
12014184Sgabeblack@google.com
12114184Sgabeblack@google.com  // DirectoryEntry
12214184Sgabeblack@google.com  structure(Entry, desc="...", interface="AbstractEntry") {
12314184Sgabeblack@google.com    State DirectoryState,          desc="Directory state";
12414184Sgabeblack@google.com    DataBlock DataBlk,             desc="data for the block";
12514184Sgabeblack@google.com    NetDest VicDirtyIgnore,  desc="VicDirty coming from whom to ignore";
12614184Sgabeblack@google.com  }
12714184Sgabeblack@google.com
12814184Sgabeblack@google.com  structure(CacheEntry, desc="...", interface="AbstractCacheEntry") {
12914184Sgabeblack@google.com    DataBlock DataBlk,          desc="data for the block";
13014184Sgabeblack@google.com    MachineID LastSender,       desc="Mach which this block came from";
13114184Sgabeblack@google.com  }
13214184Sgabeblack@google.com
13314184Sgabeblack@google.com  structure(TBE, desc="...") {
13414184Sgabeblack@google.com    State TBEState,     desc="Transient state";
13514184Sgabeblack@google.com    DataBlock DataBlk,  desc="data for the block";
13614184Sgabeblack@google.com    bool Dirty,         desc="Is the data dirty?";
13714184Sgabeblack@google.com    int NumPendingAcks,        desc="num acks expected";
13814184Sgabeblack@google.com    MachineID OriginalRequestor,        desc="Original Requestor";
13914184Sgabeblack@google.com    MachineID WTRequestor,        desc="WT Requestor";
14014184Sgabeblack@google.com    bool Cached,        desc="data hit in Cache";
14114184Sgabeblack@google.com    bool MemData,       desc="Got MemData?",default="false";
14214184Sgabeblack@google.com    bool wtData,       desc="Got write through data?",default="false";
14314184Sgabeblack@google.com    bool atomicData,   desc="Got Atomic op?",default="false";
14414184Sgabeblack@google.com    Cycles InitialRequestTime, desc="...";
14514184Sgabeblack@google.com    Cycles ForwardRequestTime, desc="...";
14614184Sgabeblack@google.com    Cycles ProbeRequestStartTime, desc="...";
14714184Sgabeblack@google.com    MachineID LastSender, desc="Mach which this block came from";
14814184Sgabeblack@google.com    bool L3Hit, default="false", desc="Was this an L3 hit?";
14914184Sgabeblack@google.com    uint64_t probe_id,        desc="probe id for lifetime profiling";
15014184Sgabeblack@google.com    WriteMask writeMask,    desc="outstanding write through mask";
15114184Sgabeblack@google.com  }
15214184Sgabeblack@google.com
15314184Sgabeblack@google.com  structure(TBETable, external="yes") {
15414184Sgabeblack@google.com    TBE lookup(Addr);
15514184Sgabeblack@google.com    void allocate(Addr);
15614184Sgabeblack@google.com    void deallocate(Addr);
15714184Sgabeblack@google.com    bool isPresent(Addr);
15814184Sgabeblack@google.com  }
15914184Sgabeblack@google.com
16014184Sgabeblack@google.com  TBETable TBEs, template="<Directory_TBE>", constructor="m_number_of_TBEs";
16114184Sgabeblack@google.com
16214184Sgabeblack@google.com  int TCC_select_low_bit, default="RubySystem::getBlockSizeBits()";
16314184Sgabeblack@google.com
16414184Sgabeblack@google.com  Tick clockEdge();
16514184Sgabeblack@google.com  Tick cyclesToTicks(Cycles c);
16614184Sgabeblack@google.com
16714184Sgabeblack@google.com  void set_tbe(TBE a);
16814184Sgabeblack@google.com  void unset_tbe();
16914184Sgabeblack@google.com  void wakeUpAllBuffers();
17014184Sgabeblack@google.com  void wakeUpBuffers(Addr a);
17114184Sgabeblack@google.com  Cycles curCycle();
17214184Sgabeblack@google.com
17314184Sgabeblack@google.com  Entry getDirectoryEntry(Addr addr), return_by_pointer="yes" {
17414184Sgabeblack@google.com    Entry dir_entry := static_cast(Entry, "pointer", directory.lookup(addr));
17514184Sgabeblack@google.com
17614184Sgabeblack@google.com    if (is_valid(dir_entry)) {
17714184Sgabeblack@google.com      return dir_entry;
17814184Sgabeblack@google.com    }
17914184Sgabeblack@google.com
18014184Sgabeblack@google.com    dir_entry :=  static_cast(Entry, "pointer",
18114184Sgabeblack@google.com                              directory.allocate(addr, new Entry));
18214184Sgabeblack@google.com    return dir_entry;
18314184Sgabeblack@google.com  }
18414184Sgabeblack@google.com
18514184Sgabeblack@google.com  DataBlock getDataBlock(Addr addr), return_by_ref="yes" {
18614184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
18714184Sgabeblack@google.com    if (is_valid(tbe) && tbe.MemData) {
18814184Sgabeblack@google.com      DPRINTF(RubySlicc, "Returning DataBlk from TBE %s:%s\n", addr, tbe);
18914184Sgabeblack@google.com      return tbe.DataBlk;
19014184Sgabeblack@google.com    }
19114184Sgabeblack@google.com    DPRINTF(RubySlicc, "Returning DataBlk from Dir %s:%s\n", addr, getDirectoryEntry(addr));
19214184Sgabeblack@google.com    return getDirectoryEntry(addr).DataBlk;
19314184Sgabeblack@google.com  }
19414184Sgabeblack@google.com
19514184Sgabeblack@google.com  State getState(TBE tbe, CacheEntry entry, Addr addr) {
19614184Sgabeblack@google.com    return getDirectoryEntry(addr).DirectoryState;
19714184Sgabeblack@google.com  }
19814184Sgabeblack@google.com
19914184Sgabeblack@google.com  void setState(TBE tbe, CacheEntry entry, Addr addr, State state) {
20014184Sgabeblack@google.com    getDirectoryEntry(addr).DirectoryState := state;
20114184Sgabeblack@google.com  }
20214184Sgabeblack@google.com
20314184Sgabeblack@google.com  void functionalRead(Addr addr, Packet *pkt) {
20414184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
20514184Sgabeblack@google.com    if(is_valid(tbe)) {
20614184Sgabeblack@google.com      testAndRead(addr, tbe.DataBlk, pkt);
20714184Sgabeblack@google.com    } else {
20814184Sgabeblack@google.com      functionalMemoryRead(pkt);
20914184Sgabeblack@google.com    }
21014184Sgabeblack@google.com  }
21114184Sgabeblack@google.com
21214184Sgabeblack@google.com  int functionalWrite(Addr addr, Packet *pkt) {
21314184Sgabeblack@google.com    int num_functional_writes := 0;
21414184Sgabeblack@google.com
21514184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
21614184Sgabeblack@google.com    if(is_valid(tbe)) {
21714184Sgabeblack@google.com      num_functional_writes := num_functional_writes +
21814184Sgabeblack@google.com            testAndWrite(addr, tbe.DataBlk, pkt);
21914184Sgabeblack@google.com    }
22014184Sgabeblack@google.com
22114184Sgabeblack@google.com    num_functional_writes := num_functional_writes
22214184Sgabeblack@google.com        + functionalMemoryWrite(pkt);
22314184Sgabeblack@google.com    return num_functional_writes;
22414184Sgabeblack@google.com  }
22514184Sgabeblack@google.com
22614184Sgabeblack@google.com  AccessPermission getAccessPermission(Addr addr) {
22714184Sgabeblack@google.com    // For this Directory, all permissions are just tracked in Directory, since
22814184Sgabeblack@google.com    // it's not possible to have something in TBE but not Dir, just keep track
22914184Sgabeblack@google.com    // of state all in one place.
23014184Sgabeblack@google.com    if (directory.isPresent(addr)) {
23114184Sgabeblack@google.com      return Directory_State_to_permission(getDirectoryEntry(addr).DirectoryState);
23214184Sgabeblack@google.com    }
23314184Sgabeblack@google.com
23414184Sgabeblack@google.com    return AccessPermission:NotPresent;
23514184Sgabeblack@google.com  }
23614184Sgabeblack@google.com
23714184Sgabeblack@google.com  void setAccessPermission(CacheEntry entry, Addr addr, State state) {
23814184Sgabeblack@google.com    getDirectoryEntry(addr).changePermission(Directory_State_to_permission(state));
23914184Sgabeblack@google.com  }
24014184Sgabeblack@google.com
24114184Sgabeblack@google.com  void recordRequestType(RequestType request_type, Addr addr) {
24214184Sgabeblack@google.com    if (request_type == RequestType:L3DataArrayRead) {
24314184Sgabeblack@google.com        L3CacheMemory.recordRequestType(CacheRequestType:DataArrayRead, addr);
24414184Sgabeblack@google.com    } else if (request_type == RequestType:L3DataArrayWrite) {
24514184Sgabeblack@google.com        L3CacheMemory.recordRequestType(CacheRequestType:DataArrayWrite, addr);
24614184Sgabeblack@google.com    } else if (request_type == RequestType:L3TagArrayRead) {
24714184Sgabeblack@google.com        L3CacheMemory.recordRequestType(CacheRequestType:TagArrayRead, addr);
24814184Sgabeblack@google.com    } else if (request_type == RequestType:L3TagArrayWrite) {
24914184Sgabeblack@google.com        L3CacheMemory.recordRequestType(CacheRequestType:TagArrayWrite, addr);
25014184Sgabeblack@google.com    }
25114184Sgabeblack@google.com  }
25214184Sgabeblack@google.com
25314184Sgabeblack@google.com  bool checkResourceAvailable(RequestType request_type, Addr addr) {
25414184Sgabeblack@google.com    if (request_type == RequestType:L3DataArrayRead) {
25514184Sgabeblack@google.com      return L3CacheMemory.checkResourceAvailable(CacheResourceType:DataArray, addr);
25614184Sgabeblack@google.com    } else if (request_type == RequestType:L3DataArrayWrite) {
25714184Sgabeblack@google.com      return L3CacheMemory.checkResourceAvailable(CacheResourceType:DataArray, addr);
25814184Sgabeblack@google.com    } else if (request_type == RequestType:L3TagArrayRead) {
25914184Sgabeblack@google.com      return L3CacheMemory.checkResourceAvailable(CacheResourceType:TagArray, addr);
26014184Sgabeblack@google.com    } else if (request_type == RequestType:L3TagArrayWrite) {
26114184Sgabeblack@google.com      return L3CacheMemory.checkResourceAvailable(CacheResourceType:TagArray, addr);
26214184Sgabeblack@google.com    } else {
26314184Sgabeblack@google.com      error("Invalid RequestType type in checkResourceAvailable");
26414184Sgabeblack@google.com      return true;
26514184Sgabeblack@google.com    }
26614184Sgabeblack@google.com  }
26714184Sgabeblack@google.com
26814184Sgabeblack@google.com  // ** OUT_PORTS **
26914184Sgabeblack@google.com  out_port(probeNetwork_out, NBProbeRequestMsg, probeToCore);
27014184Sgabeblack@google.com  out_port(responseNetwork_out, ResponseMsg, responseToCore);
27114184Sgabeblack@google.com
27214184Sgabeblack@google.com  out_port(triggerQueue_out, TriggerMsg, triggerQueue);
27314184Sgabeblack@google.com  out_port(L3TriggerQueue_out, TriggerMsg, L3triggerQueue);
27414184Sgabeblack@google.com
27514184Sgabeblack@google.com  // ** IN_PORTS **
27614184Sgabeblack@google.com
27714184Sgabeblack@google.com  // Trigger Queue
27814184Sgabeblack@google.com  in_port(triggerQueue_in, TriggerMsg, triggerQueue, rank=5) {
27914184Sgabeblack@google.com    if (triggerQueue_in.isReady(clockEdge())) {
28014184Sgabeblack@google.com      peek(triggerQueue_in, TriggerMsg) {
28114184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
28214184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(in_msg.addr));
28314184Sgabeblack@google.com        if (in_msg.Type == TriggerType:AcksComplete) {
28414184Sgabeblack@google.com          trigger(Event:ProbeAcksComplete, in_msg.addr, entry, tbe);
28514184Sgabeblack@google.com        }else if (in_msg.Type == TriggerType:UnblockWriteThrough) {
28614184Sgabeblack@google.com          trigger(Event:UnblockWriteThrough, in_msg.addr, entry, tbe);
28714184Sgabeblack@google.com        } else {
28814184Sgabeblack@google.com          error("Unknown trigger msg");
28914184Sgabeblack@google.com        }
29014184Sgabeblack@google.com      }
29114184Sgabeblack@google.com    }
29214184Sgabeblack@google.com  }
29314184Sgabeblack@google.com
29414184Sgabeblack@google.com  in_port(L3TriggerQueue_in, TriggerMsg, L3triggerQueue, rank=4) {
29514184Sgabeblack@google.com    if (L3TriggerQueue_in.isReady(clockEdge())) {
29614184Sgabeblack@google.com      peek(L3TriggerQueue_in, TriggerMsg) {
29714184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
29814184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(in_msg.addr));
29914184Sgabeblack@google.com        if (in_msg.Type == TriggerType:L3Hit) {
30014184Sgabeblack@google.com          trigger(Event:L3Hit, in_msg.addr, entry, tbe);
30114184Sgabeblack@google.com        } else {
30214184Sgabeblack@google.com          error("Unknown trigger msg");
30314184Sgabeblack@google.com        }
30414184Sgabeblack@google.com      }
30514184Sgabeblack@google.com    }
30614184Sgabeblack@google.com  }
30714184Sgabeblack@google.com
30814184Sgabeblack@google.com  // Unblock Network
30914184Sgabeblack@google.com  in_port(unblockNetwork_in, UnblockMsg, unblockFromCores, rank=3) {
31014184Sgabeblack@google.com    if (unblockNetwork_in.isReady(clockEdge())) {
31114184Sgabeblack@google.com      peek(unblockNetwork_in, UnblockMsg) {
31214184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
31314184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(in_msg.addr));
31414184Sgabeblack@google.com        trigger(Event:CoreUnblock, in_msg.addr, entry, tbe);
31514184Sgabeblack@google.com      }
31614184Sgabeblack@google.com    }
31714184Sgabeblack@google.com  }
31814184Sgabeblack@google.com
31914184Sgabeblack@google.com  // Core response network
32014184Sgabeblack@google.com  in_port(responseNetwork_in, ResponseMsg, responseFromCores, rank=2) {
32114184Sgabeblack@google.com    if (responseNetwork_in.isReady(clockEdge())) {
32214184Sgabeblack@google.com      peek(responseNetwork_in, ResponseMsg) {
32314184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
32414184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(in_msg.addr));
32514184Sgabeblack@google.com        if (in_msg.Type == CoherenceResponseType:CPUPrbResp) {
32614184Sgabeblack@google.com          trigger(Event:CPUPrbResp, in_msg.addr, entry, tbe);
32714184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:CPUData) {
32814184Sgabeblack@google.com          trigger(Event:CPUData, in_msg.addr, entry, tbe);
32914184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:StaleNotif) {
33014184Sgabeblack@google.com            trigger(Event:StaleWB, in_msg.addr, entry, tbe);
33114184Sgabeblack@google.com        } else {
33214184Sgabeblack@google.com          error("Unexpected response type");
33314184Sgabeblack@google.com        }
33414184Sgabeblack@google.com      }
33514184Sgabeblack@google.com    }
33614184Sgabeblack@google.com  }
33714184Sgabeblack@google.com
33814184Sgabeblack@google.com  // off-chip memory request/response is done
33914184Sgabeblack@google.com  in_port(memQueue_in, MemoryMsg, responseFromMemory, rank=1) {
34014184Sgabeblack@google.com    if (memQueue_in.isReady(clockEdge())) {
34114184Sgabeblack@google.com      peek(memQueue_in, MemoryMsg) {
34214184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
34314184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(in_msg.addr));
34414184Sgabeblack@google.com        if (in_msg.Type == MemoryRequestType:MEMORY_READ) {
34514184Sgabeblack@google.com          trigger(Event:MemData, in_msg.addr, entry, tbe);
34614184Sgabeblack@google.com          DPRINTF(RubySlicc, "%s\n", in_msg);
34714184Sgabeblack@google.com        } else if (in_msg.Type == MemoryRequestType:MEMORY_WB) {
34814184Sgabeblack@google.com          trigger(Event:WBAck, in_msg.addr, entry, tbe); // ignore WBAcks, don't care about them.
34914184Sgabeblack@google.com        } else {
35014184Sgabeblack@google.com          DPRINTF(RubySlicc, "%s\n", in_msg.Type);
35114184Sgabeblack@google.com          error("Invalid message");
35214184Sgabeblack@google.com        }
35314184Sgabeblack@google.com      }
35414184Sgabeblack@google.com    }
35514184Sgabeblack@google.com  }
35614184Sgabeblack@google.com
35714184Sgabeblack@google.com  in_port(requestNetwork_in, CPURequestMsg, requestFromCores, rank=0) {
35814184Sgabeblack@google.com    if (requestNetwork_in.isReady(clockEdge())) {
35914184Sgabeblack@google.com      peek(requestNetwork_in, CPURequestMsg) {
36014184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
36114184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(in_msg.addr));
36214184Sgabeblack@google.com        if (in_msg.Type == CoherenceRequestType:RdBlk) {
36314184Sgabeblack@google.com          trigger(Event:RdBlk, in_msg.addr, entry, tbe);
36414184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:RdBlkS) {
36514184Sgabeblack@google.com          trigger(Event:RdBlkS, in_msg.addr, entry, tbe);
36614184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:RdBlkM) {
36714184Sgabeblack@google.com          trigger(Event:RdBlkM, in_msg.addr, entry, tbe);
36814184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:WriteThrough) {
36914184Sgabeblack@google.com          trigger(Event:WriteThrough, in_msg.addr, entry, tbe);
37014184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:Atomic) {
37114184Sgabeblack@google.com          trigger(Event:Atomic, in_msg.addr, entry, tbe);
37214184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:VicDirty) {
37314184Sgabeblack@google.com          if (getDirectoryEntry(in_msg.addr).VicDirtyIgnore.isElement(in_msg.Requestor)) {
37414184Sgabeblack@google.com            DPRINTF(RubySlicc, "Dropping VicDirty for address %s\n", in_msg.addr);
37514184Sgabeblack@google.com            trigger(Event:StaleVicDirty, in_msg.addr, entry, tbe);
37614184Sgabeblack@google.com          } else {
37714184Sgabeblack@google.com            DPRINTF(RubySlicc, "Got VicDirty from %s on %s\n", in_msg.Requestor, in_msg.addr);
37814184Sgabeblack@google.com            trigger(Event:VicDirty, in_msg.addr, entry, tbe);
37914184Sgabeblack@google.com          }
38014184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:VicClean) {
38114184Sgabeblack@google.com          if (getDirectoryEntry(in_msg.addr).VicDirtyIgnore.isElement(in_msg.Requestor)) {
38214184Sgabeblack@google.com            DPRINTF(RubySlicc, "Dropping VicClean for address %s\n", in_msg.addr);
38314184Sgabeblack@google.com            trigger(Event:StaleVicDirty, in_msg.addr, entry, tbe);
38414184Sgabeblack@google.com          } else {
38514184Sgabeblack@google.com            DPRINTF(RubySlicc, "Got VicClean from %s on %s\n", in_msg.Requestor, in_msg.addr);
38614184Sgabeblack@google.com            trigger(Event:VicClean, in_msg.addr, entry, tbe);
38714184Sgabeblack@google.com          }
38814184Sgabeblack@google.com        } else {
38914184Sgabeblack@google.com          error("Bad request message type");
39014184Sgabeblack@google.com        }
39114184Sgabeblack@google.com      }
39214184Sgabeblack@google.com    }
39314184Sgabeblack@google.com  }
39414184Sgabeblack@google.com
39514184Sgabeblack@google.com  // Actions
39614184Sgabeblack@google.com  action(s_sendResponseS, "s", desc="send Shared response") {
39714184Sgabeblack@google.com    enqueue(responseNetwork_out, ResponseMsg, response_latency) {
39814184Sgabeblack@google.com      out_msg.addr := address;
39914184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:NBSysResp;
40014184Sgabeblack@google.com      if (tbe.L3Hit) {
40114184Sgabeblack@google.com        out_msg.Sender := createMachineID(MachineType:L3Cache, intToID(0));
40214184Sgabeblack@google.com      } else {
40314184Sgabeblack@google.com        out_msg.Sender := machineID;
40414184Sgabeblack@google.com      }
40514184Sgabeblack@google.com      out_msg.Destination.add(tbe.OriginalRequestor);
40614184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
40714184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
40814184Sgabeblack@google.com      out_msg.Dirty := false;
40914184Sgabeblack@google.com      out_msg.State := CoherenceState:Shared;
41014184Sgabeblack@google.com      out_msg.InitialRequestTime := tbe.InitialRequestTime;
41114184Sgabeblack@google.com      out_msg.ForwardRequestTime := tbe.ForwardRequestTime;
41214184Sgabeblack@google.com      out_msg.ProbeRequestStartTime := tbe.ProbeRequestStartTime;
41314184Sgabeblack@google.com      out_msg.OriginalResponder := tbe.LastSender;
41414184Sgabeblack@google.com      out_msg.L3Hit := tbe.L3Hit;
41514184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", out_msg);
41614184Sgabeblack@google.com    }
41714184Sgabeblack@google.com  }
41814184Sgabeblack@google.com
41914184Sgabeblack@google.com  action(es_sendResponseES, "es", desc="send Exclusive or Shared response") {
42014184Sgabeblack@google.com    enqueue(responseNetwork_out, ResponseMsg, response_latency) {
42114184Sgabeblack@google.com      out_msg.addr := address;
42214184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:NBSysResp;
42314184Sgabeblack@google.com      if (tbe.L3Hit) {
42414184Sgabeblack@google.com        out_msg.Sender := createMachineID(MachineType:L3Cache, intToID(0));
42514184Sgabeblack@google.com      } else {
42614184Sgabeblack@google.com        out_msg.Sender := machineID;
42714184Sgabeblack@google.com      }
42814184Sgabeblack@google.com      out_msg.Destination.add(tbe.OriginalRequestor);
42914184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
43014184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
43114184Sgabeblack@google.com      out_msg.Dirty := tbe.Dirty;
43214184Sgabeblack@google.com      if (tbe.Cached) {
43314184Sgabeblack@google.com        out_msg.State := CoherenceState:Shared;
43414184Sgabeblack@google.com      } else {
43514184Sgabeblack@google.com        out_msg.State := CoherenceState:Exclusive;
43614184Sgabeblack@google.com      }
43714184Sgabeblack@google.com      out_msg.InitialRequestTime := tbe.InitialRequestTime;
43814184Sgabeblack@google.com      out_msg.ForwardRequestTime := tbe.ForwardRequestTime;
43914184Sgabeblack@google.com      out_msg.ProbeRequestStartTime := tbe.ProbeRequestStartTime;
44014184Sgabeblack@google.com      out_msg.OriginalResponder := tbe.LastSender;
44114184Sgabeblack@google.com      out_msg.L3Hit := tbe.L3Hit;
44214184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", out_msg);
44314184Sgabeblack@google.com    }
44414184Sgabeblack@google.com  }
44514184Sgabeblack@google.com
44614184Sgabeblack@google.com  action(m_sendResponseM, "m", desc="send Modified response") {
44714184Sgabeblack@google.com    if (tbe.wtData) {
44814184Sgabeblack@google.com      enqueue(triggerQueue_out, TriggerMsg, 1) {
44914184Sgabeblack@google.com        out_msg.addr := address;
45014184Sgabeblack@google.com        out_msg.Type := TriggerType:UnblockWriteThrough;
45114184Sgabeblack@google.com      }
45214184Sgabeblack@google.com    }else{
45314184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, response_latency) {
45414184Sgabeblack@google.com        out_msg.addr := address;
45514184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:NBSysResp;
45614184Sgabeblack@google.com        if (tbe.L3Hit) {
45714184Sgabeblack@google.com          out_msg.Sender := createMachineID(MachineType:L3Cache, intToID(0));
45814184Sgabeblack@google.com        } else {
45914184Sgabeblack@google.com          out_msg.Sender := machineID;
46014184Sgabeblack@google.com        }
46114184Sgabeblack@google.com        out_msg.Destination.add(tbe.OriginalRequestor);
46214184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
46314184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
46414184Sgabeblack@google.com        out_msg.Dirty := tbe.Dirty;
46514184Sgabeblack@google.com        out_msg.State := CoherenceState:Modified;
46614184Sgabeblack@google.com        out_msg.CtoD := false;
46714184Sgabeblack@google.com        out_msg.InitialRequestTime := tbe.InitialRequestTime;
46814184Sgabeblack@google.com        out_msg.ForwardRequestTime := tbe.ForwardRequestTime;
46914184Sgabeblack@google.com        out_msg.ProbeRequestStartTime := tbe.ProbeRequestStartTime;
47014184Sgabeblack@google.com        out_msg.OriginalResponder := tbe.LastSender;
47114184Sgabeblack@google.com        if(tbe.atomicData){
47214184Sgabeblack@google.com          out_msg.WTRequestor := tbe.WTRequestor;
47314184Sgabeblack@google.com        }
47414184Sgabeblack@google.com        out_msg.L3Hit := tbe.L3Hit;
47514184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
47614184Sgabeblack@google.com      }
47714184Sgabeblack@google.com      if (tbe.atomicData) {
47814184Sgabeblack@google.com        enqueue(triggerQueue_out, TriggerMsg, 1) {
47914184Sgabeblack@google.com          out_msg.addr := address;
48014184Sgabeblack@google.com          out_msg.Type := TriggerType:UnblockWriteThrough;
48114184Sgabeblack@google.com        }
48214184Sgabeblack@google.com      }
48314184Sgabeblack@google.com    }
48414184Sgabeblack@google.com  }
48514184Sgabeblack@google.com
48614184Sgabeblack@google.com  action(c_sendResponseCtoD, "c", desc="send CtoD Ack") {
48714184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, response_latency) {
48814184Sgabeblack@google.com        out_msg.addr := address;
48914184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:NBSysResp;
49014184Sgabeblack@google.com        out_msg.Sender := machineID;
49114184Sgabeblack@google.com        out_msg.Destination.add(tbe.OriginalRequestor);
49214184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Control;
49314184Sgabeblack@google.com        out_msg.Dirty := false;
49414184Sgabeblack@google.com        out_msg.State := CoherenceState:Modified;
49514184Sgabeblack@google.com        out_msg.CtoD := true;
49614184Sgabeblack@google.com        out_msg.InitialRequestTime := tbe.InitialRequestTime;
49714184Sgabeblack@google.com        out_msg.ForwardRequestTime := curCycle();
49814184Sgabeblack@google.com        out_msg.ProbeRequestStartTime := tbe.ProbeRequestStartTime;
49914184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
50014184Sgabeblack@google.com      }
50114184Sgabeblack@google.com  }
50214184Sgabeblack@google.com
50314184Sgabeblack@google.com  action(w_sendResponseWBAck, "w", desc="send WB Ack") {
50414184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
50514184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, 1) {
50614184Sgabeblack@google.com        out_msg.addr := address;
50714184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:NBSysWBAck;
50814184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
50914184Sgabeblack@google.com        out_msg.WTRequestor := in_msg.WTRequestor;
51014184Sgabeblack@google.com        out_msg.Sender := machineID;
51114184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Control;
51214184Sgabeblack@google.com        out_msg.InitialRequestTime := in_msg.InitialRequestTime;
51314184Sgabeblack@google.com        out_msg.ForwardRequestTime := curCycle();
51414184Sgabeblack@google.com        out_msg.ProbeRequestStartTime := curCycle();
51514184Sgabeblack@google.com      }
51614184Sgabeblack@google.com    }
51714184Sgabeblack@google.com  }
51814184Sgabeblack@google.com
51914184Sgabeblack@google.com  action(l_queueMemWBReq, "lq", desc="Write WB data to memory") {
52014184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
52114184Sgabeblack@google.com      queueMemoryWrite(machineID, address, to_memory_controller_latency,
52214184Sgabeblack@google.com                       in_msg.DataBlk);
52314184Sgabeblack@google.com    }
52414184Sgabeblack@google.com  }
52514184Sgabeblack@google.com
52614184Sgabeblack@google.com  action(l_queueMemRdReq, "lr", desc="Read data from memory") {
52714184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
52814184Sgabeblack@google.com      if (L3CacheMemory.isTagPresent(address)) {
52914184Sgabeblack@google.com        enqueue(L3TriggerQueue_out, TriggerMsg, l3_hit_latency) {
53014184Sgabeblack@google.com          out_msg.addr := address;
53114184Sgabeblack@google.com          out_msg.Type := TriggerType:L3Hit;
53214184Sgabeblack@google.com          DPRINTF(RubySlicc, "%s\n", out_msg);
53314184Sgabeblack@google.com        }
53414184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(address));
53514184Sgabeblack@google.com        if (tbe.Dirty == false) {
53614184Sgabeblack@google.com          tbe.DataBlk := entry.DataBlk;
53714184Sgabeblack@google.com        }
53814184Sgabeblack@google.com        tbe.LastSender := entry.LastSender;
53914184Sgabeblack@google.com        tbe.L3Hit := true;
54014184Sgabeblack@google.com        tbe.MemData := true;
54114184Sgabeblack@google.com        L3CacheMemory.deallocate(address);
54214184Sgabeblack@google.com      } else {
54314184Sgabeblack@google.com        queueMemoryRead(machineID, address, to_memory_controller_latency);
54414184Sgabeblack@google.com      }
54514184Sgabeblack@google.com    }
54614184Sgabeblack@google.com  }
54714184Sgabeblack@google.com
54814184Sgabeblack@google.com  action(dc_probeInvCoreData, "dc", desc="probe inv cores, return data") {
54914184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
55014184Sgabeblack@google.com      enqueue(probeNetwork_out, NBProbeRequestMsg, response_latency) {
55114184Sgabeblack@google.com        out_msg.addr := address;
55214184Sgabeblack@google.com        out_msg.Type := ProbeRequestType:PrbInv;
55314184Sgabeblack@google.com        out_msg.ReturnData := true;
55414184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
55514184Sgabeblack@google.com        out_msg.Destination.broadcast(MachineType:CorePair);  // won't be realistic for multisocket
55614184Sgabeblack@google.com
55714184Sgabeblack@google.com        // add relevant TCC node to list. This replaces all TCPs and SQCs
55814184Sgabeblack@google.com        if (((in_msg.Type == CoherenceRequestType:WriteThrough ||
55914184Sgabeblack@google.com              in_msg.Type == CoherenceRequestType:Atomic) &&
56014184Sgabeblack@google.com             in_msg.NoWriteConflict) ||
56114184Sgabeblack@google.com            CPUonly) {
56214184Sgabeblack@google.com        } else if (noTCCdir) {
56314184Sgabeblack@google.com          out_msg.Destination.add(mapAddressToRange(address,MachineType:TCC,
56414184Sgabeblack@google.com                                  TCC_select_low_bit, TCC_select_num_bits));
56514184Sgabeblack@google.com        } else {
56614184Sgabeblack@google.com	      out_msg.Destination.add(mapAddressToRange(address,
56714184Sgabeblack@google.com                                                    MachineType:TCCdir,
56814184Sgabeblack@google.com                            TCC_select_low_bit, TCC_select_num_bits));
56914184Sgabeblack@google.com        }
57014184Sgabeblack@google.com        out_msg.Destination.remove(in_msg.Requestor);
57114184Sgabeblack@google.com        tbe.NumPendingAcks := out_msg.Destination.count();
57214184Sgabeblack@google.com        if (tbe.NumPendingAcks == 0) {
57314184Sgabeblack@google.com          enqueue(triggerQueue_out, TriggerMsg, 1) {
57414184Sgabeblack@google.com            out_msg.addr := address;
57514184Sgabeblack@google.com            out_msg.Type := TriggerType:AcksComplete;
57614184Sgabeblack@google.com          }
57714184Sgabeblack@google.com        }
57814184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
57914184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(" dc: Acks remaining: ");
58014184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(tbe.NumPendingAcks);
58114184Sgabeblack@google.com        tbe.ProbeRequestStartTime := curCycle();
58214184Sgabeblack@google.com      }
58314184Sgabeblack@google.com    }
58414184Sgabeblack@google.com  }
58514184Sgabeblack@google.com
58614184Sgabeblack@google.com  action(sc_probeShrCoreData, "sc", desc="probe shared cores, return data") {
58714184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) { // not the right network?
58814184Sgabeblack@google.com      enqueue(probeNetwork_out, NBProbeRequestMsg, response_latency) {
58914184Sgabeblack@google.com        out_msg.addr := address;
59014184Sgabeblack@google.com        out_msg.Type := ProbeRequestType:PrbDowngrade;
59114184Sgabeblack@google.com        out_msg.ReturnData := true;
59214184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
59314184Sgabeblack@google.com        out_msg.Destination.broadcast(MachineType:CorePair);  // won't be realistic for multisocket
59414184Sgabeblack@google.com        // add relevant TCC node to the list. This replaces all TCPs and SQCs
59514184Sgabeblack@google.com        if (noTCCdir || CPUonly) {
59614184Sgabeblack@google.com          //Don't need to notify TCC about reads
59714184Sgabeblack@google.com        } else {
59814184Sgabeblack@google.com	      out_msg.Destination.add(mapAddressToRange(address,
59914184Sgabeblack@google.com                                                    MachineType:TCCdir,
60014184Sgabeblack@google.com                            TCC_select_low_bit, TCC_select_num_bits));
60114184Sgabeblack@google.com          tbe.NumPendingAcks := tbe.NumPendingAcks + 1;
60214184Sgabeblack@google.com        }
60314184Sgabeblack@google.com        if (noTCCdir && !CPUonly) {
60414184Sgabeblack@google.com          out_msg.Destination.add(mapAddressToRange(address,MachineType:TCC,
60514184Sgabeblack@google.com                                  TCC_select_low_bit, TCC_select_num_bits));
60614184Sgabeblack@google.com        }
60714184Sgabeblack@google.com        out_msg.Destination.remove(in_msg.Requestor);
60814184Sgabeblack@google.com        tbe.NumPendingAcks := out_msg.Destination.count();
60914184Sgabeblack@google.com        if (tbe.NumPendingAcks == 0) {
61014184Sgabeblack@google.com          enqueue(triggerQueue_out, TriggerMsg, 1) {
61114184Sgabeblack@google.com            out_msg.addr := address;
61214184Sgabeblack@google.com            out_msg.Type := TriggerType:AcksComplete;
61314184Sgabeblack@google.com          }
61414184Sgabeblack@google.com        }
61514184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", (out_msg));
61614184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(" sc: Acks remaining: ");
61714184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(tbe.NumPendingAcks);
61814184Sgabeblack@google.com        tbe.ProbeRequestStartTime := curCycle();
61914184Sgabeblack@google.com      }
62014184Sgabeblack@google.com    }
62114184Sgabeblack@google.com  }
62214184Sgabeblack@google.com
62314184Sgabeblack@google.com  action(ic_probeInvCore, "ic", desc="probe invalidate core, no return data needed") {
62414184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) { // not the right network?
62514184Sgabeblack@google.com      enqueue(probeNetwork_out, NBProbeRequestMsg, response_latency) {
62614184Sgabeblack@google.com        out_msg.addr := address;
62714184Sgabeblack@google.com        out_msg.Type := ProbeRequestType:PrbInv;
62814184Sgabeblack@google.com        out_msg.ReturnData := false;
62914184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
63014184Sgabeblack@google.com        out_msg.Destination.broadcast(MachineType:CorePair);  // won't be realistic for multisocket
63114184Sgabeblack@google.com
63214184Sgabeblack@google.com        // add relevant TCC node to the list. This replaces all TCPs and SQCs
63314184Sgabeblack@google.com        if (noTCCdir && !CPUonly) {
63414184Sgabeblack@google.com            out_msg.Destination.add(mapAddressToRange(address,MachineType:TCC,
63514184Sgabeblack@google.com                              TCC_select_low_bit, TCC_select_num_bits));
63614184Sgabeblack@google.com        } else {
63714184Sgabeblack@google.com            if (!noTCCdir) {
63814184Sgabeblack@google.com                out_msg.Destination.add(mapAddressToRange(address,
63914184Sgabeblack@google.com                                                          MachineType:TCCdir,
64014184Sgabeblack@google.com                                                          TCC_select_low_bit,
64114184Sgabeblack@google.com                                                          TCC_select_num_bits));
64214184Sgabeblack@google.com            }
64314184Sgabeblack@google.com        }
64414184Sgabeblack@google.com        out_msg.Destination.remove(in_msg.Requestor);
64514184Sgabeblack@google.com        tbe.NumPendingAcks := out_msg.Destination.count();
64614184Sgabeblack@google.com        if (tbe.NumPendingAcks == 0) {
64714184Sgabeblack@google.com          enqueue(triggerQueue_out, TriggerMsg, 1) {
64814184Sgabeblack@google.com            out_msg.addr := address;
64914184Sgabeblack@google.com            out_msg.Type := TriggerType:AcksComplete;
65014184Sgabeblack@google.com          }
65114184Sgabeblack@google.com        }
65214184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(" ic: Acks remaining: ");
65314184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(tbe.NumPendingAcks);
65414184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
65514184Sgabeblack@google.com        tbe.ProbeRequestStartTime := curCycle();
65614184Sgabeblack@google.com      }
65714184Sgabeblack@google.com    }
65814184Sgabeblack@google.com  }
65914184Sgabeblack@google.com
66014184Sgabeblack@google.com  action(d_writeDataToMemory, "d", desc="Write data to memory") {
66114184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
66214184Sgabeblack@google.com      getDirectoryEntry(address).DataBlk := in_msg.DataBlk;
66314184Sgabeblack@google.com      if (tbe.Dirty == false) {
66414184Sgabeblack@google.com          // have to update the TBE, too, because of how this
66514184Sgabeblack@google.com          // directory deals with functional writes
66614184Sgabeblack@google.com        tbe.DataBlk := in_msg.DataBlk;
66714184Sgabeblack@google.com      }
66814184Sgabeblack@google.com    }
66914184Sgabeblack@google.com  }
67014184Sgabeblack@google.com
67114184Sgabeblack@google.com  action(t_allocateTBE, "t", desc="allocate TBE Entry") {
67214184Sgabeblack@google.com    check_allocate(TBEs);
67314184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
67414184Sgabeblack@google.com      TBEs.allocate(address);
67514184Sgabeblack@google.com      set_tbe(TBEs.lookup(address));
67614184Sgabeblack@google.com      if (in_msg.Type == CoherenceRequestType:WriteThrough) {
67714184Sgabeblack@google.com        tbe.writeMask.clear();
67814184Sgabeblack@google.com        tbe.writeMask.orMask(in_msg.writeMask);
67914184Sgabeblack@google.com        tbe.wtData := true;
68014184Sgabeblack@google.com        tbe.WTRequestor := in_msg.WTRequestor;
68114184Sgabeblack@google.com        tbe.LastSender := in_msg.Requestor;
68214184Sgabeblack@google.com      }
68314184Sgabeblack@google.com      if (in_msg.Type == CoherenceRequestType:Atomic) {
68414184Sgabeblack@google.com        tbe.writeMask.clear();
68514184Sgabeblack@google.com        tbe.writeMask.orMask(in_msg.writeMask);
68614184Sgabeblack@google.com        tbe.atomicData := true;
68714184Sgabeblack@google.com        tbe.WTRequestor := in_msg.WTRequestor;
68814184Sgabeblack@google.com        tbe.LastSender := in_msg.Requestor;
68914184Sgabeblack@google.com      }
69014184Sgabeblack@google.com      tbe.DataBlk := getDirectoryEntry(address).DataBlk; // Data only for WBs
69114184Sgabeblack@google.com      tbe.Dirty := false;
69214184Sgabeblack@google.com      if (in_msg.Type == CoherenceRequestType:WriteThrough) {
69314184Sgabeblack@google.com        tbe.DataBlk.copyPartial(in_msg.DataBlk,in_msg.writeMask);
69414184Sgabeblack@google.com        tbe.Dirty := true;
69514184Sgabeblack@google.com      }
69614184Sgabeblack@google.com      tbe.OriginalRequestor := in_msg.Requestor;
69714184Sgabeblack@google.com      tbe.NumPendingAcks := 0;
69814184Sgabeblack@google.com      tbe.Cached := in_msg.ForceShared;
69914184Sgabeblack@google.com      tbe.InitialRequestTime := in_msg.InitialRequestTime;
70014184Sgabeblack@google.com    }
70114184Sgabeblack@google.com  }
70214184Sgabeblack@google.com
70314184Sgabeblack@google.com  action(dt_deallocateTBE, "dt", desc="deallocate TBE Entry") {
70414184Sgabeblack@google.com    if (tbe.Dirty == false) {
70514184Sgabeblack@google.com        getDirectoryEntry(address).DataBlk := tbe.DataBlk;
70614184Sgabeblack@google.com    }
70714184Sgabeblack@google.com    TBEs.deallocate(address);
70814184Sgabeblack@google.com    unset_tbe();
70914184Sgabeblack@google.com  }
71014184Sgabeblack@google.com
71114184Sgabeblack@google.com  action(wd_writeBackData, "wd", desc="Write back data if needed") {
71214184Sgabeblack@google.com    if (tbe.wtData) {
71314184Sgabeblack@google.com      getDirectoryEntry(address).DataBlk.copyPartial(tbe.DataBlk, tbe.writeMask);
71414184Sgabeblack@google.com    } else if (tbe.atomicData) {
71514184Sgabeblack@google.com      tbe.DataBlk.atomicPartial(getDirectoryEntry(address).DataBlk,tbe.writeMask);
71614184Sgabeblack@google.com      getDirectoryEntry(address).DataBlk := tbe.DataBlk;
71714184Sgabeblack@google.com    } else if (tbe.Dirty == false) {
71814184Sgabeblack@google.com      getDirectoryEntry(address).DataBlk := tbe.DataBlk;
71914184Sgabeblack@google.com    }
72014184Sgabeblack@google.com  }
72114184Sgabeblack@google.com
72214184Sgabeblack@google.com  action(mt_writeMemDataToTBE, "mt", desc="write Mem data to TBE") {
72314184Sgabeblack@google.com    peek(memQueue_in, MemoryMsg) {
72414184Sgabeblack@google.com      if (tbe.wtData == true) {
72514184Sgabeblack@google.com          // do nothing
72614184Sgabeblack@google.com      } else if (tbe.Dirty == false) {
72714184Sgabeblack@google.com        tbe.DataBlk := getDirectoryEntry(address).DataBlk;
72814184Sgabeblack@google.com      }
72914184Sgabeblack@google.com      tbe.MemData := true;
73014184Sgabeblack@google.com    }
73114184Sgabeblack@google.com  }
73214184Sgabeblack@google.com
73314184Sgabeblack@google.com  action(y_writeProbeDataToTBE, "y", desc="write Probe Data to TBE") {
73414184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
73514184Sgabeblack@google.com      if (in_msg.Dirty) {
73614184Sgabeblack@google.com        if (tbe.wtData) {
73714184Sgabeblack@google.com          DataBlock tmp := in_msg.DataBlk;
73814184Sgabeblack@google.com          tmp.copyPartial(tbe.DataBlk,tbe.writeMask);
73914184Sgabeblack@google.com          tbe.DataBlk := tmp;
74014184Sgabeblack@google.com          tbe.writeMask.fillMask();
74114184Sgabeblack@google.com        } else if (tbe.Dirty) {
74214184Sgabeblack@google.com          if(tbe.atomicData == false && tbe.wtData == false) {
74314184Sgabeblack@google.com            DPRINTF(RubySlicc, "Got double data for %s from %s\n", address, in_msg.Sender);
74414184Sgabeblack@google.com            assert(tbe.DataBlk == in_msg.DataBlk);  // in case of double data
74514184Sgabeblack@google.com          }
74614184Sgabeblack@google.com        } else {
74714184Sgabeblack@google.com          tbe.DataBlk := in_msg.DataBlk;
74814184Sgabeblack@google.com          tbe.Dirty := in_msg.Dirty;
74914184Sgabeblack@google.com          tbe.LastSender := in_msg.Sender;
75014184Sgabeblack@google.com        }
75114184Sgabeblack@google.com      }
75214184Sgabeblack@google.com      if (in_msg.Hit) {
75314184Sgabeblack@google.com        tbe.Cached := true;
75414184Sgabeblack@google.com      }
75514184Sgabeblack@google.com    }
75614184Sgabeblack@google.com  }
75714184Sgabeblack@google.com
75814184Sgabeblack@google.com  action(mwc_markSinkWriteCancel, "mwc", desc="Mark to sink impending VicDirty") {
75914184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
76014184Sgabeblack@google.com      getDirectoryEntry(address).VicDirtyIgnore.add(in_msg.Sender);
76114184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(" setting bit to sink VicDirty ");
76214184Sgabeblack@google.com    }
76314184Sgabeblack@google.com  }
76414184Sgabeblack@google.com
76514184Sgabeblack@google.com  action(x_decrementAcks, "x", desc="decrement Acks pending") {
76614184Sgabeblack@google.com    tbe.NumPendingAcks := tbe.NumPendingAcks - 1;
76714184Sgabeblack@google.com    APPEND_TRANSITION_COMMENT(" Acks remaining: ");
76814184Sgabeblack@google.com    APPEND_TRANSITION_COMMENT(tbe.NumPendingAcks);
76914184Sgabeblack@google.com  }
77014184Sgabeblack@google.com
77114184Sgabeblack@google.com  action(o_checkForCompletion, "o", desc="check for ack completion") {
77214184Sgabeblack@google.com    if (tbe.NumPendingAcks == 0) {
77314184Sgabeblack@google.com      enqueue(triggerQueue_out, TriggerMsg, 1) {
77414184Sgabeblack@google.com        out_msg.addr := address;
77514184Sgabeblack@google.com        out_msg.Type := TriggerType:AcksComplete;
77614184Sgabeblack@google.com      }
77714184Sgabeblack@google.com    }
77814184Sgabeblack@google.com    APPEND_TRANSITION_COMMENT(" Check: Acks remaining: ");
77914184Sgabeblack@google.com    APPEND_TRANSITION_COMMENT(tbe.NumPendingAcks);
78014184Sgabeblack@google.com  }
78114184Sgabeblack@google.com
78214184Sgabeblack@google.com  action(rv_removeVicDirtyIgnore, "rv", desc="Remove ignored core") {
78314184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
78414184Sgabeblack@google.com      getDirectoryEntry(address).VicDirtyIgnore.remove(in_msg.Requestor);
78514184Sgabeblack@google.com    }
78614184Sgabeblack@google.com  }
78714184Sgabeblack@google.com
78814184Sgabeblack@google.com  action(al_allocateL3Block, "al", desc="allocate the L3 block on WB") {
78914184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
79014184Sgabeblack@google.com      if (L3CacheMemory.isTagPresent(address)) {
79114184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(address));
79214184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(" al wrote data to L3 (hit) ");
79314184Sgabeblack@google.com        entry.DataBlk := in_msg.DataBlk;
79414184Sgabeblack@google.com        entry.LastSender := in_msg.Sender;
79514184Sgabeblack@google.com      } else {
79614184Sgabeblack@google.com        if (L3CacheMemory.cacheAvail(address) == false) {
79714184Sgabeblack@google.com          Addr victim := L3CacheMemory.cacheProbe(address);
79814184Sgabeblack@google.com          CacheEntry victim_entry := static_cast(CacheEntry, "pointer",
79914184Sgabeblack@google.com                                                 L3CacheMemory.lookup(victim));
80014184Sgabeblack@google.com          queueMemoryWrite(machineID, victim, to_memory_controller_latency,
80114184Sgabeblack@google.com                           victim_entry.DataBlk);
80214184Sgabeblack@google.com          L3CacheMemory.deallocate(victim);
80314184Sgabeblack@google.com        }
80414184Sgabeblack@google.com        assert(L3CacheMemory.cacheAvail(address));
80514184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.allocate(address, new CacheEntry));
80614184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(" al wrote data to L3 ");
80714184Sgabeblack@google.com        entry.DataBlk := in_msg.DataBlk;
80814184Sgabeblack@google.com
80914184Sgabeblack@google.com        entry.LastSender := in_msg.Sender;
81014184Sgabeblack@google.com      }
81114184Sgabeblack@google.com    }
81214184Sgabeblack@google.com  }
81314184Sgabeblack@google.com
81414184Sgabeblack@google.com  action(alwt_allocateL3BlockOnWT, "alwt", desc="allocate the L3 block on WT") {
81514184Sgabeblack@google.com    if ((tbe.wtData || tbe.atomicData) && useL3OnWT) {
81614184Sgabeblack@google.com      if (L3CacheMemory.isTagPresent(address)) {
81714184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.lookup(address));
81814184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(" al wrote data to L3 (hit) ");
81914184Sgabeblack@google.com        entry.DataBlk := tbe.DataBlk;
82014184Sgabeblack@google.com        entry.LastSender := tbe.LastSender;
82114184Sgabeblack@google.com      } else {
82214184Sgabeblack@google.com        if (L3CacheMemory.cacheAvail(address) == false) {
82314184Sgabeblack@google.com          Addr victim := L3CacheMemory.cacheProbe(address);
82414184Sgabeblack@google.com          CacheEntry victim_entry := static_cast(CacheEntry, "pointer",
82514184Sgabeblack@google.com                                                 L3CacheMemory.lookup(victim));
82614184Sgabeblack@google.com          queueMemoryWrite(machineID, victim, to_memory_controller_latency,
82714184Sgabeblack@google.com                           victim_entry.DataBlk);
82814184Sgabeblack@google.com          L3CacheMemory.deallocate(victim);
82914184Sgabeblack@google.com        }
83014184Sgabeblack@google.com        assert(L3CacheMemory.cacheAvail(address));
83114184Sgabeblack@google.com        CacheEntry entry := static_cast(CacheEntry, "pointer", L3CacheMemory.allocate(address, new CacheEntry));
83214184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(" al wrote data to L3 ");
83314184Sgabeblack@google.com        entry.DataBlk := tbe.DataBlk;
83414184Sgabeblack@google.com        entry.LastSender := tbe.LastSender;
83514184Sgabeblack@google.com      }
83614184Sgabeblack@google.com    }
83714184Sgabeblack@google.com  }
83814184Sgabeblack@google.com
83914184Sgabeblack@google.com  action(sf_setForwardReqTime, "sf", desc="...") {
84014184Sgabeblack@google.com    tbe.ForwardRequestTime := curCycle();
84114184Sgabeblack@google.com  }
84214184Sgabeblack@google.com
84314184Sgabeblack@google.com  action(dl_deallocateL3, "dl", desc="deallocate the L3 block") {
84414184Sgabeblack@google.com    L3CacheMemory.deallocate(address);
84514184Sgabeblack@google.com  }
84614184Sgabeblack@google.com
84714184Sgabeblack@google.com  action(p_popRequestQueue, "p", desc="pop request queue") {
84814184Sgabeblack@google.com    requestNetwork_in.dequeue(clockEdge());
84914184Sgabeblack@google.com  }
85014184Sgabeblack@google.com
85114184Sgabeblack@google.com  action(pr_popResponseQueue, "pr", desc="pop response queue") {
85214184Sgabeblack@google.com    responseNetwork_in.dequeue(clockEdge());
85314184Sgabeblack@google.com  }
85414184Sgabeblack@google.com
85514184Sgabeblack@google.com  action(pm_popMemQueue, "pm", desc="pop mem queue") {
85614184Sgabeblack@google.com    memQueue_in.dequeue(clockEdge());
85714184Sgabeblack@google.com  }
85814184Sgabeblack@google.com
85914184Sgabeblack@google.com  action(pt_popTriggerQueue, "pt", desc="pop trigger queue") {
86014184Sgabeblack@google.com    triggerQueue_in.dequeue(clockEdge());
86114184Sgabeblack@google.com  }
86214184Sgabeblack@google.com
86314184Sgabeblack@google.com  action(ptl_popTriggerQueue, "ptl", desc="pop L3 trigger queue") {
86414184Sgabeblack@google.com    L3TriggerQueue_in.dequeue(clockEdge());
86514184Sgabeblack@google.com  }
86614184Sgabeblack@google.com
86714184Sgabeblack@google.com  action(pu_popUnblockQueue, "pu", desc="pop unblock queue") {
86814184Sgabeblack@google.com    unblockNetwork_in.dequeue(clockEdge());
86914184Sgabeblack@google.com  }
87014184Sgabeblack@google.com
87114184Sgabeblack@google.com  action(zz_recycleRequestQueue, "zz", desc="recycle request queue") {
87214184Sgabeblack@google.com    requestNetwork_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
87314184Sgabeblack@google.com  }
87414184Sgabeblack@google.com
87514184Sgabeblack@google.com  action(yy_recycleResponseQueue, "yy", desc="recycle response queue") {
87614184Sgabeblack@google.com    responseNetwork_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
87714184Sgabeblack@google.com  }
87814184Sgabeblack@google.com
87914184Sgabeblack@google.com  action(st_stallAndWaitRequest, "st", desc="Stall and wait on the address") {
88014184Sgabeblack@google.com    stall_and_wait(requestNetwork_in, address);
88114184Sgabeblack@google.com  }
88214184Sgabeblack@google.com
88314184Sgabeblack@google.com  action(wa_wakeUpDependents, "wa", desc="Wake up any requests waiting for this address") {
88414184Sgabeblack@google.com    wakeUpBuffers(address);
88514184Sgabeblack@google.com  }
88614184Sgabeblack@google.com
88714184Sgabeblack@google.com  action(wa_wakeUpAllDependents, "waa", desc="Wake up any requests waiting for this region") {
88814184Sgabeblack@google.com    wakeUpAllBuffers();
88914184Sgabeblack@google.com  }
89014184Sgabeblack@google.com
89114184Sgabeblack@google.com  action(z_stall, "z", desc="...") {
89214184Sgabeblack@google.com  }
89314184Sgabeblack@google.com
89414184Sgabeblack@google.com  // TRANSITIONS
89514184Sgabeblack@google.com  transition({BL, BS_M, BM_M, B_M, BP, BS_PM, BM_PM, B_PM, BS_Pm, BM_Pm, B_Pm, B}, {RdBlkS, RdBlkM, RdBlk, CtoD}) {
89614184Sgabeblack@google.com      st_stallAndWaitRequest;
89714184Sgabeblack@google.com  }
89814184Sgabeblack@google.com
89914184Sgabeblack@google.com  // It may be possible to save multiple invalidations here!
90014184Sgabeblack@google.com  transition({BL, BS_M, BM_M, B_M, BP, BS_PM, BM_PM, B_PM, BS_Pm, BM_Pm, B_Pm, B}, {Atomic, WriteThrough}) {
90114184Sgabeblack@google.com      st_stallAndWaitRequest;
90214184Sgabeblack@google.com  }
90314184Sgabeblack@google.com
90414184Sgabeblack@google.com
90514184Sgabeblack@google.com  // transitions from U
90614184Sgabeblack@google.com  transition(U, {RdBlkS}, BS_PM) {L3TagArrayRead} {
90714184Sgabeblack@google.com    t_allocateTBE;
90814184Sgabeblack@google.com    l_queueMemRdReq;
90914184Sgabeblack@google.com    sc_probeShrCoreData;
91014184Sgabeblack@google.com    p_popRequestQueue;
91114184Sgabeblack@google.com  }
91214184Sgabeblack@google.com
91314184Sgabeblack@google.com  transition(U, WriteThrough, BM_PM) {L3TagArrayRead, L3TagArrayWrite} {
91414184Sgabeblack@google.com    t_allocateTBE;
91514184Sgabeblack@google.com    w_sendResponseWBAck;
91614184Sgabeblack@google.com    l_queueMemRdReq;
91714184Sgabeblack@google.com    dc_probeInvCoreData;
91814184Sgabeblack@google.com    p_popRequestQueue;
91914184Sgabeblack@google.com  }
92014184Sgabeblack@google.com
92114184Sgabeblack@google.com  transition(U, Atomic, BM_PM) {L3TagArrayRead, L3TagArrayWrite} {
92214184Sgabeblack@google.com    t_allocateTBE;
92314184Sgabeblack@google.com    l_queueMemRdReq;
92414184Sgabeblack@google.com    dc_probeInvCoreData;
92514184Sgabeblack@google.com    p_popRequestQueue;
92614184Sgabeblack@google.com  }
92714184Sgabeblack@google.com
92814184Sgabeblack@google.com  transition(U, {RdBlkM}, BM_PM) {L3TagArrayRead} {
92914184Sgabeblack@google.com    t_allocateTBE;
93014184Sgabeblack@google.com    l_queueMemRdReq;
93114184Sgabeblack@google.com    dc_probeInvCoreData;
93214184Sgabeblack@google.com    p_popRequestQueue;
93314184Sgabeblack@google.com  }
93414184Sgabeblack@google.com
93514184Sgabeblack@google.com  transition(U, RdBlk, B_PM) {L3TagArrayRead}{
93614184Sgabeblack@google.com    t_allocateTBE;
93714184Sgabeblack@google.com    l_queueMemRdReq;
93814184Sgabeblack@google.com    sc_probeShrCoreData;
93914184Sgabeblack@google.com    p_popRequestQueue;
94014184Sgabeblack@google.com  }
94114184Sgabeblack@google.com
94214184Sgabeblack@google.com  transition(U, CtoD, BP) {L3TagArrayRead} {
94314184Sgabeblack@google.com    t_allocateTBE;
94414184Sgabeblack@google.com    ic_probeInvCore;
94514184Sgabeblack@google.com    p_popRequestQueue;
94614184Sgabeblack@google.com  }
94714184Sgabeblack@google.com
94814184Sgabeblack@google.com  transition(U, VicDirty, BL) {L3TagArrayRead} {
94914184Sgabeblack@google.com    t_allocateTBE;
95014184Sgabeblack@google.com    w_sendResponseWBAck;
95114184Sgabeblack@google.com    p_popRequestQueue;
95214184Sgabeblack@google.com  }
95314184Sgabeblack@google.com
95414184Sgabeblack@google.com  transition(U, VicClean, BL) {L3TagArrayRead} {
95514184Sgabeblack@google.com    t_allocateTBE;
95614184Sgabeblack@google.com    w_sendResponseWBAck;
95714184Sgabeblack@google.com    p_popRequestQueue;
95814184Sgabeblack@google.com  }
95914184Sgabeblack@google.com
96014184Sgabeblack@google.com  transition(BL, {VicDirty, VicClean}) {
96114184Sgabeblack@google.com    zz_recycleRequestQueue;
96214184Sgabeblack@google.com  }
96314184Sgabeblack@google.com
96414184Sgabeblack@google.com  transition(BL, CPUData, U) {L3TagArrayWrite, L3DataArrayWrite} {
96514184Sgabeblack@google.com    d_writeDataToMemory;
96614184Sgabeblack@google.com    al_allocateL3Block;
96714184Sgabeblack@google.com    wa_wakeUpDependents;
96814184Sgabeblack@google.com    dt_deallocateTBE;
96914184Sgabeblack@google.com    pr_popResponseQueue;
97014184Sgabeblack@google.com  }
97114184Sgabeblack@google.com
97214184Sgabeblack@google.com  transition(BL, StaleWB, U) {L3TagArrayWrite} {
97314184Sgabeblack@google.com    dt_deallocateTBE;
97414184Sgabeblack@google.com    wa_wakeUpAllDependents;
97514184Sgabeblack@google.com    pr_popResponseQueue;
97614184Sgabeblack@google.com  }
97714184Sgabeblack@google.com
97814184Sgabeblack@google.com  transition({B, BS_M, BM_M, B_M, BP, BS_PM, BM_PM, B_PM, BS_Pm, BM_Pm, B_Pm}, {VicDirty, VicClean}) {
97914184Sgabeblack@google.com    z_stall;
98014184Sgabeblack@google.com  }
98114184Sgabeblack@google.com
98214184Sgabeblack@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}, WBAck) {
98314184Sgabeblack@google.com    pm_popMemQueue;
98414184Sgabeblack@google.com  }
98514184Sgabeblack@google.com
98614184Sgabeblack@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}, StaleVicDirty) {
98714184Sgabeblack@google.com    rv_removeVicDirtyIgnore;
98814184Sgabeblack@google.com    w_sendResponseWBAck;
98914184Sgabeblack@google.com    p_popRequestQueue;
99014184Sgabeblack@google.com  }
99114184Sgabeblack@google.com
99214184Sgabeblack@google.com  transition({B}, CoreUnblock, U) {
99314184Sgabeblack@google.com    wa_wakeUpDependents;
99414184Sgabeblack@google.com    pu_popUnblockQueue;
99514184Sgabeblack@google.com  }
99614184Sgabeblack@google.com
99714184Sgabeblack@google.com  transition(B, UnblockWriteThrough, U) {
99814184Sgabeblack@google.com    wa_wakeUpDependents;
99914184Sgabeblack@google.com    pt_popTriggerQueue;
100014184Sgabeblack@google.com  }
100114184Sgabeblack@google.com
100214184Sgabeblack@google.com  transition(BS_PM, MemData, BS_Pm) {} {
100314184Sgabeblack@google.com    mt_writeMemDataToTBE;
100414184Sgabeblack@google.com    pm_popMemQueue;
100514184Sgabeblack@google.com  }
100614184Sgabeblack@google.com
100714184Sgabeblack@google.com  transition(BM_PM, MemData, BM_Pm){} {
100814184Sgabeblack@google.com    mt_writeMemDataToTBE;
100914184Sgabeblack@google.com    pm_popMemQueue;
101014184Sgabeblack@google.com  }
101114184Sgabeblack@google.com
101214184Sgabeblack@google.com  transition(B_PM, MemData, B_Pm){} {
101314184Sgabeblack@google.com    mt_writeMemDataToTBE;
101414184Sgabeblack@google.com    pm_popMemQueue;
101514184Sgabeblack@google.com  }
101614184Sgabeblack@google.com
101714184Sgabeblack@google.com  transition(BS_PM, L3Hit, BS_Pm) {} {
101814184Sgabeblack@google.com    ptl_popTriggerQueue;
101914184Sgabeblack@google.com  }
102014184Sgabeblack@google.com
102114184Sgabeblack@google.com  transition(BM_PM, L3Hit, BM_Pm) {} {
102214184Sgabeblack@google.com    ptl_popTriggerQueue;
102314184Sgabeblack@google.com  }
102414184Sgabeblack@google.com
102514184Sgabeblack@google.com  transition(B_PM, L3Hit, B_Pm) {} {
102614184Sgabeblack@google.com    ptl_popTriggerQueue;
102714184Sgabeblack@google.com  }
102814184Sgabeblack@google.com
102914184Sgabeblack@google.com  transition(BS_M, MemData, B){L3TagArrayWrite, L3DataArrayWrite} {
103014184Sgabeblack@google.com    mt_writeMemDataToTBE;
103114184Sgabeblack@google.com    s_sendResponseS;
103214184Sgabeblack@google.com    wd_writeBackData;
103314184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
103414184Sgabeblack@google.com    dt_deallocateTBE;
103514184Sgabeblack@google.com    pm_popMemQueue;
103614184Sgabeblack@google.com  }
103714184Sgabeblack@google.com
103814184Sgabeblack@google.com  transition(BM_M, MemData, B){L3TagArrayWrite, L3DataArrayWrite} {
103914184Sgabeblack@google.com    mt_writeMemDataToTBE;
104014184Sgabeblack@google.com    m_sendResponseM;
104114184Sgabeblack@google.com    wd_writeBackData;
104214184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
104314184Sgabeblack@google.com    dt_deallocateTBE;
104414184Sgabeblack@google.com    pm_popMemQueue;
104514184Sgabeblack@google.com  }
104614184Sgabeblack@google.com
104714184Sgabeblack@google.com  transition(B_M, MemData, B){L3TagArrayWrite, L3DataArrayWrite} {
104814184Sgabeblack@google.com    mt_writeMemDataToTBE;
104914184Sgabeblack@google.com    es_sendResponseES;
105014184Sgabeblack@google.com    wd_writeBackData;
105114184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
105214184Sgabeblack@google.com    dt_deallocateTBE;
105314184Sgabeblack@google.com    pm_popMemQueue;
105414184Sgabeblack@google.com  }
105514184Sgabeblack@google.com
105614184Sgabeblack@google.com  transition(BS_M, L3Hit, B) {L3TagArrayWrite, L3DataArrayWrite} {
105714184Sgabeblack@google.com    s_sendResponseS;
105814184Sgabeblack@google.com    wd_writeBackData;
105914184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
106014184Sgabeblack@google.com    dt_deallocateTBE;
106114184Sgabeblack@google.com    ptl_popTriggerQueue;
106214184Sgabeblack@google.com  }
106314184Sgabeblack@google.com
106414184Sgabeblack@google.com  transition(BM_M, L3Hit, B) {L3DataArrayWrite, L3TagArrayWrite} {
106514184Sgabeblack@google.com    m_sendResponseM;
106614184Sgabeblack@google.com    wd_writeBackData;
106714184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
106814184Sgabeblack@google.com    dt_deallocateTBE;
106914184Sgabeblack@google.com    ptl_popTriggerQueue;
107014184Sgabeblack@google.com  }
107114184Sgabeblack@google.com
107214184Sgabeblack@google.com  transition(B_M, L3Hit, B) {L3DataArrayWrite, L3TagArrayWrite} {
107314184Sgabeblack@google.com    es_sendResponseES;
107414184Sgabeblack@google.com    wd_writeBackData;
107514184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
107614184Sgabeblack@google.com    dt_deallocateTBE;
107714184Sgabeblack@google.com    ptl_popTriggerQueue;
107814184Sgabeblack@google.com  }
107914184Sgabeblack@google.com
108014184Sgabeblack@google.com  transition({BS_PM, BM_PM, B_PM, BS_Pm, BM_Pm, B_Pm, BP}, CPUPrbResp) {
108114184Sgabeblack@google.com    y_writeProbeDataToTBE;
108214184Sgabeblack@google.com    x_decrementAcks;
108314184Sgabeblack@google.com    o_checkForCompletion;
108414184Sgabeblack@google.com    pr_popResponseQueue;
108514184Sgabeblack@google.com  }
108614184Sgabeblack@google.com
108714184Sgabeblack@google.com  transition(BS_PM, ProbeAcksComplete, BS_M) {} {
108814184Sgabeblack@google.com    sf_setForwardReqTime;
108914184Sgabeblack@google.com    pt_popTriggerQueue;
109014184Sgabeblack@google.com  }
109114184Sgabeblack@google.com
109214184Sgabeblack@google.com  transition(BM_PM, ProbeAcksComplete, BM_M) {} {
109314184Sgabeblack@google.com    sf_setForwardReqTime;
109414184Sgabeblack@google.com    pt_popTriggerQueue;
109514184Sgabeblack@google.com  }
109614184Sgabeblack@google.com
109714184Sgabeblack@google.com  transition(B_PM, ProbeAcksComplete, B_M){} {
109814184Sgabeblack@google.com    sf_setForwardReqTime;
109914184Sgabeblack@google.com    pt_popTriggerQueue;
110014184Sgabeblack@google.com  }
110114184Sgabeblack@google.com
110214184Sgabeblack@google.com  transition(BS_Pm, ProbeAcksComplete, B){L3DataArrayWrite, L3TagArrayWrite} {
110314184Sgabeblack@google.com    sf_setForwardReqTime;
110414184Sgabeblack@google.com    s_sendResponseS;
110514184Sgabeblack@google.com    wd_writeBackData;
110614184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
110714184Sgabeblack@google.com    dt_deallocateTBE;
110814184Sgabeblack@google.com    pt_popTriggerQueue;
110914184Sgabeblack@google.com  }
111014184Sgabeblack@google.com
111114184Sgabeblack@google.com  transition(BM_Pm, ProbeAcksComplete, B){L3DataArrayWrite, L3TagArrayWrite} {
111214184Sgabeblack@google.com    sf_setForwardReqTime;
111314184Sgabeblack@google.com    m_sendResponseM;
111414184Sgabeblack@google.com    wd_writeBackData;
111514184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
111614184Sgabeblack@google.com    dt_deallocateTBE;
111714184Sgabeblack@google.com    pt_popTriggerQueue;
111814184Sgabeblack@google.com  }
111914184Sgabeblack@google.com
112014184Sgabeblack@google.com  transition(B_Pm, ProbeAcksComplete, B){L3DataArrayWrite, L3TagArrayWrite} {
112114184Sgabeblack@google.com    sf_setForwardReqTime;
112214184Sgabeblack@google.com    es_sendResponseES;
112314184Sgabeblack@google.com    wd_writeBackData;
112414184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
112514184Sgabeblack@google.com    dt_deallocateTBE;
112614184Sgabeblack@google.com    pt_popTriggerQueue;
112714184Sgabeblack@google.com  }
112814184Sgabeblack@google.com
112914184Sgabeblack@google.com  transition(BP, ProbeAcksComplete, B){L3TagArrayWrite, L3TagArrayWrite} {
113014184Sgabeblack@google.com    sf_setForwardReqTime;
113114184Sgabeblack@google.com    c_sendResponseCtoD;
113214184Sgabeblack@google.com    wd_writeBackData;
113314184Sgabeblack@google.com    alwt_allocateL3BlockOnWT;
113414184Sgabeblack@google.com    dt_deallocateTBE;
113514184Sgabeblack@google.com    pt_popTriggerQueue;
113614184Sgabeblack@google.com  }
113714184Sgabeblack@google.com}
1138