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