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 * Author: Sooraj Puthoor, Blake Hechtman
3414184Sgabeblack@google.com */
3514184Sgabeblack@google.com
3614184Sgabeblack@google.com/*
3714184Sgabeblack@google.com * This file is inherited from GPU_VIPER-TCC.sm and retains its structure.
3814184Sgabeblack@google.com * There are very few modifications in this file from the original VIPER TCC
3914184Sgabeblack@google.com */
4014184Sgabeblack@google.com
4114184Sgabeblack@google.commachine(MachineType:TCC, "TCC Cache")
4214184Sgabeblack@google.com : CacheMemory * L2cache;
4314184Sgabeblack@google.com   bool WB; /*is this cache Writeback?*/
4414184Sgabeblack@google.com   int regionBufferNum;
4514184Sgabeblack@google.com   Cycles l2_request_latency := 50;
4614184Sgabeblack@google.com   Cycles l2_response_latency := 20;
4714184Sgabeblack@google.com
4814184Sgabeblack@google.com  // From the TCPs or SQCs
4914184Sgabeblack@google.com  MessageBuffer * requestFromTCP, network="From", virtual_network="1", ordered="true", vnet_type="request";
5014184Sgabeblack@google.com  // To the Cores. TCC deals only with TCPs/SQCs. CP cores do not communicate directly with TCC.
5114184Sgabeblack@google.com  MessageBuffer * responseToCore, network="To", virtual_network="3", ordered="true", vnet_type="response";
5214184Sgabeblack@google.com  // From the NB
5314184Sgabeblack@google.com  MessageBuffer * probeFromNB, network="From", virtual_network="0", ordered="false", vnet_type="request";
5414184Sgabeblack@google.com  MessageBuffer * responseFromNB, network="From", virtual_network="2", ordered="false", vnet_type="response";
5514184Sgabeblack@google.com  // To the NB
5614184Sgabeblack@google.com  MessageBuffer * requestToNB, network="To", virtual_network="0", ordered="false", vnet_type="request";
5714184Sgabeblack@google.com  MessageBuffer * responseToNB, network="To", virtual_network="2", ordered="false", vnet_type="response";
5814184Sgabeblack@google.com  MessageBuffer * unblockToNB, network="To", virtual_network="4", ordered="false", vnet_type="unblock";
5914184Sgabeblack@google.com
6014184Sgabeblack@google.com  MessageBuffer * triggerQueue, ordered="true", random="false";
6114184Sgabeblack@google.com{
6214184Sgabeblack@google.com  // EVENTS
6314184Sgabeblack@google.com  enumeration(Event, desc="TCC Events") {
6414184Sgabeblack@google.com    // Requests coming from the Cores
6514184Sgabeblack@google.com    RdBlk,                  desc="RdBlk event";
6614184Sgabeblack@google.com    WrVicBlk,               desc="L1 Write Through";
6714184Sgabeblack@google.com    WrVicBlkBack,           desc="L1 Write Back(dirty cache)";
6814184Sgabeblack@google.com    Atomic,                 desc="Atomic Op";
6914184Sgabeblack@google.com    AtomicDone,             desc="AtomicOps Complete";
7014184Sgabeblack@google.com    AtomicNotDone,          desc="AtomicOps not Complete";
7114184Sgabeblack@google.com    Data,                   desc="data messgae";
7214184Sgabeblack@google.com    // Coming from this TCC
7314184Sgabeblack@google.com    L2_Repl,                desc="L2 Replacement";
7414184Sgabeblack@google.com    // Probes
7514184Sgabeblack@google.com    PrbInv,                 desc="Invalidating probe";
7614184Sgabeblack@google.com    // Coming from Memory Controller
7714184Sgabeblack@google.com    WBAck,                  desc="writethrough ack from memory";
7814184Sgabeblack@google.com  }
7914184Sgabeblack@google.com
8014184Sgabeblack@google.com  // STATES
8114184Sgabeblack@google.com  state_declaration(State, desc="TCC State", default="TCC_State_I") {
8214184Sgabeblack@google.com    M, AccessPermission:Read_Write, desc="Modified(dirty cache only)";
8314184Sgabeblack@google.com    W, AccessPermission:Read_Write, desc="Written(dirty cache only)";
8414184Sgabeblack@google.com    V, AccessPermission:Read_Only,  desc="Valid";
8514184Sgabeblack@google.com    I, AccessPermission:Invalid,    desc="Invalid";
8614184Sgabeblack@google.com    IV, AccessPermission:Busy,      desc="Waiting for Data";
8714184Sgabeblack@google.com    WI, AccessPermission:Busy,      desc="Waiting on Writethrough Ack";
8814184Sgabeblack@google.com    A, AccessPermission:Busy,       desc="Invalid waiting on atomic Data";
8914184Sgabeblack@google.com  }
9014184Sgabeblack@google.com
9114184Sgabeblack@google.com  enumeration(RequestType, desc="To communicate stats from transitions to recordStats") {
9214184Sgabeblack@google.com    DataArrayRead,    desc="Read the data array";
9314184Sgabeblack@google.com    DataArrayWrite,   desc="Write the data array";
9414184Sgabeblack@google.com    TagArrayRead,     desc="Read the data array";
9514184Sgabeblack@google.com    TagArrayWrite,    desc="Write the data array";
9614184Sgabeblack@google.com  }
9714184Sgabeblack@google.com
9814184Sgabeblack@google.com
9914184Sgabeblack@google.com  // STRUCTURES
10014184Sgabeblack@google.com
10114184Sgabeblack@google.com  structure(Entry, desc="...", interface="AbstractCacheEntry") {
10214184Sgabeblack@google.com    State CacheState,           desc="cache state";
10314184Sgabeblack@google.com    bool Dirty,                 desc="Is the data dirty (diff from memory?)";
10414184Sgabeblack@google.com    DataBlock DataBlk,          desc="Data for the block";
10514184Sgabeblack@google.com    WriteMask writeMask,        desc="Dirty byte mask";
10614184Sgabeblack@google.com  }
10714184Sgabeblack@google.com
10814184Sgabeblack@google.com  structure(TBE, desc="...") {
10914184Sgabeblack@google.com    State TBEState,     desc="Transient state";
11014184Sgabeblack@google.com    DataBlock DataBlk,  desc="data for the block";
11114184Sgabeblack@google.com    bool Dirty,         desc="Is the data dirty?";
11214184Sgabeblack@google.com    bool Shared,        desc="Victim hit by shared probe";
11314184Sgabeblack@google.com    MachineID From,     desc="Waiting for writeback from...";
11414184Sgabeblack@google.com    NetDest Destination, desc="Data destination";
11514184Sgabeblack@google.com    int numAtomics,     desc="number remaining atomics";
11614184Sgabeblack@google.com  }
11714184Sgabeblack@google.com
11814184Sgabeblack@google.com  structure(TBETable, external="yes") {
11914184Sgabeblack@google.com    TBE lookup(Addr);
12014184Sgabeblack@google.com    void allocate(Addr);
12114184Sgabeblack@google.com    void deallocate(Addr);
12214184Sgabeblack@google.com    bool isPresent(Addr);
12314184Sgabeblack@google.com  }
12414184Sgabeblack@google.com
12514184Sgabeblack@google.com  TBETable TBEs, template="<TCC_TBE>", constructor="m_number_of_TBEs";
12614184Sgabeblack@google.com
12714184Sgabeblack@google.com  void set_cache_entry(AbstractCacheEntry b);
12814184Sgabeblack@google.com  void unset_cache_entry();
12914184Sgabeblack@google.com  void set_tbe(TBE b);
13014184Sgabeblack@google.com  void unset_tbe();
13114184Sgabeblack@google.com  void wakeUpAllBuffers();
13214184Sgabeblack@google.com  void wakeUpBuffers(Addr a);
13314184Sgabeblack@google.com
13414184Sgabeblack@google.com  MachineID mapAddressToMachine(Addr addr, MachineType mtype);
13514184Sgabeblack@google.com
13614184Sgabeblack@google.com  // FUNCTION DEFINITIONS
13714184Sgabeblack@google.com
13814184Sgabeblack@google.com  Tick clockEdge();
13914184Sgabeblack@google.com  Tick cyclesToTicks(Cycles c);
14014184Sgabeblack@google.com
14114184Sgabeblack@google.com  MachineID getPeer(MachineID mach) {
14214184Sgabeblack@google.com    return createMachineID(MachineType:RegionBuffer, intToID(regionBufferNum));
14314184Sgabeblack@google.com  }
14414184Sgabeblack@google.com
14514184Sgabeblack@google.com Entry getCacheEntry(Addr addr), return_by_pointer="yes" {
14614184Sgabeblack@google.com    return static_cast(Entry, "pointer", L2cache.lookup(addr));
14714184Sgabeblack@google.com  }
14814184Sgabeblack@google.com
14914184Sgabeblack@google.com  DataBlock getDataBlock(Addr addr), return_by_ref="yes" {
15014184Sgabeblack@google.com    return getCacheEntry(addr).DataBlk;
15114184Sgabeblack@google.com  }
15214184Sgabeblack@google.com
15314184Sgabeblack@google.com  bool presentOrAvail(Addr addr) {
15414184Sgabeblack@google.com    return L2cache.isTagPresent(addr) || L2cache.cacheAvail(addr);
15514184Sgabeblack@google.com  }
15614184Sgabeblack@google.com
15714184Sgabeblack@google.com  State getState(TBE tbe, Entry cache_entry, Addr addr) {
15814184Sgabeblack@google.com    if (is_valid(tbe)) {
15914184Sgabeblack@google.com      return tbe.TBEState;
16014184Sgabeblack@google.com    } else if (is_valid(cache_entry)) {
16114184Sgabeblack@google.com      return cache_entry.CacheState;
16214184Sgabeblack@google.com    }
16314184Sgabeblack@google.com    return State:I;
16414184Sgabeblack@google.com  }
16514184Sgabeblack@google.com
16614184Sgabeblack@google.com  void setState(TBE tbe, Entry cache_entry, Addr addr, State state) {
16714184Sgabeblack@google.com    if (is_valid(tbe)) {
16814184Sgabeblack@google.com        tbe.TBEState := state;
16914184Sgabeblack@google.com    }
17014184Sgabeblack@google.com
17114184Sgabeblack@google.com    if (is_valid(cache_entry)) {
17214184Sgabeblack@google.com        cache_entry.CacheState := state;
17314184Sgabeblack@google.com    }
17414184Sgabeblack@google.com  }
17514184Sgabeblack@google.com
17614184Sgabeblack@google.com  void functionalRead(Addr addr, Packet *pkt) {
17714184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
17814184Sgabeblack@google.com    if(is_valid(tbe)) {
17914184Sgabeblack@google.com      testAndRead(addr, tbe.DataBlk, pkt);
18014184Sgabeblack@google.com    } else {
18114184Sgabeblack@google.com      functionalMemoryRead(pkt);
18214184Sgabeblack@google.com    }
18314184Sgabeblack@google.com  }
18414184Sgabeblack@google.com
18514184Sgabeblack@google.com  int functionalWrite(Addr addr, Packet *pkt) {
18614184Sgabeblack@google.com    int num_functional_writes := 0;
18714184Sgabeblack@google.com
18814184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
18914184Sgabeblack@google.com    if(is_valid(tbe)) {
19014184Sgabeblack@google.com      num_functional_writes := num_functional_writes +
19114184Sgabeblack@google.com            testAndWrite(addr, tbe.DataBlk, pkt);
19214184Sgabeblack@google.com    }
19314184Sgabeblack@google.com
19414184Sgabeblack@google.com    num_functional_writes := num_functional_writes +
19514184Sgabeblack@google.com        functionalMemoryWrite(pkt);
19614184Sgabeblack@google.com    return num_functional_writes;
19714184Sgabeblack@google.com  }
19814184Sgabeblack@google.com
19914184Sgabeblack@google.com  AccessPermission getAccessPermission(Addr addr) {
20014184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
20114184Sgabeblack@google.com    if(is_valid(tbe)) {
20214184Sgabeblack@google.com      return TCC_State_to_permission(tbe.TBEState);
20314184Sgabeblack@google.com    }
20414184Sgabeblack@google.com
20514184Sgabeblack@google.com    Entry cache_entry := getCacheEntry(addr);
20614184Sgabeblack@google.com    if(is_valid(cache_entry)) {
20714184Sgabeblack@google.com      return TCC_State_to_permission(cache_entry.CacheState);
20814184Sgabeblack@google.com    }
20914184Sgabeblack@google.com
21014184Sgabeblack@google.com    return AccessPermission:NotPresent;
21114184Sgabeblack@google.com  }
21214184Sgabeblack@google.com
21314184Sgabeblack@google.com  void setAccessPermission(Entry cache_entry, Addr addr, State state) {
21414184Sgabeblack@google.com    if (is_valid(cache_entry)) {
21514184Sgabeblack@google.com      cache_entry.changePermission(TCC_State_to_permission(state));
21614184Sgabeblack@google.com    }
21714184Sgabeblack@google.com  }
21814184Sgabeblack@google.com
21914184Sgabeblack@google.com  void recordRequestType(RequestType request_type, Addr addr) {
22014184Sgabeblack@google.com    if (request_type == RequestType:DataArrayRead) {
22114184Sgabeblack@google.com      L2cache.recordRequestType(CacheRequestType:DataArrayRead,addr);
22214184Sgabeblack@google.com    } else if (request_type == RequestType:DataArrayWrite) {
22314184Sgabeblack@google.com      L2cache.recordRequestType(CacheRequestType:DataArrayWrite,addr);
22414184Sgabeblack@google.com    } else if (request_type == RequestType:TagArrayRead) {
22514184Sgabeblack@google.com      L2cache.recordRequestType(CacheRequestType:TagArrayRead,addr);
22614184Sgabeblack@google.com    } else if (request_type == RequestType:TagArrayWrite) {
22714184Sgabeblack@google.com      L2cache.recordRequestType(CacheRequestType:TagArrayWrite,addr);
22814184Sgabeblack@google.com    }
22914184Sgabeblack@google.com  }
23014184Sgabeblack@google.com
23114184Sgabeblack@google.com  bool checkResourceAvailable(RequestType request_type, Addr addr) {
23214184Sgabeblack@google.com    if (request_type == RequestType:DataArrayRead) {
23314184Sgabeblack@google.com      return L2cache.checkResourceAvailable(CacheResourceType:DataArray, addr);
23414184Sgabeblack@google.com    } else if (request_type == RequestType:DataArrayWrite) {
23514184Sgabeblack@google.com      return L2cache.checkResourceAvailable(CacheResourceType:DataArray, addr);
23614184Sgabeblack@google.com    } else if (request_type == RequestType:TagArrayRead) {
23714184Sgabeblack@google.com      return L2cache.checkResourceAvailable(CacheResourceType:TagArray, addr);
23814184Sgabeblack@google.com    } else if (request_type == RequestType:TagArrayWrite) {
23914184Sgabeblack@google.com      return L2cache.checkResourceAvailable(CacheResourceType:TagArray, addr);
24014184Sgabeblack@google.com    } else {
24114184Sgabeblack@google.com      error("Invalid RequestType type in checkResourceAvailable");
24214184Sgabeblack@google.com      return true;
24314184Sgabeblack@google.com    }
24414184Sgabeblack@google.com  }
24514184Sgabeblack@google.com
24614184Sgabeblack@google.com
24714184Sgabeblack@google.com  // ** OUT_PORTS **
24814184Sgabeblack@google.com
24914184Sgabeblack@google.com  // Three classes of ports
25014184Sgabeblack@google.com  // Class 1: downward facing network links to NB
25114184Sgabeblack@google.com  out_port(requestToNB_out, CPURequestMsg, requestToNB);
25214184Sgabeblack@google.com  out_port(responseToNB_out, ResponseMsg, responseToNB);
25314184Sgabeblack@google.com  out_port(unblockToNB_out, UnblockMsg, unblockToNB);
25414184Sgabeblack@google.com
25514184Sgabeblack@google.com  // Class 2: upward facing ports to GPU cores
25614184Sgabeblack@google.com  out_port(responseToCore_out, ResponseMsg, responseToCore);
25714184Sgabeblack@google.com
25814184Sgabeblack@google.com  out_port(triggerQueue_out, TriggerMsg, triggerQueue);
25914184Sgabeblack@google.com  //
26014184Sgabeblack@google.com  // request queue going to NB
26114184Sgabeblack@google.com  //
26214184Sgabeblack@google.com
26314184Sgabeblack@google.com
26414184Sgabeblack@google.com// ** IN_PORTS **
26514184Sgabeblack@google.com  in_port(triggerQueue_in, TiggerMsg, triggerQueue) {
26614184Sgabeblack@google.com    if (triggerQueue_in.isReady(clockEdge())) {
26714184Sgabeblack@google.com      peek(triggerQueue_in, TriggerMsg) {
26814184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
26914184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
27014184Sgabeblack@google.com        if (tbe.numAtomics == 0) {
27114184Sgabeblack@google.com            trigger(Event:AtomicDone, in_msg.addr, cache_entry, tbe);
27214184Sgabeblack@google.com        } else {
27314184Sgabeblack@google.com            trigger(Event:AtomicNotDone, in_msg.addr, cache_entry, tbe);
27414184Sgabeblack@google.com        }
27514184Sgabeblack@google.com      }
27614184Sgabeblack@google.com    }
27714184Sgabeblack@google.com  }
27814184Sgabeblack@google.com
27914184Sgabeblack@google.com
28014184Sgabeblack@google.com
28114184Sgabeblack@google.com  in_port(responseFromNB_in, ResponseMsg, responseFromNB) {
28214184Sgabeblack@google.com    if (responseFromNB_in.isReady(clockEdge())) {
28314184Sgabeblack@google.com      peek(responseFromNB_in, ResponseMsg, block_on="addr") {
28414184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
28514184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
28614184Sgabeblack@google.com        if (in_msg.Type == CoherenceResponseType:NBSysResp) {
28714184Sgabeblack@google.com          if(presentOrAvail(in_msg.addr)) {
28814184Sgabeblack@google.com            trigger(Event:Data, in_msg.addr, cache_entry, tbe);
28914184Sgabeblack@google.com          } else {
29014184Sgabeblack@google.com            Addr victim :=  L2cache.cacheProbe(in_msg.addr);
29114184Sgabeblack@google.com            trigger(Event:L2_Repl, victim, getCacheEntry(victim), TBEs.lookup(victim));
29214184Sgabeblack@google.com          }
29314184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:NBSysWBAck) {
29414184Sgabeblack@google.com          trigger(Event:WBAck, in_msg.addr, cache_entry, tbe);
29514184Sgabeblack@google.com        } else {
29614184Sgabeblack@google.com          error("Unexpected Response Message to Core");
29714184Sgabeblack@google.com        }
29814184Sgabeblack@google.com      }
29914184Sgabeblack@google.com    }
30014184Sgabeblack@google.com  }
30114184Sgabeblack@google.com
30214184Sgabeblack@google.com  // Finally handling incoming requests (from TCP) and probes (from NB).
30314184Sgabeblack@google.com
30414184Sgabeblack@google.com  in_port(probeNetwork_in, NBProbeRequestMsg, probeFromNB) {
30514184Sgabeblack@google.com    if (probeNetwork_in.isReady(clockEdge())) {
30614184Sgabeblack@google.com      peek(probeNetwork_in, NBProbeRequestMsg) {
30714184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", in_msg);
30814184Sgabeblack@google.com        DPRINTF(RubySlicc, "machineID: %s\n", machineID);
30914184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
31014184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
31114184Sgabeblack@google.com        trigger(Event:PrbInv, in_msg.addr, cache_entry, tbe);
31214184Sgabeblack@google.com      }
31314184Sgabeblack@google.com    }
31414184Sgabeblack@google.com  }
31514184Sgabeblack@google.com
31614184Sgabeblack@google.com
31714184Sgabeblack@google.com  in_port(coreRequestNetwork_in, CPURequestMsg, requestFromTCP, rank=0) {
31814184Sgabeblack@google.com    if (coreRequestNetwork_in.isReady(clockEdge())) {
31914184Sgabeblack@google.com      peek(coreRequestNetwork_in, CPURequestMsg) {
32014184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
32114184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
32214184Sgabeblack@google.com        if (in_msg.Type == CoherenceRequestType:WriteThrough) {
32314184Sgabeblack@google.com            if(WB) {
32414184Sgabeblack@google.com                if(presentOrAvail(in_msg.addr)) {
32514184Sgabeblack@google.com                    trigger(Event:WrVicBlkBack, in_msg.addr, cache_entry, tbe);
32614184Sgabeblack@google.com                } else {
32714184Sgabeblack@google.com                    Addr victim :=  L2cache.cacheProbe(in_msg.addr);
32814184Sgabeblack@google.com                    trigger(Event:L2_Repl, victim, getCacheEntry(victim), TBEs.lookup(victim));
32914184Sgabeblack@google.com                }
33014184Sgabeblack@google.com            } else {
33114184Sgabeblack@google.com                trigger(Event:WrVicBlk, in_msg.addr, cache_entry, tbe);
33214184Sgabeblack@google.com            }
33314184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:Atomic) {
33414184Sgabeblack@google.com          trigger(Event:Atomic, in_msg.addr, cache_entry, tbe);
33514184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:RdBlk) {
33614184Sgabeblack@google.com          trigger(Event:RdBlk, in_msg.addr, cache_entry, tbe);
33714184Sgabeblack@google.com        } else {
33814184Sgabeblack@google.com          DPRINTF(RubySlicc, "%s\n", in_msg);
33914184Sgabeblack@google.com          error("Unexpected Response Message to Core");
34014184Sgabeblack@google.com        }
34114184Sgabeblack@google.com      }
34214184Sgabeblack@google.com    }
34314184Sgabeblack@google.com  }
34414184Sgabeblack@google.com  // BEGIN ACTIONS
34514184Sgabeblack@google.com
34614184Sgabeblack@google.com  action(i_invL2, "i", desc="invalidate TCC cache block") {
34714184Sgabeblack@google.com    if (is_valid(cache_entry)) {
34814184Sgabeblack@google.com        L2cache.deallocate(address);
34914184Sgabeblack@google.com    }
35014184Sgabeblack@google.com    unset_cache_entry();
35114184Sgabeblack@google.com  }
35214184Sgabeblack@google.com
35314184Sgabeblack@google.com  // Data available at TCC. Send the DATA to TCP
35414184Sgabeblack@google.com  action(sd_sendData, "sd", desc="send Shared response") {
35514184Sgabeblack@google.com    peek(coreRequestNetwork_in, CPURequestMsg) {
35614184Sgabeblack@google.com      enqueue(responseToCore_out, ResponseMsg, l2_response_latency) {
35714184Sgabeblack@google.com        out_msg.addr := address;
35814184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:TDSysResp;
35914184Sgabeblack@google.com        out_msg.Sender := machineID;
36014184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
36114184Sgabeblack@google.com        out_msg.DataBlk := cache_entry.DataBlk;
36214184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
36314184Sgabeblack@google.com        out_msg.Dirty := false;
36414184Sgabeblack@google.com        out_msg.State := CoherenceState:Shared;
36514184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
36614184Sgabeblack@google.com      }
36714184Sgabeblack@google.com    }
36814184Sgabeblack@google.com  }
36914184Sgabeblack@google.com
37014184Sgabeblack@google.com
37114184Sgabeblack@google.com  // Data was not available at TCC. So, TCC forwarded the request to
37214184Sgabeblack@google.com  // directory and directory responded back with data. Now, forward the
37314184Sgabeblack@google.com  // DATA to TCP and send the unblock ack back to directory.
37414184Sgabeblack@google.com  action(sdr_sendDataResponse, "sdr", desc="send Shared response") {
37514184Sgabeblack@google.com    enqueue(responseToCore_out, ResponseMsg, l2_response_latency) {
37614184Sgabeblack@google.com      out_msg.addr := address;
37714184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:TDSysResp;
37814184Sgabeblack@google.com      out_msg.Sender := machineID;
37914184Sgabeblack@google.com      out_msg.Destination := tbe.Destination;
38014184Sgabeblack@google.com      out_msg.DataBlk := cache_entry.DataBlk;
38114184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
38214184Sgabeblack@google.com      out_msg.Dirty := false;
38314184Sgabeblack@google.com      out_msg.State := CoherenceState:Shared;
38414184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", out_msg);
38514184Sgabeblack@google.com    }
38614184Sgabeblack@google.com    enqueue(unblockToNB_out, UnblockMsg, 1) {
38714184Sgabeblack@google.com      out_msg.addr := address;
38814184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
38914184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Unblock_Control;
39014184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", out_msg);
39114184Sgabeblack@google.com    }
39214184Sgabeblack@google.com  }
39314184Sgabeblack@google.com
39414184Sgabeblack@google.com
39514184Sgabeblack@google.com  action(rd_requestData, "r", desc="Miss in L2, pass on") {
39614184Sgabeblack@google.com    if(tbe.Destination.count()==1){
39714184Sgabeblack@google.com      peek(coreRequestNetwork_in, CPURequestMsg) {
39814184Sgabeblack@google.com        enqueue(requestToNB_out, CPURequestMsg, l2_request_latency) {
39914184Sgabeblack@google.com          out_msg.addr := address;
40014184Sgabeblack@google.com          out_msg.Type := in_msg.Type;
40114184Sgabeblack@google.com          out_msg.Requestor := machineID;
40214184Sgabeblack@google.com          out_msg.Destination.add(getPeer(machineID));
40314184Sgabeblack@google.com          out_msg.Shared := false; // unneeded for this request
40414184Sgabeblack@google.com          out_msg.MessageSize := in_msg.MessageSize;
40514184Sgabeblack@google.com          DPRINTF(RubySlicc, "%s\n", out_msg);
40614184Sgabeblack@google.com        }
40714184Sgabeblack@google.com      }
40814184Sgabeblack@google.com    }
40914184Sgabeblack@google.com  }
41014184Sgabeblack@google.com
41114184Sgabeblack@google.com  action(w_sendResponseWBAck, "w", desc="send WB Ack") {
41214184Sgabeblack@google.com    peek(responseFromNB_in, ResponseMsg) {
41314184Sgabeblack@google.com        enqueue(responseToCore_out, ResponseMsg, l2_response_latency) {
41414184Sgabeblack@google.com          out_msg.addr := address;
41514184Sgabeblack@google.com          out_msg.Type := CoherenceResponseType:TDSysWBAck;
41614184Sgabeblack@google.com          out_msg.Destination.clear();
41714184Sgabeblack@google.com          out_msg.Destination.add(in_msg.WTRequestor);
41814184Sgabeblack@google.com          out_msg.Sender := machineID;
41914184Sgabeblack@google.com          out_msg.MessageSize := MessageSizeType:Writeback_Control;
42014184Sgabeblack@google.com        }
42114184Sgabeblack@google.com    }
42214184Sgabeblack@google.com  }
42314184Sgabeblack@google.com
42414184Sgabeblack@google.com  action(swb_sendWBAck, "swb", desc="send WB Ack") {
42514184Sgabeblack@google.com    peek(coreRequestNetwork_in, CPURequestMsg) {
42614184Sgabeblack@google.com      enqueue(responseToCore_out, ResponseMsg, l2_response_latency) {
42714184Sgabeblack@google.com        out_msg.addr := address;
42814184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:TDSysWBAck;
42914184Sgabeblack@google.com        out_msg.Destination.clear();
43014184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
43114184Sgabeblack@google.com        out_msg.Sender := machineID;
43214184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Control;
43314184Sgabeblack@google.com      }
43414184Sgabeblack@google.com    }
43514184Sgabeblack@google.com  }
43614184Sgabeblack@google.com
43714184Sgabeblack@google.com  action(ar_sendAtomicResponse, "ar", desc="send Atomic Ack") {
43814184Sgabeblack@google.com    peek(responseFromNB_in, ResponseMsg) {
43914184Sgabeblack@google.com        enqueue(responseToCore_out, ResponseMsg, l2_response_latency) {
44014184Sgabeblack@google.com          out_msg.addr := address;
44114184Sgabeblack@google.com          out_msg.Type := CoherenceResponseType:TDSysResp;
44214184Sgabeblack@google.com          out_msg.Destination.add(in_msg.WTRequestor);
44314184Sgabeblack@google.com          out_msg.Sender := machineID;
44414184Sgabeblack@google.com          out_msg.MessageSize := in_msg.MessageSize;
44514184Sgabeblack@google.com          out_msg.DataBlk := in_msg.DataBlk;
44614184Sgabeblack@google.com        }
44714184Sgabeblack@google.com    }
44814184Sgabeblack@google.com  }
44914184Sgabeblack@google.com  action(sd2rb_sendDone2RegionBuffer, "sd2rb", desc="Request finished, send done ack") {
45014184Sgabeblack@google.com    enqueue(unblockToNB_out, UnblockMsg, 1) {
45114184Sgabeblack@google.com      out_msg.addr := address;
45214184Sgabeblack@google.com      out_msg.Destination.add(getPeer(machineID));
45314184Sgabeblack@google.com      out_msg.DoneAck := true;
45414184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Unblock_Control;
45514184Sgabeblack@google.com      if (is_valid(tbe)) {
45614184Sgabeblack@google.com          out_msg.Dirty := tbe.Dirty;
45714184Sgabeblack@google.com      } else {
45814184Sgabeblack@google.com          out_msg.Dirty := false;
45914184Sgabeblack@google.com      }
46014184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", out_msg);
46114184Sgabeblack@google.com    }
46214184Sgabeblack@google.com  }
46314184Sgabeblack@google.com
46414184Sgabeblack@google.com  action(a_allocateBlock, "a", desc="allocate TCC block") {
46514184Sgabeblack@google.com    if (is_invalid(cache_entry)) {
46614184Sgabeblack@google.com      set_cache_entry(L2cache.allocate(address, new Entry));
46714184Sgabeblack@google.com      cache_entry.writeMask.clear();
46814184Sgabeblack@google.com    }
46914184Sgabeblack@google.com  }
47014184Sgabeblack@google.com
47114184Sgabeblack@google.com  action(t_allocateTBE, "t", desc="allocate TBE Entry") {
47214184Sgabeblack@google.com    if (is_invalid(tbe)) {
47314184Sgabeblack@google.com      check_allocate(TBEs);
47414184Sgabeblack@google.com      TBEs.allocate(address);
47514184Sgabeblack@google.com      set_tbe(TBEs.lookup(address));
47614184Sgabeblack@google.com      tbe.Destination.clear();
47714184Sgabeblack@google.com      tbe.numAtomics := 0;
47814184Sgabeblack@google.com    }
47914184Sgabeblack@google.com    if (coreRequestNetwork_in.isReady(clockEdge())) {
48014184Sgabeblack@google.com      peek(coreRequestNetwork_in, CPURequestMsg) {
48114184Sgabeblack@google.com        if(in_msg.Type == CoherenceRequestType:RdBlk || in_msg.Type == CoherenceRequestType:Atomic){
48214184Sgabeblack@google.com          tbe.Destination.add(in_msg.Requestor);
48314184Sgabeblack@google.com        }
48414184Sgabeblack@google.com      }
48514184Sgabeblack@google.com    }
48614184Sgabeblack@google.com  }
48714184Sgabeblack@google.com
48814184Sgabeblack@google.com  action(dt_deallocateTBE, "dt", desc="Deallocate TBE entry") {
48914184Sgabeblack@google.com    tbe.Destination.clear();
49014184Sgabeblack@google.com    TBEs.deallocate(address);
49114184Sgabeblack@google.com    unset_tbe();
49214184Sgabeblack@google.com  }
49314184Sgabeblack@google.com
49414184Sgabeblack@google.com  action(wcb_writeCacheBlock, "wcb", desc="write data to TCC") {
49514184Sgabeblack@google.com    peek(responseFromNB_in, ResponseMsg) {
49614184Sgabeblack@google.com      cache_entry.DataBlk := in_msg.DataBlk;
49714184Sgabeblack@google.com      DPRINTF(RubySlicc, "Writing to TCC: %s\n", in_msg);
49814184Sgabeblack@google.com    }
49914184Sgabeblack@google.com  }
50014184Sgabeblack@google.com
50114184Sgabeblack@google.com  action(wdb_writeDirtyBytes, "wdb", desc="write data to TCC") {
50214184Sgabeblack@google.com    peek(coreRequestNetwork_in, CPURequestMsg) {
50314184Sgabeblack@google.com      cache_entry.DataBlk.copyPartial(in_msg.DataBlk,in_msg.writeMask);
50414184Sgabeblack@google.com      cache_entry.writeMask.orMask(in_msg.writeMask);
50514184Sgabeblack@google.com      DPRINTF(RubySlicc, "Writing to TCC: %s\n", in_msg);
50614184Sgabeblack@google.com    }
50714184Sgabeblack@google.com  }
50814184Sgabeblack@google.com
50914184Sgabeblack@google.com  action(wt_writeThrough, "wt", desc="write through data") {
51014184Sgabeblack@google.com    peek(coreRequestNetwork_in, CPURequestMsg) {
51114184Sgabeblack@google.com      enqueue(requestToNB_out, CPURequestMsg, l2_request_latency) {
51214184Sgabeblack@google.com        out_msg.addr := address;
51314184Sgabeblack@google.com        out_msg.Requestor := machineID;
51414184Sgabeblack@google.com        out_msg.WTRequestor := in_msg.Requestor;
51514184Sgabeblack@google.com        out_msg.Destination.add(getPeer(machineID));
51614184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Data;
51714184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:WriteThrough;
51814184Sgabeblack@google.com        out_msg.Dirty := true;
51914184Sgabeblack@google.com        out_msg.DataBlk := in_msg.DataBlk;
52014184Sgabeblack@google.com        out_msg.writeMask.orMask(in_msg.writeMask);
52114184Sgabeblack@google.com      }
52214184Sgabeblack@google.com    }
52314184Sgabeblack@google.com  }
52414184Sgabeblack@google.com
52514184Sgabeblack@google.com  action(wb_writeBack, "wb", desc="write back data") {
52614184Sgabeblack@google.com    enqueue(requestToNB_out, CPURequestMsg, l2_request_latency) {
52714184Sgabeblack@google.com      out_msg.addr := address;
52814184Sgabeblack@google.com      out_msg.Requestor := machineID;
52914184Sgabeblack@google.com      out_msg.WTRequestor := machineID;
53014184Sgabeblack@google.com      out_msg.Destination.add(getPeer(machineID));
53114184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Data;
53214184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:WriteThrough;
53314184Sgabeblack@google.com      out_msg.Dirty := true;
53414184Sgabeblack@google.com      out_msg.DataBlk := cache_entry.DataBlk;
53514184Sgabeblack@google.com      out_msg.writeMask.orMask(cache_entry.writeMask);
53614184Sgabeblack@google.com    }
53714184Sgabeblack@google.com  }
53814184Sgabeblack@google.com
53914184Sgabeblack@google.com  action(at_atomicThrough, "at", desc="write back data") {
54014184Sgabeblack@google.com    peek(coreRequestNetwork_in, CPURequestMsg) {
54114184Sgabeblack@google.com      enqueue(requestToNB_out, CPURequestMsg, l2_request_latency) {
54214184Sgabeblack@google.com        out_msg.addr := address;
54314184Sgabeblack@google.com        out_msg.Requestor := machineID;
54414184Sgabeblack@google.com        out_msg.WTRequestor := in_msg.Requestor;
54514184Sgabeblack@google.com        out_msg.Destination.add(getPeer(machineID));
54614184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Data;
54714184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:Atomic;
54814184Sgabeblack@google.com        out_msg.Dirty := true;
54914184Sgabeblack@google.com        out_msg.writeMask.orMask(in_msg.writeMask);
55014184Sgabeblack@google.com      }
55114184Sgabeblack@google.com    }
55214184Sgabeblack@google.com  }
55314184Sgabeblack@google.com
55414184Sgabeblack@google.com  action(pi_sendProbeResponseInv, "pi", desc="send probe ack inv, no data") {
55514184Sgabeblack@google.com    enqueue(responseToNB_out, ResponseMsg, 1) {
55614184Sgabeblack@google.com      out_msg.addr := address;
55714184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:CPUPrbResp;  // TCC, L3  respond in same way to probes
55814184Sgabeblack@google.com      out_msg.Sender := machineID;
55914184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
56014184Sgabeblack@google.com      out_msg.Dirty := false;
56114184Sgabeblack@google.com      out_msg.Hit := false;
56214184Sgabeblack@google.com      out_msg.Ntsl := true;
56314184Sgabeblack@google.com      out_msg.State := CoherenceState:NA;
56414184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Control;
56514184Sgabeblack@google.com    }
56614184Sgabeblack@google.com  }
56714184Sgabeblack@google.com  action(ut_updateTag, "ut", desc="update Tag (i.e. set MRU)") {
56814184Sgabeblack@google.com    L2cache.setMRU(address);
56914184Sgabeblack@google.com  }
57014184Sgabeblack@google.com
57114184Sgabeblack@google.com  action(p_popRequestQueue, "p", desc="pop request queue") {
57214184Sgabeblack@google.com    coreRequestNetwork_in.dequeue(clockEdge());
57314184Sgabeblack@google.com  }
57414184Sgabeblack@google.com
57514184Sgabeblack@google.com  action(pr_popResponseQueue, "pr", desc="pop response queue") {
57614184Sgabeblack@google.com    responseFromNB_in.dequeue(clockEdge());
57714184Sgabeblack@google.com  }
57814184Sgabeblack@google.com
57914184Sgabeblack@google.com  action(pp_popProbeQueue, "pp", desc="pop probe queue") {
58014184Sgabeblack@google.com    probeNetwork_in.dequeue(clockEdge());
58114184Sgabeblack@google.com  }
58214184Sgabeblack@google.com  action(zz_recycleRequestQueue, "z", desc="stall"){
58314184Sgabeblack@google.com    coreRequestNetwork_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
58414184Sgabeblack@google.com  }
58514184Sgabeblack@google.com
58614184Sgabeblack@google.com
58714184Sgabeblack@google.com  action(ina_incrementNumAtomics, "ina", desc="inc num atomics") {
58814184Sgabeblack@google.com    tbe.numAtomics := tbe.numAtomics + 1;
58914184Sgabeblack@google.com  }
59014184Sgabeblack@google.com
59114184Sgabeblack@google.com
59214184Sgabeblack@google.com  action(dna_decrementNumAtomics, "dna", desc="dec num atomics") {
59314184Sgabeblack@google.com    tbe.numAtomics := tbe.numAtomics - 1;
59414184Sgabeblack@google.com    if (tbe.numAtomics==0) {
59514184Sgabeblack@google.com      enqueue(triggerQueue_out, TriggerMsg, 1) {
59614184Sgabeblack@google.com        out_msg.addr := address;
59714184Sgabeblack@google.com        out_msg.Type := TriggerType:AtomicDone;
59814184Sgabeblack@google.com      }
59914184Sgabeblack@google.com    }
60014184Sgabeblack@google.com  }
60114184Sgabeblack@google.com
60214184Sgabeblack@google.com  action(ptr_popTriggerQueue, "ptr", desc="pop Trigger") {
60314184Sgabeblack@google.com    triggerQueue_in.dequeue(clockEdge());
60414184Sgabeblack@google.com  }
60514184Sgabeblack@google.com
60614184Sgabeblack@google.com  // END ACTIONS
60714184Sgabeblack@google.com
60814184Sgabeblack@google.com  // BEGIN TRANSITIONS
60914184Sgabeblack@google.com  // transitions from base
61014184Sgabeblack@google.com  // Assumptions for ArrayRead/Write
61114184Sgabeblack@google.com  // TBE checked before tags
61214184Sgabeblack@google.com  // Data Read/Write requires Tag Read
61314184Sgabeblack@google.com
61414184Sgabeblack@google.com  transition(WI, {RdBlk, WrVicBlk, Atomic, WrVicBlkBack}) {TagArrayRead} {
61514184Sgabeblack@google.com    zz_recycleRequestQueue;
61614184Sgabeblack@google.com  }
61714184Sgabeblack@google.com  transition(A, {RdBlk, WrVicBlk, WrVicBlkBack}) {TagArrayRead} {
61814184Sgabeblack@google.com    zz_recycleRequestQueue;
61914184Sgabeblack@google.com  }
62014184Sgabeblack@google.com  transition(IV, {WrVicBlk, Atomic, WrVicBlkBack}) {TagArrayRead} {
62114184Sgabeblack@google.com    zz_recycleRequestQueue;
62214184Sgabeblack@google.com  }
62314184Sgabeblack@google.com  transition({M, V}, RdBlk) {TagArrayRead, DataArrayRead} {
62414184Sgabeblack@google.com    sd_sendData;
62514184Sgabeblack@google.com    ut_updateTag;
62614184Sgabeblack@google.com    p_popRequestQueue;
62714184Sgabeblack@google.com  }
62814184Sgabeblack@google.com  transition(W, RdBlk, WI) {TagArrayRead, DataArrayRead} {
62914184Sgabeblack@google.com    t_allocateTBE;
63014184Sgabeblack@google.com    wb_writeBack;
63114184Sgabeblack@google.com  }
63214184Sgabeblack@google.com
63314184Sgabeblack@google.com  transition(I, RdBlk, IV) {TagArrayRead} {
63414184Sgabeblack@google.com    t_allocateTBE;
63514184Sgabeblack@google.com    rd_requestData;
63614184Sgabeblack@google.com    p_popRequestQueue;
63714184Sgabeblack@google.com  }
63814184Sgabeblack@google.com
63914184Sgabeblack@google.com  transition(IV, RdBlk) {
64014184Sgabeblack@google.com    t_allocateTBE;
64114184Sgabeblack@google.com    rd_requestData;
64214184Sgabeblack@google.com    p_popRequestQueue;
64314184Sgabeblack@google.com  }
64414184Sgabeblack@google.com
64514184Sgabeblack@google.com  transition({V, I},Atomic, A) {TagArrayRead} {
64614184Sgabeblack@google.com    i_invL2;
64714184Sgabeblack@google.com    t_allocateTBE;
64814184Sgabeblack@google.com    at_atomicThrough;
64914184Sgabeblack@google.com    ina_incrementNumAtomics;
65014184Sgabeblack@google.com    p_popRequestQueue;
65114184Sgabeblack@google.com  }
65214184Sgabeblack@google.com
65314184Sgabeblack@google.com  transition(A, Atomic) {
65414184Sgabeblack@google.com    at_atomicThrough;
65514184Sgabeblack@google.com    ina_incrementNumAtomics;
65614184Sgabeblack@google.com    p_popRequestQueue;
65714184Sgabeblack@google.com  }
65814184Sgabeblack@google.com
65914184Sgabeblack@google.com  transition({M, W}, Atomic, WI) {TagArrayRead} {
66014184Sgabeblack@google.com    t_allocateTBE;
66114184Sgabeblack@google.com    wb_writeBack;
66214184Sgabeblack@google.com  }
66314184Sgabeblack@google.com
66414184Sgabeblack@google.com  // Cahceblock stays in I state which implies
66514184Sgabeblack@google.com  // this TCC is a write-no-allocate cache
66614184Sgabeblack@google.com  transition(I, WrVicBlk) {TagArrayRead} {
66714184Sgabeblack@google.com    wt_writeThrough;
66814184Sgabeblack@google.com    p_popRequestQueue;
66914184Sgabeblack@google.com  }
67014184Sgabeblack@google.com
67114184Sgabeblack@google.com  transition(V, WrVicBlk) {TagArrayRead, DataArrayWrite} {
67214184Sgabeblack@google.com    ut_updateTag;
67314184Sgabeblack@google.com    wdb_writeDirtyBytes;
67414184Sgabeblack@google.com    wt_writeThrough;
67514184Sgabeblack@google.com    p_popRequestQueue;
67614184Sgabeblack@google.com  }
67714184Sgabeblack@google.com
67814184Sgabeblack@google.com  transition({V, M}, WrVicBlkBack, M) {TagArrayRead, TagArrayWrite, DataArrayWrite} {
67914184Sgabeblack@google.com    ut_updateTag;
68014184Sgabeblack@google.com    swb_sendWBAck;
68114184Sgabeblack@google.com    wdb_writeDirtyBytes;
68214184Sgabeblack@google.com    p_popRequestQueue;
68314184Sgabeblack@google.com  }
68414184Sgabeblack@google.com
68514184Sgabeblack@google.com  transition(W, WrVicBlkBack) {TagArrayRead, TagArrayWrite, DataArrayWrite} {
68614184Sgabeblack@google.com    ut_updateTag;
68714184Sgabeblack@google.com    swb_sendWBAck;
68814184Sgabeblack@google.com    wdb_writeDirtyBytes;
68914184Sgabeblack@google.com    p_popRequestQueue;
69014184Sgabeblack@google.com  }
69114184Sgabeblack@google.com
69214184Sgabeblack@google.com  transition(I, WrVicBlkBack, W) {TagArrayRead, TagArrayWrite, DataArrayWrite} {
69314184Sgabeblack@google.com    a_allocateBlock;
69414184Sgabeblack@google.com    ut_updateTag;
69514184Sgabeblack@google.com    swb_sendWBAck;
69614184Sgabeblack@google.com    wdb_writeDirtyBytes;
69714184Sgabeblack@google.com    p_popRequestQueue;
69814184Sgabeblack@google.com  }
69914184Sgabeblack@google.com
70014184Sgabeblack@google.com  transition({W, M}, L2_Repl, WI) {TagArrayRead, DataArrayRead} {
70114184Sgabeblack@google.com    t_allocateTBE;
70214184Sgabeblack@google.com    wb_writeBack;
70314184Sgabeblack@google.com    i_invL2;
70414184Sgabeblack@google.com  }
70514184Sgabeblack@google.com
70614184Sgabeblack@google.com  transition({I, V}, L2_Repl, I) {TagArrayRead, TagArrayWrite} {
70714184Sgabeblack@google.com    i_invL2;
70814184Sgabeblack@google.com  }
70914184Sgabeblack@google.com
71014184Sgabeblack@google.com  transition({A, IV, WI}, L2_Repl) {
71114184Sgabeblack@google.com    i_invL2;
71214184Sgabeblack@google.com  }
71314184Sgabeblack@google.com
71414184Sgabeblack@google.com  transition({I, V}, PrbInv, I) {TagArrayRead, TagArrayWrite} {
71514184Sgabeblack@google.com    pi_sendProbeResponseInv;
71614184Sgabeblack@google.com    pp_popProbeQueue;
71714184Sgabeblack@google.com  }
71814184Sgabeblack@google.com
71914184Sgabeblack@google.com  transition(M, PrbInv, W) {TagArrayRead, TagArrayWrite} {
72014184Sgabeblack@google.com    pi_sendProbeResponseInv;
72114184Sgabeblack@google.com    pp_popProbeQueue;
72214184Sgabeblack@google.com  }
72314184Sgabeblack@google.com
72414184Sgabeblack@google.com  transition(W, PrbInv) {TagArrayRead} {
72514184Sgabeblack@google.com    pi_sendProbeResponseInv;
72614184Sgabeblack@google.com    pp_popProbeQueue;
72714184Sgabeblack@google.com  }
72814184Sgabeblack@google.com
72914184Sgabeblack@google.com  transition({A, IV, WI}, PrbInv) {
73014184Sgabeblack@google.com    pi_sendProbeResponseInv;
73114184Sgabeblack@google.com    pp_popProbeQueue;
73214184Sgabeblack@google.com  }
73314184Sgabeblack@google.com
73414184Sgabeblack@google.com  transition(IV, Data, V) {TagArrayRead, TagArrayWrite, DataArrayWrite} {
73514184Sgabeblack@google.com    a_allocateBlock;
73614184Sgabeblack@google.com    ut_updateTag;
73714184Sgabeblack@google.com    wcb_writeCacheBlock;
73814184Sgabeblack@google.com    sdr_sendDataResponse;
73914184Sgabeblack@google.com    sd2rb_sendDone2RegionBuffer;
74014184Sgabeblack@google.com    pr_popResponseQueue;
74114184Sgabeblack@google.com    dt_deallocateTBE;
74214184Sgabeblack@google.com  }
74314184Sgabeblack@google.com
74414184Sgabeblack@google.com  transition(A, Data) {TagArrayRead, TagArrayWrite, DataArrayWrite} {
74514184Sgabeblack@google.com    a_allocateBlock;
74614184Sgabeblack@google.com    ar_sendAtomicResponse;
74714184Sgabeblack@google.com    sd2rb_sendDone2RegionBuffer;
74814184Sgabeblack@google.com    dna_decrementNumAtomics;
74914184Sgabeblack@google.com    pr_popResponseQueue;
75014184Sgabeblack@google.com  }
75114184Sgabeblack@google.com
75214184Sgabeblack@google.com  transition(A, AtomicDone, I) {TagArrayRead, TagArrayWrite} {
75314184Sgabeblack@google.com    dt_deallocateTBE;
75414184Sgabeblack@google.com    ptr_popTriggerQueue;
75514184Sgabeblack@google.com  }
75614184Sgabeblack@google.com
75714184Sgabeblack@google.com  transition(A, AtomicNotDone) {TagArrayRead} {
75814184Sgabeblack@google.com    ptr_popTriggerQueue;
75914184Sgabeblack@google.com  }
76014184Sgabeblack@google.com
76114184Sgabeblack@google.com  //M,W should not see WBAck as the cache is in WB mode
76214184Sgabeblack@google.com  //WBAcks do not need to check tags
76314184Sgabeblack@google.com  transition({I, V, IV, A}, WBAck) {
76414184Sgabeblack@google.com    w_sendResponseWBAck;
76514184Sgabeblack@google.com    sd2rb_sendDone2RegionBuffer;
76614184Sgabeblack@google.com    pr_popResponseQueue;
76714184Sgabeblack@google.com  }
76814184Sgabeblack@google.com
76914184Sgabeblack@google.com  transition(WI, WBAck,I) {
77014184Sgabeblack@google.com    sd2rb_sendDone2RegionBuffer;
77114184Sgabeblack@google.com    dt_deallocateTBE;
77214184Sgabeblack@google.com    pr_popResponseQueue;
77314184Sgabeblack@google.com  }
77414184Sgabeblack@google.com}
775