114184Sgabeblack@google.com/*
214184Sgabeblack@google.com * Copyright (c) 2010-2015 Advanced Micro Devices, Inc.
314184Sgabeblack@google.com * All rights reserved.
414184Sgabeblack@google.com *
514184Sgabeblack@google.com * For use for simulation and test purposes only
614184Sgabeblack@google.com *
714184Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
814184Sgabeblack@google.com * modification, are permitted provided that the following conditions are met:
914184Sgabeblack@google.com *
1014184Sgabeblack@google.com * 1. Redistributions of source code must retain the above copyright notice,
1114184Sgabeblack@google.com * this list of conditions and the following disclaimer.
1214184Sgabeblack@google.com *
1314184Sgabeblack@google.com * 2. Redistributions in binary form must reproduce the above copyright notice,
1414184Sgabeblack@google.com * this list of conditions and the following disclaimer in the documentation
1514184Sgabeblack@google.com * and/or other materials provided with the distribution.
1614184Sgabeblack@google.com *
1714184Sgabeblack@google.com * 3. Neither the name of the copyright holder nor the names of its
1814184Sgabeblack@google.com * contributors may be used to endorse or promote products derived from this
1914184Sgabeblack@google.com * software without specific prior written permission.
2014184Sgabeblack@google.com *
2114184Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2214184Sgabeblack@google.com * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2314184Sgabeblack@google.com * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2414184Sgabeblack@google.com * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
2514184Sgabeblack@google.com * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2614184Sgabeblack@google.com * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2714184Sgabeblack@google.com * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2814184Sgabeblack@google.com * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2914184Sgabeblack@google.com * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3014184Sgabeblack@google.com * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3114184Sgabeblack@google.com * POSSIBILITY OF SUCH DAMAGE.
3214184Sgabeblack@google.com *
3314184Sgabeblack@google.com * Authors: Lisa Hsu
3414184Sgabeblack@google.com */
3514184Sgabeblack@google.com
3614184Sgabeblack@google.commachine(MachineType:TCC, "TCC Cache")
3714184Sgabeblack@google.com : CacheMemory * L2cache;
3814184Sgabeblack@google.com   WireBuffer * w_reqToTCCDir;
3914184Sgabeblack@google.com   WireBuffer * w_respToTCCDir;
4014184Sgabeblack@google.com   WireBuffer * w_TCCUnblockToTCCDir;
4114184Sgabeblack@google.com   WireBuffer * w_reqToTCC;
4214184Sgabeblack@google.com   WireBuffer * w_probeToTCC;
4314184Sgabeblack@google.com   WireBuffer * w_respToTCC;
4414184Sgabeblack@google.com   int TCC_select_num_bits;
4514184Sgabeblack@google.com   Cycles l2_request_latency := 1;
4614184Sgabeblack@google.com   Cycles l2_response_latency := 20;
4714184Sgabeblack@google.com
4814184Sgabeblack@google.com  // To the general response network
4914184Sgabeblack@google.com  MessageBuffer * responseFromTCC, network="To", virtual_network="3", vnet_type="response";
5014184Sgabeblack@google.com
5114184Sgabeblack@google.com  // From the general response network
5214184Sgabeblack@google.com  MessageBuffer * responseToTCC, network="From", virtual_network="3", vnet_type="response";
5314184Sgabeblack@google.com
5414184Sgabeblack@google.com{
5514184Sgabeblack@google.com  // EVENTS
5614184Sgabeblack@google.com  enumeration(Event, desc="TCC Events") {
5714184Sgabeblack@google.com    // Requests coming from the Cores
5814184Sgabeblack@google.com    RdBlk,                  desc="CPU RdBlk event";
5914184Sgabeblack@google.com    RdBlkM,                 desc="CPU RdBlkM event";
6014184Sgabeblack@google.com    RdBlkS,                 desc="CPU RdBlkS event";
6114184Sgabeblack@google.com    CtoD,                   desc="Change to Dirty request";
6214184Sgabeblack@google.com    WrVicBlk,               desc="L1 Victim (dirty)";
6314184Sgabeblack@google.com    WrVicBlkShared,               desc="L1 Victim (dirty)";
6414184Sgabeblack@google.com    ClVicBlk,               desc="L1 Victim (clean)";
6514184Sgabeblack@google.com    ClVicBlkShared,               desc="L1 Victim (clean)";
6614184Sgabeblack@google.com
6714184Sgabeblack@google.com    CPUData,                      desc="WB data from CPU";
6814184Sgabeblack@google.com    CPUDataShared,                desc="WB data from CPU, NBReqShared 1";
6914184Sgabeblack@google.com    StaleWB,                desc="Stale WB, No data";
7014184Sgabeblack@google.com
7114184Sgabeblack@google.com    L2_Repl,             desc="L2 Replacement";
7214184Sgabeblack@google.com
7314184Sgabeblack@google.com    // Probes
7414184Sgabeblack@google.com    PrbInvData,         desc="Invalidating probe, return dirty data";
7514184Sgabeblack@google.com    PrbInv,             desc="Invalidating probe, no need to return data";
7614184Sgabeblack@google.com    PrbShrData,         desc="Downgrading probe, return data";
7714184Sgabeblack@google.com
7814184Sgabeblack@google.com    // Coming from Memory Controller
7914184Sgabeblack@google.com    WBAck,                     desc="ack from memory";
8014184Sgabeblack@google.com
8114184Sgabeblack@google.com    CancelWB,                   desc="Cancel WB from L2";
8214184Sgabeblack@google.com  }
8314184Sgabeblack@google.com
8414184Sgabeblack@google.com  // STATES
8514184Sgabeblack@google.com  state_declaration(State, desc="TCC State", default="TCC_State_I") {
8614184Sgabeblack@google.com    M, AccessPermission:Read_Write, desc="Modified";  // No other cache has copy, memory stale
8714184Sgabeblack@google.com    O, AccessPermission:Read_Only, desc="Owned";     // Correct most recent copy, others may exist in S
8814184Sgabeblack@google.com    E, AccessPermission:Read_Write, desc="Exclusive"; // Correct, most recent, and only copy (and == Memory)
8914184Sgabeblack@google.com    S, AccessPermission:Read_Only, desc="Shared";    // Correct, most recent. If no one in O, then == Memory
9014184Sgabeblack@google.com    I, AccessPermission:Invalid, desc="Invalid";
9114184Sgabeblack@google.com
9214184Sgabeblack@google.com    I_M, AccessPermission:Busy, desc="Invalid, received WrVicBlk, sent Ack, waiting for Data";
9314184Sgabeblack@google.com    I_O, AccessPermission:Busy, desc="Invalid, received WrVicBlk, sent Ack, waiting for Data";
9414184Sgabeblack@google.com    I_E, AccessPermission:Busy, desc="Invalid, receive ClVicBlk, sent Ack, waiting for Data";
9514184Sgabeblack@google.com    I_S, AccessPermission:Busy, desc="Invalid, receive ClVicBlk, sent Ack, waiting for Data";
9614184Sgabeblack@google.com    S_M, AccessPermission:Busy, desc="received WrVicBlk, sent Ack, waiting for Data, then go to M";
9714184Sgabeblack@google.com    S_O, AccessPermission:Busy, desc="received WrVicBlkShared, sent Ack, waiting for Data, then go to O";
9814184Sgabeblack@google.com    S_E, AccessPermission:Busy, desc="Shared, received ClVicBlk, sent Ack, waiting for Data, then go to E";
9914184Sgabeblack@google.com    S_S, AccessPermission:Busy, desc="Shared, received ClVicBlk, sent Ack, waiting for Data, then go to S";
10014184Sgabeblack@google.com    E_M, AccessPermission:Busy, desc="received WrVicBlk, sent Ack, waiting for Data, then go to O";
10114184Sgabeblack@google.com    E_O, AccessPermission:Busy, desc="received WrVicBlkShared, sent Ack, waiting for Data, then go to O";
10214184Sgabeblack@google.com    E_E, AccessPermission:Busy, desc="received WrVicBlk, sent Ack, waiting for Data, then go to O";
10314184Sgabeblack@google.com    E_S, AccessPermission:Busy, desc="Shared, received WrVicBlk, sent Ack, waiting for Data";
10414184Sgabeblack@google.com    O_M, AccessPermission:Busy, desc="...";
10514184Sgabeblack@google.com    O_O, AccessPermission:Busy, desc="...";
10614184Sgabeblack@google.com    O_E, AccessPermission:Busy, desc="...";
10714184Sgabeblack@google.com    M_M, AccessPermission:Busy, desc="...";
10814184Sgabeblack@google.com    M_O, AccessPermission:Busy, desc="...";
10914184Sgabeblack@google.com    M_E, AccessPermission:Busy, desc="...";
11014184Sgabeblack@google.com    M_S, AccessPermission:Busy, desc="...";
11114184Sgabeblack@google.com    D_I, AccessPermission:Invalid,  desc="drop WB data on the floor when receive";
11214184Sgabeblack@google.com    MOD_I, AccessPermission:Busy, desc="drop WB data on the floor, waiting for WBAck from Mem";
11314184Sgabeblack@google.com    MO_I, AccessPermission:Busy, desc="M or O, received L2_Repl, waiting for WBAck from Mem";
11414184Sgabeblack@google.com    ES_I, AccessPermission:Busy, desc="E or S, received L2_Repl, waiting for WBAck from Mem";
11514184Sgabeblack@google.com    I_C, AccessPermission:Invalid, desc="sent cancel, just waiting to receive mem wb ack so nothing gets confused";
11614184Sgabeblack@google.com  }
11714184Sgabeblack@google.com
11814184Sgabeblack@google.com  enumeration(RequestType, desc="To communicate stats from transitions to recordStats") {
11914184Sgabeblack@google.com    DataArrayRead,    desc="Read the data array";
12014184Sgabeblack@google.com    DataArrayWrite,   desc="Write the data array";
12114184Sgabeblack@google.com    TagArrayRead,     desc="Read the data array";
12214184Sgabeblack@google.com    TagArrayWrite,    desc="Write the data array";
12314184Sgabeblack@google.com  }
12414184Sgabeblack@google.com
12514184Sgabeblack@google.com
12614184Sgabeblack@google.com  // STRUCTURES
12714184Sgabeblack@google.com
12814184Sgabeblack@google.com  structure(Entry, desc="...", interface="AbstractCacheEntry") {
12914184Sgabeblack@google.com    State CacheState,           desc="cache state";
13014184Sgabeblack@google.com    bool Dirty,                 desc="Is the data dirty (diff from memory?)";
13114184Sgabeblack@google.com    DataBlock DataBlk,          desc="Data for the block";
13214184Sgabeblack@google.com  }
13314184Sgabeblack@google.com
13414184Sgabeblack@google.com  structure(TBE, desc="...") {
13514184Sgabeblack@google.com    State TBEState,     desc="Transient state";
13614184Sgabeblack@google.com    DataBlock DataBlk,  desc="data for the block";
13714184Sgabeblack@google.com    bool Dirty,         desc="Is the data dirty?";
13814184Sgabeblack@google.com    bool Shared,        desc="Victim hit by shared probe";
13914184Sgabeblack@google.com    MachineID From,     desc="Waiting for writeback from...";
14014184Sgabeblack@google.com  }
14114184Sgabeblack@google.com
14214184Sgabeblack@google.com  structure(TBETable, external="yes") {
14314184Sgabeblack@google.com    TBE lookup(Addr);
14414184Sgabeblack@google.com    void allocate(Addr);
14514184Sgabeblack@google.com    void deallocate(Addr);
14614184Sgabeblack@google.com    bool isPresent(Addr);
14714184Sgabeblack@google.com  }
14814184Sgabeblack@google.com
14914184Sgabeblack@google.com  TBETable TBEs, template="<TCC_TBE>", constructor="m_number_of_TBEs";
15014184Sgabeblack@google.com  int TCC_select_low_bit, default="RubySystem::getBlockSizeBits()";
15114184Sgabeblack@google.com
15214184Sgabeblack@google.com  void set_cache_entry(AbstractCacheEntry b);
15314184Sgabeblack@google.com  void unset_cache_entry();
15414184Sgabeblack@google.com  void set_tbe(TBE b);
15514184Sgabeblack@google.com  void unset_tbe();
15614184Sgabeblack@google.com  void wakeUpAllBuffers();
15714184Sgabeblack@google.com  void wakeUpBuffers(Addr a);
15814184Sgabeblack@google.com
15914184Sgabeblack@google.com
16014184Sgabeblack@google.com  // FUNCTION DEFINITIONS
16114184Sgabeblack@google.com  Tick clockEdge();
16214184Sgabeblack@google.com  Tick cyclesToTicks(Cycles c);
16314184Sgabeblack@google.com
16414184Sgabeblack@google.com  Entry getCacheEntry(Addr addr), return_by_pointer="yes" {
16514184Sgabeblack@google.com    return static_cast(Entry, "pointer", L2cache.lookup(addr));
16614184Sgabeblack@google.com  }
16714184Sgabeblack@google.com
16814184Sgabeblack@google.com  DataBlock getDataBlock(Addr addr), return_by_ref="yes" {
16914184Sgabeblack@google.com    return getCacheEntry(addr).DataBlk;
17014184Sgabeblack@google.com  }
17114184Sgabeblack@google.com
17214184Sgabeblack@google.com  bool presentOrAvail(Addr addr) {
17314184Sgabeblack@google.com    return L2cache.isTagPresent(addr) || L2cache.cacheAvail(addr);
17414184Sgabeblack@google.com  }
17514184Sgabeblack@google.com
17614184Sgabeblack@google.com  State getState(TBE tbe, Entry cache_entry, Addr addr) {
17714184Sgabeblack@google.com    if (is_valid(tbe)) {
17814184Sgabeblack@google.com      return tbe.TBEState;
17914184Sgabeblack@google.com    } else if (is_valid(cache_entry)) {
18014184Sgabeblack@google.com      return cache_entry.CacheState;
18114184Sgabeblack@google.com    }
18214184Sgabeblack@google.com    return State:I;
18314184Sgabeblack@google.com  }
18414184Sgabeblack@google.com
18514184Sgabeblack@google.com  void setState(TBE tbe, Entry cache_entry, Addr addr, State state) {
18614184Sgabeblack@google.com    if (is_valid(tbe)) {
18714184Sgabeblack@google.com        tbe.TBEState := state;
18814184Sgabeblack@google.com    }
18914184Sgabeblack@google.com
19014184Sgabeblack@google.com    if (is_valid(cache_entry)) {
19114184Sgabeblack@google.com        cache_entry.CacheState := state;
19214184Sgabeblack@google.com    }
19314184Sgabeblack@google.com  }
19414184Sgabeblack@google.com
19514184Sgabeblack@google.com  AccessPermission getAccessPermission(Addr addr) {
19614184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
19714184Sgabeblack@google.com    if(is_valid(tbe)) {
19814184Sgabeblack@google.com      return TCC_State_to_permission(tbe.TBEState);
19914184Sgabeblack@google.com    }
20014184Sgabeblack@google.com
20114184Sgabeblack@google.com    Entry cache_entry := getCacheEntry(addr);
20214184Sgabeblack@google.com    if(is_valid(cache_entry)) {
20314184Sgabeblack@google.com      return TCC_State_to_permission(cache_entry.CacheState);
20414184Sgabeblack@google.com    }
20514184Sgabeblack@google.com
20614184Sgabeblack@google.com    return AccessPermission:NotPresent;
20714184Sgabeblack@google.com  }
20814184Sgabeblack@google.com
20914184Sgabeblack@google.com  void setAccessPermission(Entry cache_entry, Addr addr, State state) {
21014184Sgabeblack@google.com    if (is_valid(cache_entry)) {
21114184Sgabeblack@google.com      cache_entry.changePermission(TCC_State_to_permission(state));
21214184Sgabeblack@google.com    }
21314184Sgabeblack@google.com  }
21414184Sgabeblack@google.com
21514184Sgabeblack@google.com  void functionalRead(Addr addr, Packet *pkt) {
21614184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
21714184Sgabeblack@google.com    if(is_valid(tbe)) {
21814184Sgabeblack@google.com      testAndRead(addr, tbe.DataBlk, pkt);
21914184Sgabeblack@google.com    } else {
22014184Sgabeblack@google.com      functionalMemoryRead(pkt);
22114184Sgabeblack@google.com    }
22214184Sgabeblack@google.com  }
22314184Sgabeblack@google.com
22414184Sgabeblack@google.com  int functionalWrite(Addr addr, Packet *pkt) {
22514184Sgabeblack@google.com    int num_functional_writes := 0;
22614184Sgabeblack@google.com
22714184Sgabeblack@google.com    TBE tbe := TBEs.lookup(addr);
22814184Sgabeblack@google.com    if(is_valid(tbe)) {
22914184Sgabeblack@google.com      num_functional_writes := num_functional_writes +
23014184Sgabeblack@google.com            testAndWrite(addr, tbe.DataBlk, pkt);
23114184Sgabeblack@google.com    }
23214184Sgabeblack@google.com
23314184Sgabeblack@google.com    num_functional_writes := num_functional_writes + functionalMemoryWrite(pkt);
23414184Sgabeblack@google.com    return num_functional_writes;
23514184Sgabeblack@google.com  }
23614184Sgabeblack@google.com
23714184Sgabeblack@google.com  void recordRequestType(RequestType request_type, Addr addr) {
23814184Sgabeblack@google.com    if (request_type == RequestType:DataArrayRead) {
23914184Sgabeblack@google.com        L2cache.recordRequestType(CacheRequestType:DataArrayRead, addr);
24014184Sgabeblack@google.com    } else if (request_type == RequestType:DataArrayWrite) {
24114184Sgabeblack@google.com        L2cache.recordRequestType(CacheRequestType:DataArrayWrite, addr);
24214184Sgabeblack@google.com    } else if (request_type == RequestType:TagArrayRead) {
24314184Sgabeblack@google.com        L2cache.recordRequestType(CacheRequestType:TagArrayRead, addr);
24414184Sgabeblack@google.com    } else if (request_type == RequestType:TagArrayWrite) {
24514184Sgabeblack@google.com        L2cache.recordRequestType(CacheRequestType:TagArrayWrite, addr);
24614184Sgabeblack@google.com    }
24714184Sgabeblack@google.com  }
24814184Sgabeblack@google.com
24914184Sgabeblack@google.com  bool checkResourceAvailable(RequestType request_type, Addr addr) {
25014184Sgabeblack@google.com    if (request_type == RequestType:DataArrayRead) {
25114184Sgabeblack@google.com      return L2cache.checkResourceAvailable(CacheResourceType:DataArray, addr);
25214184Sgabeblack@google.com    } else if (request_type == RequestType:DataArrayWrite) {
25314184Sgabeblack@google.com      return L2cache.checkResourceAvailable(CacheResourceType:DataArray, addr);
25414184Sgabeblack@google.com    } else if (request_type == RequestType:TagArrayRead) {
25514184Sgabeblack@google.com      return L2cache.checkResourceAvailable(CacheResourceType:TagArray, addr);
25614184Sgabeblack@google.com    } else if (request_type == RequestType:TagArrayWrite) {
25714184Sgabeblack@google.com      return L2cache.checkResourceAvailable(CacheResourceType:TagArray, addr);
25814184Sgabeblack@google.com    } else {
25914184Sgabeblack@google.com      error("Invalid RequestType type in checkResourceAvailable");
26014184Sgabeblack@google.com      return true;
26114184Sgabeblack@google.com    }
26214184Sgabeblack@google.com  }
26314184Sgabeblack@google.com
26414184Sgabeblack@google.com
26514184Sgabeblack@google.com
26614184Sgabeblack@google.com  // OUT PORTS
26714184Sgabeblack@google.com  out_port(w_requestNetwork_out, CPURequestMsg, w_reqToTCCDir);
26814184Sgabeblack@google.com  out_port(w_TCCResp_out, ResponseMsg, w_respToTCCDir);
26914184Sgabeblack@google.com  out_port(responseNetwork_out, ResponseMsg, responseFromTCC);
27014184Sgabeblack@google.com  out_port(w_unblockNetwork_out, UnblockMsg, w_TCCUnblockToTCCDir);
27114184Sgabeblack@google.com
27214184Sgabeblack@google.com  // IN PORTS
27314184Sgabeblack@google.com  in_port(TDResponse_in, ResponseMsg, w_respToTCC) {
27414184Sgabeblack@google.com    if (TDResponse_in.isReady(clockEdge())) {
27514184Sgabeblack@google.com      peek(TDResponse_in, ResponseMsg) {
27614184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
27714184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
27814184Sgabeblack@google.com        if (in_msg.Type == CoherenceResponseType:TDSysWBAck) {
27914184Sgabeblack@google.com          trigger(Event:WBAck, in_msg.addr, cache_entry, tbe);
28014184Sgabeblack@google.com        }
28114184Sgabeblack@google.com        else {
28214184Sgabeblack@google.com          DPRINTF(RubySlicc, "%s\n", in_msg);
28314184Sgabeblack@google.com          error("Error on TDResponse Type");
28414184Sgabeblack@google.com        }
28514184Sgabeblack@google.com      }
28614184Sgabeblack@google.com    }
28714184Sgabeblack@google.com  }
28814184Sgabeblack@google.com
28914184Sgabeblack@google.com  // Response Network
29014184Sgabeblack@google.com  in_port(responseNetwork_in, ResponseMsg, responseToTCC) {
29114184Sgabeblack@google.com    if (responseNetwork_in.isReady(clockEdge())) {
29214184Sgabeblack@google.com      peek(responseNetwork_in, ResponseMsg) {
29314184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
29414184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
29514184Sgabeblack@google.com        if (in_msg.Type == CoherenceResponseType:CPUData) {
29614184Sgabeblack@google.com          if (in_msg.NbReqShared) {
29714184Sgabeblack@google.com            trigger(Event:CPUDataShared, in_msg.addr, cache_entry, tbe);
29814184Sgabeblack@google.com          } else {
29914184Sgabeblack@google.com            trigger(Event:CPUData, in_msg.addr, cache_entry, tbe);
30014184Sgabeblack@google.com          }
30114184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:StaleNotif) {
30214184Sgabeblack@google.com            trigger(Event:StaleWB, in_msg.addr, cache_entry, tbe);
30314184Sgabeblack@google.com        } else {
30414184Sgabeblack@google.com          DPRINTF(RubySlicc, "%s\n", in_msg);
30514184Sgabeblack@google.com          error("Error on TDResponse Type");
30614184Sgabeblack@google.com        }
30714184Sgabeblack@google.com      }
30814184Sgabeblack@google.com    }
30914184Sgabeblack@google.com  }
31014184Sgabeblack@google.com
31114184Sgabeblack@google.com  // probe network
31214184Sgabeblack@google.com  in_port(probeNetwork_in, TDProbeRequestMsg, w_probeToTCC) {
31314184Sgabeblack@google.com    if (probeNetwork_in.isReady(clockEdge())) {
31414184Sgabeblack@google.com      peek(probeNetwork_in, TDProbeRequestMsg) {
31514184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
31614184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
31714184Sgabeblack@google.com        if (in_msg.Type == ProbeRequestType:PrbInv) {
31814184Sgabeblack@google.com          if (in_msg.ReturnData) {
31914184Sgabeblack@google.com            trigger(Event:PrbInvData, in_msg.addr, cache_entry, tbe);
32014184Sgabeblack@google.com          } else {
32114184Sgabeblack@google.com            trigger(Event:PrbInv, in_msg.addr, cache_entry, tbe);
32214184Sgabeblack@google.com          }
32314184Sgabeblack@google.com        } else if (in_msg.Type == ProbeRequestType:PrbDowngrade) {
32414184Sgabeblack@google.com          if (in_msg.ReturnData) {
32514184Sgabeblack@google.com            trigger(Event:PrbShrData, in_msg.addr, cache_entry, tbe);
32614184Sgabeblack@google.com          } else {
32714184Sgabeblack@google.com            error("Don't think I should get any of these");
32814184Sgabeblack@google.com          }
32914184Sgabeblack@google.com        }
33014184Sgabeblack@google.com      }
33114184Sgabeblack@google.com    }
33214184Sgabeblack@google.com  }
33314184Sgabeblack@google.com
33414184Sgabeblack@google.com  // Request Network
33514184Sgabeblack@google.com  in_port(requestNetwork_in, CPURequestMsg, w_reqToTCC) {
33614184Sgabeblack@google.com    if (requestNetwork_in.isReady(clockEdge())) {
33714184Sgabeblack@google.com      peek(requestNetwork_in, CPURequestMsg) {
33814184Sgabeblack@google.com        assert(in_msg.Destination.isElement(machineID));
33914184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
34014184Sgabeblack@google.com        TBE tbe := TBEs.lookup(in_msg.addr);
34114184Sgabeblack@google.com        if (in_msg.Type == CoherenceRequestType:RdBlk) {
34214184Sgabeblack@google.com          trigger(Event:RdBlk, in_msg.addr, cache_entry, tbe);
34314184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:RdBlkS) {
34414184Sgabeblack@google.com          trigger(Event:RdBlkS, in_msg.addr, cache_entry, tbe);
34514184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:RdBlkM) {
34614184Sgabeblack@google.com          trigger(Event:RdBlkM, in_msg.addr, cache_entry, tbe);
34714184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:VicClean) {
34814184Sgabeblack@google.com          if (presentOrAvail(in_msg.addr)) {
34914184Sgabeblack@google.com            if (in_msg.Shared) {
35014184Sgabeblack@google.com              trigger(Event:ClVicBlkShared, in_msg.addr, cache_entry, tbe);
35114184Sgabeblack@google.com            } else {
35214184Sgabeblack@google.com              trigger(Event:ClVicBlk, in_msg.addr, cache_entry, tbe);
35314184Sgabeblack@google.com            }
35414184Sgabeblack@google.com          } else {
35514184Sgabeblack@google.com            Addr victim :=  L2cache.cacheProbe(in_msg.addr);
35614184Sgabeblack@google.com            trigger(Event:L2_Repl, victim, getCacheEntry(victim), TBEs.lookup(victim));
35714184Sgabeblack@google.com          }
35814184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:VicDirty) {
35914184Sgabeblack@google.com          if (presentOrAvail(in_msg.addr)) {
36014184Sgabeblack@google.com            if (in_msg.Shared) {
36114184Sgabeblack@google.com              trigger(Event:WrVicBlkShared, in_msg.addr, cache_entry, tbe);
36214184Sgabeblack@google.com            } else {
36314184Sgabeblack@google.com              trigger(Event:WrVicBlk, in_msg.addr, cache_entry, tbe);
36414184Sgabeblack@google.com            }
36514184Sgabeblack@google.com          } else {
36614184Sgabeblack@google.com            Addr victim := L2cache.cacheProbe(in_msg.addr);
36714184Sgabeblack@google.com            trigger(Event:L2_Repl, victim, getCacheEntry(victim), TBEs.lookup(victim));
36814184Sgabeblack@google.com          }
36914184Sgabeblack@google.com        } else {
37014184Sgabeblack@google.com            requestNetwork_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
37114184Sgabeblack@google.com        }
37214184Sgabeblack@google.com      }
37314184Sgabeblack@google.com    }
37414184Sgabeblack@google.com  }
37514184Sgabeblack@google.com
37614184Sgabeblack@google.com  // BEGIN ACTIONS
37714184Sgabeblack@google.com
37814184Sgabeblack@google.com  action(i_invL2, "i", desc="invalidate TCC cache block") {
37914184Sgabeblack@google.com    if (is_valid(cache_entry)) {
38014184Sgabeblack@google.com        L2cache.deallocate(address);
38114184Sgabeblack@google.com    }
38214184Sgabeblack@google.com    unset_cache_entry();
38314184Sgabeblack@google.com  }
38414184Sgabeblack@google.com
38514184Sgabeblack@google.com  action(rm_sendResponseM, "rm", desc="send Modified response") {
38614184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
38714184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, l2_response_latency) {
38814184Sgabeblack@google.com        out_msg.addr := address;
38914184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:TDSysResp;
39014184Sgabeblack@google.com        out_msg.Sender := machineID;
39114184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
39214184Sgabeblack@google.com        out_msg.DataBlk := cache_entry.DataBlk;
39314184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
39414184Sgabeblack@google.com        out_msg.Dirty := cache_entry.Dirty;
39514184Sgabeblack@google.com        out_msg.State := CoherenceState:Modified;
39614184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
39714184Sgabeblack@google.com      }
39814184Sgabeblack@google.com    }
39914184Sgabeblack@google.com  }
40014184Sgabeblack@google.com
40114184Sgabeblack@google.com  action(rs_sendResponseS, "rs", desc="send Shared response") {
40214184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
40314184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, l2_response_latency) {
40414184Sgabeblack@google.com        out_msg.addr := address;
40514184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:TDSysResp;
40614184Sgabeblack@google.com        out_msg.Sender := machineID;
40714184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
40814184Sgabeblack@google.com        out_msg.DataBlk := cache_entry.DataBlk;
40914184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
41014184Sgabeblack@google.com        out_msg.Dirty := cache_entry.Dirty;
41114184Sgabeblack@google.com        out_msg.State := CoherenceState:Shared;
41214184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
41314184Sgabeblack@google.com      }
41414184Sgabeblack@google.com    }
41514184Sgabeblack@google.com  }
41614184Sgabeblack@google.com
41714184Sgabeblack@google.com
41814184Sgabeblack@google.com  action(r_requestToTD, "r", desc="Miss in L2, pass on") {
41914184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
42014184Sgabeblack@google.com      enqueue(w_requestNetwork_out, CPURequestMsg, l2_request_latency) {
42114184Sgabeblack@google.com        out_msg.addr := address;
42214184Sgabeblack@google.com        out_msg.Type := in_msg.Type;
42314184Sgabeblack@google.com        out_msg.Requestor := in_msg.Requestor;
42414184Sgabeblack@google.com        out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir,
42514184Sgabeblack@google.com                                TCC_select_low_bit, TCC_select_num_bits));
42614184Sgabeblack@google.com        out_msg.Shared := false; // unneeded for this request
42714184Sgabeblack@google.com        out_msg.MessageSize := in_msg.MessageSize;
42814184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg);
42914184Sgabeblack@google.com      }
43014184Sgabeblack@google.com    }
43114184Sgabeblack@google.com  }
43214184Sgabeblack@google.com
43314184Sgabeblack@google.com  action(t_allocateTBE, "t", desc="allocate TBE Entry") {
43414184Sgabeblack@google.com    TBEs.allocate(address);
43514184Sgabeblack@google.com    set_tbe(TBEs.lookup(address));
43614184Sgabeblack@google.com    if (is_valid(cache_entry)) {
43714184Sgabeblack@google.com      tbe.DataBlk := cache_entry.DataBlk; // Data only for WBs
43814184Sgabeblack@google.com      tbe.Dirty := cache_entry.Dirty;
43914184Sgabeblack@google.com    }
44014184Sgabeblack@google.com    tbe.From := machineID;
44114184Sgabeblack@google.com  }
44214184Sgabeblack@google.com
44314184Sgabeblack@google.com  action(dt_deallocateTBE, "dt", desc="deallocate TBE Entry") {
44414184Sgabeblack@google.com    TBEs.deallocate(address);
44514184Sgabeblack@google.com    unset_tbe();
44614184Sgabeblack@google.com  }
44714184Sgabeblack@google.com
44814184Sgabeblack@google.com  action(vc_vicClean, "vc", desc="Victimize Clean L2 data") {
44914184Sgabeblack@google.com    enqueue(w_requestNetwork_out, CPURequestMsg, l2_request_latency) {
45014184Sgabeblack@google.com      out_msg.addr := address;
45114184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:VicClean;
45214184Sgabeblack@google.com      out_msg.Requestor := machineID;
45314184Sgabeblack@google.com      out_msg.DataBlk := cache_entry.DataBlk;
45414184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir,
45514184Sgabeblack@google.com                              TCC_select_low_bit, TCC_select_num_bits));
45614184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
45714184Sgabeblack@google.com    }
45814184Sgabeblack@google.com  }
45914184Sgabeblack@google.com
46014184Sgabeblack@google.com  action(vd_vicDirty, "vd", desc="Victimize dirty L2 data") {
46114184Sgabeblack@google.com    enqueue(w_requestNetwork_out, CPURequestMsg, l2_request_latency) {
46214184Sgabeblack@google.com      out_msg.addr := address;
46314184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:VicDirty;
46414184Sgabeblack@google.com      out_msg.Requestor := machineID;
46514184Sgabeblack@google.com      out_msg.DataBlk := cache_entry.DataBlk;
46614184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir,
46714184Sgabeblack@google.com                              TCC_select_low_bit, TCC_select_num_bits));
46814184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
46914184Sgabeblack@google.com    }
47014184Sgabeblack@google.com  }
47114184Sgabeblack@google.com
47214184Sgabeblack@google.com  action(w_sendResponseWBAck, "w", desc="send WB Ack") {
47314184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
47414184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, l2_response_latency) {
47514184Sgabeblack@google.com        out_msg.addr := address;
47614184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:TDSysWBAck;
47714184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
47814184Sgabeblack@google.com        out_msg.Sender := machineID;
47914184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Control;
48014184Sgabeblack@google.com      }
48114184Sgabeblack@google.com    }
48214184Sgabeblack@google.com  }
48314184Sgabeblack@google.com
48414184Sgabeblack@google.com  action(pi_sendProbeResponseInv, "pi", desc="send probe ack inv, no data") {
48514184Sgabeblack@google.com    enqueue(w_TCCResp_out, ResponseMsg, l2_request_latency) {
48614184Sgabeblack@google.com      out_msg.addr := address;
48714184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:CPUPrbResp;  // TCC and CPUs respond in same way to probes
48814184Sgabeblack@google.com      out_msg.Sender := machineID;
48914184Sgabeblack@google.com      // will this always be ok? probably not for multisocket
49014184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir,
49114184Sgabeblack@google.com                              TCC_select_low_bit, TCC_select_num_bits));
49214184Sgabeblack@google.com      out_msg.Dirty := false;
49314184Sgabeblack@google.com      out_msg.Hit := false;
49414184Sgabeblack@google.com      out_msg.Ntsl := true;
49514184Sgabeblack@google.com      out_msg.State := CoherenceState:NA;
49614184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Control;
49714184Sgabeblack@google.com    }
49814184Sgabeblack@google.com  }
49914184Sgabeblack@google.com
50014184Sgabeblack@google.com  action(ph_sendProbeResponseHit, "ph", desc="send probe ack, no data") {
50114184Sgabeblack@google.com    enqueue(w_TCCResp_out, ResponseMsg, l2_request_latency) {
50214184Sgabeblack@google.com      out_msg.addr := address;
50314184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:CPUPrbResp;  // TCC and CPUs respond in same way to probes
50414184Sgabeblack@google.com      out_msg.Sender := machineID;
50514184Sgabeblack@google.com      // will this always be ok? probably not for multisocket
50614184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir,
50714184Sgabeblack@google.com                              TCC_select_low_bit, TCC_select_num_bits));
50814184Sgabeblack@google.com      out_msg.Dirty := false;
50914184Sgabeblack@google.com      out_msg.Hit := true;
51014184Sgabeblack@google.com      out_msg.Ntsl := false;
51114184Sgabeblack@google.com      out_msg.State := CoherenceState:NA;
51214184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Control;
51314184Sgabeblack@google.com    }
51414184Sgabeblack@google.com  }
51514184Sgabeblack@google.com
51614184Sgabeblack@google.com  action(pm_sendProbeResponseMiss, "pm", desc="send probe ack, no data") {
51714184Sgabeblack@google.com    enqueue(w_TCCResp_out, ResponseMsg, l2_request_latency) {
51814184Sgabeblack@google.com      out_msg.addr := address;
51914184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:CPUPrbResp;  // TCC and CPUs respond in same way to probes
52014184Sgabeblack@google.com      out_msg.Sender := machineID;
52114184Sgabeblack@google.com      // will this always be ok? probably not for multisocket
52214184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir,
52314184Sgabeblack@google.com                              TCC_select_low_bit, TCC_select_num_bits));
52414184Sgabeblack@google.com      out_msg.Dirty := false;
52514184Sgabeblack@google.com      out_msg.Hit := false;
52614184Sgabeblack@google.com      out_msg.Ntsl := false;
52714184Sgabeblack@google.com      out_msg.State := CoherenceState:NA;
52814184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Control;
52914184Sgabeblack@google.com    }
53014184Sgabeblack@google.com  }
53114184Sgabeblack@google.com
53214184Sgabeblack@google.com  action(pd_sendProbeResponseData, "pd", desc="send probe ack, with data") {
53314184Sgabeblack@google.com    enqueue(w_TCCResp_out, ResponseMsg, l2_request_latency) {
53414184Sgabeblack@google.com      out_msg.addr := address;
53514184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:CPUPrbResp;  // TCC and CPUs respond in same way to probes
53614184Sgabeblack@google.com      out_msg.Sender := machineID;
53714184Sgabeblack@google.com      // will this always be ok? probably not for multisocket
53814184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir,
53914184Sgabeblack@google.com                              TCC_select_low_bit, TCC_select_num_bits));
54014184Sgabeblack@google.com      out_msg.DataBlk := cache_entry.DataBlk;
54114184Sgabeblack@google.com      //assert(cache_entry.Dirty); Not needed in TCC where TCC can supply clean data
54214184Sgabeblack@google.com      out_msg.Dirty := cache_entry.Dirty;
54314184Sgabeblack@google.com      out_msg.Hit := true;
54414184Sgabeblack@google.com      out_msg.State := CoherenceState:NA;
54514184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
54614184Sgabeblack@google.com    }
54714184Sgabeblack@google.com  }
54814184Sgabeblack@google.com
54914184Sgabeblack@google.com  action(pdt_sendProbeResponseDataFromTBE, "pdt", desc="send probe ack with data") {
55014184Sgabeblack@google.com    enqueue(w_TCCResp_out, ResponseMsg, l2_request_latency) {
55114184Sgabeblack@google.com      out_msg.addr := address;
55214184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:CPUPrbResp;
55314184Sgabeblack@google.com      out_msg.Sender := machineID;
55414184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir,
55514184Sgabeblack@google.com                              TCC_select_low_bit, TCC_select_num_bits));
55614184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
55714184Sgabeblack@google.com      //assert(tbe.Dirty);
55814184Sgabeblack@google.com      out_msg.Dirty := tbe.Dirty;
55914184Sgabeblack@google.com      out_msg.Hit := true;
56014184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
56114184Sgabeblack@google.com      out_msg.State := CoherenceState:NA;
56214184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", out_msg);
56314184Sgabeblack@google.com    }
56414184Sgabeblack@google.com  }
56514184Sgabeblack@google.com
56614184Sgabeblack@google.com  action(mc_cancelMemWriteback, "mc", desc="send writeback cancel to memory") {
56714184Sgabeblack@google.com    enqueue(w_requestNetwork_out, CPURequestMsg, l2_request_latency) {
56814184Sgabeblack@google.com      out_msg.addr := address;
56914184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:WrCancel;
57014184Sgabeblack@google.com      out_msg.Requestor := machineID;
57114184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir,
57214184Sgabeblack@google.com                              TCC_select_low_bit, TCC_select_num_bits));
57314184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Request_Control;
57414184Sgabeblack@google.com    }
57514184Sgabeblack@google.com  }
57614184Sgabeblack@google.com
57714184Sgabeblack@google.com  action(a_allocateBlock, "a", desc="allocate TCC block") {
57814184Sgabeblack@google.com    if (is_invalid(cache_entry)) {
57914184Sgabeblack@google.com      set_cache_entry(L2cache.allocate(address, new Entry));
58014184Sgabeblack@google.com    }
58114184Sgabeblack@google.com  }
58214184Sgabeblack@google.com
58314184Sgabeblack@google.com  action(d_writeData, "d", desc="write data to TCC") {
58414184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
58514184Sgabeblack@google.com      if (in_msg.Dirty) {
58614184Sgabeblack@google.com        cache_entry.Dirty := in_msg.Dirty;
58714184Sgabeblack@google.com      }
58814184Sgabeblack@google.com      cache_entry.DataBlk := in_msg.DataBlk;
58914184Sgabeblack@google.com      DPRINTF(RubySlicc, "Writing to TCC: %s\n", in_msg);
59014184Sgabeblack@google.com    }
59114184Sgabeblack@google.com  }
59214184Sgabeblack@google.com
59314184Sgabeblack@google.com  action(rd_copyDataFromRequest, "rd", desc="write data to TCC") {
59414184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
59514184Sgabeblack@google.com      cache_entry.DataBlk := in_msg.DataBlk;
59614184Sgabeblack@google.com      cache_entry.Dirty := true;
59714184Sgabeblack@google.com    }
59814184Sgabeblack@google.com  }
59914184Sgabeblack@google.com
60014184Sgabeblack@google.com  action(f_setFrom, "f", desc="set who WB is expected to come from") {
60114184Sgabeblack@google.com    peek(requestNetwork_in, CPURequestMsg) {
60214184Sgabeblack@google.com      tbe.From := in_msg.Requestor;
60314184Sgabeblack@google.com    }
60414184Sgabeblack@google.com  }
60514184Sgabeblack@google.com
60614184Sgabeblack@google.com  action(rf_resetFrom, "rf", desc="reset From") {
60714184Sgabeblack@google.com    tbe.From := machineID;
60814184Sgabeblack@google.com  }
60914184Sgabeblack@google.com
61014184Sgabeblack@google.com  action(wb_data, "wb", desc="write back data") {
61114184Sgabeblack@google.com    enqueue(w_TCCResp_out, ResponseMsg, l2_request_latency) {
61214184Sgabeblack@google.com      out_msg.addr := address;
61314184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:CPUData;
61414184Sgabeblack@google.com      out_msg.Sender := machineID;
61514184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir,
61614184Sgabeblack@google.com                              TCC_select_low_bit, TCC_select_num_bits));
61714184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
61814184Sgabeblack@google.com      out_msg.Dirty := tbe.Dirty;
61914184Sgabeblack@google.com      if (tbe.Shared) {
62014184Sgabeblack@google.com        out_msg.NbReqShared := true;
62114184Sgabeblack@google.com      } else {
62214184Sgabeblack@google.com        out_msg.NbReqShared := false;
62314184Sgabeblack@google.com      }
62414184Sgabeblack@google.com      out_msg.State := CoherenceState:Shared; // faux info
62514184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Writeback_Data;
62614184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", out_msg);
62714184Sgabeblack@google.com    }
62814184Sgabeblack@google.com  }
62914184Sgabeblack@google.com
63014184Sgabeblack@google.com  action(wt_writeDataToTBE, "wt", desc="write WB data to TBE") {
63114184Sgabeblack@google.com    peek(responseNetwork_in, ResponseMsg) {
63214184Sgabeblack@google.com      tbe.DataBlk := in_msg.DataBlk;
63314184Sgabeblack@google.com      tbe.Dirty := in_msg.Dirty;
63414184Sgabeblack@google.com    }
63514184Sgabeblack@google.com  }
63614184Sgabeblack@google.com
63714184Sgabeblack@google.com  action(uo_sendUnblockOwner, "uo", desc="state changed to E, M, or O, unblock") {
63814184Sgabeblack@google.com    enqueue(w_unblockNetwork_out, UnblockMsg, l2_request_latency) {
63914184Sgabeblack@google.com      out_msg.addr := address;
64014184Sgabeblack@google.com      out_msg.Sender := machineID;
64114184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir,
64214184Sgabeblack@google.com                              TCC_select_low_bit, TCC_select_num_bits));
64314184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Unblock_Control;
64414184Sgabeblack@google.com      out_msg.currentOwner := true;
64514184Sgabeblack@google.com      out_msg.valid := true;
64614184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", out_msg);
64714184Sgabeblack@google.com    }
64814184Sgabeblack@google.com  }
64914184Sgabeblack@google.com
65014184Sgabeblack@google.com  action(us_sendUnblockSharer, "us", desc="state changed to S , unblock") {
65114184Sgabeblack@google.com    enqueue(w_unblockNetwork_out, UnblockMsg, l2_request_latency) {
65214184Sgabeblack@google.com      out_msg.addr := address;
65314184Sgabeblack@google.com      out_msg.Sender := machineID;
65414184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir,
65514184Sgabeblack@google.com                              TCC_select_low_bit, TCC_select_num_bits));
65614184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Unblock_Control;
65714184Sgabeblack@google.com      out_msg.currentOwner := false;
65814184Sgabeblack@google.com      out_msg.valid := true;
65914184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", out_msg);
66014184Sgabeblack@google.com    }
66114184Sgabeblack@google.com  }
66214184Sgabeblack@google.com
66314184Sgabeblack@google.com  action(un_sendUnblockNotValid, "un", desc="state changed toI, unblock") {
66414184Sgabeblack@google.com    enqueue(w_unblockNetwork_out, UnblockMsg, l2_request_latency) {
66514184Sgabeblack@google.com      out_msg.addr := address;
66614184Sgabeblack@google.com      out_msg.Sender := machineID;
66714184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir,
66814184Sgabeblack@google.com                              TCC_select_low_bit, TCC_select_num_bits));
66914184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Unblock_Control;
67014184Sgabeblack@google.com      out_msg.currentOwner := false;
67114184Sgabeblack@google.com      out_msg.valid := false;
67214184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", out_msg);
67314184Sgabeblack@google.com    }
67414184Sgabeblack@google.com  }
67514184Sgabeblack@google.com
67614184Sgabeblack@google.com  action(ut_updateTag, "ut", desc="update Tag (i.e. set MRU)") {
67714184Sgabeblack@google.com    L2cache.setMRU(address);
67814184Sgabeblack@google.com  }
67914184Sgabeblack@google.com
68014184Sgabeblack@google.com  action(p_popRequestQueue, "p", desc="pop request queue") {
68114184Sgabeblack@google.com    requestNetwork_in.dequeue(clockEdge());
68214184Sgabeblack@google.com  }
68314184Sgabeblack@google.com
68414184Sgabeblack@google.com  action(pr_popResponseQueue, "pr", desc="pop response queue") {
68514184Sgabeblack@google.com    responseNetwork_in.dequeue(clockEdge());
68614184Sgabeblack@google.com  }
68714184Sgabeblack@google.com
68814184Sgabeblack@google.com  action(pn_popTDResponseQueue, "pn", desc="pop TD response queue") {
68914184Sgabeblack@google.com    TDResponse_in.dequeue(clockEdge());
69014184Sgabeblack@google.com  }
69114184Sgabeblack@google.com
69214184Sgabeblack@google.com  action(pp_popProbeQueue, "pp", desc="pop probe queue") {
69314184Sgabeblack@google.com    probeNetwork_in.dequeue(clockEdge());
69414184Sgabeblack@google.com  }
69514184Sgabeblack@google.com
69614184Sgabeblack@google.com  action(zz_recycleRequestQueue, "\z", desc="recycle request queue") {
69714184Sgabeblack@google.com    requestNetwork_in.recycle(clockEdge(), cyclesToTicks(recycle_latency));
69814184Sgabeblack@google.com  }
69914184Sgabeblack@google.com
70014184Sgabeblack@google.com
70114184Sgabeblack@google.com  // END ACTIONS
70214184Sgabeblack@google.com
70314184Sgabeblack@google.com  // BEGIN TRANSITIONS
70414184Sgabeblack@google.com
70514184Sgabeblack@google.com  // transitions from base
70614184Sgabeblack@google.com
70714184Sgabeblack@google.com  transition({I, I_C}, {RdBlk, RdBlkS, RdBlkM, CtoD}){TagArrayRead} {
70814184Sgabeblack@google.com    // TCCdir already knows that the block is not here. This is to allocate and get the block.
70914184Sgabeblack@google.com    r_requestToTD;
71014184Sgabeblack@google.com    p_popRequestQueue;
71114184Sgabeblack@google.com  }
71214184Sgabeblack@google.com
71314184Sgabeblack@google.com// check
71414184Sgabeblack@google.com  transition({M, O}, RdBlk, O){TagArrayRead, TagArrayWrite} {
71514184Sgabeblack@google.com    rs_sendResponseS;
71614184Sgabeblack@google.com    ut_updateTag;
71714184Sgabeblack@google.com    // detect 2nd chancing
71814184Sgabeblack@google.com    p_popRequestQueue;
71914184Sgabeblack@google.com  }
72014184Sgabeblack@google.com
72114184Sgabeblack@google.com//check
72214184Sgabeblack@google.com  transition({E, S}, RdBlk, S){TagArrayRead, TagArrayWrite} {
72314184Sgabeblack@google.com    rs_sendResponseS;
72414184Sgabeblack@google.com    ut_updateTag;
72514184Sgabeblack@google.com    // detect 2nd chancing
72614184Sgabeblack@google.com    p_popRequestQueue;
72714184Sgabeblack@google.com  }
72814184Sgabeblack@google.com
72914184Sgabeblack@google.com// check
73014184Sgabeblack@google.com  transition({M, O}, RdBlkS, O){TagArrayRead, TagArrayWrite} {
73114184Sgabeblack@google.com    rs_sendResponseS;
73214184Sgabeblack@google.com    ut_updateTag;
73314184Sgabeblack@google.com    // detect 2nd chance sharing
73414184Sgabeblack@google.com    p_popRequestQueue;
73514184Sgabeblack@google.com  }
73614184Sgabeblack@google.com
73714184Sgabeblack@google.com//check
73814184Sgabeblack@google.com  transition({E, S}, RdBlkS, S){TagArrayRead, TagArrayWrite} {
73914184Sgabeblack@google.com    rs_sendResponseS;
74014184Sgabeblack@google.com    ut_updateTag;
74114184Sgabeblack@google.com    // detect 2nd chance sharing
74214184Sgabeblack@google.com    p_popRequestQueue;
74314184Sgabeblack@google.com  }
74414184Sgabeblack@google.com
74514184Sgabeblack@google.com// check
74614184Sgabeblack@google.com  transition(M, RdBlkM, I){TagArrayRead, TagArrayWrite} {
74714184Sgabeblack@google.com    rm_sendResponseM;
74814184Sgabeblack@google.com    i_invL2;
74914184Sgabeblack@google.com    p_popRequestQueue;
75014184Sgabeblack@google.com  }
75114184Sgabeblack@google.com
75214184Sgabeblack@google.com  //check
75314184Sgabeblack@google.com  transition(E, RdBlkM, I){TagArrayRead, TagArrayWrite} {
75414184Sgabeblack@google.com    rm_sendResponseM;
75514184Sgabeblack@google.com    i_invL2;
75614184Sgabeblack@google.com    p_popRequestQueue;
75714184Sgabeblack@google.com  }
75814184Sgabeblack@google.com
75914184Sgabeblack@google.com// check
76014184Sgabeblack@google.com  transition({I}, WrVicBlk, I_M){TagArrayRead} {
76114184Sgabeblack@google.com    a_allocateBlock;
76214184Sgabeblack@google.com    t_allocateTBE;
76314184Sgabeblack@google.com    f_setFrom;
76414184Sgabeblack@google.com    w_sendResponseWBAck;
76514184Sgabeblack@google.com    p_popRequestQueue;
76614184Sgabeblack@google.com  }
76714184Sgabeblack@google.com
76814184Sgabeblack@google.com  transition(I_C, {WrVicBlk, WrVicBlkShared, ClVicBlk, ClVicBlkShared}) {
76914184Sgabeblack@google.com    zz_recycleRequestQueue;
77014184Sgabeblack@google.com  }
77114184Sgabeblack@google.com
77214184Sgabeblack@google.com//check
77314184Sgabeblack@google.com  transition({I}, WrVicBlkShared, I_O) {TagArrayRead}{
77414184Sgabeblack@google.com    a_allocateBlock;
77514184Sgabeblack@google.com    t_allocateTBE;
77614184Sgabeblack@google.com    f_setFrom;
77714184Sgabeblack@google.com//    rd_copyDataFromRequest;
77814184Sgabeblack@google.com    w_sendResponseWBAck;
77914184Sgabeblack@google.com    p_popRequestQueue;
78014184Sgabeblack@google.com  }
78114184Sgabeblack@google.com
78214184Sgabeblack@google.com//check
78314184Sgabeblack@google.com  transition(S, WrVicBlkShared, S_O){TagArrayRead} {
78414184Sgabeblack@google.com    t_allocateTBE;
78514184Sgabeblack@google.com    f_setFrom;
78614184Sgabeblack@google.com    w_sendResponseWBAck;
78714184Sgabeblack@google.com    p_popRequestQueue;
78814184Sgabeblack@google.com  }
78914184Sgabeblack@google.com
79014184Sgabeblack@google.com// a stale writeback
79114184Sgabeblack@google.com transition(S, WrVicBlk, S_S){TagArrayRead} {
79214184Sgabeblack@google.com   t_allocateTBE;
79314184Sgabeblack@google.com   f_setFrom;
79414184Sgabeblack@google.com   w_sendResponseWBAck;
79514184Sgabeblack@google.com   p_popRequestQueue;
79614184Sgabeblack@google.com }
79714184Sgabeblack@google.com
79814184Sgabeblack@google.com// a stale writeback
79914184Sgabeblack@google.com  transition(E, WrVicBlk, E_E){TagArrayRead} {
80014184Sgabeblack@google.com    t_allocateTBE;
80114184Sgabeblack@google.com    f_setFrom;
80214184Sgabeblack@google.com    w_sendResponseWBAck;
80314184Sgabeblack@google.com    p_popRequestQueue;
80414184Sgabeblack@google.com  }
80514184Sgabeblack@google.com
80614184Sgabeblack@google.com// a stale writeback
80714184Sgabeblack@google.com  transition(E, WrVicBlkShared, E_E){TagArrayRead} {
80814184Sgabeblack@google.com    t_allocateTBE;
80914184Sgabeblack@google.com    f_setFrom;
81014184Sgabeblack@google.com    w_sendResponseWBAck;
81114184Sgabeblack@google.com    p_popRequestQueue;
81214184Sgabeblack@google.com  }
81314184Sgabeblack@google.com
81414184Sgabeblack@google.com// a stale writeback
81514184Sgabeblack@google.com  transition(O, WrVicBlk, O_O){TagArrayRead} {
81614184Sgabeblack@google.com    t_allocateTBE;
81714184Sgabeblack@google.com    f_setFrom;
81814184Sgabeblack@google.com    w_sendResponseWBAck;
81914184Sgabeblack@google.com    p_popRequestQueue;
82014184Sgabeblack@google.com  }
82114184Sgabeblack@google.com
82214184Sgabeblack@google.com// a stale writeback
82314184Sgabeblack@google.com transition(O, WrVicBlkShared, O_O){TagArrayRead} {
82414184Sgabeblack@google.com   t_allocateTBE;
82514184Sgabeblack@google.com   f_setFrom;
82614184Sgabeblack@google.com   w_sendResponseWBAck;
82714184Sgabeblack@google.com   p_popRequestQueue;
82814184Sgabeblack@google.com }
82914184Sgabeblack@google.com
83014184Sgabeblack@google.com// a stale writeback
83114184Sgabeblack@google.com  transition(M, WrVicBlk, M_M){TagArrayRead} {
83214184Sgabeblack@google.com    t_allocateTBE;
83314184Sgabeblack@google.com    f_setFrom;
83414184Sgabeblack@google.com    w_sendResponseWBAck;
83514184Sgabeblack@google.com    p_popRequestQueue;
83614184Sgabeblack@google.com  }
83714184Sgabeblack@google.com
83814184Sgabeblack@google.com// a stale writeback
83914184Sgabeblack@google.com  transition(M, WrVicBlkShared, M_O){TagArrayRead} {
84014184Sgabeblack@google.com    t_allocateTBE;
84114184Sgabeblack@google.com    f_setFrom;
84214184Sgabeblack@google.com    w_sendResponseWBAck;
84314184Sgabeblack@google.com    p_popRequestQueue;
84414184Sgabeblack@google.com  }
84514184Sgabeblack@google.com
84614184Sgabeblack@google.com//check
84714184Sgabeblack@google.com  transition({I}, ClVicBlk, I_E){TagArrayRead} {
84814184Sgabeblack@google.com    t_allocateTBE;
84914184Sgabeblack@google.com    f_setFrom;
85014184Sgabeblack@google.com    a_allocateBlock;
85114184Sgabeblack@google.com    w_sendResponseWBAck;
85214184Sgabeblack@google.com    p_popRequestQueue;
85314184Sgabeblack@google.com  }
85414184Sgabeblack@google.com
85514184Sgabeblack@google.com  transition({I}, ClVicBlkShared, I_S){TagArrayRead} {
85614184Sgabeblack@google.com    t_allocateTBE;
85714184Sgabeblack@google.com    f_setFrom;
85814184Sgabeblack@google.com    a_allocateBlock;
85914184Sgabeblack@google.com    w_sendResponseWBAck;
86014184Sgabeblack@google.com    p_popRequestQueue;
86114184Sgabeblack@google.com  }
86214184Sgabeblack@google.com
86314184Sgabeblack@google.com//check
86414184Sgabeblack@google.com  transition(S, ClVicBlkShared, S_S){TagArrayRead} {
86514184Sgabeblack@google.com    t_allocateTBE;
86614184Sgabeblack@google.com    f_setFrom;
86714184Sgabeblack@google.com    w_sendResponseWBAck;
86814184Sgabeblack@google.com    p_popRequestQueue;
86914184Sgabeblack@google.com  }
87014184Sgabeblack@google.com
87114184Sgabeblack@google.com// a stale writeback
87214184Sgabeblack@google.com  transition(E, ClVicBlk, E_E){TagArrayRead} {
87314184Sgabeblack@google.com    t_allocateTBE;
87414184Sgabeblack@google.com    f_setFrom;
87514184Sgabeblack@google.com    w_sendResponseWBAck;
87614184Sgabeblack@google.com    p_popRequestQueue;
87714184Sgabeblack@google.com  }
87814184Sgabeblack@google.com
87914184Sgabeblack@google.com// a stale writeback
88014184Sgabeblack@google.com  transition(E, ClVicBlkShared, E_S){TagArrayRead} {
88114184Sgabeblack@google.com    t_allocateTBE;
88214184Sgabeblack@google.com    f_setFrom;
88314184Sgabeblack@google.com    w_sendResponseWBAck;
88414184Sgabeblack@google.com    p_popRequestQueue;
88514184Sgabeblack@google.com  }
88614184Sgabeblack@google.com
88714184Sgabeblack@google.com// a stale writeback
88814184Sgabeblack@google.com transition(O, ClVicBlk, O_O){TagArrayRead} {
88914184Sgabeblack@google.com   t_allocateTBE;
89014184Sgabeblack@google.com   f_setFrom;
89114184Sgabeblack@google.com   w_sendResponseWBAck;
89214184Sgabeblack@google.com   p_popRequestQueue;
89314184Sgabeblack@google.com }
89414184Sgabeblack@google.com
89514184Sgabeblack@google.com// check. Original L3 ahd it going from O to O_S. Something can go from O to S only on writeback.
89614184Sgabeblack@google.com  transition(O, ClVicBlkShared, O_O){TagArrayRead} {
89714184Sgabeblack@google.com    t_allocateTBE;
89814184Sgabeblack@google.com    f_setFrom;
89914184Sgabeblack@google.com    w_sendResponseWBAck;
90014184Sgabeblack@google.com    p_popRequestQueue;
90114184Sgabeblack@google.com  }
90214184Sgabeblack@google.com
90314184Sgabeblack@google.com// a stale writeback
90414184Sgabeblack@google.com transition(M, ClVicBlk, M_E){TagArrayRead} {
90514184Sgabeblack@google.com   t_allocateTBE;
90614184Sgabeblack@google.com   f_setFrom;
90714184Sgabeblack@google.com   w_sendResponseWBAck;
90814184Sgabeblack@google.com   p_popRequestQueue;
90914184Sgabeblack@google.com }
91014184Sgabeblack@google.com
91114184Sgabeblack@google.com// a stale writeback
91214184Sgabeblack@google.com transition(M, ClVicBlkShared, M_S){TagArrayRead} {
91314184Sgabeblack@google.com   t_allocateTBE;
91414184Sgabeblack@google.com   f_setFrom;
91514184Sgabeblack@google.com   w_sendResponseWBAck;
91614184Sgabeblack@google.com   p_popRequestQueue;
91714184Sgabeblack@google.com }
91814184Sgabeblack@google.com
91914184Sgabeblack@google.com
92014184Sgabeblack@google.com  transition({MO_I}, {RdBlk, RdBlkS, RdBlkM, CtoD}) {
92114184Sgabeblack@google.com    a_allocateBlock;
92214184Sgabeblack@google.com    t_allocateTBE;
92314184Sgabeblack@google.com    f_setFrom;
92414184Sgabeblack@google.com    r_requestToTD;
92514184Sgabeblack@google.com    p_popRequestQueue;
92614184Sgabeblack@google.com  }
92714184Sgabeblack@google.com
92814184Sgabeblack@google.com  transition(MO_I, {WrVicBlkShared, WrVicBlk, ClVicBlk, ClVicBlkShared}, MOD_I) {
92914184Sgabeblack@google.com    f_setFrom;
93014184Sgabeblack@google.com    w_sendResponseWBAck;
93114184Sgabeblack@google.com    p_popRequestQueue;
93214184Sgabeblack@google.com  }
93314184Sgabeblack@google.com
93414184Sgabeblack@google.com  transition(I_M, CPUData, M){TagArrayWrite} {
93514184Sgabeblack@google.com    uo_sendUnblockOwner;
93614184Sgabeblack@google.com    dt_deallocateTBE;
93714184Sgabeblack@google.com    d_writeData;
93814184Sgabeblack@google.com    pr_popResponseQueue;
93914184Sgabeblack@google.com  }
94014184Sgabeblack@google.com
94114184Sgabeblack@google.com  transition(I_M, CPUDataShared, O){TagArrayWrite, DataArrayWrite} {
94214184Sgabeblack@google.com    uo_sendUnblockOwner;
94314184Sgabeblack@google.com    dt_deallocateTBE;
94414184Sgabeblack@google.com    d_writeData;
94514184Sgabeblack@google.com    pr_popResponseQueue;
94614184Sgabeblack@google.com  }
94714184Sgabeblack@google.com
94814184Sgabeblack@google.com  transition(I_O, {CPUData, CPUDataShared}, O){TagArrayWrite, DataArrayWrite}  {
94914184Sgabeblack@google.com    uo_sendUnblockOwner;
95014184Sgabeblack@google.com    dt_deallocateTBE;
95114184Sgabeblack@google.com    d_writeData;
95214184Sgabeblack@google.com    pr_popResponseQueue;
95314184Sgabeblack@google.com  }
95414184Sgabeblack@google.com
95514184Sgabeblack@google.com  transition(I_E, CPUData, E){TagArrayWrite, DataArrayWrite}  {
95614184Sgabeblack@google.com    uo_sendUnblockOwner;
95714184Sgabeblack@google.com    dt_deallocateTBE;
95814184Sgabeblack@google.com    d_writeData;
95914184Sgabeblack@google.com    pr_popResponseQueue;
96014184Sgabeblack@google.com  }
96114184Sgabeblack@google.com
96214184Sgabeblack@google.com  transition(I_E, CPUDataShared, S){TagArrayWrite, DataArrayWrite}  {
96314184Sgabeblack@google.com    us_sendUnblockSharer;
96414184Sgabeblack@google.com    dt_deallocateTBE;
96514184Sgabeblack@google.com    d_writeData;
96614184Sgabeblack@google.com    pr_popResponseQueue;
96714184Sgabeblack@google.com  }
96814184Sgabeblack@google.com
96914184Sgabeblack@google.com  transition(I_S, {CPUData, CPUDataShared}, S){TagArrayWrite, DataArrayWrite}  {
97014184Sgabeblack@google.com    us_sendUnblockSharer;
97114184Sgabeblack@google.com    dt_deallocateTBE;
97214184Sgabeblack@google.com    d_writeData;
97314184Sgabeblack@google.com    pr_popResponseQueue;
97414184Sgabeblack@google.com  }
97514184Sgabeblack@google.com
97614184Sgabeblack@google.com  transition(S_M, CPUDataShared, O){TagArrayWrite, DataArrayWrite}  {
97714184Sgabeblack@google.com    uo_sendUnblockOwner;
97814184Sgabeblack@google.com    dt_deallocateTBE;
97914184Sgabeblack@google.com    d_writeData;
98014184Sgabeblack@google.com    ut_updateTag;  // update tag on writeback hits.
98114184Sgabeblack@google.com    pr_popResponseQueue;
98214184Sgabeblack@google.com  }
98314184Sgabeblack@google.com
98414184Sgabeblack@google.com  transition(S_O, {CPUData, CPUDataShared}, O){TagArrayWrite, DataArrayWrite}  {
98514184Sgabeblack@google.com    uo_sendUnblockOwner;
98614184Sgabeblack@google.com    dt_deallocateTBE;
98714184Sgabeblack@google.com    d_writeData;
98814184Sgabeblack@google.com    ut_updateTag;  // update tag on writeback hits.
98914184Sgabeblack@google.com    pr_popResponseQueue;
99014184Sgabeblack@google.com  }
99114184Sgabeblack@google.com
99214184Sgabeblack@google.com  transition(S_E, CPUDataShared, S){TagArrayWrite, DataArrayWrite}  {
99314184Sgabeblack@google.com    us_sendUnblockSharer;
99414184Sgabeblack@google.com    dt_deallocateTBE;
99514184Sgabeblack@google.com    d_writeData;
99614184Sgabeblack@google.com    ut_updateTag;  // update tag on writeback hits.
99714184Sgabeblack@google.com    pr_popResponseQueue;
99814184Sgabeblack@google.com  }
99914184Sgabeblack@google.com
100014184Sgabeblack@google.com  transition(S_S, {CPUData, CPUDataShared}, S){TagArrayWrite, DataArrayWrite}  {
100114184Sgabeblack@google.com    us_sendUnblockSharer;
100214184Sgabeblack@google.com    dt_deallocateTBE;
100314184Sgabeblack@google.com    d_writeData;
100414184Sgabeblack@google.com    ut_updateTag;  // update tag on writeback hits.
100514184Sgabeblack@google.com    pr_popResponseQueue;
100614184Sgabeblack@google.com  }
100714184Sgabeblack@google.com
100814184Sgabeblack@google.com  transition(O_E, CPUDataShared, O){TagArrayWrite, DataArrayWrite}  {
100914184Sgabeblack@google.com    uo_sendUnblockOwner;
101014184Sgabeblack@google.com    dt_deallocateTBE;
101114184Sgabeblack@google.com    d_writeData;
101214184Sgabeblack@google.com    ut_updateTag;  // update tag on writeback hits.
101314184Sgabeblack@google.com    pr_popResponseQueue;
101414184Sgabeblack@google.com  }
101514184Sgabeblack@google.com
101614184Sgabeblack@google.com  transition(O_O, {CPUData, CPUDataShared}, O){TagArrayWrite, DataArrayWrite}  {
101714184Sgabeblack@google.com    uo_sendUnblockOwner;
101814184Sgabeblack@google.com    dt_deallocateTBE;
101914184Sgabeblack@google.com    d_writeData;
102014184Sgabeblack@google.com    ut_updateTag;  // update tag on writeback hits.
102114184Sgabeblack@google.com    pr_popResponseQueue;
102214184Sgabeblack@google.com  }
102314184Sgabeblack@google.com
102414184Sgabeblack@google.com  transition({D_I}, {CPUData, CPUDataShared}, I){TagArrayWrite}  {
102514184Sgabeblack@google.com    un_sendUnblockNotValid;
102614184Sgabeblack@google.com    dt_deallocateTBE;
102714184Sgabeblack@google.com    pr_popResponseQueue;
102814184Sgabeblack@google.com  }
102914184Sgabeblack@google.com
103014184Sgabeblack@google.com  transition(MOD_I, {CPUData, CPUDataShared}, MO_I) {
103114184Sgabeblack@google.com    un_sendUnblockNotValid;
103214184Sgabeblack@google.com    rf_resetFrom;
103314184Sgabeblack@google.com    pr_popResponseQueue;
103414184Sgabeblack@google.com  }
103514184Sgabeblack@google.com
103614184Sgabeblack@google.com  transition({O,S,I}, CPUData) {
103714184Sgabeblack@google.com    pr_popResponseQueue;
103814184Sgabeblack@google.com  }
103914184Sgabeblack@google.com
104014184Sgabeblack@google.com  transition({M, O}, L2_Repl, MO_I){TagArrayRead, DataArrayRead} {
104114184Sgabeblack@google.com    t_allocateTBE;
104214184Sgabeblack@google.com    vd_vicDirty;
104314184Sgabeblack@google.com    i_invL2;
104414184Sgabeblack@google.com  }
104514184Sgabeblack@google.com
104614184Sgabeblack@google.com  transition({E, S,}, L2_Repl, ES_I){TagArrayRead, DataArrayRead} {
104714184Sgabeblack@google.com    t_allocateTBE;
104814184Sgabeblack@google.com    vc_vicClean;
104914184Sgabeblack@google.com    i_invL2;
105014184Sgabeblack@google.com  }
105114184Sgabeblack@google.com
105214184Sgabeblack@google.com  transition({I_M, I_O, S_M, S_O, E_M, E_O}, L2_Repl) {
105314184Sgabeblack@google.com    zz_recycleRequestQueue;
105414184Sgabeblack@google.com  }
105514184Sgabeblack@google.com
105614184Sgabeblack@google.com  transition({O_M, O_O, O_E, M_M, M_O, M_E, M_S}, L2_Repl) {
105714184Sgabeblack@google.com    zz_recycleRequestQueue;
105814184Sgabeblack@google.com  }
105914184Sgabeblack@google.com
106014184Sgabeblack@google.com  transition({I_E, I_S, S_E, S_S, E_E, E_S}, L2_Repl) {
106114184Sgabeblack@google.com    zz_recycleRequestQueue;
106214184Sgabeblack@google.com  }
106314184Sgabeblack@google.com
106414184Sgabeblack@google.com  transition({M, O}, PrbInvData, I){TagArrayRead, TagArrayWrite} {
106514184Sgabeblack@google.com    pd_sendProbeResponseData;
106614184Sgabeblack@google.com    i_invL2;
106714184Sgabeblack@google.com    pp_popProbeQueue;
106814184Sgabeblack@google.com  }
106914184Sgabeblack@google.com
107014184Sgabeblack@google.com  transition(I, PrbInvData){TagArrayRead, TagArrayWrite}  {
107114184Sgabeblack@google.com    pi_sendProbeResponseInv;
107214184Sgabeblack@google.com    pp_popProbeQueue;
107314184Sgabeblack@google.com  }
107414184Sgabeblack@google.com
107514184Sgabeblack@google.com  transition({E, S}, PrbInvData, I){TagArrayRead, TagArrayWrite}  {
107614184Sgabeblack@google.com    pd_sendProbeResponseData;
107714184Sgabeblack@google.com    i_invL2;
107814184Sgabeblack@google.com    pp_popProbeQueue;
107914184Sgabeblack@google.com  }
108014184Sgabeblack@google.com
108114184Sgabeblack@google.com  transition({M, O, E, S, I}, PrbInv, I){TagArrayRead, TagArrayWrite}  {
108214184Sgabeblack@google.com    pi_sendProbeResponseInv;
108314184Sgabeblack@google.com    i_invL2; // nothing will happen in I
108414184Sgabeblack@google.com    pp_popProbeQueue;
108514184Sgabeblack@google.com  }
108614184Sgabeblack@google.com
108714184Sgabeblack@google.com  transition({M, O}, PrbShrData, O){TagArrayRead, TagArrayWrite}  {
108814184Sgabeblack@google.com    pd_sendProbeResponseData;
108914184Sgabeblack@google.com    pp_popProbeQueue;
109014184Sgabeblack@google.com  }
109114184Sgabeblack@google.com
109214184Sgabeblack@google.com  transition({E, S}, PrbShrData, S){TagArrayRead, TagArrayWrite}  {
109314184Sgabeblack@google.com    pd_sendProbeResponseData;
109414184Sgabeblack@google.com    pp_popProbeQueue;
109514184Sgabeblack@google.com  }
109614184Sgabeblack@google.com
109714184Sgabeblack@google.com  transition(I, PrbShrData){TagArrayRead}  {
109814184Sgabeblack@google.com    pm_sendProbeResponseMiss;
109914184Sgabeblack@google.com    pp_popProbeQueue;
110014184Sgabeblack@google.com  }
110114184Sgabeblack@google.com
110214184Sgabeblack@google.com  transition(MO_I, PrbInvData, I_C) {
110314184Sgabeblack@google.com    pdt_sendProbeResponseDataFromTBE;
110414184Sgabeblack@google.com    pp_popProbeQueue;
110514184Sgabeblack@google.com  }
110614184Sgabeblack@google.com
110714184Sgabeblack@google.com  transition(ES_I, PrbInvData, I_C) {
110814184Sgabeblack@google.com    pi_sendProbeResponseInv;
110914184Sgabeblack@google.com    pp_popProbeQueue;
111014184Sgabeblack@google.com  }
111114184Sgabeblack@google.com
111214184Sgabeblack@google.com  transition({ES_I,MO_I}, PrbInv, I_C) {
111314184Sgabeblack@google.com    pi_sendProbeResponseInv;
111414184Sgabeblack@google.com    pp_popProbeQueue;
111514184Sgabeblack@google.com  }
111614184Sgabeblack@google.com
111714184Sgabeblack@google.com  transition({ES_I, MO_I}, PrbShrData) {
111814184Sgabeblack@google.com    pdt_sendProbeResponseDataFromTBE;
111914184Sgabeblack@google.com    pp_popProbeQueue;
112014184Sgabeblack@google.com  }
112114184Sgabeblack@google.com
112214184Sgabeblack@google.com  transition(I_C, {PrbInvData, PrbInv}) {
112314184Sgabeblack@google.com    pi_sendProbeResponseInv;
112414184Sgabeblack@google.com    pp_popProbeQueue;
112514184Sgabeblack@google.com  }
112614184Sgabeblack@google.com
112714184Sgabeblack@google.com  transition(I_C, PrbShrData) {
112814184Sgabeblack@google.com    pm_sendProbeResponseMiss;
112914184Sgabeblack@google.com    pp_popProbeQueue;
113014184Sgabeblack@google.com  }
113114184Sgabeblack@google.com
113214184Sgabeblack@google.com  transition(MOD_I, WBAck, D_I) {
113314184Sgabeblack@google.com    pn_popTDResponseQueue;
113414184Sgabeblack@google.com  }
113514184Sgabeblack@google.com
113614184Sgabeblack@google.com  transition(MO_I, WBAck, I){TagArrayWrite} {
113714184Sgabeblack@google.com    dt_deallocateTBE;
113814184Sgabeblack@google.com    pn_popTDResponseQueue;
113914184Sgabeblack@google.com  }
114014184Sgabeblack@google.com
114114184Sgabeblack@google.com  // this can only be a spurious CPUData from a shared block.
114214184Sgabeblack@google.com  transition(MO_I, CPUData) {
114314184Sgabeblack@google.com    pr_popResponseQueue;
114414184Sgabeblack@google.com  }
114514184Sgabeblack@google.com
114614184Sgabeblack@google.com  transition(ES_I, WBAck, I){TagArrayWrite} {
114714184Sgabeblack@google.com    dt_deallocateTBE;
114814184Sgabeblack@google.com    pn_popTDResponseQueue;
114914184Sgabeblack@google.com  }
115014184Sgabeblack@google.com
115114184Sgabeblack@google.com  transition(I_C, {WBAck}, I){TagArrayWrite} {
115214184Sgabeblack@google.com    dt_deallocateTBE;
115314184Sgabeblack@google.com    pn_popTDResponseQueue;
115414184Sgabeblack@google.com  }
115514184Sgabeblack@google.com
115614184Sgabeblack@google.com  transition({I_M, I_O, I_E, I_S}, StaleWB, I){TagArrayWrite} {
115714184Sgabeblack@google.com    un_sendUnblockNotValid;
115814184Sgabeblack@google.com    dt_deallocateTBE;
115914184Sgabeblack@google.com    i_invL2;
116014184Sgabeblack@google.com    pr_popResponseQueue;
116114184Sgabeblack@google.com  }
116214184Sgabeblack@google.com
116314184Sgabeblack@google.com  transition({S_S, S_O, S_M, S_E}, StaleWB, S){TagArrayWrite} {
116414184Sgabeblack@google.com    us_sendUnblockSharer;
116514184Sgabeblack@google.com    dt_deallocateTBE;
116614184Sgabeblack@google.com    pr_popResponseQueue;
116714184Sgabeblack@google.com  }
116814184Sgabeblack@google.com
116914184Sgabeblack@google.com  transition({E_M, E_O, E_E, E_S}, StaleWB, E){TagArrayWrite} {
117014184Sgabeblack@google.com    uo_sendUnblockOwner;
117114184Sgabeblack@google.com    dt_deallocateTBE;
117214184Sgabeblack@google.com    pr_popResponseQueue;
117314184Sgabeblack@google.com  }
117414184Sgabeblack@google.com
117514184Sgabeblack@google.com  transition({O_M, O_O, O_E}, StaleWB, O){TagArrayWrite} {
117614184Sgabeblack@google.com    uo_sendUnblockOwner;
117714184Sgabeblack@google.com    dt_deallocateTBE;
117814184Sgabeblack@google.com    pr_popResponseQueue;
117914184Sgabeblack@google.com  }
118014184Sgabeblack@google.com
118114184Sgabeblack@google.com  transition({M_M, M_O, M_E, M_S}, StaleWB, M){TagArrayWrite} {
118214184Sgabeblack@google.com    uo_sendUnblockOwner;
118314184Sgabeblack@google.com    dt_deallocateTBE;
118414184Sgabeblack@google.com    pr_popResponseQueue;
118514184Sgabeblack@google.com  }
118614184Sgabeblack@google.com
118714184Sgabeblack@google.com  transition(D_I, StaleWB, I) {TagArrayWrite}{
118814184Sgabeblack@google.com    un_sendUnblockNotValid;
118914184Sgabeblack@google.com    dt_deallocateTBE;
119014184Sgabeblack@google.com    pr_popResponseQueue;
119114184Sgabeblack@google.com  }
119214184Sgabeblack@google.com
119314184Sgabeblack@google.com  transition(MOD_I, StaleWB, MO_I) {
119414184Sgabeblack@google.com    un_sendUnblockNotValid;
119514184Sgabeblack@google.com    rf_resetFrom;
119614184Sgabeblack@google.com    pr_popResponseQueue;
119714184Sgabeblack@google.com  }
119814184Sgabeblack@google.com
119914184Sgabeblack@google.com}
1200