114184Sgabeblack@google.com/*
214184Sgabeblack@google.com * Copyright (c) 1999-2013 Mark D. Hill and David A. Wood
314184Sgabeblack@google.com * Copyright (c) 2009 Advanced Micro Devices, Inc.
414184Sgabeblack@google.com * All rights reserved.
514184Sgabeblack@google.com *
614184Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
714184Sgabeblack@google.com * modification, are permitted provided that the following conditions are
814184Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
914184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
1014184Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
1114184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1214184Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1314184Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1414184Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1514184Sgabeblack@google.com * this software without specific prior written permission.
1614184Sgabeblack@google.com *
1714184Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1814184Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1914184Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2014184Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2114184Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2214184Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2314184Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2414184Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2514184Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2614184Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2714184Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2814184Sgabeblack@google.com *
2914184Sgabeblack@google.com * AMD's contributions to the MOESI hammer protocol do not constitute an
3014184Sgabeblack@google.com * endorsement of its similarity to any AMD products.
3114184Sgabeblack@google.com *
3214184Sgabeblack@google.com * Authors: Milo Martin
3314184Sgabeblack@google.com *          Brad Beckmann
3414184Sgabeblack@google.com */
3514184Sgabeblack@google.com
3614184Sgabeblack@google.commachine(MachineType:L1Cache, "AMD Hammer-like protocol")
3714184Sgabeblack@google.com    : Sequencer * sequencer;
3814184Sgabeblack@google.com      CacheMemory * L1Icache;
3914184Sgabeblack@google.com      CacheMemory * L1Dcache;
4014184Sgabeblack@google.com      CacheMemory * L2cache;
4114184Sgabeblack@google.com      Cycles cache_response_latency := 10;
4214184Sgabeblack@google.com      Cycles issue_latency := 2;
4314184Sgabeblack@google.com      Cycles l2_cache_hit_latency := 10;
4414184Sgabeblack@google.com      bool no_mig_atomic := "True";
4514184Sgabeblack@google.com      bool send_evictions;
4614184Sgabeblack@google.com
4714184Sgabeblack@google.com      // NETWORK BUFFERS
4814184Sgabeblack@google.com      MessageBuffer * requestFromCache, network="To", virtual_network="2",
4914184Sgabeblack@google.com            vnet_type="request";
5014184Sgabeblack@google.com      MessageBuffer * responseFromCache, network="To", virtual_network="4",
5114184Sgabeblack@google.com            vnet_type="response";
5214184Sgabeblack@google.com      MessageBuffer * unblockFromCache, network="To", virtual_network="5",
5314184Sgabeblack@google.com            vnet_type="unblock";
5414184Sgabeblack@google.com
5514184Sgabeblack@google.com      MessageBuffer * forwardToCache, network="From", virtual_network="3",
5614184Sgabeblack@google.com            vnet_type="forward";
5714184Sgabeblack@google.com      MessageBuffer * responseToCache, network="From", virtual_network="4",
5814184Sgabeblack@google.com            vnet_type="response";
5914184Sgabeblack@google.com
6014184Sgabeblack@google.com      MessageBuffer * mandatoryQueue;
6114184Sgabeblack@google.com
6214184Sgabeblack@google.com      MessageBuffer * triggerQueue;
6314184Sgabeblack@google.com{
6414184Sgabeblack@google.com  // STATES
6514184Sgabeblack@google.com  state_declaration(State, desc="Cache states", default="L1Cache_State_I") {
6614184Sgabeblack@google.com    // Base states
6714184Sgabeblack@google.com    I, AccessPermission:Invalid, desc="Idle";
6814184Sgabeblack@google.com    S, AccessPermission:Read_Only, desc="Shared";
6914184Sgabeblack@google.com    O, AccessPermission:Read_Only, desc="Owned";
7014184Sgabeblack@google.com    M, AccessPermission:Read_Only, desc="Modified (dirty)";
7114184Sgabeblack@google.com    MM, AccessPermission:Read_Write, desc="Modified (dirty and locally modified)";
7214184Sgabeblack@google.com
7314184Sgabeblack@google.com    // Base states, locked and ready to service the mandatory queue
7414184Sgabeblack@google.com    IR, AccessPermission:Invalid, desc="Idle";
7514184Sgabeblack@google.com    SR, AccessPermission:Read_Only, desc="Shared";
7614184Sgabeblack@google.com    OR, AccessPermission:Read_Only, desc="Owned";
7714184Sgabeblack@google.com    MR, AccessPermission:Read_Only, desc="Modified (dirty)";
7814184Sgabeblack@google.com    MMR, AccessPermission:Read_Write, desc="Modified (dirty and locally modified)";
7914184Sgabeblack@google.com
8014184Sgabeblack@google.com    // Transient States
8114184Sgabeblack@google.com    IM, AccessPermission:Busy, "IM", desc="Issued GetX";
8214184Sgabeblack@google.com    SM, AccessPermission:Read_Only, "SM", desc="Issued GetX, we still have a valid copy of the line";
8314184Sgabeblack@google.com    OM, AccessPermission:Read_Only, "OM", desc="Issued GetX, received data";
8414184Sgabeblack@google.com    ISM, AccessPermission:Read_Only, "ISM", desc="Issued GetX, received valid data, waiting for all acks";
8514184Sgabeblack@google.com    M_W, AccessPermission:Read_Only, "M^W", desc="Issued GetS, received exclusive data";
8614184Sgabeblack@google.com    MM_W, AccessPermission:Read_Write, "MM^W", desc="Issued GetX, received exclusive data";
8714184Sgabeblack@google.com    IS, AccessPermission:Busy, "IS", desc="Issued GetS";
8814184Sgabeblack@google.com    SS, AccessPermission:Read_Only, "SS", desc="Issued GetS, received data, waiting for all acks";
8914184Sgabeblack@google.com    OI, AccessPermission:Busy, "OI", desc="Issued PutO, waiting for ack";
9014184Sgabeblack@google.com    MI, AccessPermission:Busy, "MI", desc="Issued PutX, waiting for ack";
9114184Sgabeblack@google.com    II, AccessPermission:Busy, "II", desc="Issued PutX/O, saw Other_GETS or Other_GETX, waiting for ack";
9214184Sgabeblack@google.com    ST, AccessPermission:Busy, "ST", desc="S block transferring to L1";
9314184Sgabeblack@google.com    OT, AccessPermission:Busy, "OT", desc="O block transferring to L1";
9414184Sgabeblack@google.com    MT, AccessPermission:Busy, "MT", desc="M block transferring to L1";
9514184Sgabeblack@google.com    MMT, AccessPermission:Busy, "MMT", desc="MM block transferring to L0";
9614184Sgabeblack@google.com
9714184Sgabeblack@google.com    //Transition States Related to Flushing
9814184Sgabeblack@google.com    MI_F, AccessPermission:Busy, "MI_F", desc="Issued PutX due to a Flush, waiting for ack";
9914184Sgabeblack@google.com    MM_F, AccessPermission:Busy, "MM_F", desc="Issued GETF due to a Flush, waiting for ack";
10014184Sgabeblack@google.com    IM_F, AccessPermission:Busy, "IM_F", desc="Issued GetX due to a Flush";
10114184Sgabeblack@google.com    ISM_F, AccessPermission:Read_Only, "ISM_F", desc="Issued GetX, received data, waiting for all acks";
10214184Sgabeblack@google.com    SM_F, AccessPermission:Read_Only, "SM_F", desc="Issued GetX, we still have an old copy of the line";
10314184Sgabeblack@google.com    OM_F, AccessPermission:Read_Only, "OM_F", desc="Issued GetX, received data";
10414184Sgabeblack@google.com    MM_WF, AccessPermission:Busy, "MM_WF", desc="Issued GetX, received exclusive data";
10514184Sgabeblack@google.com  }
10614184Sgabeblack@google.com
10714184Sgabeblack@google.com  // EVENTS
10814184Sgabeblack@google.com  enumeration(Event, desc="Cache events") {
10914184Sgabeblack@google.com    Load,            desc="Load request from the processor";
11014184Sgabeblack@google.com    Ifetch,          desc="I-fetch request from the processor";
11114184Sgabeblack@google.com    Store,           desc="Store request from the processor";
11214184Sgabeblack@google.com    L2_Replacement,  desc="L2 Replacement";
11314184Sgabeblack@google.com    L1_to_L2,        desc="L1 to L2 transfer";
11414184Sgabeblack@google.com    Trigger_L2_to_L1D,  desc="Trigger L2 to L1-Data transfer";
11514184Sgabeblack@google.com    Trigger_L2_to_L1I,  desc="Trigger L2 to L1-Instruction transfer";
11614184Sgabeblack@google.com    Complete_L2_to_L1, desc="L2 to L1 transfer completed";
11714184Sgabeblack@google.com
11814184Sgabeblack@google.com    // Requests
11914184Sgabeblack@google.com    Other_GETX,      desc="A GetX from another processor";
12014184Sgabeblack@google.com    Other_GETS,      desc="A GetS from another processor";
12114184Sgabeblack@google.com    Merged_GETS,     desc="A Merged GetS from another processor";
12214184Sgabeblack@google.com    Other_GETS_No_Mig, desc="A GetS from another processor";
12314184Sgabeblack@google.com    NC_DMA_GETS,     desc="special GetS when only DMA exists";
12414184Sgabeblack@google.com    Invalidate,      desc="Invalidate block";
12514184Sgabeblack@google.com
12614184Sgabeblack@google.com    // Responses
12714184Sgabeblack@google.com    Ack,             desc="Received an ack message";
12814184Sgabeblack@google.com    Shared_Ack,      desc="Received an ack message, responder has a shared copy";
12914184Sgabeblack@google.com    Data,            desc="Received a data message";
13014184Sgabeblack@google.com    Shared_Data,     desc="Received a data message, responder has a shared copy";
13114184Sgabeblack@google.com    Exclusive_Data,  desc="Received a data message, responder had an exclusive copy, they gave it to us";
13214184Sgabeblack@google.com
13314184Sgabeblack@google.com    Writeback_Ack,   desc="Writeback O.K. from directory";
13414184Sgabeblack@google.com    Writeback_Nack,  desc="Writeback not O.K. from directory";
13514184Sgabeblack@google.com
13614184Sgabeblack@google.com    // Triggers
13714184Sgabeblack@google.com    All_acks,                  desc="Received all required data and message acks";
13814184Sgabeblack@google.com    All_acks_no_sharers,        desc="Received all acks and no other processor has a shared copy";
13914184Sgabeblack@google.com
14014184Sgabeblack@google.com    // For Flush
14114184Sgabeblack@google.com    Flush_line,                  desc="flush the cache line from all caches";
14214184Sgabeblack@google.com    Block_Ack,                   desc="the directory is blocked and ready for the flush";
14314184Sgabeblack@google.com  }
14414184Sgabeblack@google.com
14514184Sgabeblack@google.com  // STRUCTURE DEFINITIONS
14614184Sgabeblack@google.com  // CacheEntry
14714184Sgabeblack@google.com  structure(Entry, desc="...", interface="AbstractCacheEntry") {
14814184Sgabeblack@google.com    State CacheState,        desc="cache state";
14914184Sgabeblack@google.com    bool Dirty,              desc="Is the data dirty (different than memory)?";
15014184Sgabeblack@google.com    DataBlock DataBlk,       desc="data for the block";
15114184Sgabeblack@google.com    bool FromL2, default="false", desc="block just moved from L2";
15214184Sgabeblack@google.com    bool AtomicAccessed, default="false", desc="block just moved from L2";
15314184Sgabeblack@google.com  }
15414184Sgabeblack@google.com
15514184Sgabeblack@google.com  // TBE fields
15614184Sgabeblack@google.com  structure(TBE, desc="...") {
15714184Sgabeblack@google.com    State TBEState,          desc="Transient state";
15814184Sgabeblack@google.com    DataBlock DataBlk,       desc="data for the block, required for concurrent writebacks";
15914184Sgabeblack@google.com    bool Dirty,              desc="Is the data dirty (different than memory)?";
16014184Sgabeblack@google.com    int NumPendingMsgs,      desc="Number of acks/data messages that this processor is waiting for";
16114184Sgabeblack@google.com    bool Sharers,            desc="On a GetS, did we find any other sharers in the system";
16214184Sgabeblack@google.com    bool AppliedSilentAcks, default="false", desc="for full-bit dir, does the pending msg count reflect the silent acks";
16314184Sgabeblack@google.com    MachineID LastResponder, desc="last machine to send a response for this request";
16414184Sgabeblack@google.com    MachineID CurOwner,      desc="current owner of the block, used for UnblockS responses";
16514184Sgabeblack@google.com
16614184Sgabeblack@google.com    Cycles InitialRequestTime, default="Cycles(0)",
16714184Sgabeblack@google.com            desc="time the initial requests was sent from the L1Cache";
16814184Sgabeblack@google.com    Cycles ForwardRequestTime, default="Cycles(0)",
16914184Sgabeblack@google.com            desc="time the dir forwarded the request";
17014184Sgabeblack@google.com    Cycles FirstResponseTime, default="Cycles(0)",
17114184Sgabeblack@google.com            desc="the time the first response was received";
17214184Sgabeblack@google.com  }
17314184Sgabeblack@google.com
17414184Sgabeblack@google.com  structure(TBETable, external="yes") {
17514184Sgabeblack@google.com    TBE lookup(Addr);
17614184Sgabeblack@google.com    void allocate(Addr);
17714184Sgabeblack@google.com    void deallocate(Addr);
17814184Sgabeblack@google.com    bool isPresent(Addr);
17914184Sgabeblack@google.com  }
18014184Sgabeblack@google.com
18114184Sgabeblack@google.com  TBETable TBEs, template="<L1Cache_TBE>", constructor="m_number_of_TBEs";
18214184Sgabeblack@google.com
18314184Sgabeblack@google.com  Tick clockEdge();
18414184Sgabeblack@google.com  void set_cache_entry(AbstractCacheEntry b);
18514184Sgabeblack@google.com  void unset_cache_entry();
18614184Sgabeblack@google.com  void set_tbe(TBE b);
18714184Sgabeblack@google.com  void unset_tbe();
18814184Sgabeblack@google.com  void wakeUpAllBuffers();
18914184Sgabeblack@google.com  void wakeUpBuffers(Addr a);
19014184Sgabeblack@google.com  Cycles curCycle();
19114184Sgabeblack@google.com  MachineID mapAddressToMachine(Addr addr, MachineType mtype);
19214184Sgabeblack@google.com
19314184Sgabeblack@google.com  Entry getCacheEntry(Addr address), return_by_pointer="yes" {
19414184Sgabeblack@google.com    Entry L2cache_entry := static_cast(Entry, "pointer", L2cache.lookup(address));
19514184Sgabeblack@google.com    if(is_valid(L2cache_entry)) {
19614184Sgabeblack@google.com      return L2cache_entry;
19714184Sgabeblack@google.com    }
19814184Sgabeblack@google.com
19914184Sgabeblack@google.com    Entry L1Dcache_entry := static_cast(Entry, "pointer", L1Dcache.lookup(address));
20014184Sgabeblack@google.com    if(is_valid(L1Dcache_entry)) {
20114184Sgabeblack@google.com      return L1Dcache_entry;
20214184Sgabeblack@google.com    }
20314184Sgabeblack@google.com
20414184Sgabeblack@google.com    Entry L1Icache_entry := static_cast(Entry, "pointer", L1Icache.lookup(address));
20514184Sgabeblack@google.com    return L1Icache_entry;
20614184Sgabeblack@google.com  }
20714184Sgabeblack@google.com
20814184Sgabeblack@google.com  void functionalRead(Addr addr, Packet *pkt) {
20914184Sgabeblack@google.com    Entry cache_entry := getCacheEntry(addr);
21014184Sgabeblack@google.com    if(is_valid(cache_entry)) {
21114184Sgabeblack@google.com      testAndRead(addr, cache_entry.DataBlk, pkt);
21214184Sgabeblack@google.com    } else {
21314184Sgabeblack@google.com      TBE tbe := TBEs[addr];
21414184Sgabeblack@google.com      if(is_valid(tbe)) {
21514184Sgabeblack@google.com        testAndRead(addr, tbe.DataBlk, pkt);
21614184Sgabeblack@google.com      } else {
21714184Sgabeblack@google.com        error("Missing data block");
21814184Sgabeblack@google.com      }
21914184Sgabeblack@google.com    }
22014184Sgabeblack@google.com  }
22114184Sgabeblack@google.com
22214184Sgabeblack@google.com  int functionalWrite(Addr addr, Packet *pkt) {
22314184Sgabeblack@google.com    int num_functional_writes := 0;
22414184Sgabeblack@google.com
22514184Sgabeblack@google.com    Entry cache_entry := getCacheEntry(addr);
22614184Sgabeblack@google.com    if(is_valid(cache_entry)) {
22714184Sgabeblack@google.com      num_functional_writes := num_functional_writes +
22814184Sgabeblack@google.com        testAndWrite(addr, cache_entry.DataBlk, pkt);
22914184Sgabeblack@google.com      return num_functional_writes;
23014184Sgabeblack@google.com    }
23114184Sgabeblack@google.com
23214184Sgabeblack@google.com    TBE tbe := TBEs[addr];
23314184Sgabeblack@google.com    num_functional_writes := num_functional_writes +
23414184Sgabeblack@google.com      testAndWrite(addr, tbe.DataBlk, pkt);
23514184Sgabeblack@google.com    return num_functional_writes;
23614184Sgabeblack@google.com  }
23714184Sgabeblack@google.com
23814184Sgabeblack@google.com  Entry getL2CacheEntry(Addr address), return_by_pointer="yes" {
23914184Sgabeblack@google.com    Entry L2cache_entry := static_cast(Entry, "pointer", L2cache.lookup(address));
24014184Sgabeblack@google.com    return L2cache_entry;
24114184Sgabeblack@google.com  }
24214184Sgabeblack@google.com
24314184Sgabeblack@google.com  Entry getL1DCacheEntry(Addr address), return_by_pointer="yes" {
24414184Sgabeblack@google.com    Entry L1Dcache_entry := static_cast(Entry, "pointer", L1Dcache.lookup(address));
24514184Sgabeblack@google.com    return L1Dcache_entry;
24614184Sgabeblack@google.com  }
24714184Sgabeblack@google.com
24814184Sgabeblack@google.com  Entry getL1ICacheEntry(Addr address), return_by_pointer="yes" {
24914184Sgabeblack@google.com    Entry L1Icache_entry := static_cast(Entry, "pointer", L1Icache.lookup(address));
25014184Sgabeblack@google.com    return L1Icache_entry;
25114184Sgabeblack@google.com  }
25214184Sgabeblack@google.com
25314184Sgabeblack@google.com  State getState(TBE tbe, Entry cache_entry, Addr addr) {
25414184Sgabeblack@google.com    if(is_valid(tbe)) {
25514184Sgabeblack@google.com      return tbe.TBEState;
25614184Sgabeblack@google.com    } else if (is_valid(cache_entry)) {
25714184Sgabeblack@google.com      return cache_entry.CacheState;
25814184Sgabeblack@google.com    }
25914184Sgabeblack@google.com    return State:I;
26014184Sgabeblack@google.com  }
26114184Sgabeblack@google.com
26214184Sgabeblack@google.com  void setState(TBE tbe, Entry cache_entry, Addr addr, State state) {
26314184Sgabeblack@google.com    assert((L1Dcache.isTagPresent(addr) && L1Icache.isTagPresent(addr)) == false);
26414184Sgabeblack@google.com    assert((L1Icache.isTagPresent(addr) && L2cache.isTagPresent(addr)) == false);
26514184Sgabeblack@google.com    assert((L1Dcache.isTagPresent(addr) && L2cache.isTagPresent(addr)) == false);
26614184Sgabeblack@google.com
26714184Sgabeblack@google.com    if (is_valid(tbe)) {
26814184Sgabeblack@google.com      tbe.TBEState := state;
26914184Sgabeblack@google.com    }
27014184Sgabeblack@google.com
27114184Sgabeblack@google.com    if (is_valid(cache_entry)) {
27214184Sgabeblack@google.com      cache_entry.CacheState := state;
27314184Sgabeblack@google.com    }
27414184Sgabeblack@google.com  }
27514184Sgabeblack@google.com
27614184Sgabeblack@google.com  AccessPermission getAccessPermission(Addr addr) {
27714184Sgabeblack@google.com    TBE tbe := TBEs[addr];
27814184Sgabeblack@google.com    if(is_valid(tbe)) {
27914184Sgabeblack@google.com      return L1Cache_State_to_permission(tbe.TBEState);
28014184Sgabeblack@google.com    }
28114184Sgabeblack@google.com
28214184Sgabeblack@google.com    Entry cache_entry := getCacheEntry(addr);
28314184Sgabeblack@google.com    if(is_valid(cache_entry)) {
28414184Sgabeblack@google.com      return L1Cache_State_to_permission(cache_entry.CacheState);
28514184Sgabeblack@google.com    }
28614184Sgabeblack@google.com
28714184Sgabeblack@google.com    return AccessPermission:NotPresent;
28814184Sgabeblack@google.com  }
28914184Sgabeblack@google.com
29014184Sgabeblack@google.com  void setAccessPermission(Entry cache_entry, Addr addr, State state) {
29114184Sgabeblack@google.com    if (is_valid(cache_entry)) {
29214184Sgabeblack@google.com      cache_entry.changePermission(L1Cache_State_to_permission(state));
29314184Sgabeblack@google.com    }
29414184Sgabeblack@google.com  }
29514184Sgabeblack@google.com
29614184Sgabeblack@google.com  Event mandatory_request_type_to_event(RubyRequestType type) {
29714184Sgabeblack@google.com    if (type == RubyRequestType:LD) {
29814184Sgabeblack@google.com      return Event:Load;
29914184Sgabeblack@google.com    } else if (type == RubyRequestType:IFETCH) {
30014184Sgabeblack@google.com      return Event:Ifetch;
30114184Sgabeblack@google.com    } else if ((type == RubyRequestType:ST) || (type == RubyRequestType:ATOMIC)) {
30214184Sgabeblack@google.com      return Event:Store;
30314184Sgabeblack@google.com    } else if ((type == RubyRequestType:FLUSH)) {
30414184Sgabeblack@google.com      return Event:Flush_line;
30514184Sgabeblack@google.com    } else {
30614184Sgabeblack@google.com      error("Invalid RubyRequestType");
30714184Sgabeblack@google.com    }
30814184Sgabeblack@google.com  }
30914184Sgabeblack@google.com
31014184Sgabeblack@google.com  MachineType testAndClearLocalHit(Entry cache_entry) {
31114184Sgabeblack@google.com    if (is_valid(cache_entry) && cache_entry.FromL2) {
31214184Sgabeblack@google.com      cache_entry.FromL2 := false;
31314184Sgabeblack@google.com      return MachineType:L2Cache;
31414184Sgabeblack@google.com    }
31514184Sgabeblack@google.com    return MachineType:L1Cache;
31614184Sgabeblack@google.com  }
31714184Sgabeblack@google.com
31814184Sgabeblack@google.com  bool IsAtomicAccessed(Entry cache_entry) {
31914184Sgabeblack@google.com    assert(is_valid(cache_entry));
32014184Sgabeblack@google.com    return cache_entry.AtomicAccessed;
32114184Sgabeblack@google.com  }
32214184Sgabeblack@google.com
32314184Sgabeblack@google.com  // ** OUT_PORTS **
32414184Sgabeblack@google.com  out_port(requestNetwork_out, RequestMsg, requestFromCache);
32514184Sgabeblack@google.com  out_port(responseNetwork_out, ResponseMsg, responseFromCache);
32614184Sgabeblack@google.com  out_port(unblockNetwork_out, ResponseMsg, unblockFromCache);
32714184Sgabeblack@google.com  out_port(triggerQueue_out, TriggerMsg, triggerQueue);
32814184Sgabeblack@google.com
32914184Sgabeblack@google.com  // ** IN_PORTS **
33014184Sgabeblack@google.com
33114184Sgabeblack@google.com  // Trigger Queue
33214184Sgabeblack@google.com  in_port(triggerQueue_in, TriggerMsg, triggerQueue, rank=3) {
33314184Sgabeblack@google.com    if (triggerQueue_in.isReady(clockEdge())) {
33414184Sgabeblack@google.com      peek(triggerQueue_in, TriggerMsg) {
33514184Sgabeblack@google.com
33614184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
33714184Sgabeblack@google.com        TBE tbe := TBEs[in_msg.addr];
33814184Sgabeblack@google.com
33914184Sgabeblack@google.com        if (in_msg.Type == TriggerType:L2_to_L1) {
34014184Sgabeblack@google.com          trigger(Event:Complete_L2_to_L1, in_msg.addr, cache_entry, tbe);
34114184Sgabeblack@google.com        } else if (in_msg.Type == TriggerType:ALL_ACKS) {
34214184Sgabeblack@google.com          trigger(Event:All_acks, in_msg.addr, cache_entry, tbe);
34314184Sgabeblack@google.com        } else if (in_msg.Type == TriggerType:ALL_ACKS_NO_SHARERS) {
34414184Sgabeblack@google.com          trigger(Event:All_acks_no_sharers, in_msg.addr, cache_entry, tbe);
34514184Sgabeblack@google.com        } else {
34614184Sgabeblack@google.com          error("Unexpected message");
34714184Sgabeblack@google.com        }
34814184Sgabeblack@google.com      }
34914184Sgabeblack@google.com    }
35014184Sgabeblack@google.com  }
35114184Sgabeblack@google.com
35214184Sgabeblack@google.com  // Nothing from the unblock network
35314184Sgabeblack@google.com
35414184Sgabeblack@google.com  // Response Network
35514184Sgabeblack@google.com  in_port(responseToCache_in, ResponseMsg, responseToCache, rank=2) {
35614184Sgabeblack@google.com    if (responseToCache_in.isReady(clockEdge())) {
35714184Sgabeblack@google.com      peek(responseToCache_in, ResponseMsg, block_on="addr") {
35814184Sgabeblack@google.com
35914184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
36014184Sgabeblack@google.com        TBE tbe := TBEs[in_msg.addr];
36114184Sgabeblack@google.com
36214184Sgabeblack@google.com        if (in_msg.Type == CoherenceResponseType:ACK) {
36314184Sgabeblack@google.com          trigger(Event:Ack, in_msg.addr, cache_entry, tbe);
36414184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:ACK_SHARED) {
36514184Sgabeblack@google.com          trigger(Event:Shared_Ack, in_msg.addr, cache_entry, tbe);
36614184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:DATA) {
36714184Sgabeblack@google.com          trigger(Event:Data, in_msg.addr, cache_entry, tbe);
36814184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:DATA_SHARED) {
36914184Sgabeblack@google.com          trigger(Event:Shared_Data, in_msg.addr, cache_entry, tbe);
37014184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:DATA_EXCLUSIVE) {
37114184Sgabeblack@google.com          trigger(Event:Exclusive_Data, in_msg.addr, cache_entry, tbe);
37214184Sgabeblack@google.com        } else {
37314184Sgabeblack@google.com          error("Unexpected message");
37414184Sgabeblack@google.com        }
37514184Sgabeblack@google.com      }
37614184Sgabeblack@google.com    }
37714184Sgabeblack@google.com  }
37814184Sgabeblack@google.com
37914184Sgabeblack@google.com  // Forward Network
38014184Sgabeblack@google.com  in_port(forwardToCache_in, RequestMsg, forwardToCache, rank=1) {
38114184Sgabeblack@google.com    if (forwardToCache_in.isReady(clockEdge())) {
38214184Sgabeblack@google.com      peek(forwardToCache_in, RequestMsg, block_on="addr") {
38314184Sgabeblack@google.com
38414184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
38514184Sgabeblack@google.com        TBE tbe := TBEs[in_msg.addr];
38614184Sgabeblack@google.com
38714184Sgabeblack@google.com        if ((in_msg.Type == CoherenceRequestType:GETX) ||
38814184Sgabeblack@google.com            (in_msg.Type == CoherenceRequestType:GETF)) {
38914184Sgabeblack@google.com          trigger(Event:Other_GETX, in_msg.addr, cache_entry, tbe);
39014184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:MERGED_GETS) {
39114184Sgabeblack@google.com          trigger(Event:Merged_GETS, in_msg.addr, cache_entry, tbe);
39214184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:GETS) {
39314184Sgabeblack@google.com          if (machineCount(MachineType:L1Cache) > 1) {
39414184Sgabeblack@google.com            if (is_valid(cache_entry)) {
39514184Sgabeblack@google.com              if (IsAtomicAccessed(cache_entry) && no_mig_atomic) {
39614184Sgabeblack@google.com                trigger(Event:Other_GETS_No_Mig, in_msg.addr, cache_entry, tbe);
39714184Sgabeblack@google.com              } else {
39814184Sgabeblack@google.com                trigger(Event:Other_GETS, in_msg.addr, cache_entry, tbe);
39914184Sgabeblack@google.com              }
40014184Sgabeblack@google.com            } else {
40114184Sgabeblack@google.com              trigger(Event:Other_GETS, in_msg.addr, cache_entry, tbe);
40214184Sgabeblack@google.com            }
40314184Sgabeblack@google.com          } else {
40414184Sgabeblack@google.com            trigger(Event:NC_DMA_GETS, in_msg.addr, cache_entry, tbe);
40514184Sgabeblack@google.com          }
40614184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:INV) {
40714184Sgabeblack@google.com          trigger(Event:Invalidate, in_msg.addr, cache_entry, tbe);
40814184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:WB_ACK) {
40914184Sgabeblack@google.com          trigger(Event:Writeback_Ack, in_msg.addr, cache_entry, tbe);
41014184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:WB_NACK) {
41114184Sgabeblack@google.com          trigger(Event:Writeback_Nack, in_msg.addr, cache_entry, tbe);
41214184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:BLOCK_ACK) {
41314184Sgabeblack@google.com          trigger(Event:Block_Ack, in_msg.addr, cache_entry, tbe);
41414184Sgabeblack@google.com        } else {
41514184Sgabeblack@google.com          error("Unexpected message");
41614184Sgabeblack@google.com        }
41714184Sgabeblack@google.com      }
41814184Sgabeblack@google.com    }
41914184Sgabeblack@google.com  }
42014184Sgabeblack@google.com
42114184Sgabeblack@google.com  // Nothing from the request network
42214184Sgabeblack@google.com
42314184Sgabeblack@google.com  // Mandatory Queue
42414184Sgabeblack@google.com  in_port(mandatoryQueue_in, RubyRequest, mandatoryQueue, desc="...", rank=0) {
42514184Sgabeblack@google.com    if (mandatoryQueue_in.isReady(clockEdge())) {
42614184Sgabeblack@google.com      peek(mandatoryQueue_in, RubyRequest, block_on="LineAddress") {
42714184Sgabeblack@google.com
42814184Sgabeblack@google.com        // Check for data access to blocks in I-cache and ifetchs to blocks in D-cache
42914184Sgabeblack@google.com        TBE tbe := TBEs[in_msg.LineAddress];
43014184Sgabeblack@google.com
43114184Sgabeblack@google.com        if (in_msg.Type == RubyRequestType:IFETCH) {
43214184Sgabeblack@google.com          // ** INSTRUCTION ACCESS ***
43314184Sgabeblack@google.com
43414184Sgabeblack@google.com          Entry L1Icache_entry := getL1ICacheEntry(in_msg.LineAddress);
43514184Sgabeblack@google.com          if (is_valid(L1Icache_entry)) {
43614184Sgabeblack@google.com            // The tag matches for the L1, so the L1 fetches the line.
43714184Sgabeblack@google.com            // We know it can't be in the L2 due to exclusion
43814184Sgabeblack@google.com            trigger(mandatory_request_type_to_event(in_msg.Type),
43914184Sgabeblack@google.com                    in_msg.LineAddress, L1Icache_entry, tbe);
44014184Sgabeblack@google.com          } else {
44114184Sgabeblack@google.com            // Check to see if it is in the OTHER L1
44214184Sgabeblack@google.com            Entry L1Dcache_entry := getL1DCacheEntry(in_msg.LineAddress);
44314184Sgabeblack@google.com            if (is_valid(L1Dcache_entry)) {
44414184Sgabeblack@google.com              // The block is in the wrong L1, try to write it to the L2
44514184Sgabeblack@google.com              if (L2cache.cacheAvail(in_msg.LineAddress)) {
44614184Sgabeblack@google.com                trigger(Event:L1_to_L2, in_msg.LineAddress, L1Dcache_entry, tbe);
44714184Sgabeblack@google.com              } else {
44814184Sgabeblack@google.com                Addr l2_victim_addr := L2cache.cacheProbe(in_msg.LineAddress);
44914184Sgabeblack@google.com                trigger(Event:L2_Replacement,
45014184Sgabeblack@google.com                        l2_victim_addr,
45114184Sgabeblack@google.com                        getL2CacheEntry(l2_victim_addr),
45214184Sgabeblack@google.com                        TBEs[l2_victim_addr]);
45314184Sgabeblack@google.com              }
45414184Sgabeblack@google.com            }
45514184Sgabeblack@google.com
45614184Sgabeblack@google.com            if (L1Icache.cacheAvail(in_msg.LineAddress)) {
45714184Sgabeblack@google.com              // L1 does't have the line, but we have space for it in the L1
45814184Sgabeblack@google.com
45914184Sgabeblack@google.com              Entry L2cache_entry := getL2CacheEntry(in_msg.LineAddress);
46014184Sgabeblack@google.com              if (is_valid(L2cache_entry)) {
46114184Sgabeblack@google.com                // L2 has it (maybe not with the right permissions)
46214184Sgabeblack@google.com                trigger(Event:Trigger_L2_to_L1I, in_msg.LineAddress,
46314184Sgabeblack@google.com                        L2cache_entry, tbe);
46414184Sgabeblack@google.com              } else {
46514184Sgabeblack@google.com                // We have room, the L2 doesn't have it, so the L1 fetches the line
46614184Sgabeblack@google.com                trigger(mandatory_request_type_to_event(in_msg.Type),
46714184Sgabeblack@google.com                        in_msg.LineAddress, L1Icache_entry, tbe);
46814184Sgabeblack@google.com              }
46914184Sgabeblack@google.com            } else {
47014184Sgabeblack@google.com              // No room in the L1, so we need to make room
47114184Sgabeblack@google.com              // Check if the line we want to evict is not locked
47214184Sgabeblack@google.com              Addr l1i_victim_addr := L1Icache.cacheProbe(in_msg.LineAddress);
47314184Sgabeblack@google.com              check_on_cache_probe(mandatoryQueue_in, l1i_victim_addr);
47414184Sgabeblack@google.com              if (L2cache.cacheAvail(l1i_victim_addr)) {
47514184Sgabeblack@google.com                // The L2 has room, so we move the line from the L1 to the L2
47614184Sgabeblack@google.com                trigger(Event:L1_to_L2,
47714184Sgabeblack@google.com                        l1i_victim_addr,
47814184Sgabeblack@google.com                        getL1ICacheEntry(l1i_victim_addr),
47914184Sgabeblack@google.com                        TBEs[l1i_victim_addr]);
48014184Sgabeblack@google.com              } else {
48114184Sgabeblack@google.com                Addr l2_victim_addr := L2cache.cacheProbe(l1i_victim_addr);
48214184Sgabeblack@google.com                // The L2 does not have room, so we replace a line from the L2
48314184Sgabeblack@google.com                trigger(Event:L2_Replacement,
48414184Sgabeblack@google.com                        l2_victim_addr,
48514184Sgabeblack@google.com                        getL2CacheEntry(l2_victim_addr),
48614184Sgabeblack@google.com                        TBEs[l2_victim_addr]);
48714184Sgabeblack@google.com              }
48814184Sgabeblack@google.com            }
48914184Sgabeblack@google.com          }
49014184Sgabeblack@google.com        } else {
49114184Sgabeblack@google.com          // *** DATA ACCESS ***
49214184Sgabeblack@google.com
49314184Sgabeblack@google.com          Entry L1Dcache_entry := getL1DCacheEntry(in_msg.LineAddress);
49414184Sgabeblack@google.com          if (is_valid(L1Dcache_entry)) {
49514184Sgabeblack@google.com            // The tag matches for the L1, so the L1 fetches the line.
49614184Sgabeblack@google.com            // We know it can't be in the L2 due to exclusion
49714184Sgabeblack@google.com            trigger(mandatory_request_type_to_event(in_msg.Type),
49814184Sgabeblack@google.com                    in_msg.LineAddress, L1Dcache_entry, tbe);
49914184Sgabeblack@google.com          } else {
50014184Sgabeblack@google.com
50114184Sgabeblack@google.com            // Check to see if it is in the OTHER L1
50214184Sgabeblack@google.com            Entry L1Icache_entry := getL1ICacheEntry(in_msg.LineAddress);
50314184Sgabeblack@google.com            if (is_valid(L1Icache_entry)) {
50414184Sgabeblack@google.com              // The block is in the wrong L1, try to write it to the L2
50514184Sgabeblack@google.com              if (L2cache.cacheAvail(in_msg.LineAddress)) {
50614184Sgabeblack@google.com                trigger(Event:L1_to_L2, in_msg.LineAddress, L1Icache_entry, tbe);
50714184Sgabeblack@google.com              } else {
50814184Sgabeblack@google.com                Addr l2_victim_addr := L2cache.cacheProbe(in_msg.LineAddress);
50914184Sgabeblack@google.com                trigger(Event:L2_Replacement,
51014184Sgabeblack@google.com                        l2_victim_addr,
51114184Sgabeblack@google.com                        getL2CacheEntry(l2_victim_addr),
51214184Sgabeblack@google.com                        TBEs[l2_victim_addr]);
51314184Sgabeblack@google.com              }
51414184Sgabeblack@google.com            }
51514184Sgabeblack@google.com
51614184Sgabeblack@google.com            if (L1Dcache.cacheAvail(in_msg.LineAddress)) {
51714184Sgabeblack@google.com              // L1 does't have the line, but we have space for it in the L1
51814184Sgabeblack@google.com              Entry L2cache_entry := getL2CacheEntry(in_msg.LineAddress);
51914184Sgabeblack@google.com              if (is_valid(L2cache_entry)) {
52014184Sgabeblack@google.com                // L2 has it (maybe not with the right permissions)
52114184Sgabeblack@google.com                trigger(Event:Trigger_L2_to_L1D, in_msg.LineAddress,
52214184Sgabeblack@google.com                        L2cache_entry, tbe);
52314184Sgabeblack@google.com              } else {
52414184Sgabeblack@google.com                // We have room, the L2 doesn't have it, so the L1 fetches the line
52514184Sgabeblack@google.com                trigger(mandatory_request_type_to_event(in_msg.Type),
52614184Sgabeblack@google.com                        in_msg.LineAddress, L1Dcache_entry, tbe);
52714184Sgabeblack@google.com              }
52814184Sgabeblack@google.com            } else {
52914184Sgabeblack@google.com              // No room in the L1, so we need to make room
53014184Sgabeblack@google.com              // Check if the line we want to evict is not locked
53114184Sgabeblack@google.com              Addr l1d_victim_addr := L1Dcache.cacheProbe(in_msg.LineAddress);
53214184Sgabeblack@google.com              check_on_cache_probe(mandatoryQueue_in, l1d_victim_addr);
53314184Sgabeblack@google.com              if (L2cache.cacheAvail(l1d_victim_addr)) {
53414184Sgabeblack@google.com                // The L2 has room, so we move the line from the L1 to the L2
53514184Sgabeblack@google.com                trigger(Event:L1_to_L2,
53614184Sgabeblack@google.com                        l1d_victim_addr,
53714184Sgabeblack@google.com                        getL1DCacheEntry(l1d_victim_addr),
53814184Sgabeblack@google.com                        TBEs[l1d_victim_addr]);
53914184Sgabeblack@google.com              } else {
54014184Sgabeblack@google.com                Addr l2_victim_addr := L2cache.cacheProbe(l1d_victim_addr);
54114184Sgabeblack@google.com                // The L2 does not have room, so we replace a line from the L2
54214184Sgabeblack@google.com                trigger(Event:L2_Replacement,
54314184Sgabeblack@google.com                        l2_victim_addr,
54414184Sgabeblack@google.com                        getL2CacheEntry(l2_victim_addr),
54514184Sgabeblack@google.com                        TBEs[l2_victim_addr]);
54614184Sgabeblack@google.com              }
54714184Sgabeblack@google.com            }
54814184Sgabeblack@google.com          }
54914184Sgabeblack@google.com        }
55014184Sgabeblack@google.com      }
55114184Sgabeblack@google.com    }
55214184Sgabeblack@google.com  }
55314184Sgabeblack@google.com
55414184Sgabeblack@google.com  // ACTIONS
55514184Sgabeblack@google.com
55614184Sgabeblack@google.com  action(a_issueGETS, "a", desc="Issue GETS") {
55714184Sgabeblack@google.com    enqueue(requestNetwork_out, RequestMsg, issue_latency) {
55814184Sgabeblack@google.com      assert(is_valid(tbe));
55914184Sgabeblack@google.com      out_msg.addr := address;
56014184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:GETS;
56114184Sgabeblack@google.com      out_msg.Requestor := machineID;
56214184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
56314184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Request_Control;
56414184Sgabeblack@google.com      out_msg.InitialRequestTime := curCycle();
56514184Sgabeblack@google.com
56614184Sgabeblack@google.com      // One from each other cache (n-1) plus the memory (+1)
56714184Sgabeblack@google.com      tbe.NumPendingMsgs := machineCount(MachineType:L1Cache);
56814184Sgabeblack@google.com    }
56914184Sgabeblack@google.com  }
57014184Sgabeblack@google.com
57114184Sgabeblack@google.com  action(b_issueGETX, "b", desc="Issue GETX") {
57214184Sgabeblack@google.com    enqueue(requestNetwork_out, RequestMsg, issue_latency) {
57314184Sgabeblack@google.com      assert(is_valid(tbe));
57414184Sgabeblack@google.com      out_msg.addr := address;
57514184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:GETX;
57614184Sgabeblack@google.com      out_msg.Requestor := machineID;
57714184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
57814184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Request_Control;
57914184Sgabeblack@google.com      out_msg.InitialRequestTime := curCycle();
58014184Sgabeblack@google.com
58114184Sgabeblack@google.com      // One from each other cache (n-1) plus the memory (+1)
58214184Sgabeblack@google.com      tbe.NumPendingMsgs := machineCount(MachineType:L1Cache);
58314184Sgabeblack@google.com    }
58414184Sgabeblack@google.com  }
58514184Sgabeblack@google.com
58614184Sgabeblack@google.com  action(b_issueGETXIfMoreThanOne, "bo", desc="Issue GETX") {
58714184Sgabeblack@google.com    if (machineCount(MachineType:L1Cache) > 1) {
58814184Sgabeblack@google.com      enqueue(requestNetwork_out, RequestMsg, issue_latency) {
58914184Sgabeblack@google.com        assert(is_valid(tbe));
59014184Sgabeblack@google.com        out_msg.addr := address;
59114184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:GETX;
59214184Sgabeblack@google.com        out_msg.Requestor := machineID;
59314184Sgabeblack@google.com        out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
59414184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Request_Control;
59514184Sgabeblack@google.com        out_msg.InitialRequestTime := curCycle();
59614184Sgabeblack@google.com      }
59714184Sgabeblack@google.com    }
59814184Sgabeblack@google.com
59914184Sgabeblack@google.com    // One from each other cache (n-1) plus the memory (+1)
60014184Sgabeblack@google.com    tbe.NumPendingMsgs := machineCount(MachineType:L1Cache);
60114184Sgabeblack@google.com  }
60214184Sgabeblack@google.com
60314184Sgabeblack@google.com  action(bf_issueGETF, "bf", desc="Issue GETF") {
60414184Sgabeblack@google.com    enqueue(requestNetwork_out, RequestMsg, issue_latency) {
60514184Sgabeblack@google.com      assert(is_valid(tbe));
60614184Sgabeblack@google.com      out_msg.addr := address;
60714184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:GETF;
60814184Sgabeblack@google.com      out_msg.Requestor := machineID;
60914184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
61014184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Request_Control;
61114184Sgabeblack@google.com      out_msg.InitialRequestTime := curCycle();
61214184Sgabeblack@google.com
61314184Sgabeblack@google.com      // One from each other cache (n-1) plus the memory (+1)
61414184Sgabeblack@google.com      tbe.NumPendingMsgs := machineCount(MachineType:L1Cache);
61514184Sgabeblack@google.com    }
61614184Sgabeblack@google.com  }
61714184Sgabeblack@google.com
61814184Sgabeblack@google.com  action(c_sendExclusiveData, "c", desc="Send exclusive data from cache to requestor") {
61914184Sgabeblack@google.com    peek(forwardToCache_in, RequestMsg) {
62014184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cache_response_latency) {
62114184Sgabeblack@google.com        assert(is_valid(cache_entry));
62214184Sgabeblack@google.com        out_msg.addr := address;
62314184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
62414184Sgabeblack@google.com        out_msg.Sender := machineID;
62514184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
62614184Sgabeblack@google.com        out_msg.DataBlk := cache_entry.DataBlk;
62714184Sgabeblack@google.com        out_msg.Dirty := cache_entry.Dirty;
62814184Sgabeblack@google.com        if (in_msg.DirectedProbe) {
62914184Sgabeblack@google.com          out_msg.Acks := machineCount(MachineType:L1Cache);
63014184Sgabeblack@google.com        } else {
63114184Sgabeblack@google.com          out_msg.Acks := 2;
63214184Sgabeblack@google.com        }
63314184Sgabeblack@google.com        out_msg.SilentAcks := in_msg.SilentAcks;
63414184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
63514184Sgabeblack@google.com        out_msg.InitialRequestTime := in_msg.InitialRequestTime;
63614184Sgabeblack@google.com        out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
63714184Sgabeblack@google.com      }
63814184Sgabeblack@google.com    }
63914184Sgabeblack@google.com  }
64014184Sgabeblack@google.com
64114184Sgabeblack@google.com  action(ct_sendExclusiveDataFromTBE, "ct", desc="Send exclusive data from tbe to requestor") {
64214184Sgabeblack@google.com    peek(forwardToCache_in, RequestMsg) {
64314184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cache_response_latency) {
64414184Sgabeblack@google.com        assert(is_valid(tbe));
64514184Sgabeblack@google.com        out_msg.addr := address;
64614184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
64714184Sgabeblack@google.com        out_msg.Sender := machineID;
64814184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
64914184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
65014184Sgabeblack@google.com        out_msg.Dirty := tbe.Dirty;
65114184Sgabeblack@google.com        if (in_msg.DirectedProbe) {
65214184Sgabeblack@google.com          out_msg.Acks := machineCount(MachineType:L1Cache);
65314184Sgabeblack@google.com        } else {
65414184Sgabeblack@google.com          out_msg.Acks := 2;
65514184Sgabeblack@google.com        }
65614184Sgabeblack@google.com        out_msg.SilentAcks := in_msg.SilentAcks;
65714184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
65814184Sgabeblack@google.com        out_msg.InitialRequestTime := in_msg.InitialRequestTime;
65914184Sgabeblack@google.com        out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
66014184Sgabeblack@google.com      }
66114184Sgabeblack@google.com    }
66214184Sgabeblack@google.com  }
66314184Sgabeblack@google.com
66414184Sgabeblack@google.com  action(d_issuePUT, "d", desc="Issue PUT") {
66514184Sgabeblack@google.com    enqueue(requestNetwork_out, RequestMsg, issue_latency) {
66614184Sgabeblack@google.com      out_msg.addr := address;
66714184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:PUT;
66814184Sgabeblack@google.com      out_msg.Requestor := machineID;
66914184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
67014184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Writeback_Control;
67114184Sgabeblack@google.com    }
67214184Sgabeblack@google.com  }
67314184Sgabeblack@google.com
67414184Sgabeblack@google.com  action(df_issuePUTF, "df", desc="Issue PUTF") {
67514184Sgabeblack@google.com    enqueue(requestNetwork_out, RequestMsg, issue_latency) {
67614184Sgabeblack@google.com      out_msg.addr := address;
67714184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:PUTF;
67814184Sgabeblack@google.com      out_msg.Requestor := machineID;
67914184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
68014184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Writeback_Control;
68114184Sgabeblack@google.com    }
68214184Sgabeblack@google.com  }
68314184Sgabeblack@google.com
68414184Sgabeblack@google.com  action(e_sendData, "e", desc="Send data from cache to requestor") {
68514184Sgabeblack@google.com    peek(forwardToCache_in, RequestMsg) {
68614184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cache_response_latency) {
68714184Sgabeblack@google.com        assert(is_valid(cache_entry));
68814184Sgabeblack@google.com        out_msg.addr := address;
68914184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA;
69014184Sgabeblack@google.com        out_msg.Sender := machineID;
69114184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
69214184Sgabeblack@google.com        out_msg.DataBlk := cache_entry.DataBlk;
69314184Sgabeblack@google.com        out_msg.Dirty := cache_entry.Dirty;
69414184Sgabeblack@google.com        if (in_msg.DirectedProbe) {
69514184Sgabeblack@google.com          out_msg.Acks := machineCount(MachineType:L1Cache);
69614184Sgabeblack@google.com        } else {
69714184Sgabeblack@google.com          out_msg.Acks := 2;
69814184Sgabeblack@google.com        }
69914184Sgabeblack@google.com        out_msg.SilentAcks := in_msg.SilentAcks;
70014184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
70114184Sgabeblack@google.com        out_msg.InitialRequestTime := in_msg.InitialRequestTime;
70214184Sgabeblack@google.com        out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
70314184Sgabeblack@google.com      }
70414184Sgabeblack@google.com    }
70514184Sgabeblack@google.com  }
70614184Sgabeblack@google.com
70714184Sgabeblack@google.com  action(ee_sendDataShared, "\e", desc="Send data from cache to requestor, remaining the owner") {
70814184Sgabeblack@google.com    peek(forwardToCache_in, RequestMsg) {
70914184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cache_response_latency) {
71014184Sgabeblack@google.com        assert(is_valid(cache_entry));
71114184Sgabeblack@google.com        out_msg.addr := address;
71214184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA_SHARED;
71314184Sgabeblack@google.com        out_msg.Sender := machineID;
71414184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
71514184Sgabeblack@google.com        out_msg.DataBlk := cache_entry.DataBlk;
71614184Sgabeblack@google.com        out_msg.Dirty := cache_entry.Dirty;
71714184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg.DataBlk);
71814184Sgabeblack@google.com        if (in_msg.DirectedProbe) {
71914184Sgabeblack@google.com          out_msg.Acks := machineCount(MachineType:L1Cache);
72014184Sgabeblack@google.com        } else {
72114184Sgabeblack@google.com          out_msg.Acks := 2;
72214184Sgabeblack@google.com        }
72314184Sgabeblack@google.com        out_msg.SilentAcks := in_msg.SilentAcks;
72414184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
72514184Sgabeblack@google.com        out_msg.InitialRequestTime := in_msg.InitialRequestTime;
72614184Sgabeblack@google.com        out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
72714184Sgabeblack@google.com      }
72814184Sgabeblack@google.com    }
72914184Sgabeblack@google.com  }
73014184Sgabeblack@google.com
73114184Sgabeblack@google.com  action(et_sendDataSharedFromTBE, "\et", desc="Send data from TBE to requestor, keep a shared copy") {
73214184Sgabeblack@google.com    peek(forwardToCache_in, RequestMsg) {
73314184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cache_response_latency) {
73414184Sgabeblack@google.com        assert(is_valid(tbe));
73514184Sgabeblack@google.com        out_msg.addr := address;
73614184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA_SHARED;
73714184Sgabeblack@google.com        out_msg.Sender := machineID;
73814184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
73914184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
74014184Sgabeblack@google.com        out_msg.Dirty := tbe.Dirty;
74114184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg.DataBlk);
74214184Sgabeblack@google.com        if (in_msg.DirectedProbe) {
74314184Sgabeblack@google.com          out_msg.Acks := machineCount(MachineType:L1Cache);
74414184Sgabeblack@google.com        } else {
74514184Sgabeblack@google.com          out_msg.Acks := 2;
74614184Sgabeblack@google.com        }
74714184Sgabeblack@google.com        out_msg.SilentAcks := in_msg.SilentAcks;
74814184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
74914184Sgabeblack@google.com        out_msg.InitialRequestTime := in_msg.InitialRequestTime;
75014184Sgabeblack@google.com        out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
75114184Sgabeblack@google.com      }
75214184Sgabeblack@google.com    }
75314184Sgabeblack@google.com  }
75414184Sgabeblack@google.com
75514184Sgabeblack@google.com  action(em_sendDataSharedMultiple, "em", desc="Send data from cache to all requestors, still the owner") {
75614184Sgabeblack@google.com    peek(forwardToCache_in, RequestMsg) {
75714184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cache_response_latency) {
75814184Sgabeblack@google.com        assert(is_valid(cache_entry));
75914184Sgabeblack@google.com        out_msg.addr := address;
76014184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA_SHARED;
76114184Sgabeblack@google.com        out_msg.Sender := machineID;
76214184Sgabeblack@google.com        out_msg.Destination := in_msg.MergedRequestors;
76314184Sgabeblack@google.com        out_msg.DataBlk := cache_entry.DataBlk;
76414184Sgabeblack@google.com        out_msg.Dirty := cache_entry.Dirty;
76514184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg.DataBlk);
76614184Sgabeblack@google.com        out_msg.Acks := machineCount(MachineType:L1Cache);
76714184Sgabeblack@google.com        out_msg.SilentAcks := in_msg.SilentAcks;
76814184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
76914184Sgabeblack@google.com        out_msg.InitialRequestTime := in_msg.InitialRequestTime;
77014184Sgabeblack@google.com        out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
77114184Sgabeblack@google.com      }
77214184Sgabeblack@google.com    }
77314184Sgabeblack@google.com  }
77414184Sgabeblack@google.com
77514184Sgabeblack@google.com  action(emt_sendDataSharedMultipleFromTBE, "emt", desc="Send data from tbe to all requestors") {
77614184Sgabeblack@google.com    peek(forwardToCache_in, RequestMsg) {
77714184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cache_response_latency) {
77814184Sgabeblack@google.com        assert(is_valid(tbe));
77914184Sgabeblack@google.com        out_msg.addr := address;
78014184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA_SHARED;
78114184Sgabeblack@google.com        out_msg.Sender := machineID;
78214184Sgabeblack@google.com        out_msg.Destination := in_msg.MergedRequestors;
78314184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
78414184Sgabeblack@google.com        out_msg.Dirty := tbe.Dirty;
78514184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg.DataBlk);
78614184Sgabeblack@google.com        out_msg.Acks := machineCount(MachineType:L1Cache);
78714184Sgabeblack@google.com        out_msg.SilentAcks := in_msg.SilentAcks;
78814184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
78914184Sgabeblack@google.com        out_msg.InitialRequestTime := in_msg.InitialRequestTime;
79014184Sgabeblack@google.com        out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
79114184Sgabeblack@google.com      }
79214184Sgabeblack@google.com    }
79314184Sgabeblack@google.com  }
79414184Sgabeblack@google.com
79514184Sgabeblack@google.com  action(f_sendAck, "f", desc="Send ack from cache to requestor") {
79614184Sgabeblack@google.com    peek(forwardToCache_in, RequestMsg) {
79714184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cache_response_latency) {
79814184Sgabeblack@google.com        out_msg.addr := address;
79914184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:ACK;
80014184Sgabeblack@google.com        out_msg.Sender := machineID;
80114184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
80214184Sgabeblack@google.com        out_msg.Acks := 1;
80314184Sgabeblack@google.com        out_msg.SilentAcks := in_msg.SilentAcks;
80414184Sgabeblack@google.com        assert(in_msg.DirectedProbe == false);
80514184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Control;
80614184Sgabeblack@google.com        out_msg.InitialRequestTime := in_msg.InitialRequestTime;
80714184Sgabeblack@google.com        out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
80814184Sgabeblack@google.com      }
80914184Sgabeblack@google.com    }
81014184Sgabeblack@google.com  }
81114184Sgabeblack@google.com
81214184Sgabeblack@google.com  action(ff_sendAckShared, "\f", desc="Send shared ack from cache to requestor") {
81314184Sgabeblack@google.com    peek(forwardToCache_in, RequestMsg) {
81414184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cache_response_latency) {
81514184Sgabeblack@google.com        out_msg.addr := address;
81614184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:ACK_SHARED;
81714184Sgabeblack@google.com        out_msg.Sender := machineID;
81814184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
81914184Sgabeblack@google.com        out_msg.Acks := 1;
82014184Sgabeblack@google.com        out_msg.SilentAcks := in_msg.SilentAcks;
82114184Sgabeblack@google.com        assert(in_msg.DirectedProbe == false);
82214184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Control;
82314184Sgabeblack@google.com        out_msg.InitialRequestTime := in_msg.InitialRequestTime;
82414184Sgabeblack@google.com        out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
82514184Sgabeblack@google.com      }
82614184Sgabeblack@google.com    }
82714184Sgabeblack@google.com  }
82814184Sgabeblack@google.com
82914184Sgabeblack@google.com  action(g_sendUnblock, "g", desc="Send unblock to memory") {
83014184Sgabeblack@google.com    enqueue(unblockNetwork_out, ResponseMsg, cache_response_latency) {
83114184Sgabeblack@google.com      out_msg.addr := address;
83214184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:UNBLOCK;
83314184Sgabeblack@google.com      out_msg.Sender := machineID;
83414184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
83514184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Unblock_Control;
83614184Sgabeblack@google.com    }
83714184Sgabeblack@google.com  }
83814184Sgabeblack@google.com
83914184Sgabeblack@google.com  action(gm_sendUnblockM, "gm", desc="Send unblock to memory and indicate M/O/E state") {
84014184Sgabeblack@google.com    enqueue(unblockNetwork_out, ResponseMsg, cache_response_latency) {
84114184Sgabeblack@google.com      out_msg.addr := address;
84214184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:UNBLOCKM;
84314184Sgabeblack@google.com      out_msg.Sender := machineID;
84414184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
84514184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Unblock_Control;
84614184Sgabeblack@google.com    }
84714184Sgabeblack@google.com  }
84814184Sgabeblack@google.com
84914184Sgabeblack@google.com  action(gs_sendUnblockS, "gs", desc="Send unblock to memory and indicate S state") {
85014184Sgabeblack@google.com    enqueue(unblockNetwork_out, ResponseMsg, cache_response_latency) {
85114184Sgabeblack@google.com      assert(is_valid(tbe));
85214184Sgabeblack@google.com      out_msg.addr := address;
85314184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:UNBLOCKS;
85414184Sgabeblack@google.com      out_msg.Sender := machineID;
85514184Sgabeblack@google.com      out_msg.CurOwner := tbe.CurOwner;
85614184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
85714184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Unblock_Control;
85814184Sgabeblack@google.com    }
85914184Sgabeblack@google.com  }
86014184Sgabeblack@google.com
86114184Sgabeblack@google.com  action(h_load_hit, "hd", desc="Notify sequencer the load completed.") {
86214184Sgabeblack@google.com    assert(is_valid(cache_entry));
86314184Sgabeblack@google.com    DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
86414184Sgabeblack@google.com    L1Dcache.setMRU(cache_entry);
86514184Sgabeblack@google.com    sequencer.readCallback(address, cache_entry.DataBlk, false,
86614184Sgabeblack@google.com                           testAndClearLocalHit(cache_entry));
86714184Sgabeblack@google.com  }
86814184Sgabeblack@google.com
86914184Sgabeblack@google.com  action(h_ifetch_hit, "hi", desc="Notify sequencer the ifetch completed.") {
87014184Sgabeblack@google.com    assert(is_valid(cache_entry));
87114184Sgabeblack@google.com    DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
87214184Sgabeblack@google.com    L1Icache.setMRU(cache_entry);
87314184Sgabeblack@google.com    sequencer.readCallback(address, cache_entry.DataBlk, false,
87414184Sgabeblack@google.com                           testAndClearLocalHit(cache_entry));
87514184Sgabeblack@google.com  }
87614184Sgabeblack@google.com
87714184Sgabeblack@google.com  action(hx_external_load_hit, "hx", desc="load required external msgs") {
87814184Sgabeblack@google.com    assert(is_valid(cache_entry));
87914184Sgabeblack@google.com    assert(is_valid(tbe));
88014184Sgabeblack@google.com    DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
88114184Sgabeblack@google.com    peek(responseToCache_in, ResponseMsg) {
88214184Sgabeblack@google.com      L1Icache.setMRU(address);
88314184Sgabeblack@google.com      L1Dcache.setMRU(address);
88414184Sgabeblack@google.com      sequencer.readCallback(address, cache_entry.DataBlk, true,
88514184Sgabeblack@google.com                 machineIDToMachineType(in_msg.Sender), tbe.InitialRequestTime,
88614184Sgabeblack@google.com                 tbe.ForwardRequestTime, tbe.FirstResponseTime);
88714184Sgabeblack@google.com    }
88814184Sgabeblack@google.com  }
88914184Sgabeblack@google.com
89014184Sgabeblack@google.com  action(hh_store_hit, "\h", desc="Notify sequencer that store completed.") {
89114184Sgabeblack@google.com    assert(is_valid(cache_entry));
89214184Sgabeblack@google.com    DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
89314184Sgabeblack@google.com    peek(mandatoryQueue_in, RubyRequest) {
89414184Sgabeblack@google.com      L1Dcache.setMRU(cache_entry);
89514184Sgabeblack@google.com      sequencer.writeCallback(address, cache_entry.DataBlk, false,
89614184Sgabeblack@google.com                              testAndClearLocalHit(cache_entry));
89714184Sgabeblack@google.com
89814184Sgabeblack@google.com      cache_entry.Dirty := true;
89914184Sgabeblack@google.com      if (in_msg.Type == RubyRequestType:ATOMIC) {
90014184Sgabeblack@google.com        cache_entry.AtomicAccessed := true;
90114184Sgabeblack@google.com      }
90214184Sgabeblack@google.com    }
90314184Sgabeblack@google.com  }
90414184Sgabeblack@google.com
90514184Sgabeblack@google.com  action(hh_flush_hit, "\hf", desc="Notify sequencer that flush completed.") {
90614184Sgabeblack@google.com    assert(is_valid(tbe));
90714184Sgabeblack@google.com    DPRINTF(RubySlicc, "%s\n", tbe.DataBlk);
90814184Sgabeblack@google.com    sequencer.writeCallback(address, tbe.DataBlk, false, MachineType:L1Cache);
90914184Sgabeblack@google.com  }
91014184Sgabeblack@google.com
91114184Sgabeblack@google.com  action(sx_external_store_hit, "sx", desc="store required external msgs.") {
91214184Sgabeblack@google.com    assert(is_valid(cache_entry));
91314184Sgabeblack@google.com    assert(is_valid(tbe));
91414184Sgabeblack@google.com    DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
91514184Sgabeblack@google.com    peek(responseToCache_in, ResponseMsg) {
91614184Sgabeblack@google.com      L1Icache.setMRU(address);
91714184Sgabeblack@google.com      L1Dcache.setMRU(address);
91814184Sgabeblack@google.com      sequencer.writeCallback(address, cache_entry.DataBlk, true,
91914184Sgabeblack@google.com              machineIDToMachineType(in_msg.Sender), tbe.InitialRequestTime,
92014184Sgabeblack@google.com              tbe.ForwardRequestTime, tbe.FirstResponseTime);
92114184Sgabeblack@google.com    }
92214184Sgabeblack@google.com    DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
92314184Sgabeblack@google.com    cache_entry.Dirty := true;
92414184Sgabeblack@google.com  }
92514184Sgabeblack@google.com
92614184Sgabeblack@google.com  action(sxt_trig_ext_store_hit, "sxt", desc="store required external msgs.") {
92714184Sgabeblack@google.com    assert(is_valid(cache_entry));
92814184Sgabeblack@google.com    assert(is_valid(tbe));
92914184Sgabeblack@google.com    DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
93014184Sgabeblack@google.com    L1Icache.setMRU(address);
93114184Sgabeblack@google.com    L1Dcache.setMRU(address);
93214184Sgabeblack@google.com    sequencer.writeCallback(address, cache_entry.DataBlk, true,
93314184Sgabeblack@google.com            machineIDToMachineType(tbe.LastResponder), tbe.InitialRequestTime,
93414184Sgabeblack@google.com            tbe.ForwardRequestTime, tbe.FirstResponseTime);
93514184Sgabeblack@google.com
93614184Sgabeblack@google.com    cache_entry.Dirty := true;
93714184Sgabeblack@google.com  }
93814184Sgabeblack@google.com
93914184Sgabeblack@google.com  action(i_allocateTBE, "i", desc="Allocate TBE") {
94014184Sgabeblack@google.com    check_allocate(TBEs);
94114184Sgabeblack@google.com    assert(is_valid(cache_entry));
94214184Sgabeblack@google.com    TBEs.allocate(address);
94314184Sgabeblack@google.com    set_tbe(TBEs[address]);
94414184Sgabeblack@google.com    tbe.DataBlk := cache_entry.DataBlk; // Data only used for writebacks
94514184Sgabeblack@google.com    tbe.Dirty := cache_entry.Dirty;
94614184Sgabeblack@google.com    tbe.Sharers := false;
94714184Sgabeblack@google.com  }
94814184Sgabeblack@google.com
94914184Sgabeblack@google.com  action(it_allocateTBE, "it", desc="Allocate TBE") {
95014184Sgabeblack@google.com    check_allocate(TBEs);
95114184Sgabeblack@google.com    TBEs.allocate(address);
95214184Sgabeblack@google.com    set_tbe(TBEs[address]);
95314184Sgabeblack@google.com    tbe.Dirty := false;
95414184Sgabeblack@google.com    tbe.Sharers := false;
95514184Sgabeblack@google.com  }
95614184Sgabeblack@google.com
95714184Sgabeblack@google.com  action(j_popTriggerQueue, "j", desc="Pop trigger queue.") {
95814184Sgabeblack@google.com    triggerQueue_in.dequeue(clockEdge());
95914184Sgabeblack@google.com  }
96014184Sgabeblack@google.com
96114184Sgabeblack@google.com  action(k_popMandatoryQueue, "k", desc="Pop mandatory queue.") {
96214184Sgabeblack@google.com    mandatoryQueue_in.dequeue(clockEdge());
96314184Sgabeblack@google.com  }
96414184Sgabeblack@google.com
96514184Sgabeblack@google.com  action(l_popForwardQueue, "l", desc="Pop forwareded request queue.") {
96614184Sgabeblack@google.com    forwardToCache_in.dequeue(clockEdge());
96714184Sgabeblack@google.com  }
96814184Sgabeblack@google.com
96914184Sgabeblack@google.com  action(hp_copyFromTBEToL2, "li", desc="Copy data from TBE to L2 cache entry.") {
97014184Sgabeblack@google.com    assert(is_valid(cache_entry));
97114184Sgabeblack@google.com    assert(is_valid(tbe));
97214184Sgabeblack@google.com    cache_entry.Dirty   := tbe.Dirty;
97314184Sgabeblack@google.com    cache_entry.DataBlk := tbe.DataBlk;
97414184Sgabeblack@google.com  }
97514184Sgabeblack@google.com
97614184Sgabeblack@google.com  action(nb_copyFromTBEToL1, "fu", desc="Copy data from TBE to L1 cache entry.") {
97714184Sgabeblack@google.com    assert(is_valid(cache_entry));
97814184Sgabeblack@google.com    assert(is_valid(tbe));
97914184Sgabeblack@google.com    cache_entry.Dirty   := tbe.Dirty;
98014184Sgabeblack@google.com    cache_entry.DataBlk := tbe.DataBlk;
98114184Sgabeblack@google.com    cache_entry.FromL2 := true;
98214184Sgabeblack@google.com  }
98314184Sgabeblack@google.com
98414184Sgabeblack@google.com  action(m_decrementNumberOfMessages, "m", desc="Decrement the number of messages for which we're waiting") {
98514184Sgabeblack@google.com    peek(responseToCache_in, ResponseMsg) {
98614184Sgabeblack@google.com      assert(in_msg.Acks >= 0);
98714184Sgabeblack@google.com      assert(is_valid(tbe));
98814184Sgabeblack@google.com      DPRINTF(RubySlicc, "Sender = %s\n", in_msg.Sender);
98914184Sgabeblack@google.com      DPRINTF(RubySlicc, "SilentAcks = %d\n", in_msg.SilentAcks);
99014184Sgabeblack@google.com      if (tbe.AppliedSilentAcks == false) {
99114184Sgabeblack@google.com        tbe.NumPendingMsgs := tbe.NumPendingMsgs - in_msg.SilentAcks;
99214184Sgabeblack@google.com        tbe.AppliedSilentAcks := true;
99314184Sgabeblack@google.com      }
99414184Sgabeblack@google.com      DPRINTF(RubySlicc, "%d\n", tbe.NumPendingMsgs);
99514184Sgabeblack@google.com      tbe.NumPendingMsgs := tbe.NumPendingMsgs - in_msg.Acks;
99614184Sgabeblack@google.com      DPRINTF(RubySlicc, "%d\n", tbe.NumPendingMsgs);
99714184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(tbe.NumPendingMsgs);
99814184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(in_msg.Sender);
99914184Sgabeblack@google.com      tbe.LastResponder := in_msg.Sender;
100014184Sgabeblack@google.com      if (tbe.InitialRequestTime != zero_time() && in_msg.InitialRequestTime != zero_time()) {
100114184Sgabeblack@google.com        assert(tbe.InitialRequestTime == in_msg.InitialRequestTime);
100214184Sgabeblack@google.com      }
100314184Sgabeblack@google.com      if (in_msg.InitialRequestTime != zero_time()) {
100414184Sgabeblack@google.com        tbe.InitialRequestTime := in_msg.InitialRequestTime;
100514184Sgabeblack@google.com      }
100614184Sgabeblack@google.com      if (tbe.ForwardRequestTime != zero_time() && in_msg.ForwardRequestTime != zero_time()) {
100714184Sgabeblack@google.com        assert(tbe.ForwardRequestTime == in_msg.ForwardRequestTime);
100814184Sgabeblack@google.com      }
100914184Sgabeblack@google.com      if (in_msg.ForwardRequestTime != zero_time()) {
101014184Sgabeblack@google.com        tbe.ForwardRequestTime := in_msg.ForwardRequestTime;
101114184Sgabeblack@google.com      }
101214184Sgabeblack@google.com      if (tbe.FirstResponseTime == zero_time()) {
101314184Sgabeblack@google.com        tbe.FirstResponseTime := curCycle();
101414184Sgabeblack@google.com      }
101514184Sgabeblack@google.com    }
101614184Sgabeblack@google.com  }
101714184Sgabeblack@google.com  action(uo_updateCurrentOwner, "uo", desc="When moving SS state, update current owner.") {
101814184Sgabeblack@google.com    peek(responseToCache_in, ResponseMsg) {
101914184Sgabeblack@google.com      assert(is_valid(tbe));
102014184Sgabeblack@google.com      tbe.CurOwner := in_msg.Sender;
102114184Sgabeblack@google.com    }
102214184Sgabeblack@google.com  }
102314184Sgabeblack@google.com
102414184Sgabeblack@google.com  action(n_popResponseQueue, "n", desc="Pop response queue") {
102514184Sgabeblack@google.com    responseToCache_in.dequeue(clockEdge());
102614184Sgabeblack@google.com  }
102714184Sgabeblack@google.com
102814184Sgabeblack@google.com  action(ll_L2toL1Transfer, "ll", desc="") {
102914184Sgabeblack@google.com    enqueue(triggerQueue_out, TriggerMsg, l2_cache_hit_latency) {
103014184Sgabeblack@google.com      out_msg.addr := address;
103114184Sgabeblack@google.com      out_msg.Type := TriggerType:L2_to_L1;
103214184Sgabeblack@google.com    }
103314184Sgabeblack@google.com  }
103414184Sgabeblack@google.com
103514184Sgabeblack@google.com  action(o_checkForCompletion, "o", desc="Check if we have received all the messages required for completion") {
103614184Sgabeblack@google.com    assert(is_valid(tbe));
103714184Sgabeblack@google.com    if (tbe.NumPendingMsgs == 0) {
103814184Sgabeblack@google.com      enqueue(triggerQueue_out, TriggerMsg) {
103914184Sgabeblack@google.com        out_msg.addr := address;
104014184Sgabeblack@google.com        if (tbe.Sharers) {
104114184Sgabeblack@google.com          out_msg.Type := TriggerType:ALL_ACKS;
104214184Sgabeblack@google.com        } else {
104314184Sgabeblack@google.com          out_msg.Type := TriggerType:ALL_ACKS_NO_SHARERS;
104414184Sgabeblack@google.com        }
104514184Sgabeblack@google.com      }
104614184Sgabeblack@google.com    }
104714184Sgabeblack@google.com  }
104814184Sgabeblack@google.com
104914184Sgabeblack@google.com  action(p_decrementNumberOfMessagesByOne, "p", desc="Decrement the number of messages for which we're waiting by one") {
105014184Sgabeblack@google.com    assert(is_valid(tbe));
105114184Sgabeblack@google.com    tbe.NumPendingMsgs := tbe.NumPendingMsgs - 1;
105214184Sgabeblack@google.com  }
105314184Sgabeblack@google.com
105414184Sgabeblack@google.com  action(pp_incrementNumberOfMessagesByOne, "\p", desc="Increment the number of messages for which we're waiting by one") {
105514184Sgabeblack@google.com    assert(is_valid(tbe));
105614184Sgabeblack@google.com    tbe.NumPendingMsgs := tbe.NumPendingMsgs + 1;
105714184Sgabeblack@google.com  }
105814184Sgabeblack@google.com
105914184Sgabeblack@google.com  action(q_sendDataFromTBEToCache, "q", desc="Send data from TBE to cache") {
106014184Sgabeblack@google.com    peek(forwardToCache_in, RequestMsg) {
106114184Sgabeblack@google.com        assert(in_msg.Requestor != machineID);
106214184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cache_response_latency) {
106314184Sgabeblack@google.com        assert(is_valid(tbe));
106414184Sgabeblack@google.com        out_msg.addr := address;
106514184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA;
106614184Sgabeblack@google.com        out_msg.Sender := machineID;
106714184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
106814184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg.Destination);
106914184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
107014184Sgabeblack@google.com        out_msg.Dirty := tbe.Dirty;
107114184Sgabeblack@google.com        if (in_msg.DirectedProbe) {
107214184Sgabeblack@google.com          out_msg.Acks := machineCount(MachineType:L1Cache);
107314184Sgabeblack@google.com        } else {
107414184Sgabeblack@google.com          out_msg.Acks := 2;
107514184Sgabeblack@google.com        }
107614184Sgabeblack@google.com        out_msg.SilentAcks := in_msg.SilentAcks;
107714184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
107814184Sgabeblack@google.com        out_msg.InitialRequestTime := in_msg.InitialRequestTime;
107914184Sgabeblack@google.com        out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
108014184Sgabeblack@google.com      }
108114184Sgabeblack@google.com    }
108214184Sgabeblack@google.com  }
108314184Sgabeblack@google.com
108414184Sgabeblack@google.com  action(sq_sendSharedDataFromTBEToCache, "sq", desc="Send shared data from TBE to cache, still the owner") {
108514184Sgabeblack@google.com    peek(forwardToCache_in, RequestMsg) {
108614184Sgabeblack@google.com        assert(in_msg.Requestor != machineID);
108714184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cache_response_latency) {
108814184Sgabeblack@google.com        assert(is_valid(tbe));
108914184Sgabeblack@google.com        out_msg.addr := address;
109014184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA_SHARED;
109114184Sgabeblack@google.com        out_msg.Sender := machineID;
109214184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
109314184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg.Destination);
109414184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
109514184Sgabeblack@google.com        out_msg.Dirty := tbe.Dirty;
109614184Sgabeblack@google.com        if (in_msg.DirectedProbe) {
109714184Sgabeblack@google.com          out_msg.Acks := machineCount(MachineType:L1Cache);
109814184Sgabeblack@google.com        } else {
109914184Sgabeblack@google.com          out_msg.Acks := 2;
110014184Sgabeblack@google.com        }
110114184Sgabeblack@google.com        out_msg.SilentAcks := in_msg.SilentAcks;
110214184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
110314184Sgabeblack@google.com        out_msg.InitialRequestTime := in_msg.InitialRequestTime;
110414184Sgabeblack@google.com        out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
110514184Sgabeblack@google.com      }
110614184Sgabeblack@google.com    }
110714184Sgabeblack@google.com  }
110814184Sgabeblack@google.com
110914184Sgabeblack@google.com  action(qm_sendDataFromTBEToCache, "qm", desc="Send data from TBE to cache, multiple sharers, still the owner") {
111014184Sgabeblack@google.com    peek(forwardToCache_in, RequestMsg) {
111114184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, cache_response_latency) {
111214184Sgabeblack@google.com        assert(is_valid(tbe));
111314184Sgabeblack@google.com        out_msg.addr := address;
111414184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA_SHARED;
111514184Sgabeblack@google.com        out_msg.Sender := machineID;
111614184Sgabeblack@google.com        out_msg.Destination := in_msg.MergedRequestors;
111714184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg.Destination);
111814184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
111914184Sgabeblack@google.com        out_msg.Dirty := tbe.Dirty;
112014184Sgabeblack@google.com        out_msg.Acks := machineCount(MachineType:L1Cache);
112114184Sgabeblack@google.com        out_msg.SilentAcks := in_msg.SilentAcks;
112214184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
112314184Sgabeblack@google.com        out_msg.InitialRequestTime := in_msg.InitialRequestTime;
112414184Sgabeblack@google.com        out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
112514184Sgabeblack@google.com      }
112614184Sgabeblack@google.com    }
112714184Sgabeblack@google.com  }
112814184Sgabeblack@google.com
112914184Sgabeblack@google.com  action(qq_sendDataFromTBEToMemory, "\q", desc="Send data from TBE to memory") {
113014184Sgabeblack@google.com    enqueue(unblockNetwork_out, ResponseMsg, cache_response_latency) {
113114184Sgabeblack@google.com      assert(is_valid(tbe));
113214184Sgabeblack@google.com      out_msg.addr := address;
113314184Sgabeblack@google.com      out_msg.Sender := machineID;
113414184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
113514184Sgabeblack@google.com      out_msg.Dirty := tbe.Dirty;
113614184Sgabeblack@google.com      if (tbe.Dirty) {
113714184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:WB_DIRTY;
113814184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
113914184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Data;
114014184Sgabeblack@google.com      } else {
114114184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:WB_CLEAN;
114214184Sgabeblack@google.com        // NOTE: in a real system this would not send data.  We send
114314184Sgabeblack@google.com        // data here only so we can check it at the memory
114414184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
114514184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Control;
114614184Sgabeblack@google.com      }
114714184Sgabeblack@google.com    }
114814184Sgabeblack@google.com  }
114914184Sgabeblack@google.com
115014184Sgabeblack@google.com  action(r_setSharerBit, "r", desc="We saw other sharers") {
115114184Sgabeblack@google.com    assert(is_valid(tbe));
115214184Sgabeblack@google.com    tbe.Sharers := true;
115314184Sgabeblack@google.com  }
115414184Sgabeblack@google.com
115514184Sgabeblack@google.com  action(s_deallocateTBE, "s", desc="Deallocate TBE") {
115614184Sgabeblack@google.com    TBEs.deallocate(address);
115714184Sgabeblack@google.com    unset_tbe();
115814184Sgabeblack@google.com  }
115914184Sgabeblack@google.com
116014184Sgabeblack@google.com  action(t_sendExclusiveDataFromTBEToMemory, "t", desc="Send exclusive data from TBE to memory") {
116114184Sgabeblack@google.com    enqueue(unblockNetwork_out, ResponseMsg, cache_response_latency) {
116214184Sgabeblack@google.com      assert(is_valid(tbe));
116314184Sgabeblack@google.com      out_msg.addr := address;
116414184Sgabeblack@google.com      out_msg.Sender := machineID;
116514184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory));
116614184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
116714184Sgabeblack@google.com      out_msg.Dirty := tbe.Dirty;
116814184Sgabeblack@google.com      if (tbe.Dirty) {
116914184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:WB_EXCLUSIVE_DIRTY;
117014184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
117114184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Data;
117214184Sgabeblack@google.com      } else {
117314184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:WB_EXCLUSIVE_CLEAN;
117414184Sgabeblack@google.com        // NOTE: in a real system this would not send data.  We send
117514184Sgabeblack@google.com        // data here only so we can check it at the memory
117614184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
117714184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Control;
117814184Sgabeblack@google.com      }
117914184Sgabeblack@google.com    }
118014184Sgabeblack@google.com  }
118114184Sgabeblack@google.com
118214184Sgabeblack@google.com  action(u_writeDataToCache, "u", desc="Write data to cache") {
118314184Sgabeblack@google.com    peek(responseToCache_in, ResponseMsg) {
118414184Sgabeblack@google.com      assert(is_valid(cache_entry));
118514184Sgabeblack@google.com      cache_entry.DataBlk := in_msg.DataBlk;
118614184Sgabeblack@google.com      cache_entry.Dirty := in_msg.Dirty;
118714184Sgabeblack@google.com    }
118814184Sgabeblack@google.com  }
118914184Sgabeblack@google.com
119014184Sgabeblack@google.com  action(uf_writeDataToCacheTBE, "uf", desc="Write data to TBE") {
119114184Sgabeblack@google.com    peek(responseToCache_in, ResponseMsg) {
119214184Sgabeblack@google.com      assert(is_valid(tbe));
119314184Sgabeblack@google.com      tbe.DataBlk := in_msg.DataBlk;
119414184Sgabeblack@google.com      tbe.Dirty := in_msg.Dirty;
119514184Sgabeblack@google.com    }
119614184Sgabeblack@google.com  }
119714184Sgabeblack@google.com
119814184Sgabeblack@google.com  action(v_writeDataToCacheVerify, "v", desc="Write data to cache, assert it was same as before") {
119914184Sgabeblack@google.com    peek(responseToCache_in, ResponseMsg) {
120014184Sgabeblack@google.com      assert(is_valid(cache_entry));
120114184Sgabeblack@google.com      DPRINTF(RubySlicc, "Cached Data Block: %s, Msg Data Block: %s\n",
120214184Sgabeblack@google.com              cache_entry.DataBlk, in_msg.DataBlk);
120314184Sgabeblack@google.com      assert(cache_entry.DataBlk == in_msg.DataBlk);
120414184Sgabeblack@google.com      cache_entry.DataBlk := in_msg.DataBlk;
120514184Sgabeblack@google.com      cache_entry.Dirty := in_msg.Dirty || cache_entry.Dirty;
120614184Sgabeblack@google.com    }
120714184Sgabeblack@google.com  }
120814184Sgabeblack@google.com
120914184Sgabeblack@google.com  action(vt_writeDataToTBEVerify, "vt", desc="Write data to TBE, assert it was same as before") {
121014184Sgabeblack@google.com    peek(responseToCache_in, ResponseMsg) {
121114184Sgabeblack@google.com      assert(is_valid(tbe));
121214184Sgabeblack@google.com      DPRINTF(RubySlicc, "Cached Data Block: %s, Msg Data Block: %s\n",
121314184Sgabeblack@google.com              tbe.DataBlk, in_msg.DataBlk);
121414184Sgabeblack@google.com      assert(tbe.DataBlk == in_msg.DataBlk);
121514184Sgabeblack@google.com      tbe.DataBlk := in_msg.DataBlk;
121614184Sgabeblack@google.com      tbe.Dirty := in_msg.Dirty || tbe.Dirty;
121714184Sgabeblack@google.com    }
121814184Sgabeblack@google.com  }
121914184Sgabeblack@google.com
122014184Sgabeblack@google.com  action(gg_deallocateL1CacheBlock, "\g", desc="Deallocate cache block.  Sets the cache to invalid, allowing a replacement in parallel with a fetch.") {
122114184Sgabeblack@google.com    if (L1Dcache.isTagPresent(address)) {
122214184Sgabeblack@google.com      L1Dcache.deallocate(address);
122314184Sgabeblack@google.com    } else {
122414184Sgabeblack@google.com      L1Icache.deallocate(address);
122514184Sgabeblack@google.com    }
122614184Sgabeblack@google.com    unset_cache_entry();
122714184Sgabeblack@google.com  }
122814184Sgabeblack@google.com
122914184Sgabeblack@google.com  action(ii_allocateL1DCacheBlock, "\i", desc="Set L1 D-cache tag equal to tag of block B.") {
123014184Sgabeblack@google.com    if (is_invalid(cache_entry)) {
123114184Sgabeblack@google.com      set_cache_entry(L1Dcache.allocate(address, new Entry));
123214184Sgabeblack@google.com    }
123314184Sgabeblack@google.com  }
123414184Sgabeblack@google.com
123514184Sgabeblack@google.com  action(jj_allocateL1ICacheBlock, "\j", desc="Set L1 I-cache tag equal to tag of block B.") {
123614184Sgabeblack@google.com    if (is_invalid(cache_entry)) {
123714184Sgabeblack@google.com      set_cache_entry(L1Icache.allocate(address, new Entry));
123814184Sgabeblack@google.com    }
123914184Sgabeblack@google.com  }
124014184Sgabeblack@google.com
124114184Sgabeblack@google.com  action(vv_allocateL2CacheBlock, "\v", desc="Set L2 cache tag equal to tag of block B.") {
124214184Sgabeblack@google.com    set_cache_entry(L2cache.allocate(address, new Entry));
124314184Sgabeblack@google.com  }
124414184Sgabeblack@google.com
124514184Sgabeblack@google.com  action(rr_deallocateL2CacheBlock, "\r", desc="Deallocate L2 cache block.  Sets the cache to not present, allowing a replacement in parallel with a fetch.") {
124614184Sgabeblack@google.com    L2cache.deallocate(address);
124714184Sgabeblack@google.com    unset_cache_entry();
124814184Sgabeblack@google.com  }
124914184Sgabeblack@google.com
125014184Sgabeblack@google.com  action(gr_deallocateCacheBlock, "\gr", desc="Deallocate an L1 or L2 cache block.") {
125114184Sgabeblack@google.com    if (L1Dcache.isTagPresent(address)) {
125214184Sgabeblack@google.com      L1Dcache.deallocate(address);
125314184Sgabeblack@google.com    }
125414184Sgabeblack@google.com    else if (L1Icache.isTagPresent(address)){
125514184Sgabeblack@google.com      L1Icache.deallocate(address);
125614184Sgabeblack@google.com    }
125714184Sgabeblack@google.com    else {
125814184Sgabeblack@google.com      assert(L2cache.isTagPresent(address));
125914184Sgabeblack@google.com      L2cache.deallocate(address);
126014184Sgabeblack@google.com    }
126114184Sgabeblack@google.com    unset_cache_entry();
126214184Sgabeblack@google.com  }
126314184Sgabeblack@google.com
126414184Sgabeblack@google.com  action(forward_eviction_to_cpu, "\cc", desc="sends eviction information to the processor") {
126514184Sgabeblack@google.com    if (send_evictions) {
126614184Sgabeblack@google.com      DPRINTF(RubySlicc, "Sending invalidation for %#x to the CPU\n", address);
126714184Sgabeblack@google.com      sequencer.evictionCallback(address);
126814184Sgabeblack@google.com    }
126914184Sgabeblack@google.com  }
127014184Sgabeblack@google.com
127114184Sgabeblack@google.com  action(uu_profileL1DataMiss, "\udm", desc="Profile the demand miss") {
127214184Sgabeblack@google.com      ++L1Dcache.demand_misses;
127314184Sgabeblack@google.com  }
127414184Sgabeblack@google.com
127514184Sgabeblack@google.com  action(uu_profileL1DataHit, "\udh", desc="Profile the demand hits") {
127614184Sgabeblack@google.com      ++L1Dcache.demand_hits;
127714184Sgabeblack@google.com  }
127814184Sgabeblack@google.com
127914184Sgabeblack@google.com  action(uu_profileL1InstMiss, "\uim", desc="Profile the demand miss") {
128014184Sgabeblack@google.com      ++L1Icache.demand_misses;
128114184Sgabeblack@google.com  }
128214184Sgabeblack@google.com
128314184Sgabeblack@google.com  action(uu_profileL1InstHit, "\uih", desc="Profile the demand hits") {
128414184Sgabeblack@google.com      ++L1Icache.demand_hits;
128514184Sgabeblack@google.com  }
128614184Sgabeblack@google.com
128714184Sgabeblack@google.com  action(uu_profileL2Miss, "\um", desc="Profile the demand miss") {
128814184Sgabeblack@google.com      ++L2cache.demand_misses;
128914184Sgabeblack@google.com  }
129014184Sgabeblack@google.com
129114184Sgabeblack@google.com  action(uu_profileL2Hit, "\uh", desc="Profile the demand hits ") {
129214184Sgabeblack@google.com      ++L2cache.demand_hits;
129314184Sgabeblack@google.com  }
129414184Sgabeblack@google.com
129514184Sgabeblack@google.com  action(zz_stallAndWaitMandatoryQueue, "\z", desc="Send the head of the mandatory queue to the back of the queue.") {
129614184Sgabeblack@google.com    stall_and_wait(mandatoryQueue_in, address);    
129714184Sgabeblack@google.com  }
129814184Sgabeblack@google.com
129914184Sgabeblack@google.com  action(z_stall, "z", desc="stall") {
130014184Sgabeblack@google.com    // do nothing and the special z_stall action will return a protocol stall
130114184Sgabeblack@google.com    // so that the next port is checked
130214184Sgabeblack@google.com  }
130314184Sgabeblack@google.com
130414184Sgabeblack@google.com  action(kd_wakeUpDependents, "kd", desc="wake-up dependents") {
130514184Sgabeblack@google.com    wakeUpBuffers(address);
130614184Sgabeblack@google.com  }
130714184Sgabeblack@google.com
130814184Sgabeblack@google.com  action(ka_wakeUpAllDependents, "ka", desc="wake-up all dependents") {
130914184Sgabeblack@google.com    wakeUpAllBuffers();
131014184Sgabeblack@google.com  }
131114184Sgabeblack@google.com
131214184Sgabeblack@google.com  //*****************************************************
131314184Sgabeblack@google.com  // TRANSITIONS
131414184Sgabeblack@google.com  //*****************************************************
131514184Sgabeblack@google.com
131614184Sgabeblack@google.com  // Transitions for Load/Store/L2_Replacement from transient states
131714184Sgabeblack@google.com  transition({IM, IM_F, MM_WF, SM, SM_F, ISM, ISM_F, OM, OM_F, IS, SS, OI, MI, II, ST, OT, MT, MMT}, {Store, L2_Replacement}) {
131814184Sgabeblack@google.com    zz_stallAndWaitMandatoryQueue;
131914184Sgabeblack@google.com  }
132014184Sgabeblack@google.com
132114184Sgabeblack@google.com  transition({IM, IM_F, MM_WF, SM, SM_F, ISM, ISM_F, OM, OM_F, IS, SS, OI, MI, II}, {Flush_line}) {
132214184Sgabeblack@google.com    zz_stallAndWaitMandatoryQueue;
132314184Sgabeblack@google.com  }
132414184Sgabeblack@google.com
132514184Sgabeblack@google.com  transition({M_W, MM_W}, {L2_Replacement, Flush_line}) {
132614184Sgabeblack@google.com    zz_stallAndWaitMandatoryQueue;
132714184Sgabeblack@google.com  }
132814184Sgabeblack@google.com
132914184Sgabeblack@google.com  transition({IM, IS, OI, MI, II, ST, OT, MT, MMT, MI_F, MM_F, OM_F, IM_F, ISM_F, SM_F, MM_WF}, {Load, Ifetch}) {
133014184Sgabeblack@google.com    zz_stallAndWaitMandatoryQueue;
133114184Sgabeblack@google.com  }
133214184Sgabeblack@google.com
133314184Sgabeblack@google.com  transition({IM, SM, ISM, OM, IS, SS, MM_W, M_W, OI, MI, II, ST, OT, MT, MMT, IM_F, SM_F, ISM_F, OM_F, MM_WF, MI_F, MM_F, IR, SR, OR, MR, MMR}, L1_to_L2) {
133414184Sgabeblack@google.com    zz_stallAndWaitMandatoryQueue;
133514184Sgabeblack@google.com  }
133614184Sgabeblack@google.com
133714184Sgabeblack@google.com  transition({MI_F, MM_F}, {Store}) {
133814184Sgabeblack@google.com    zz_stallAndWaitMandatoryQueue;
133914184Sgabeblack@google.com  }
134014184Sgabeblack@google.com
134114184Sgabeblack@google.com  transition({MM_F, MI_F}, {Flush_line}) {
134214184Sgabeblack@google.com    zz_stallAndWaitMandatoryQueue;
134314184Sgabeblack@google.com  }
134414184Sgabeblack@google.com
134514184Sgabeblack@google.com  transition({ST, OT, MT, MMT}, {Other_GETX, NC_DMA_GETS, Other_GETS, Merged_GETS, Other_GETS_No_Mig, Invalidate, Flush_line}) {
134614184Sgabeblack@google.com    z_stall;
134714184Sgabeblack@google.com  }
134814184Sgabeblack@google.com
134914184Sgabeblack@google.com  transition({IR, SR, OR, MR, MMR}, {Other_GETX, NC_DMA_GETS, Other_GETS, Merged_GETS, Other_GETS_No_Mig, Invalidate}) {
135014184Sgabeblack@google.com    z_stall;
135114184Sgabeblack@google.com  }
135214184Sgabeblack@google.com
135314184Sgabeblack@google.com  // Transitions moving data between the L1 and L2 caches
135414184Sgabeblack@google.com  transition({S, O, M, MM}, L1_to_L2) {
135514184Sgabeblack@google.com    i_allocateTBE;
135614184Sgabeblack@google.com    gg_deallocateL1CacheBlock;
135714184Sgabeblack@google.com    vv_allocateL2CacheBlock;
135814184Sgabeblack@google.com    hp_copyFromTBEToL2;
135914184Sgabeblack@google.com    s_deallocateTBE;
136014184Sgabeblack@google.com  }
136114184Sgabeblack@google.com
136214184Sgabeblack@google.com  transition(S, Trigger_L2_to_L1D, ST) {
136314184Sgabeblack@google.com    i_allocateTBE;
136414184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
136514184Sgabeblack@google.com    ii_allocateL1DCacheBlock;
136614184Sgabeblack@google.com    nb_copyFromTBEToL1;
136714184Sgabeblack@google.com    s_deallocateTBE;
136814184Sgabeblack@google.com    zz_stallAndWaitMandatoryQueue;
136914184Sgabeblack@google.com    ll_L2toL1Transfer;
137014184Sgabeblack@google.com  }
137114184Sgabeblack@google.com
137214184Sgabeblack@google.com  transition(O, Trigger_L2_to_L1D, OT) {
137314184Sgabeblack@google.com    i_allocateTBE;
137414184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
137514184Sgabeblack@google.com    ii_allocateL1DCacheBlock;
137614184Sgabeblack@google.com    nb_copyFromTBEToL1;
137714184Sgabeblack@google.com    s_deallocateTBE;
137814184Sgabeblack@google.com    zz_stallAndWaitMandatoryQueue;
137914184Sgabeblack@google.com    ll_L2toL1Transfer;
138014184Sgabeblack@google.com  }
138114184Sgabeblack@google.com
138214184Sgabeblack@google.com  transition(M, Trigger_L2_to_L1D, MT) {
138314184Sgabeblack@google.com    i_allocateTBE;
138414184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
138514184Sgabeblack@google.com    ii_allocateL1DCacheBlock;
138614184Sgabeblack@google.com    nb_copyFromTBEToL1;
138714184Sgabeblack@google.com    s_deallocateTBE;
138814184Sgabeblack@google.com    zz_stallAndWaitMandatoryQueue;
138914184Sgabeblack@google.com    ll_L2toL1Transfer;
139014184Sgabeblack@google.com  }
139114184Sgabeblack@google.com
139214184Sgabeblack@google.com  transition(MM, Trigger_L2_to_L1D, MMT) {
139314184Sgabeblack@google.com    i_allocateTBE;
139414184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
139514184Sgabeblack@google.com    ii_allocateL1DCacheBlock;
139614184Sgabeblack@google.com    nb_copyFromTBEToL1;
139714184Sgabeblack@google.com    s_deallocateTBE;
139814184Sgabeblack@google.com    zz_stallAndWaitMandatoryQueue;
139914184Sgabeblack@google.com    ll_L2toL1Transfer;
140014184Sgabeblack@google.com  }
140114184Sgabeblack@google.com
140214184Sgabeblack@google.com  transition(S, Trigger_L2_to_L1I, ST) {
140314184Sgabeblack@google.com    i_allocateTBE;
140414184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
140514184Sgabeblack@google.com    jj_allocateL1ICacheBlock;
140614184Sgabeblack@google.com    nb_copyFromTBEToL1;
140714184Sgabeblack@google.com    s_deallocateTBE;
140814184Sgabeblack@google.com    zz_stallAndWaitMandatoryQueue;
140914184Sgabeblack@google.com    ll_L2toL1Transfer;
141014184Sgabeblack@google.com  }
141114184Sgabeblack@google.com
141214184Sgabeblack@google.com  transition(O, Trigger_L2_to_L1I, OT) {
141314184Sgabeblack@google.com    i_allocateTBE;
141414184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
141514184Sgabeblack@google.com    jj_allocateL1ICacheBlock;
141614184Sgabeblack@google.com    nb_copyFromTBEToL1;
141714184Sgabeblack@google.com    s_deallocateTBE;
141814184Sgabeblack@google.com    zz_stallAndWaitMandatoryQueue;
141914184Sgabeblack@google.com    ll_L2toL1Transfer;
142014184Sgabeblack@google.com  }
142114184Sgabeblack@google.com
142214184Sgabeblack@google.com  transition(M, Trigger_L2_to_L1I, MT) {
142314184Sgabeblack@google.com    i_allocateTBE;
142414184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
142514184Sgabeblack@google.com    jj_allocateL1ICacheBlock;
142614184Sgabeblack@google.com    nb_copyFromTBEToL1;
142714184Sgabeblack@google.com    s_deallocateTBE;
142814184Sgabeblack@google.com    zz_stallAndWaitMandatoryQueue;
142914184Sgabeblack@google.com    ll_L2toL1Transfer;
143014184Sgabeblack@google.com  }
143114184Sgabeblack@google.com
143214184Sgabeblack@google.com  transition(MM, Trigger_L2_to_L1I, MMT) {
143314184Sgabeblack@google.com    i_allocateTBE;
143414184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
143514184Sgabeblack@google.com    jj_allocateL1ICacheBlock;
143614184Sgabeblack@google.com    nb_copyFromTBEToL1;
143714184Sgabeblack@google.com    s_deallocateTBE;
143814184Sgabeblack@google.com    zz_stallAndWaitMandatoryQueue;
143914184Sgabeblack@google.com    ll_L2toL1Transfer;
144014184Sgabeblack@google.com  }
144114184Sgabeblack@google.com
144214184Sgabeblack@google.com  transition(ST, Complete_L2_to_L1, SR) {
144314184Sgabeblack@google.com    j_popTriggerQueue;
144414184Sgabeblack@google.com    kd_wakeUpDependents;
144514184Sgabeblack@google.com  }
144614184Sgabeblack@google.com
144714184Sgabeblack@google.com  transition(OT, Complete_L2_to_L1, OR) {
144814184Sgabeblack@google.com    j_popTriggerQueue;
144914184Sgabeblack@google.com    kd_wakeUpDependents;
145014184Sgabeblack@google.com  }
145114184Sgabeblack@google.com
145214184Sgabeblack@google.com  transition(MT, Complete_L2_to_L1, MR) {
145314184Sgabeblack@google.com    j_popTriggerQueue;
145414184Sgabeblack@google.com    kd_wakeUpDependents;
145514184Sgabeblack@google.com  }
145614184Sgabeblack@google.com
145714184Sgabeblack@google.com  transition(MMT, Complete_L2_to_L1, MMR) {
145814184Sgabeblack@google.com    j_popTriggerQueue;
145914184Sgabeblack@google.com    kd_wakeUpDependents;
146014184Sgabeblack@google.com  }
146114184Sgabeblack@google.com
146214184Sgabeblack@google.com  // Transitions from Idle
146314184Sgabeblack@google.com  transition({I,IR}, Load, IS) {
146414184Sgabeblack@google.com    ii_allocateL1DCacheBlock;
146514184Sgabeblack@google.com    i_allocateTBE;
146614184Sgabeblack@google.com    a_issueGETS;
146714184Sgabeblack@google.com    uu_profileL1DataMiss;
146814184Sgabeblack@google.com    uu_profileL2Miss;
146914184Sgabeblack@google.com    k_popMandatoryQueue;
147014184Sgabeblack@google.com  }
147114184Sgabeblack@google.com
147214184Sgabeblack@google.com  transition({I,IR}, Ifetch, IS) {
147314184Sgabeblack@google.com    jj_allocateL1ICacheBlock;
147414184Sgabeblack@google.com    i_allocateTBE;
147514184Sgabeblack@google.com    a_issueGETS;
147614184Sgabeblack@google.com    uu_profileL1InstMiss;
147714184Sgabeblack@google.com    uu_profileL2Miss;
147814184Sgabeblack@google.com    k_popMandatoryQueue;
147914184Sgabeblack@google.com  }
148014184Sgabeblack@google.com
148114184Sgabeblack@google.com  transition({I,IR}, Store, IM) {
148214184Sgabeblack@google.com    ii_allocateL1DCacheBlock;
148314184Sgabeblack@google.com    i_allocateTBE;
148414184Sgabeblack@google.com    b_issueGETX;
148514184Sgabeblack@google.com    uu_profileL1DataMiss;
148614184Sgabeblack@google.com    uu_profileL2Miss;
148714184Sgabeblack@google.com    k_popMandatoryQueue;
148814184Sgabeblack@google.com  }
148914184Sgabeblack@google.com
149014184Sgabeblack@google.com  transition({I, IR}, Flush_line, IM_F) {
149114184Sgabeblack@google.com    it_allocateTBE;
149214184Sgabeblack@google.com    bf_issueGETF;
149314184Sgabeblack@google.com    k_popMandatoryQueue;
149414184Sgabeblack@google.com  }
149514184Sgabeblack@google.com
149614184Sgabeblack@google.com  transition(I, {Other_GETX, NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig, Invalidate}) {
149714184Sgabeblack@google.com    f_sendAck;
149814184Sgabeblack@google.com    l_popForwardQueue;
149914184Sgabeblack@google.com  }
150014184Sgabeblack@google.com
150114184Sgabeblack@google.com  // Transitions from Shared
150214184Sgabeblack@google.com  transition({S, SM, ISM}, Load) {
150314184Sgabeblack@google.com    h_load_hit;
150414184Sgabeblack@google.com    uu_profileL1DataHit;
150514184Sgabeblack@google.com    k_popMandatoryQueue;
150614184Sgabeblack@google.com  }
150714184Sgabeblack@google.com
150814184Sgabeblack@google.com  transition({S, SM, ISM}, Ifetch) {
150914184Sgabeblack@google.com    h_ifetch_hit;
151014184Sgabeblack@google.com    uu_profileL1InstHit;
151114184Sgabeblack@google.com    k_popMandatoryQueue;
151214184Sgabeblack@google.com  }
151314184Sgabeblack@google.com
151414184Sgabeblack@google.com  transition(SR, Load, S) {
151514184Sgabeblack@google.com    h_load_hit;
151614184Sgabeblack@google.com    uu_profileL1DataMiss;
151714184Sgabeblack@google.com    uu_profileL2Hit;
151814184Sgabeblack@google.com    k_popMandatoryQueue;
151914184Sgabeblack@google.com    ka_wakeUpAllDependents;
152014184Sgabeblack@google.com  }
152114184Sgabeblack@google.com
152214184Sgabeblack@google.com  transition(SR, Ifetch, S) {
152314184Sgabeblack@google.com    h_ifetch_hit;
152414184Sgabeblack@google.com    uu_profileL1InstMiss;
152514184Sgabeblack@google.com    uu_profileL2Hit;
152614184Sgabeblack@google.com    k_popMandatoryQueue;
152714184Sgabeblack@google.com    ka_wakeUpAllDependents;
152814184Sgabeblack@google.com  }
152914184Sgabeblack@google.com
153014184Sgabeblack@google.com  transition({S,SR}, Store, SM) {
153114184Sgabeblack@google.com    i_allocateTBE;
153214184Sgabeblack@google.com    b_issueGETX;
153314184Sgabeblack@google.com    uu_profileL1DataMiss;
153414184Sgabeblack@google.com    uu_profileL2Miss;
153514184Sgabeblack@google.com    k_popMandatoryQueue;
153614184Sgabeblack@google.com  }
153714184Sgabeblack@google.com
153814184Sgabeblack@google.com  transition({S, SR}, Flush_line, SM_F) {
153914184Sgabeblack@google.com    i_allocateTBE;
154014184Sgabeblack@google.com    bf_issueGETF;
154114184Sgabeblack@google.com    forward_eviction_to_cpu;
154214184Sgabeblack@google.com    gg_deallocateL1CacheBlock;
154314184Sgabeblack@google.com    k_popMandatoryQueue;
154414184Sgabeblack@google.com  }
154514184Sgabeblack@google.com
154614184Sgabeblack@google.com  transition(S, L2_Replacement, I) {
154714184Sgabeblack@google.com    forward_eviction_to_cpu;
154814184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
154914184Sgabeblack@google.com    ka_wakeUpAllDependents;
155014184Sgabeblack@google.com  }
155114184Sgabeblack@google.com
155214184Sgabeblack@google.com  transition(S, {Other_GETX, Invalidate}, I) {
155314184Sgabeblack@google.com    f_sendAck;
155414184Sgabeblack@google.com    forward_eviction_to_cpu;
155514184Sgabeblack@google.com    gr_deallocateCacheBlock;
155614184Sgabeblack@google.com    l_popForwardQueue;
155714184Sgabeblack@google.com  }
155814184Sgabeblack@google.com
155914184Sgabeblack@google.com  transition(S, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}) {
156014184Sgabeblack@google.com    ff_sendAckShared;
156114184Sgabeblack@google.com    l_popForwardQueue;
156214184Sgabeblack@google.com  }
156314184Sgabeblack@google.com
156414184Sgabeblack@google.com  // Transitions from Owned
156514184Sgabeblack@google.com  transition({O, OM, SS, MM_W, M_W}, {Load}) {
156614184Sgabeblack@google.com    h_load_hit;
156714184Sgabeblack@google.com    uu_profileL1DataHit;
156814184Sgabeblack@google.com    k_popMandatoryQueue;
156914184Sgabeblack@google.com  }
157014184Sgabeblack@google.com
157114184Sgabeblack@google.com  transition({O, OM, SS, MM_W, M_W}, {Ifetch}) {
157214184Sgabeblack@google.com    h_ifetch_hit;
157314184Sgabeblack@google.com    uu_profileL1InstHit;
157414184Sgabeblack@google.com    k_popMandatoryQueue;
157514184Sgabeblack@google.com  }
157614184Sgabeblack@google.com
157714184Sgabeblack@google.com  transition(OR, Load, O) {
157814184Sgabeblack@google.com    h_load_hit;
157914184Sgabeblack@google.com    uu_profileL1DataMiss;
158014184Sgabeblack@google.com    uu_profileL2Hit;
158114184Sgabeblack@google.com    k_popMandatoryQueue;
158214184Sgabeblack@google.com    ka_wakeUpAllDependents;
158314184Sgabeblack@google.com  }
158414184Sgabeblack@google.com
158514184Sgabeblack@google.com  transition(OR, Ifetch, O) {
158614184Sgabeblack@google.com    h_ifetch_hit;
158714184Sgabeblack@google.com    uu_profileL1InstMiss;
158814184Sgabeblack@google.com    uu_profileL2Hit;
158914184Sgabeblack@google.com    k_popMandatoryQueue;
159014184Sgabeblack@google.com    ka_wakeUpAllDependents;
159114184Sgabeblack@google.com  }
159214184Sgabeblack@google.com
159314184Sgabeblack@google.com  transition({O,OR}, Store, OM) {
159414184Sgabeblack@google.com    i_allocateTBE;
159514184Sgabeblack@google.com    b_issueGETX;
159614184Sgabeblack@google.com    p_decrementNumberOfMessagesByOne;
159714184Sgabeblack@google.com    uu_profileL1DataMiss;
159814184Sgabeblack@google.com    uu_profileL2Miss;
159914184Sgabeblack@google.com    k_popMandatoryQueue;
160014184Sgabeblack@google.com  }
160114184Sgabeblack@google.com
160214184Sgabeblack@google.com  transition({O, OR}, Flush_line, OM_F) {
160314184Sgabeblack@google.com    i_allocateTBE;
160414184Sgabeblack@google.com    bf_issueGETF;
160514184Sgabeblack@google.com    p_decrementNumberOfMessagesByOne;
160614184Sgabeblack@google.com    forward_eviction_to_cpu;
160714184Sgabeblack@google.com    gg_deallocateL1CacheBlock;
160814184Sgabeblack@google.com    k_popMandatoryQueue;
160914184Sgabeblack@google.com  }
161014184Sgabeblack@google.com
161114184Sgabeblack@google.com  transition(O, L2_Replacement, OI) {
161214184Sgabeblack@google.com    i_allocateTBE;
161314184Sgabeblack@google.com    d_issuePUT;
161414184Sgabeblack@google.com    forward_eviction_to_cpu;
161514184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
161614184Sgabeblack@google.com    ka_wakeUpAllDependents;
161714184Sgabeblack@google.com  }
161814184Sgabeblack@google.com
161914184Sgabeblack@google.com  transition(O, {Other_GETX, Invalidate}, I) {
162014184Sgabeblack@google.com    e_sendData;
162114184Sgabeblack@google.com    forward_eviction_to_cpu;
162214184Sgabeblack@google.com    gr_deallocateCacheBlock;
162314184Sgabeblack@google.com    l_popForwardQueue;
162414184Sgabeblack@google.com  }
162514184Sgabeblack@google.com
162614184Sgabeblack@google.com  transition(O, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}) {
162714184Sgabeblack@google.com    ee_sendDataShared;
162814184Sgabeblack@google.com    l_popForwardQueue;
162914184Sgabeblack@google.com  }
163014184Sgabeblack@google.com
163114184Sgabeblack@google.com  transition(O, Merged_GETS) {
163214184Sgabeblack@google.com    em_sendDataSharedMultiple;
163314184Sgabeblack@google.com    l_popForwardQueue;
163414184Sgabeblack@google.com  }
163514184Sgabeblack@google.com
163614184Sgabeblack@google.com  // Transitions from Modified
163714184Sgabeblack@google.com  transition({MM, M}, {Ifetch}) {
163814184Sgabeblack@google.com    h_ifetch_hit;
163914184Sgabeblack@google.com    uu_profileL1InstHit;
164014184Sgabeblack@google.com    k_popMandatoryQueue;
164114184Sgabeblack@google.com  }
164214184Sgabeblack@google.com
164314184Sgabeblack@google.com  transition({MM, M}, {Load}) {
164414184Sgabeblack@google.com    h_load_hit;
164514184Sgabeblack@google.com    uu_profileL1DataHit;
164614184Sgabeblack@google.com    k_popMandatoryQueue;
164714184Sgabeblack@google.com  }
164814184Sgabeblack@google.com
164914184Sgabeblack@google.com  transition(MM, Store) {
165014184Sgabeblack@google.com    hh_store_hit;
165114184Sgabeblack@google.com    uu_profileL1DataHit;
165214184Sgabeblack@google.com    k_popMandatoryQueue;
165314184Sgabeblack@google.com  }
165414184Sgabeblack@google.com
165514184Sgabeblack@google.com  transition(MMR, Load, MM) {
165614184Sgabeblack@google.com    h_load_hit;
165714184Sgabeblack@google.com    uu_profileL1DataMiss;
165814184Sgabeblack@google.com    uu_profileL2Hit;
165914184Sgabeblack@google.com    k_popMandatoryQueue;
166014184Sgabeblack@google.com    ka_wakeUpAllDependents;
166114184Sgabeblack@google.com  }
166214184Sgabeblack@google.com
166314184Sgabeblack@google.com  transition(MMR, Ifetch, MM) {
166414184Sgabeblack@google.com    h_ifetch_hit;
166514184Sgabeblack@google.com    uu_profileL1InstMiss;
166614184Sgabeblack@google.com    uu_profileL2Hit;
166714184Sgabeblack@google.com    k_popMandatoryQueue;
166814184Sgabeblack@google.com    ka_wakeUpAllDependents;
166914184Sgabeblack@google.com  }
167014184Sgabeblack@google.com
167114184Sgabeblack@google.com  transition(MMR, Store, MM) {
167214184Sgabeblack@google.com    hh_store_hit;
167314184Sgabeblack@google.com    uu_profileL1DataMiss;
167414184Sgabeblack@google.com    uu_profileL2Hit;
167514184Sgabeblack@google.com    k_popMandatoryQueue;
167614184Sgabeblack@google.com    ka_wakeUpAllDependents;
167714184Sgabeblack@google.com  }
167814184Sgabeblack@google.com
167914184Sgabeblack@google.com  transition({MM, M, MMR, MR}, Flush_line, MM_F) {
168014184Sgabeblack@google.com    i_allocateTBE;
168114184Sgabeblack@google.com    bf_issueGETF;
168214184Sgabeblack@google.com    p_decrementNumberOfMessagesByOne;
168314184Sgabeblack@google.com    forward_eviction_to_cpu;
168414184Sgabeblack@google.com    gg_deallocateL1CacheBlock;
168514184Sgabeblack@google.com    k_popMandatoryQueue;
168614184Sgabeblack@google.com  }
168714184Sgabeblack@google.com
168814184Sgabeblack@google.com  transition(MM_F, Block_Ack, MI_F) {
168914184Sgabeblack@google.com    df_issuePUTF;
169014184Sgabeblack@google.com    l_popForwardQueue;
169114184Sgabeblack@google.com    kd_wakeUpDependents;
169214184Sgabeblack@google.com  }
169314184Sgabeblack@google.com
169414184Sgabeblack@google.com  transition(MM, L2_Replacement, MI) {
169514184Sgabeblack@google.com    i_allocateTBE;
169614184Sgabeblack@google.com    d_issuePUT;
169714184Sgabeblack@google.com    forward_eviction_to_cpu;
169814184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
169914184Sgabeblack@google.com    ka_wakeUpAllDependents;
170014184Sgabeblack@google.com  }
170114184Sgabeblack@google.com
170214184Sgabeblack@google.com  transition(MM, {Other_GETX, Invalidate}, I) {
170314184Sgabeblack@google.com    c_sendExclusiveData;
170414184Sgabeblack@google.com    forward_eviction_to_cpu;
170514184Sgabeblack@google.com    gr_deallocateCacheBlock;
170614184Sgabeblack@google.com    l_popForwardQueue;
170714184Sgabeblack@google.com  }
170814184Sgabeblack@google.com
170914184Sgabeblack@google.com  transition(MM, Other_GETS, I) {
171014184Sgabeblack@google.com    c_sendExclusiveData;
171114184Sgabeblack@google.com    forward_eviction_to_cpu;
171214184Sgabeblack@google.com    gr_deallocateCacheBlock;
171314184Sgabeblack@google.com    l_popForwardQueue;
171414184Sgabeblack@google.com  }
171514184Sgabeblack@google.com
171614184Sgabeblack@google.com  transition(MM, NC_DMA_GETS, O) {
171714184Sgabeblack@google.com    ee_sendDataShared;
171814184Sgabeblack@google.com    l_popForwardQueue;
171914184Sgabeblack@google.com  }
172014184Sgabeblack@google.com
172114184Sgabeblack@google.com  transition(MM, Other_GETS_No_Mig, O) {
172214184Sgabeblack@google.com    ee_sendDataShared;
172314184Sgabeblack@google.com    l_popForwardQueue;
172414184Sgabeblack@google.com  }
172514184Sgabeblack@google.com
172614184Sgabeblack@google.com  transition(MM, Merged_GETS, O) {
172714184Sgabeblack@google.com    em_sendDataSharedMultiple;
172814184Sgabeblack@google.com    l_popForwardQueue;
172914184Sgabeblack@google.com  }
173014184Sgabeblack@google.com
173114184Sgabeblack@google.com  // Transitions from Dirty Exclusive
173214184Sgabeblack@google.com  transition(M, Store, MM) {
173314184Sgabeblack@google.com    hh_store_hit;
173414184Sgabeblack@google.com    uu_profileL1DataHit;
173514184Sgabeblack@google.com    k_popMandatoryQueue;
173614184Sgabeblack@google.com  }
173714184Sgabeblack@google.com
173814184Sgabeblack@google.com  transition(MR, Load, M) {
173914184Sgabeblack@google.com    h_load_hit;
174014184Sgabeblack@google.com    uu_profileL1DataMiss;
174114184Sgabeblack@google.com    uu_profileL2Hit;
174214184Sgabeblack@google.com    k_popMandatoryQueue;
174314184Sgabeblack@google.com    ka_wakeUpAllDependents;
174414184Sgabeblack@google.com  }
174514184Sgabeblack@google.com
174614184Sgabeblack@google.com  transition(MR, Ifetch, M) {
174714184Sgabeblack@google.com    h_ifetch_hit;
174814184Sgabeblack@google.com    uu_profileL1InstMiss;
174914184Sgabeblack@google.com    uu_profileL2Hit;
175014184Sgabeblack@google.com    k_popMandatoryQueue;
175114184Sgabeblack@google.com    ka_wakeUpAllDependents;
175214184Sgabeblack@google.com  }
175314184Sgabeblack@google.com
175414184Sgabeblack@google.com  transition(MR, Store, MM) {
175514184Sgabeblack@google.com    hh_store_hit;
175614184Sgabeblack@google.com    uu_profileL1DataMiss;
175714184Sgabeblack@google.com    uu_profileL2Hit;
175814184Sgabeblack@google.com    k_popMandatoryQueue;
175914184Sgabeblack@google.com    ka_wakeUpAllDependents;
176014184Sgabeblack@google.com  }
176114184Sgabeblack@google.com
176214184Sgabeblack@google.com  transition(M, L2_Replacement, MI) {
176314184Sgabeblack@google.com    i_allocateTBE;
176414184Sgabeblack@google.com    d_issuePUT;
176514184Sgabeblack@google.com    forward_eviction_to_cpu;
176614184Sgabeblack@google.com    rr_deallocateL2CacheBlock;
176714184Sgabeblack@google.com    ka_wakeUpAllDependents;
176814184Sgabeblack@google.com  }
176914184Sgabeblack@google.com
177014184Sgabeblack@google.com  transition(M, {Other_GETX, Invalidate}, I) {
177114184Sgabeblack@google.com    c_sendExclusiveData;
177214184Sgabeblack@google.com    forward_eviction_to_cpu;
177314184Sgabeblack@google.com    gr_deallocateCacheBlock;
177414184Sgabeblack@google.com    l_popForwardQueue;
177514184Sgabeblack@google.com  }
177614184Sgabeblack@google.com
177714184Sgabeblack@google.com  transition(M, {Other_GETS, Other_GETS_No_Mig}, O) {
177814184Sgabeblack@google.com    ee_sendDataShared;
177914184Sgabeblack@google.com    l_popForwardQueue;
178014184Sgabeblack@google.com  }
178114184Sgabeblack@google.com
178214184Sgabeblack@google.com  transition(M, NC_DMA_GETS, O) {
178314184Sgabeblack@google.com    ee_sendDataShared;
178414184Sgabeblack@google.com    l_popForwardQueue;
178514184Sgabeblack@google.com  }
178614184Sgabeblack@google.com
178714184Sgabeblack@google.com  transition(M, Merged_GETS, O) {
178814184Sgabeblack@google.com    em_sendDataSharedMultiple;
178914184Sgabeblack@google.com    l_popForwardQueue;
179014184Sgabeblack@google.com  }
179114184Sgabeblack@google.com
179214184Sgabeblack@google.com  // Transitions from IM
179314184Sgabeblack@google.com
179414184Sgabeblack@google.com  transition({IM, IM_F}, {Other_GETX, NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig, Invalidate}) {
179514184Sgabeblack@google.com    f_sendAck;
179614184Sgabeblack@google.com    l_popForwardQueue;
179714184Sgabeblack@google.com  }
179814184Sgabeblack@google.com
179914184Sgabeblack@google.com  transition({IM, IM_F, MM_F}, Ack) {
180014184Sgabeblack@google.com    m_decrementNumberOfMessages;
180114184Sgabeblack@google.com    o_checkForCompletion;
180214184Sgabeblack@google.com    n_popResponseQueue;
180314184Sgabeblack@google.com  }
180414184Sgabeblack@google.com
180514184Sgabeblack@google.com  transition(IM, Data, ISM) {
180614184Sgabeblack@google.com    u_writeDataToCache;
180714184Sgabeblack@google.com    m_decrementNumberOfMessages;
180814184Sgabeblack@google.com    o_checkForCompletion;
180914184Sgabeblack@google.com    n_popResponseQueue;
181014184Sgabeblack@google.com  }
181114184Sgabeblack@google.com
181214184Sgabeblack@google.com  transition(IM_F, Data, ISM_F) {
181314184Sgabeblack@google.com      uf_writeDataToCacheTBE;
181414184Sgabeblack@google.com      m_decrementNumberOfMessages;
181514184Sgabeblack@google.com      o_checkForCompletion;
181614184Sgabeblack@google.com      n_popResponseQueue;
181714184Sgabeblack@google.com  }
181814184Sgabeblack@google.com
181914184Sgabeblack@google.com  transition(IM, Exclusive_Data, MM_W) {
182014184Sgabeblack@google.com    u_writeDataToCache;
182114184Sgabeblack@google.com    m_decrementNumberOfMessages;
182214184Sgabeblack@google.com    o_checkForCompletion;
182314184Sgabeblack@google.com    sx_external_store_hit;
182414184Sgabeblack@google.com    n_popResponseQueue;
182514184Sgabeblack@google.com    kd_wakeUpDependents;
182614184Sgabeblack@google.com  }
182714184Sgabeblack@google.com
182814184Sgabeblack@google.com  transition(IM_F, Exclusive_Data, MM_WF) {
182914184Sgabeblack@google.com      uf_writeDataToCacheTBE;
183014184Sgabeblack@google.com      m_decrementNumberOfMessages;
183114184Sgabeblack@google.com      o_checkForCompletion;
183214184Sgabeblack@google.com      n_popResponseQueue;
183314184Sgabeblack@google.com  }
183414184Sgabeblack@google.com
183514184Sgabeblack@google.com  // Transitions from SM
183614184Sgabeblack@google.com  transition({SM, SM_F}, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}) {
183714184Sgabeblack@google.com    ff_sendAckShared;
183814184Sgabeblack@google.com    l_popForwardQueue;
183914184Sgabeblack@google.com  }
184014184Sgabeblack@google.com
184114184Sgabeblack@google.com  transition(SM, {Other_GETX, Invalidate}, IM) {
184214184Sgabeblack@google.com    f_sendAck;
184314184Sgabeblack@google.com    forward_eviction_to_cpu;
184414184Sgabeblack@google.com    l_popForwardQueue;
184514184Sgabeblack@google.com  }
184614184Sgabeblack@google.com
184714184Sgabeblack@google.com  transition(SM_F, {Other_GETX, Invalidate}, IM_F) {
184814184Sgabeblack@google.com    f_sendAck;
184914184Sgabeblack@google.com    forward_eviction_to_cpu;
185014184Sgabeblack@google.com    l_popForwardQueue;
185114184Sgabeblack@google.com  }
185214184Sgabeblack@google.com
185314184Sgabeblack@google.com  transition({SM, SM_F}, Ack) {
185414184Sgabeblack@google.com    m_decrementNumberOfMessages;
185514184Sgabeblack@google.com    o_checkForCompletion;
185614184Sgabeblack@google.com    n_popResponseQueue;
185714184Sgabeblack@google.com  }
185814184Sgabeblack@google.com
185914184Sgabeblack@google.com  transition(SM, {Data, Exclusive_Data}, ISM) {
186014184Sgabeblack@google.com    v_writeDataToCacheVerify;
186114184Sgabeblack@google.com    m_decrementNumberOfMessages;
186214184Sgabeblack@google.com    o_checkForCompletion;
186314184Sgabeblack@google.com    n_popResponseQueue;
186414184Sgabeblack@google.com  }
186514184Sgabeblack@google.com
186614184Sgabeblack@google.com  transition(SM_F, {Data, Exclusive_Data}, ISM_F) {
186714184Sgabeblack@google.com    vt_writeDataToTBEVerify;
186814184Sgabeblack@google.com    m_decrementNumberOfMessages;
186914184Sgabeblack@google.com    o_checkForCompletion;
187014184Sgabeblack@google.com    n_popResponseQueue;
187114184Sgabeblack@google.com  }
187214184Sgabeblack@google.com
187314184Sgabeblack@google.com  // Transitions from ISM
187414184Sgabeblack@google.com  transition({ISM, ISM_F}, Ack) {
187514184Sgabeblack@google.com    m_decrementNumberOfMessages;
187614184Sgabeblack@google.com    o_checkForCompletion;
187714184Sgabeblack@google.com    n_popResponseQueue;
187814184Sgabeblack@google.com  }
187914184Sgabeblack@google.com
188014184Sgabeblack@google.com  transition(ISM, All_acks_no_sharers, MM) {
188114184Sgabeblack@google.com    sxt_trig_ext_store_hit;
188214184Sgabeblack@google.com    gm_sendUnblockM;
188314184Sgabeblack@google.com    s_deallocateTBE;
188414184Sgabeblack@google.com    j_popTriggerQueue;
188514184Sgabeblack@google.com    kd_wakeUpDependents;
188614184Sgabeblack@google.com  }
188714184Sgabeblack@google.com
188814184Sgabeblack@google.com  transition(ISM_F, All_acks_no_sharers, MI_F) {
188914184Sgabeblack@google.com    df_issuePUTF;
189014184Sgabeblack@google.com    j_popTriggerQueue;
189114184Sgabeblack@google.com    kd_wakeUpDependents;
189214184Sgabeblack@google.com  }
189314184Sgabeblack@google.com
189414184Sgabeblack@google.com  // Transitions from OM
189514184Sgabeblack@google.com
189614184Sgabeblack@google.com  transition(OM, {Other_GETX, Invalidate}, IM) {
189714184Sgabeblack@google.com    e_sendData;
189814184Sgabeblack@google.com    pp_incrementNumberOfMessagesByOne;
189914184Sgabeblack@google.com    forward_eviction_to_cpu;
190014184Sgabeblack@google.com    l_popForwardQueue;
190114184Sgabeblack@google.com  }
190214184Sgabeblack@google.com
190314184Sgabeblack@google.com  transition(OM_F, {Other_GETX, Invalidate}, IM_F) {
190414184Sgabeblack@google.com    q_sendDataFromTBEToCache;
190514184Sgabeblack@google.com    pp_incrementNumberOfMessagesByOne;
190614184Sgabeblack@google.com    forward_eviction_to_cpu;
190714184Sgabeblack@google.com    l_popForwardQueue;
190814184Sgabeblack@google.com  }
190914184Sgabeblack@google.com
191014184Sgabeblack@google.com  transition(OM, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}) {
191114184Sgabeblack@google.com    ee_sendDataShared;
191214184Sgabeblack@google.com    l_popForwardQueue;
191314184Sgabeblack@google.com  }
191414184Sgabeblack@google.com
191514184Sgabeblack@google.com  transition(OM, Merged_GETS) {
191614184Sgabeblack@google.com    em_sendDataSharedMultiple;
191714184Sgabeblack@google.com    l_popForwardQueue;
191814184Sgabeblack@google.com  }
191914184Sgabeblack@google.com
192014184Sgabeblack@google.com  transition(OM_F, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}) {
192114184Sgabeblack@google.com    et_sendDataSharedFromTBE;
192214184Sgabeblack@google.com    l_popForwardQueue;
192314184Sgabeblack@google.com  }
192414184Sgabeblack@google.com
192514184Sgabeblack@google.com  transition(OM_F, Merged_GETS) {
192614184Sgabeblack@google.com    emt_sendDataSharedMultipleFromTBE;
192714184Sgabeblack@google.com    l_popForwardQueue;
192814184Sgabeblack@google.com  }
192914184Sgabeblack@google.com
193014184Sgabeblack@google.com  transition({OM, OM_F}, Ack) {
193114184Sgabeblack@google.com    m_decrementNumberOfMessages;
193214184Sgabeblack@google.com    o_checkForCompletion;
193314184Sgabeblack@google.com    n_popResponseQueue;
193414184Sgabeblack@google.com  }
193514184Sgabeblack@google.com
193614184Sgabeblack@google.com  transition(OM, {All_acks, All_acks_no_sharers}, MM) {
193714184Sgabeblack@google.com    sxt_trig_ext_store_hit;
193814184Sgabeblack@google.com    gm_sendUnblockM;
193914184Sgabeblack@google.com    s_deallocateTBE;
194014184Sgabeblack@google.com    j_popTriggerQueue;
194114184Sgabeblack@google.com    kd_wakeUpDependents;
194214184Sgabeblack@google.com  }
194314184Sgabeblack@google.com
194414184Sgabeblack@google.com  transition({MM_F, OM_F}, {All_acks, All_acks_no_sharers}, MI_F) {
194514184Sgabeblack@google.com    df_issuePUTF;
194614184Sgabeblack@google.com    j_popTriggerQueue;
194714184Sgabeblack@google.com    kd_wakeUpDependents;
194814184Sgabeblack@google.com  }
194914184Sgabeblack@google.com  // Transitions from IS
195014184Sgabeblack@google.com
195114184Sgabeblack@google.com  transition(IS, {Other_GETX, NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig, Invalidate}) {
195214184Sgabeblack@google.com    f_sendAck;
195314184Sgabeblack@google.com    l_popForwardQueue;
195414184Sgabeblack@google.com  }
195514184Sgabeblack@google.com
195614184Sgabeblack@google.com  transition(IS, Ack) {
195714184Sgabeblack@google.com    m_decrementNumberOfMessages;
195814184Sgabeblack@google.com    o_checkForCompletion;
195914184Sgabeblack@google.com    n_popResponseQueue;
196014184Sgabeblack@google.com  }
196114184Sgabeblack@google.com
196214184Sgabeblack@google.com  transition(IS, Shared_Ack) {
196314184Sgabeblack@google.com    m_decrementNumberOfMessages;
196414184Sgabeblack@google.com    r_setSharerBit;
196514184Sgabeblack@google.com    o_checkForCompletion;
196614184Sgabeblack@google.com    n_popResponseQueue;
196714184Sgabeblack@google.com  }
196814184Sgabeblack@google.com
196914184Sgabeblack@google.com  transition(IS, Data, SS) {
197014184Sgabeblack@google.com    u_writeDataToCache;
197114184Sgabeblack@google.com    m_decrementNumberOfMessages;
197214184Sgabeblack@google.com    o_checkForCompletion;
197314184Sgabeblack@google.com    hx_external_load_hit;
197414184Sgabeblack@google.com    uo_updateCurrentOwner;
197514184Sgabeblack@google.com    n_popResponseQueue;
197614184Sgabeblack@google.com    kd_wakeUpDependents;
197714184Sgabeblack@google.com  }
197814184Sgabeblack@google.com
197914184Sgabeblack@google.com  transition(IS, Exclusive_Data, M_W) {
198014184Sgabeblack@google.com    u_writeDataToCache;
198114184Sgabeblack@google.com    m_decrementNumberOfMessages;
198214184Sgabeblack@google.com    o_checkForCompletion;
198314184Sgabeblack@google.com    hx_external_load_hit;
198414184Sgabeblack@google.com    n_popResponseQueue;
198514184Sgabeblack@google.com    kd_wakeUpDependents;
198614184Sgabeblack@google.com  }
198714184Sgabeblack@google.com
198814184Sgabeblack@google.com  transition(IS, Shared_Data, SS) {
198914184Sgabeblack@google.com    u_writeDataToCache;
199014184Sgabeblack@google.com    r_setSharerBit;
199114184Sgabeblack@google.com    m_decrementNumberOfMessages;
199214184Sgabeblack@google.com    o_checkForCompletion;
199314184Sgabeblack@google.com    hx_external_load_hit;
199414184Sgabeblack@google.com    uo_updateCurrentOwner;
199514184Sgabeblack@google.com    n_popResponseQueue;
199614184Sgabeblack@google.com    kd_wakeUpDependents;
199714184Sgabeblack@google.com  }
199814184Sgabeblack@google.com
199914184Sgabeblack@google.com  // Transitions from SS
200014184Sgabeblack@google.com
200114184Sgabeblack@google.com  transition(SS, Ack) {
200214184Sgabeblack@google.com    m_decrementNumberOfMessages;
200314184Sgabeblack@google.com    o_checkForCompletion;
200414184Sgabeblack@google.com    n_popResponseQueue;
200514184Sgabeblack@google.com  }
200614184Sgabeblack@google.com
200714184Sgabeblack@google.com  transition(SS, Shared_Ack) {
200814184Sgabeblack@google.com    m_decrementNumberOfMessages;
200914184Sgabeblack@google.com    r_setSharerBit;
201014184Sgabeblack@google.com    o_checkForCompletion;
201114184Sgabeblack@google.com    n_popResponseQueue;
201214184Sgabeblack@google.com  }
201314184Sgabeblack@google.com
201414184Sgabeblack@google.com  transition(SS, All_acks, S) {
201514184Sgabeblack@google.com    gs_sendUnblockS;
201614184Sgabeblack@google.com    s_deallocateTBE;
201714184Sgabeblack@google.com    j_popTriggerQueue;
201814184Sgabeblack@google.com    kd_wakeUpDependents;
201914184Sgabeblack@google.com  }
202014184Sgabeblack@google.com
202114184Sgabeblack@google.com  transition(SS, All_acks_no_sharers, S) {
202214184Sgabeblack@google.com    // Note: The directory might still be the owner, so that is why we go to S
202314184Sgabeblack@google.com    gs_sendUnblockS;
202414184Sgabeblack@google.com    s_deallocateTBE;
202514184Sgabeblack@google.com    j_popTriggerQueue;
202614184Sgabeblack@google.com    kd_wakeUpDependents;
202714184Sgabeblack@google.com  }
202814184Sgabeblack@google.com
202914184Sgabeblack@google.com  // Transitions from MM_W
203014184Sgabeblack@google.com
203114184Sgabeblack@google.com  transition(MM_W, Store) {
203214184Sgabeblack@google.com    hh_store_hit;
203314184Sgabeblack@google.com    uu_profileL1DataHit;
203414184Sgabeblack@google.com    k_popMandatoryQueue;
203514184Sgabeblack@google.com  }
203614184Sgabeblack@google.com
203714184Sgabeblack@google.com  transition({MM_W, MM_WF}, Ack) {
203814184Sgabeblack@google.com    m_decrementNumberOfMessages;
203914184Sgabeblack@google.com    o_checkForCompletion;
204014184Sgabeblack@google.com    n_popResponseQueue;
204114184Sgabeblack@google.com  }
204214184Sgabeblack@google.com
204314184Sgabeblack@google.com  transition(MM_W, All_acks_no_sharers, MM) {
204414184Sgabeblack@google.com    gm_sendUnblockM;
204514184Sgabeblack@google.com    s_deallocateTBE;
204614184Sgabeblack@google.com    j_popTriggerQueue;
204714184Sgabeblack@google.com    kd_wakeUpDependents;
204814184Sgabeblack@google.com  }
204914184Sgabeblack@google.com
205014184Sgabeblack@google.com  transition(MM_WF, All_acks_no_sharers, MI_F) {
205114184Sgabeblack@google.com    df_issuePUTF;
205214184Sgabeblack@google.com    j_popTriggerQueue;
205314184Sgabeblack@google.com    kd_wakeUpDependents;
205414184Sgabeblack@google.com  }
205514184Sgabeblack@google.com  // Transitions from M_W
205614184Sgabeblack@google.com
205714184Sgabeblack@google.com  transition(M_W, Store, MM_W) {
205814184Sgabeblack@google.com    hh_store_hit;
205914184Sgabeblack@google.com    uu_profileL1DataHit;
206014184Sgabeblack@google.com    k_popMandatoryQueue;
206114184Sgabeblack@google.com  }
206214184Sgabeblack@google.com
206314184Sgabeblack@google.com  transition(M_W, Ack) {
206414184Sgabeblack@google.com    m_decrementNumberOfMessages;
206514184Sgabeblack@google.com    o_checkForCompletion;
206614184Sgabeblack@google.com    n_popResponseQueue;
206714184Sgabeblack@google.com  }
206814184Sgabeblack@google.com
206914184Sgabeblack@google.com  transition(M_W, All_acks_no_sharers, M) {
207014184Sgabeblack@google.com    gm_sendUnblockM;
207114184Sgabeblack@google.com    s_deallocateTBE;
207214184Sgabeblack@google.com    j_popTriggerQueue;
207314184Sgabeblack@google.com    kd_wakeUpDependents;
207414184Sgabeblack@google.com  }
207514184Sgabeblack@google.com
207614184Sgabeblack@google.com  // Transitions from OI/MI
207714184Sgabeblack@google.com
207814184Sgabeblack@google.com  transition({OI, MI}, {Other_GETX, Invalidate}, II) {
207914184Sgabeblack@google.com    q_sendDataFromTBEToCache;
208014184Sgabeblack@google.com    l_popForwardQueue;
208114184Sgabeblack@google.com  }
208214184Sgabeblack@google.com
208314184Sgabeblack@google.com  transition({OI, MI}, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}, OI) {
208414184Sgabeblack@google.com    sq_sendSharedDataFromTBEToCache;
208514184Sgabeblack@google.com    l_popForwardQueue;
208614184Sgabeblack@google.com  }
208714184Sgabeblack@google.com
208814184Sgabeblack@google.com  transition({OI, MI}, Merged_GETS, OI) {
208914184Sgabeblack@google.com    qm_sendDataFromTBEToCache;
209014184Sgabeblack@google.com    l_popForwardQueue;
209114184Sgabeblack@google.com  }
209214184Sgabeblack@google.com
209314184Sgabeblack@google.com  transition(MI, Writeback_Ack, I) {
209414184Sgabeblack@google.com    t_sendExclusiveDataFromTBEToMemory;
209514184Sgabeblack@google.com    s_deallocateTBE;
209614184Sgabeblack@google.com    l_popForwardQueue;
209714184Sgabeblack@google.com    kd_wakeUpDependents;
209814184Sgabeblack@google.com  }
209914184Sgabeblack@google.com
210014184Sgabeblack@google.com  transition(MI_F, Writeback_Ack, I) {
210114184Sgabeblack@google.com      hh_flush_hit;
210214184Sgabeblack@google.com      t_sendExclusiveDataFromTBEToMemory;
210314184Sgabeblack@google.com      s_deallocateTBE;
210414184Sgabeblack@google.com      l_popForwardQueue;
210514184Sgabeblack@google.com      kd_wakeUpDependents;
210614184Sgabeblack@google.com  }
210714184Sgabeblack@google.com
210814184Sgabeblack@google.com  transition(OI, Writeback_Ack, I) {
210914184Sgabeblack@google.com    qq_sendDataFromTBEToMemory;
211014184Sgabeblack@google.com    s_deallocateTBE;
211114184Sgabeblack@google.com    l_popForwardQueue;
211214184Sgabeblack@google.com    kd_wakeUpDependents;
211314184Sgabeblack@google.com  }
211414184Sgabeblack@google.com
211514184Sgabeblack@google.com  // Transitions from II
211614184Sgabeblack@google.com  transition(II, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig, Other_GETX, Invalidate}, II) {
211714184Sgabeblack@google.com    f_sendAck;
211814184Sgabeblack@google.com    l_popForwardQueue;
211914184Sgabeblack@google.com  }
212014184Sgabeblack@google.com
212114184Sgabeblack@google.com  transition(II, Writeback_Ack, I) {
212214184Sgabeblack@google.com    g_sendUnblock;
212314184Sgabeblack@google.com    s_deallocateTBE;
212414184Sgabeblack@google.com    l_popForwardQueue;
212514184Sgabeblack@google.com    kd_wakeUpDependents;
212614184Sgabeblack@google.com  }
212714184Sgabeblack@google.com
212814184Sgabeblack@google.com  transition(II, Writeback_Nack, I) {
212914184Sgabeblack@google.com    s_deallocateTBE;
213014184Sgabeblack@google.com    l_popForwardQueue;
213114184Sgabeblack@google.com    kd_wakeUpDependents;
213214184Sgabeblack@google.com  }
213314184Sgabeblack@google.com
213414184Sgabeblack@google.com  transition(MM_F, {Other_GETX, Invalidate}, IM_F) {
213514184Sgabeblack@google.com    ct_sendExclusiveDataFromTBE;
213614184Sgabeblack@google.com    pp_incrementNumberOfMessagesByOne;
213714184Sgabeblack@google.com    l_popForwardQueue;
213814184Sgabeblack@google.com  }
213914184Sgabeblack@google.com
214014184Sgabeblack@google.com  transition(MM_F, Other_GETS, IM_F) {
214114184Sgabeblack@google.com    ct_sendExclusiveDataFromTBE;
214214184Sgabeblack@google.com    pp_incrementNumberOfMessagesByOne;
214314184Sgabeblack@google.com    l_popForwardQueue;
214414184Sgabeblack@google.com  }
214514184Sgabeblack@google.com
214614184Sgabeblack@google.com  transition(MM_F, NC_DMA_GETS, OM_F) {
214714184Sgabeblack@google.com    sq_sendSharedDataFromTBEToCache;
214814184Sgabeblack@google.com    l_popForwardQueue;
214914184Sgabeblack@google.com  }
215014184Sgabeblack@google.com
215114184Sgabeblack@google.com  transition(MM_F, Other_GETS_No_Mig, OM_F) {
215214184Sgabeblack@google.com    et_sendDataSharedFromTBE;
215314184Sgabeblack@google.com    l_popForwardQueue;
215414184Sgabeblack@google.com  }
215514184Sgabeblack@google.com
215614184Sgabeblack@google.com  transition(MM_F, Merged_GETS, OM_F) {
215714184Sgabeblack@google.com    emt_sendDataSharedMultipleFromTBE;
215814184Sgabeblack@google.com    l_popForwardQueue;
215914184Sgabeblack@google.com  }
216014184Sgabeblack@google.com}
2161