114184Sgabeblack@google.com/*
214184Sgabeblack@google.com * Copyright (c) 1999-2013 Mark D. Hill and David A. Wood
314184Sgabeblack@google.com * All rights reserved.
414184Sgabeblack@google.com *
514184Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
614184Sgabeblack@google.com * modification, are permitted provided that the following conditions are
714184Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
814184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
914184Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
1014184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
1114184Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
1214184Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
1314184Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
1414184Sgabeblack@google.com * this software without specific prior written permission.
1514184Sgabeblack@google.com *
1614184Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1714184Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1814184Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1914184Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2014184Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2114184Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2214184Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2314184Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2414184Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2514184Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2614184Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2714184Sgabeblack@google.com */
2814184Sgabeblack@google.com
2914184Sgabeblack@google.commachine(MachineType:L1Cache, "MESI Directory L1 Cache CMP")
3014184Sgabeblack@google.com : Sequencer * sequencer;
3114184Sgabeblack@google.com   CacheMemory * L1Icache;
3214184Sgabeblack@google.com   CacheMemory * L1Dcache;
3314184Sgabeblack@google.com   Prefetcher * prefetcher;
3414184Sgabeblack@google.com   int l2_select_num_bits;
3514184Sgabeblack@google.com   Cycles l1_request_latency := 2;
3614184Sgabeblack@google.com   Cycles l1_response_latency := 2;
3714184Sgabeblack@google.com   Cycles to_l2_latency := 1;
3814184Sgabeblack@google.com   bool send_evictions;
3914184Sgabeblack@google.com   bool enable_prefetch := "False";
4014184Sgabeblack@google.com
4114184Sgabeblack@google.com   // Message Queues
4214184Sgabeblack@google.com   // From this node's L1 cache TO the network
4314184Sgabeblack@google.com
4414184Sgabeblack@google.com   // a local L1 -> this L2 bank, currently ordered with directory forwarded requests
4514184Sgabeblack@google.com   MessageBuffer * requestFromL1Cache, network="To", virtual_network="0",
4614184Sgabeblack@google.com        vnet_type="request";
4714184Sgabeblack@google.com
4814184Sgabeblack@google.com   // a local L1 -> this L2 bank
4914184Sgabeblack@google.com   MessageBuffer * responseFromL1Cache, network="To", virtual_network="1",
5014184Sgabeblack@google.com        vnet_type="response";
5114184Sgabeblack@google.com
5214184Sgabeblack@google.com   MessageBuffer * unblockFromL1Cache, network="To", virtual_network="2",
5314184Sgabeblack@google.com        vnet_type="unblock";
5414184Sgabeblack@google.com
5514184Sgabeblack@google.com
5614184Sgabeblack@google.com   // To this node's L1 cache FROM the network
5714184Sgabeblack@google.com   // a L2 bank -> this L1
5814184Sgabeblack@google.com   MessageBuffer * requestToL1Cache, network="From", virtual_network="2",
5914184Sgabeblack@google.com        vnet_type="request";
6014184Sgabeblack@google.com
6114184Sgabeblack@google.com   // a L2 bank -> this L1
6214184Sgabeblack@google.com   MessageBuffer * responseToL1Cache, network="From", virtual_network="1",
6314184Sgabeblack@google.com        vnet_type="response";
6414184Sgabeblack@google.com
6514184Sgabeblack@google.com  // Request Buffer for prefetches
6614184Sgabeblack@google.com  MessageBuffer * optionalQueue;
6714184Sgabeblack@google.com
6814184Sgabeblack@google.com  // Buffer for requests generated by the processor core.
6914184Sgabeblack@google.com  MessageBuffer * mandatoryQueue;
7014184Sgabeblack@google.com{
7114184Sgabeblack@google.com  // STATES
7214184Sgabeblack@google.com  state_declaration(State, desc="Cache states", default="L1Cache_State_I") {
7314184Sgabeblack@google.com    // Base states
7414184Sgabeblack@google.com    NP, AccessPermission:Invalid, desc="Not present in either cache";
7514184Sgabeblack@google.com    I, AccessPermission:Invalid, desc="a L1 cache entry Idle";
7614184Sgabeblack@google.com    S, AccessPermission:Read_Only, desc="a L1 cache entry Shared";
7714184Sgabeblack@google.com    E, AccessPermission:Read_Only, desc="a L1 cache entry Exclusive";
7814184Sgabeblack@google.com    M, AccessPermission:Read_Write, desc="a L1 cache entry Modified", format="!b";
7914184Sgabeblack@google.com
8014184Sgabeblack@google.com    // Transient States
8114184Sgabeblack@google.com    IS, AccessPermission:Busy, desc="L1 idle, issued GETS, have not seen response yet";
8214184Sgabeblack@google.com    IM, AccessPermission:Busy, desc="L1 idle, issued GETX, have not seen response yet";
8314184Sgabeblack@google.com    SM, AccessPermission:Read_Only, desc="L1 idle, issued GETX, have not seen response yet";
8414184Sgabeblack@google.com    IS_I, AccessPermission:Busy, desc="L1 idle, issued GETS, saw Inv before data because directory doesn't block on GETS hit";
8514184Sgabeblack@google.com
8614184Sgabeblack@google.com    M_I, AccessPermission:Busy, desc="L1 replacing, waiting for ACK";
8714184Sgabeblack@google.com    SINK_WB_ACK, AccessPermission:Busy, desc="This is to sink WB_Acks from L2";
8814184Sgabeblack@google.com
8914184Sgabeblack@google.com    // Transient States in which block is being prefetched
9014184Sgabeblack@google.com    PF_IS, AccessPermission:Busy, desc="Issued GETS, have not seen response yet";
9114184Sgabeblack@google.com    PF_IM, AccessPermission:Busy, desc="Issued GETX, have not seen response yet";
9214184Sgabeblack@google.com    PF_SM, AccessPermission:Busy, desc="Issued GETX, received data, waiting for acks";
9314184Sgabeblack@google.com    PF_IS_I, AccessPermission:Busy, desc="Issued GETs, saw inv before data";
9414184Sgabeblack@google.com  }
9514184Sgabeblack@google.com
9614184Sgabeblack@google.com  // EVENTS
9714184Sgabeblack@google.com  enumeration(Event, desc="Cache events") {
9814184Sgabeblack@google.com    // L1 events
9914184Sgabeblack@google.com    Load,            desc="Load request from the home processor";
10014184Sgabeblack@google.com    Ifetch,          desc="I-fetch request from the home processor";
10114184Sgabeblack@google.com    Store,           desc="Store request from the home processor";
10214184Sgabeblack@google.com
10314184Sgabeblack@google.com    Inv,           desc="Invalidate request from L2 bank";
10414184Sgabeblack@google.com
10514184Sgabeblack@google.com    // internal generated request
10614184Sgabeblack@google.com    L1_Replacement,  desc="L1 Replacement", format="!r";
10714184Sgabeblack@google.com    PF_L1_Replacement,  desc="Prefetch L1 Replacement", format="!pr";
10814184Sgabeblack@google.com
10914184Sgabeblack@google.com    // other requests
11014184Sgabeblack@google.com    Fwd_GETX,   desc="GETX from other processor";
11114184Sgabeblack@google.com    Fwd_GETS,   desc="GETS from other processor";
11214184Sgabeblack@google.com    Fwd_GET_INSTR,   desc="GET_INSTR from other processor";
11314184Sgabeblack@google.com
11414184Sgabeblack@google.com    Data,       desc="Data for processor";
11514184Sgabeblack@google.com    Data_Exclusive,       desc="Data for processor";
11614184Sgabeblack@google.com    DataS_fromL1,       desc="data for GETS request, need to unblock directory";
11714184Sgabeblack@google.com    Data_all_Acks,       desc="Data for processor, all acks";
11814184Sgabeblack@google.com
11914184Sgabeblack@google.com    Ack,        desc="Ack for processor";
12014184Sgabeblack@google.com    Ack_all,      desc="Last ack for processor";
12114184Sgabeblack@google.com
12214184Sgabeblack@google.com    WB_Ack,        desc="Ack for replacement";
12314184Sgabeblack@google.com
12414184Sgabeblack@google.com    PF_Load,    desc="load request from prefetcher";
12514184Sgabeblack@google.com    PF_Ifetch,  desc="instruction fetch request from prefetcher";
12614184Sgabeblack@google.com    PF_Store,   desc="exclusive load request from prefetcher";
12714184Sgabeblack@google.com  }
12814184Sgabeblack@google.com
12914184Sgabeblack@google.com  // TYPES
13014184Sgabeblack@google.com
13114184Sgabeblack@google.com  // CacheEntry
13214184Sgabeblack@google.com  structure(Entry, desc="...", interface="AbstractCacheEntry" ) {
13314184Sgabeblack@google.com    State CacheState,        desc="cache state";
13414184Sgabeblack@google.com    DataBlock DataBlk,       desc="data for the block";
13514184Sgabeblack@google.com    bool Dirty, default="false",   desc="data is dirty";
13614184Sgabeblack@google.com    bool isPrefetch, desc="Set if this block was prefetched and not yet accessed";
13714184Sgabeblack@google.com  }
13814184Sgabeblack@google.com
13914184Sgabeblack@google.com  // TBE fields
14014184Sgabeblack@google.com  structure(TBE, desc="...") {
14114184Sgabeblack@google.com    Addr addr,              desc="Physical address for this TBE";
14214184Sgabeblack@google.com    State TBEState,        desc="Transient state";
14314184Sgabeblack@google.com    DataBlock DataBlk,                desc="Buffer for the data block";
14414184Sgabeblack@google.com    bool Dirty, default="false",   desc="data is dirty";
14514184Sgabeblack@google.com    bool isPrefetch,       desc="Set if this was caused by a prefetch";
14614184Sgabeblack@google.com    int pendingAcks, default="0", desc="number of pending acks";
14714184Sgabeblack@google.com  }
14814184Sgabeblack@google.com
14914184Sgabeblack@google.com  structure(TBETable, external="yes") {
15014184Sgabeblack@google.com    TBE lookup(Addr);
15114184Sgabeblack@google.com    void allocate(Addr);
15214184Sgabeblack@google.com    void deallocate(Addr);
15314184Sgabeblack@google.com    bool isPresent(Addr);
15414184Sgabeblack@google.com  }
15514184Sgabeblack@google.com
15614184Sgabeblack@google.com  TBETable TBEs, template="<L1Cache_TBE>", constructor="m_number_of_TBEs";
15714184Sgabeblack@google.com
15814184Sgabeblack@google.com  int l2_select_low_bit, default="RubySystem::getBlockSizeBits()";
15914184Sgabeblack@google.com
16014184Sgabeblack@google.com  Tick clockEdge();
16114184Sgabeblack@google.com  Cycles ticksToCycles(Tick t);
16214184Sgabeblack@google.com  void set_cache_entry(AbstractCacheEntry a);
16314184Sgabeblack@google.com  void unset_cache_entry();
16414184Sgabeblack@google.com  void set_tbe(TBE a);
16514184Sgabeblack@google.com  void unset_tbe();
16614184Sgabeblack@google.com  void wakeUpBuffers(Addr a);
16714184Sgabeblack@google.com  void profileMsgDelay(int virtualNetworkType, Cycles c);
16814184Sgabeblack@google.com
16914184Sgabeblack@google.com  // inclusive cache returns L1 entries only
17014184Sgabeblack@google.com  Entry getCacheEntry(Addr addr), return_by_pointer="yes" {
17114184Sgabeblack@google.com    Entry L1Dcache_entry := static_cast(Entry, "pointer", L1Dcache[addr]);
17214184Sgabeblack@google.com    if(is_valid(L1Dcache_entry)) {
17314184Sgabeblack@google.com      return L1Dcache_entry;
17414184Sgabeblack@google.com    }
17514184Sgabeblack@google.com
17614184Sgabeblack@google.com    Entry L1Icache_entry := static_cast(Entry, "pointer", L1Icache[addr]);
17714184Sgabeblack@google.com    return L1Icache_entry;
17814184Sgabeblack@google.com  }
17914184Sgabeblack@google.com
18014184Sgabeblack@google.com  Entry getL1DCacheEntry(Addr addr), return_by_pointer="yes" {
18114184Sgabeblack@google.com    Entry L1Dcache_entry := static_cast(Entry, "pointer", L1Dcache[addr]);
18214184Sgabeblack@google.com    return L1Dcache_entry;
18314184Sgabeblack@google.com  }
18414184Sgabeblack@google.com
18514184Sgabeblack@google.com  Entry getL1ICacheEntry(Addr addr), return_by_pointer="yes" {
18614184Sgabeblack@google.com    Entry L1Icache_entry := static_cast(Entry, "pointer", L1Icache[addr]);
18714184Sgabeblack@google.com    return L1Icache_entry;
18814184Sgabeblack@google.com  }
18914184Sgabeblack@google.com
19014184Sgabeblack@google.com  State getState(TBE tbe, Entry cache_entry, Addr addr) {
19114184Sgabeblack@google.com    assert((L1Dcache.isTagPresent(addr) && L1Icache.isTagPresent(addr)) == false);
19214184Sgabeblack@google.com
19314184Sgabeblack@google.com    if(is_valid(tbe)) {
19414184Sgabeblack@google.com      return tbe.TBEState;
19514184Sgabeblack@google.com    } else if (is_valid(cache_entry)) {
19614184Sgabeblack@google.com      return cache_entry.CacheState;
19714184Sgabeblack@google.com    }
19814184Sgabeblack@google.com    return State:NP;
19914184Sgabeblack@google.com  }
20014184Sgabeblack@google.com
20114184Sgabeblack@google.com  void setState(TBE tbe, Entry cache_entry, Addr addr, State state) {
20214184Sgabeblack@google.com    assert((L1Dcache.isTagPresent(addr) && L1Icache.isTagPresent(addr)) == false);
20314184Sgabeblack@google.com
20414184Sgabeblack@google.com    // MUST CHANGE
20514184Sgabeblack@google.com    if(is_valid(tbe)) {
20614184Sgabeblack@google.com      tbe.TBEState := state;
20714184Sgabeblack@google.com    }
20814184Sgabeblack@google.com
20914184Sgabeblack@google.com    if (is_valid(cache_entry)) {
21014184Sgabeblack@google.com      cache_entry.CacheState := state;
21114184Sgabeblack@google.com    }
21214184Sgabeblack@google.com  }
21314184Sgabeblack@google.com
21414184Sgabeblack@google.com  AccessPermission getAccessPermission(Addr addr) {
21514184Sgabeblack@google.com    TBE tbe := TBEs[addr];
21614184Sgabeblack@google.com    if(is_valid(tbe)) {
21714184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", L1Cache_State_to_permission(tbe.TBEState));
21814184Sgabeblack@google.com      return L1Cache_State_to_permission(tbe.TBEState);
21914184Sgabeblack@google.com    }
22014184Sgabeblack@google.com
22114184Sgabeblack@google.com    Entry cache_entry := getCacheEntry(addr);
22214184Sgabeblack@google.com    if(is_valid(cache_entry)) {
22314184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", L1Cache_State_to_permission(cache_entry.CacheState));
22414184Sgabeblack@google.com      return L1Cache_State_to_permission(cache_entry.CacheState);
22514184Sgabeblack@google.com    }
22614184Sgabeblack@google.com
22714184Sgabeblack@google.com    DPRINTF(RubySlicc, "%s\n", AccessPermission:NotPresent);
22814184Sgabeblack@google.com    return AccessPermission:NotPresent;
22914184Sgabeblack@google.com  }
23014184Sgabeblack@google.com
23114184Sgabeblack@google.com  void functionalRead(Addr addr, Packet *pkt) {
23214184Sgabeblack@google.com    TBE tbe := TBEs[addr];
23314184Sgabeblack@google.com    if(is_valid(tbe)) {
23414184Sgabeblack@google.com      testAndRead(addr, tbe.DataBlk, pkt);
23514184Sgabeblack@google.com    } else {
23614184Sgabeblack@google.com      testAndRead(addr, getCacheEntry(addr).DataBlk, pkt);
23714184Sgabeblack@google.com    }
23814184Sgabeblack@google.com  }
23914184Sgabeblack@google.com
24014184Sgabeblack@google.com  int functionalWrite(Addr addr, Packet *pkt) {
24114184Sgabeblack@google.com    int num_functional_writes := 0;
24214184Sgabeblack@google.com
24314184Sgabeblack@google.com    TBE tbe := TBEs[addr];
24414184Sgabeblack@google.com    if(is_valid(tbe)) {
24514184Sgabeblack@google.com      num_functional_writes := num_functional_writes +
24614184Sgabeblack@google.com        testAndWrite(addr, tbe.DataBlk, pkt);
24714184Sgabeblack@google.com      return num_functional_writes;
24814184Sgabeblack@google.com    }
24914184Sgabeblack@google.com
25014184Sgabeblack@google.com    num_functional_writes := num_functional_writes +
25114184Sgabeblack@google.com        testAndWrite(addr, getCacheEntry(addr).DataBlk, pkt);
25214184Sgabeblack@google.com    return num_functional_writes;
25314184Sgabeblack@google.com  }
25414184Sgabeblack@google.com
25514184Sgabeblack@google.com  void setAccessPermission(Entry cache_entry, Addr addr, State state) {
25614184Sgabeblack@google.com    if (is_valid(cache_entry)) {
25714184Sgabeblack@google.com      cache_entry.changePermission(L1Cache_State_to_permission(state));
25814184Sgabeblack@google.com    }
25914184Sgabeblack@google.com  }
26014184Sgabeblack@google.com
26114184Sgabeblack@google.com  Event mandatory_request_type_to_event(RubyRequestType type) {
26214184Sgabeblack@google.com    if (type == RubyRequestType:LD) {
26314184Sgabeblack@google.com      return Event:Load;
26414184Sgabeblack@google.com    } else if (type == RubyRequestType:IFETCH) {
26514184Sgabeblack@google.com      return Event:Ifetch;
26614184Sgabeblack@google.com    } else if ((type == RubyRequestType:ST) || (type == RubyRequestType:ATOMIC)) {
26714184Sgabeblack@google.com      return Event:Store;
26814184Sgabeblack@google.com    } else {
26914184Sgabeblack@google.com      error("Invalid RubyRequestType");
27014184Sgabeblack@google.com    }
27114184Sgabeblack@google.com  }
27214184Sgabeblack@google.com
27314184Sgabeblack@google.com  Event prefetch_request_type_to_event(RubyRequestType type) {
27414184Sgabeblack@google.com      if (type == RubyRequestType:LD) {
27514184Sgabeblack@google.com          return Event:PF_Load;
27614184Sgabeblack@google.com      } else if (type == RubyRequestType:IFETCH) {
27714184Sgabeblack@google.com          return Event:PF_Ifetch;
27814184Sgabeblack@google.com      } else if ((type == RubyRequestType:ST) ||
27914184Sgabeblack@google.com                 (type == RubyRequestType:ATOMIC)) {
28014184Sgabeblack@google.com          return Event:PF_Store;
28114184Sgabeblack@google.com      } else {
28214184Sgabeblack@google.com          error("Invalid RubyRequestType");
28314184Sgabeblack@google.com      }
28414184Sgabeblack@google.com  }
28514184Sgabeblack@google.com
28614184Sgabeblack@google.com  int getPendingAcks(TBE tbe) {
28714184Sgabeblack@google.com    return tbe.pendingAcks;
28814184Sgabeblack@google.com  }
28914184Sgabeblack@google.com
29014184Sgabeblack@google.com  out_port(requestL1Network_out, RequestMsg, requestFromL1Cache);
29114184Sgabeblack@google.com  out_port(responseL1Network_out, ResponseMsg, responseFromL1Cache);
29214184Sgabeblack@google.com  out_port(unblockNetwork_out, ResponseMsg, unblockFromL1Cache);
29314184Sgabeblack@google.com  out_port(optionalQueue_out, RubyRequest, optionalQueue);
29414184Sgabeblack@google.com
29514184Sgabeblack@google.com
29614184Sgabeblack@google.com  // Prefetch queue between the controller and the prefetcher
29714184Sgabeblack@google.com  // As per Spracklen et al. (HPCA 2005), the prefetch queue should be
29814184Sgabeblack@google.com  // implemented as a LIFO structure.  The structure would allow for fast
29914184Sgabeblack@google.com  // searches of all entries in the queue, not just the head msg. All
30014184Sgabeblack@google.com  // msgs in the structure can be invalidated if a demand miss matches.
30114184Sgabeblack@google.com  in_port(optionalQueue_in, RubyRequest, optionalQueue, desc="...", rank = 3) {
30214184Sgabeblack@google.com      if (optionalQueue_in.isReady(clockEdge())) {
30314184Sgabeblack@google.com          peek(optionalQueue_in, RubyRequest) {
30414184Sgabeblack@google.com              // Instruction Prefetch
30514184Sgabeblack@google.com              if (in_msg.Type == RubyRequestType:IFETCH) {
30614184Sgabeblack@google.com                  Entry L1Icache_entry := getL1ICacheEntry(in_msg.LineAddress);
30714184Sgabeblack@google.com                  if (is_valid(L1Icache_entry)) {
30814184Sgabeblack@google.com                      // The block to be prefetched is already present in the
30914184Sgabeblack@google.com                      // cache. We should drop this request.
31014184Sgabeblack@google.com                      trigger(prefetch_request_type_to_event(in_msg.Type),
31114184Sgabeblack@google.com                              in_msg.LineAddress,
31214184Sgabeblack@google.com                              L1Icache_entry, TBEs[in_msg.LineAddress]);
31314184Sgabeblack@google.com                  }
31414184Sgabeblack@google.com
31514184Sgabeblack@google.com                  // Check to see if it is in the OTHER L1
31614184Sgabeblack@google.com                  Entry L1Dcache_entry := getL1DCacheEntry(in_msg.LineAddress);
31714184Sgabeblack@google.com                  if (is_valid(L1Dcache_entry)) {
31814184Sgabeblack@google.com                      // The block is in the wrong L1 cache. We should drop
31914184Sgabeblack@google.com                      // this request.
32014184Sgabeblack@google.com                      trigger(prefetch_request_type_to_event(in_msg.Type),
32114184Sgabeblack@google.com                              in_msg.LineAddress,
32214184Sgabeblack@google.com                              L1Dcache_entry, TBEs[in_msg.LineAddress]);
32314184Sgabeblack@google.com                  }
32414184Sgabeblack@google.com
32514184Sgabeblack@google.com                  if (L1Icache.cacheAvail(in_msg.LineAddress)) {
32614184Sgabeblack@google.com                      // L1 does't have the line, but we have space for it
32714184Sgabeblack@google.com                      // in the L1 so let's see if the L2 has it
32814184Sgabeblack@google.com                      trigger(prefetch_request_type_to_event(in_msg.Type),
32914184Sgabeblack@google.com                              in_msg.LineAddress,
33014184Sgabeblack@google.com                              L1Icache_entry, TBEs[in_msg.LineAddress]);
33114184Sgabeblack@google.com                  } else {
33214184Sgabeblack@google.com                      // No room in the L1, so we need to make room in the L1
33314300Sjqu32@wisc.edu                      Addr victim := L1Icache.cacheProbe(in_msg.LineAddress);
33414184Sgabeblack@google.com                      trigger(Event:PF_L1_Replacement,
33514300Sjqu32@wisc.edu                              victim, getL1ICacheEntry(victim), TBEs[victim]);
33614184Sgabeblack@google.com                  }
33714184Sgabeblack@google.com              } else {
33814184Sgabeblack@google.com                  // Data prefetch
33914184Sgabeblack@google.com                  Entry L1Dcache_entry := getL1DCacheEntry(in_msg.LineAddress);
34014184Sgabeblack@google.com                  if (is_valid(L1Dcache_entry)) {
34114184Sgabeblack@google.com                      // The block to be prefetched is already present in the
34214184Sgabeblack@google.com                      // cache. We should drop this request.
34314184Sgabeblack@google.com                      trigger(prefetch_request_type_to_event(in_msg.Type),
34414184Sgabeblack@google.com                              in_msg.LineAddress,
34514184Sgabeblack@google.com                              L1Dcache_entry, TBEs[in_msg.LineAddress]);
34614184Sgabeblack@google.com                  }
34714184Sgabeblack@google.com
34814184Sgabeblack@google.com                  // Check to see if it is in the OTHER L1
34914184Sgabeblack@google.com                  Entry L1Icache_entry := getL1ICacheEntry(in_msg.LineAddress);
35014184Sgabeblack@google.com                  if (is_valid(L1Icache_entry)) {
35114184Sgabeblack@google.com                      // The block is in the wrong L1. Just drop the prefetch
35214184Sgabeblack@google.com                      // request.
35314184Sgabeblack@google.com                      trigger(prefetch_request_type_to_event(in_msg.Type),
35414184Sgabeblack@google.com                              in_msg.LineAddress,
35514184Sgabeblack@google.com                              L1Icache_entry, TBEs[in_msg.LineAddress]);
35614184Sgabeblack@google.com                  }
35714184Sgabeblack@google.com
35814184Sgabeblack@google.com                  if (L1Dcache.cacheAvail(in_msg.LineAddress)) {
35914184Sgabeblack@google.com                      // L1 does't have the line, but we have space for it in
36014184Sgabeblack@google.com                      // the L1 let's see if the L2 has it
36114184Sgabeblack@google.com                      trigger(prefetch_request_type_to_event(in_msg.Type),
36214184Sgabeblack@google.com                              in_msg.LineAddress,
36314184Sgabeblack@google.com                              L1Dcache_entry, TBEs[in_msg.LineAddress]);
36414184Sgabeblack@google.com                  } else {
36514184Sgabeblack@google.com                      // No room in the L1, so we need to make room in the L1
36614300Sjqu32@wisc.edu                      Addr victim := L1Dcache.cacheProbe(in_msg.LineAddress);
36714184Sgabeblack@google.com                      trigger(Event:PF_L1_Replacement,
36814300Sjqu32@wisc.edu                              victim, getL1DCacheEntry(victim), TBEs[victim]);
36914184Sgabeblack@google.com                  }
37014184Sgabeblack@google.com              }
37114184Sgabeblack@google.com          }
37214184Sgabeblack@google.com      }
37314184Sgabeblack@google.com  }
37414184Sgabeblack@google.com
37514184Sgabeblack@google.com  // Response  L1 Network - response msg to this L1 cache
37614184Sgabeblack@google.com  in_port(responseL1Network_in, ResponseMsg, responseToL1Cache, rank = 2) {
37714184Sgabeblack@google.com    if (responseL1Network_in.isReady(clockEdge())) {
37814184Sgabeblack@google.com      peek(responseL1Network_in, ResponseMsg, block_on="addr") {
37914184Sgabeblack@google.com        assert(in_msg.Destination.isElement(machineID));
38014184Sgabeblack@google.com
38114184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
38214184Sgabeblack@google.com        TBE tbe := TBEs[in_msg.addr];
38314184Sgabeblack@google.com
38414184Sgabeblack@google.com        if(in_msg.Type == CoherenceResponseType:DATA_EXCLUSIVE) {
38514184Sgabeblack@google.com          trigger(Event:Data_Exclusive, in_msg.addr, cache_entry, tbe);
38614184Sgabeblack@google.com        } else if(in_msg.Type == CoherenceResponseType:DATA) {
38714184Sgabeblack@google.com          if ((getState(tbe, cache_entry, in_msg.addr) == State:IS ||
38814184Sgabeblack@google.com               getState(tbe, cache_entry, in_msg.addr) == State:IS_I ||
38914184Sgabeblack@google.com               getState(tbe, cache_entry, in_msg.addr) == State:PF_IS ||
39014184Sgabeblack@google.com               getState(tbe, cache_entry, in_msg.addr) == State:PF_IS_I) &&
39114184Sgabeblack@google.com              machineIDToMachineType(in_msg.Sender) == MachineType:L1Cache) {
39214184Sgabeblack@google.com
39314184Sgabeblack@google.com              trigger(Event:DataS_fromL1, in_msg.addr, cache_entry, tbe);
39414184Sgabeblack@google.com
39514184Sgabeblack@google.com          } else if ( (getPendingAcks(tbe) - in_msg.AckCount) == 0 ) {
39614184Sgabeblack@google.com            trigger(Event:Data_all_Acks, in_msg.addr, cache_entry, tbe);
39714184Sgabeblack@google.com          } else {
39814184Sgabeblack@google.com            trigger(Event:Data, in_msg.addr, cache_entry, tbe);
39914184Sgabeblack@google.com          }
40014184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:ACK) {
40114184Sgabeblack@google.com          if ( (getPendingAcks(tbe) - in_msg.AckCount) == 0 ) {
40214184Sgabeblack@google.com            trigger(Event:Ack_all, in_msg.addr, cache_entry, tbe);
40314184Sgabeblack@google.com          } else {
40414184Sgabeblack@google.com            trigger(Event:Ack, in_msg.addr, cache_entry, tbe);
40514184Sgabeblack@google.com          }
40614184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:WB_ACK) {
40714184Sgabeblack@google.com          trigger(Event:WB_Ack, in_msg.addr, cache_entry, tbe);
40814184Sgabeblack@google.com        } else {
40914184Sgabeblack@google.com          error("Invalid L1 response type");
41014184Sgabeblack@google.com        }
41114184Sgabeblack@google.com      }
41214184Sgabeblack@google.com    }
41314184Sgabeblack@google.com  }
41414184Sgabeblack@google.com
41514184Sgabeblack@google.com  // Request InterChip network - request from this L1 cache to the shared L2
41614184Sgabeblack@google.com  in_port(requestL1Network_in, RequestMsg, requestToL1Cache, rank = 1) {
41714184Sgabeblack@google.com    if(requestL1Network_in.isReady(clockEdge())) {
41814184Sgabeblack@google.com      peek(requestL1Network_in, RequestMsg, block_on="addr") {
41914184Sgabeblack@google.com        assert(in_msg.Destination.isElement(machineID));
42014184Sgabeblack@google.com
42114184Sgabeblack@google.com        Entry cache_entry := getCacheEntry(in_msg.addr);
42214184Sgabeblack@google.com        TBE tbe := TBEs[in_msg.addr];
42314184Sgabeblack@google.com
42414184Sgabeblack@google.com        if (in_msg.Type == CoherenceRequestType:INV) {
42514184Sgabeblack@google.com          trigger(Event:Inv, in_msg.addr, cache_entry, tbe);
42614184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:GETX ||
42714184Sgabeblack@google.com                   in_msg.Type == CoherenceRequestType:UPGRADE) {
42814184Sgabeblack@google.com          // upgrade transforms to GETX due to race
42914184Sgabeblack@google.com          trigger(Event:Fwd_GETX, in_msg.addr, cache_entry, tbe);
43014184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:GETS) {
43114184Sgabeblack@google.com          trigger(Event:Fwd_GETS, in_msg.addr, cache_entry, tbe);
43214184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:GET_INSTR) {
43314184Sgabeblack@google.com          trigger(Event:Fwd_GET_INSTR, in_msg.addr, cache_entry, tbe);
43414184Sgabeblack@google.com        } else {
43514184Sgabeblack@google.com          error("Invalid forwarded request type");
43614184Sgabeblack@google.com        }
43714184Sgabeblack@google.com      }
43814184Sgabeblack@google.com    }
43914184Sgabeblack@google.com  }
44014184Sgabeblack@google.com
44114184Sgabeblack@google.com  // Mandatory Queue betweens Node's CPU and it's L1 caches
44214184Sgabeblack@google.com  in_port(mandatoryQueue_in, RubyRequest, mandatoryQueue, desc="...", rank = 0) {
44314184Sgabeblack@google.com    if (mandatoryQueue_in.isReady(clockEdge())) {
44414184Sgabeblack@google.com      peek(mandatoryQueue_in, RubyRequest, block_on="LineAddress") {
44514184Sgabeblack@google.com
44614184Sgabeblack@google.com        // Check for data access to blocks in I-cache and ifetchs to blocks in D-cache
44714184Sgabeblack@google.com
44814184Sgabeblack@google.com        if (in_msg.Type == RubyRequestType:IFETCH) {
44914184Sgabeblack@google.com          // ** INSTRUCTION ACCESS ***
45014184Sgabeblack@google.com
45114184Sgabeblack@google.com          Entry L1Icache_entry := getL1ICacheEntry(in_msg.LineAddress);
45214184Sgabeblack@google.com          if (is_valid(L1Icache_entry)) {
45314184Sgabeblack@google.com            // The tag matches for the L1, so the L1 asks the L2 for it.
45414184Sgabeblack@google.com            trigger(mandatory_request_type_to_event(in_msg.Type), in_msg.LineAddress,
45514184Sgabeblack@google.com                    L1Icache_entry, TBEs[in_msg.LineAddress]);
45614184Sgabeblack@google.com          } else {
45714184Sgabeblack@google.com
45814184Sgabeblack@google.com            // Check to see if it is in the OTHER L1
45914184Sgabeblack@google.com            Entry L1Dcache_entry := getL1DCacheEntry(in_msg.LineAddress);
46014184Sgabeblack@google.com            if (is_valid(L1Dcache_entry)) {
46114184Sgabeblack@google.com              // The block is in the wrong L1, put the request on the queue to the shared L2
46214184Sgabeblack@google.com              trigger(Event:L1_Replacement, in_msg.LineAddress,
46314184Sgabeblack@google.com                      L1Dcache_entry, TBEs[in_msg.LineAddress]);
46414184Sgabeblack@google.com            }
46514184Sgabeblack@google.com
46614184Sgabeblack@google.com            if (L1Icache.cacheAvail(in_msg.LineAddress)) {
46714184Sgabeblack@google.com              // L1 does't have the line, but we have space for it
46814184Sgabeblack@google.com              // in the L1 so let's see if the L2 has it.
46914184Sgabeblack@google.com              trigger(mandatory_request_type_to_event(in_msg.Type), in_msg.LineAddress,
47014184Sgabeblack@google.com                      L1Icache_entry, TBEs[in_msg.LineAddress]);
47114184Sgabeblack@google.com            } else {
47214184Sgabeblack@google.com              // No room in the L1, so we need to make room in the L1
47314184Sgabeblack@google.com
47414184Sgabeblack@google.com              // Check if the line we want to evict is not locked
47514184Sgabeblack@google.com              Addr addr := L1Icache.cacheProbe(in_msg.LineAddress);
47614184Sgabeblack@google.com              check_on_cache_probe(mandatoryQueue_in, addr);
47714184Sgabeblack@google.com
47814184Sgabeblack@google.com              trigger(Event:L1_Replacement, addr,
47914184Sgabeblack@google.com                      getL1ICacheEntry(addr),
48014184Sgabeblack@google.com                      TBEs[addr]);
48114184Sgabeblack@google.com            }
48214184Sgabeblack@google.com          }
48314184Sgabeblack@google.com        } else {
48414184Sgabeblack@google.com
48514184Sgabeblack@google.com          // *** DATA ACCESS ***
48614184Sgabeblack@google.com          Entry L1Dcache_entry := getL1DCacheEntry(in_msg.LineAddress);
48714184Sgabeblack@google.com          if (is_valid(L1Dcache_entry)) {
48814184Sgabeblack@google.com            // The tag matches for the L1, so the L1 ask the L2 for it
48914184Sgabeblack@google.com            trigger(mandatory_request_type_to_event(in_msg.Type), in_msg.LineAddress,
49014184Sgabeblack@google.com                    L1Dcache_entry, TBEs[in_msg.LineAddress]);
49114184Sgabeblack@google.com          } else {
49214184Sgabeblack@google.com
49314184Sgabeblack@google.com            // Check to see if it is in the OTHER L1
49414184Sgabeblack@google.com            Entry L1Icache_entry := getL1ICacheEntry(in_msg.LineAddress);
49514184Sgabeblack@google.com            if (is_valid(L1Icache_entry)) {
49614184Sgabeblack@google.com              // The block is in the wrong L1, put the request on the queue to the shared L2
49714184Sgabeblack@google.com              trigger(Event:L1_Replacement, in_msg.LineAddress,
49814184Sgabeblack@google.com                      L1Icache_entry, TBEs[in_msg.LineAddress]);
49914184Sgabeblack@google.com            }
50014184Sgabeblack@google.com
50114184Sgabeblack@google.com            if (L1Dcache.cacheAvail(in_msg.LineAddress)) {
50214184Sgabeblack@google.com              // L1 does't have the line, but we have space for it
50314184Sgabeblack@google.com              // in the L1 let's see if the L2 has it.
50414184Sgabeblack@google.com              trigger(mandatory_request_type_to_event(in_msg.Type), in_msg.LineAddress,
50514184Sgabeblack@google.com                      L1Dcache_entry, TBEs[in_msg.LineAddress]);
50614184Sgabeblack@google.com            } else {
50714184Sgabeblack@google.com              // No room in the L1, so we need to make room in the L1
50814184Sgabeblack@google.com
50914184Sgabeblack@google.com              // Check if the line we want to evict is not locked
51014184Sgabeblack@google.com              Addr addr := L1Dcache.cacheProbe(in_msg.LineAddress);
51114184Sgabeblack@google.com              check_on_cache_probe(mandatoryQueue_in, addr);
51214184Sgabeblack@google.com
51314184Sgabeblack@google.com              trigger(Event:L1_Replacement, addr,
51414184Sgabeblack@google.com                      getL1DCacheEntry(addr),
51514184Sgabeblack@google.com                      TBEs[addr]);
51614184Sgabeblack@google.com            }
51714184Sgabeblack@google.com          }
51814184Sgabeblack@google.com        }
51914184Sgabeblack@google.com      }
52014184Sgabeblack@google.com    }
52114184Sgabeblack@google.com  }
52214184Sgabeblack@google.com
52314184Sgabeblack@google.com  void enqueuePrefetch(Addr address, RubyRequestType type) {
52414184Sgabeblack@google.com      enqueue(optionalQueue_out, RubyRequest, 1) {
52514184Sgabeblack@google.com          out_msg.LineAddress := address;
52614184Sgabeblack@google.com          out_msg.Type := type;
52714184Sgabeblack@google.com          out_msg.AccessMode := RubyAccessMode:Supervisor;
52814184Sgabeblack@google.com      }
52914184Sgabeblack@google.com  }
53014184Sgabeblack@google.com
53114184Sgabeblack@google.com  // ACTIONS
53214184Sgabeblack@google.com  action(a_issueGETS, "a", desc="Issue GETS") {
53314184Sgabeblack@google.com    peek(mandatoryQueue_in, RubyRequest) {
53414184Sgabeblack@google.com      enqueue(requestL1Network_out, RequestMsg, l1_request_latency) {
53514184Sgabeblack@google.com        out_msg.addr := address;
53614184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:GETS;
53714184Sgabeblack@google.com        out_msg.Requestor := machineID;
53814184Sgabeblack@google.com        out_msg.Destination.add(mapAddressToRange(address, MachineType:L2Cache,
53914184Sgabeblack@google.com                          l2_select_low_bit, l2_select_num_bits, intToID(0)));
54014184Sgabeblack@google.com        DPRINTF(RubySlicc, "address: %#x, destination: %s\n",
54114184Sgabeblack@google.com                address, out_msg.Destination);
54214184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
54314184Sgabeblack@google.com        out_msg.Prefetch := in_msg.Prefetch;
54414184Sgabeblack@google.com        out_msg.AccessMode := in_msg.AccessMode;
54514184Sgabeblack@google.com      }
54614184Sgabeblack@google.com    }
54714184Sgabeblack@google.com  }
54814184Sgabeblack@google.com
54914184Sgabeblack@google.com  action(pa_issuePfGETS, "pa", desc="Issue prefetch GETS") {
55014184Sgabeblack@google.com    peek(optionalQueue_in, RubyRequest) {
55114184Sgabeblack@google.com      enqueue(requestL1Network_out, RequestMsg, l1_request_latency) {
55214184Sgabeblack@google.com        out_msg.addr := address;
55314184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:GETS;
55414184Sgabeblack@google.com        out_msg.Requestor := machineID;
55514184Sgabeblack@google.com        out_msg.Destination.add(mapAddressToRange(address, MachineType:L2Cache,
55614184Sgabeblack@google.com                          l2_select_low_bit, l2_select_num_bits, intToID(0)));
55714184Sgabeblack@google.com        DPRINTF(RubySlicc, "address: %#x, destination: %s\n",
55814184Sgabeblack@google.com                address, out_msg.Destination);
55914184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
56014184Sgabeblack@google.com        out_msg.Prefetch := in_msg.Prefetch;
56114184Sgabeblack@google.com        out_msg.AccessMode := in_msg.AccessMode;
56214184Sgabeblack@google.com      }
56314184Sgabeblack@google.com    }
56414184Sgabeblack@google.com  }
56514184Sgabeblack@google.com
56614184Sgabeblack@google.com  action(ai_issueGETINSTR, "ai", desc="Issue GETINSTR") {
56714184Sgabeblack@google.com    peek(mandatoryQueue_in, RubyRequest) {
56814184Sgabeblack@google.com      enqueue(requestL1Network_out, RequestMsg, l1_request_latency) {
56914184Sgabeblack@google.com        out_msg.addr := address;
57014184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:GET_INSTR;
57114184Sgabeblack@google.com        out_msg.Requestor := machineID;
57214184Sgabeblack@google.com        out_msg.Destination.add(mapAddressToRange(address, MachineType:L2Cache,
57314184Sgabeblack@google.com                          l2_select_low_bit, l2_select_num_bits, intToID(0)));
57414184Sgabeblack@google.com        DPRINTF(RubySlicc, "address: %#x, destination: %s\n",
57514184Sgabeblack@google.com                address, out_msg.Destination);
57614184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
57714184Sgabeblack@google.com        out_msg.Prefetch := in_msg.Prefetch;
57814184Sgabeblack@google.com        out_msg.AccessMode := in_msg.AccessMode;
57914184Sgabeblack@google.com      }
58014184Sgabeblack@google.com    }
58114184Sgabeblack@google.com  }
58214184Sgabeblack@google.com
58314184Sgabeblack@google.com  action(pai_issuePfGETINSTR, "pai",
58414184Sgabeblack@google.com         desc="Issue GETINSTR for prefetch request") {
58514184Sgabeblack@google.com      peek(optionalQueue_in, RubyRequest) {
58614184Sgabeblack@google.com          enqueue(requestL1Network_out, RequestMsg, l1_request_latency) {
58714184Sgabeblack@google.com              out_msg.addr := address;
58814184Sgabeblack@google.com              out_msg.Type := CoherenceRequestType:GET_INSTR;
58914184Sgabeblack@google.com              out_msg.Requestor := machineID;
59014184Sgabeblack@google.com              out_msg.Destination.add(
59114184Sgabeblack@google.com                  mapAddressToRange(address, MachineType:L2Cache,
59214184Sgabeblack@google.com                          l2_select_low_bit, l2_select_num_bits, intToID(0)));
59314184Sgabeblack@google.com              out_msg.MessageSize := MessageSizeType:Control;
59414184Sgabeblack@google.com              out_msg.Prefetch := in_msg.Prefetch;
59514184Sgabeblack@google.com              out_msg.AccessMode := in_msg.AccessMode;
59614184Sgabeblack@google.com
59714184Sgabeblack@google.com              DPRINTF(RubySlicc, "address: %#x, destination: %s\n",
59814184Sgabeblack@google.com                      address, out_msg.Destination);
59914184Sgabeblack@google.com          }
60014184Sgabeblack@google.com      }
60114184Sgabeblack@google.com  }
60214184Sgabeblack@google.com
60314184Sgabeblack@google.com  action(b_issueGETX, "b", desc="Issue GETX") {
60414184Sgabeblack@google.com    peek(mandatoryQueue_in, RubyRequest) {
60514184Sgabeblack@google.com      enqueue(requestL1Network_out, RequestMsg, l1_request_latency) {
60614184Sgabeblack@google.com        out_msg.addr := address;
60714184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:GETX;
60814184Sgabeblack@google.com        out_msg.Requestor := machineID;
60914184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", machineID);
61014184Sgabeblack@google.com        out_msg.Destination.add(mapAddressToRange(address, MachineType:L2Cache,
61114184Sgabeblack@google.com                          l2_select_low_bit, l2_select_num_bits, intToID(0)));
61214184Sgabeblack@google.com        DPRINTF(RubySlicc, "address: %#x, destination: %s\n",
61314184Sgabeblack@google.com                address, out_msg.Destination);
61414184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
61514184Sgabeblack@google.com        out_msg.Prefetch := in_msg.Prefetch;
61614184Sgabeblack@google.com        out_msg.AccessMode := in_msg.AccessMode;
61714184Sgabeblack@google.com      }
61814184Sgabeblack@google.com    }
61914184Sgabeblack@google.com  }
62014184Sgabeblack@google.com
62114184Sgabeblack@google.com  action(pb_issuePfGETX, "pb", desc="Issue prefetch GETX") {
62214184Sgabeblack@google.com      peek(optionalQueue_in, RubyRequest) {
62314184Sgabeblack@google.com          enqueue(requestL1Network_out, RequestMsg, l1_request_latency) {
62414184Sgabeblack@google.com              out_msg.addr := address;
62514184Sgabeblack@google.com              out_msg.Type := CoherenceRequestType:GETX;
62614184Sgabeblack@google.com              out_msg.Requestor := machineID;
62714184Sgabeblack@google.com              DPRINTF(RubySlicc, "%s\n", machineID);
62814184Sgabeblack@google.com
62914184Sgabeblack@google.com              out_msg.Destination.add(mapAddressToRange(address, MachineType:L2Cache,
63014184Sgabeblack@google.com                          l2_select_low_bit, l2_select_num_bits, intToID(0)));
63114184Sgabeblack@google.com
63214184Sgabeblack@google.com              DPRINTF(RubySlicc, "address: %#x, destination: %s\n",
63314184Sgabeblack@google.com                      address, out_msg.Destination);
63414184Sgabeblack@google.com              out_msg.MessageSize := MessageSizeType:Control;
63514184Sgabeblack@google.com              out_msg.Prefetch := in_msg.Prefetch;
63614184Sgabeblack@google.com              out_msg.AccessMode := in_msg.AccessMode;
63714184Sgabeblack@google.com          }
63814184Sgabeblack@google.com      }
63914184Sgabeblack@google.com  }
64014184Sgabeblack@google.com
64114184Sgabeblack@google.com  action(c_issueUPGRADE, "c", desc="Issue GETX") {
64214184Sgabeblack@google.com    peek(mandatoryQueue_in, RubyRequest) {
64314184Sgabeblack@google.com      enqueue(requestL1Network_out, RequestMsg,  l1_request_latency) {
64414184Sgabeblack@google.com        out_msg.addr := address;
64514184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:UPGRADE;
64614184Sgabeblack@google.com        out_msg.Requestor := machineID;
64714184Sgabeblack@google.com        out_msg.Destination.add(mapAddressToRange(address, MachineType:L2Cache,
64814184Sgabeblack@google.com                          l2_select_low_bit, l2_select_num_bits, intToID(0)));
64914184Sgabeblack@google.com        DPRINTF(RubySlicc, "address: %#x, destination: %s\n",
65014184Sgabeblack@google.com                address, out_msg.Destination);
65114184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Control;
65214184Sgabeblack@google.com        out_msg.Prefetch := in_msg.Prefetch;
65314184Sgabeblack@google.com        out_msg.AccessMode := in_msg.AccessMode;
65414184Sgabeblack@google.com      }
65514184Sgabeblack@google.com    }
65614184Sgabeblack@google.com  }
65714184Sgabeblack@google.com
65814184Sgabeblack@google.com  action(d_sendDataToRequestor, "d", desc="send data to requestor") {
65914184Sgabeblack@google.com    peek(requestL1Network_in, RequestMsg) {
66014184Sgabeblack@google.com      enqueue(responseL1Network_out, ResponseMsg, l1_response_latency) {
66114184Sgabeblack@google.com        assert(is_valid(cache_entry));
66214184Sgabeblack@google.com        out_msg.addr := address;
66314184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA;
66414184Sgabeblack@google.com        out_msg.DataBlk := cache_entry.DataBlk;
66514184Sgabeblack@google.com        out_msg.Dirty := cache_entry.Dirty;
66614184Sgabeblack@google.com        out_msg.Sender := machineID;
66714184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
66814184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
66914184Sgabeblack@google.com      }
67014184Sgabeblack@google.com    }
67114184Sgabeblack@google.com  }
67214184Sgabeblack@google.com
67314184Sgabeblack@google.com  action(d2_sendDataToL2, "d2", desc="send data to the L2 cache because of M downgrade") {
67414184Sgabeblack@google.com    enqueue(responseL1Network_out, ResponseMsg, l1_response_latency) {
67514184Sgabeblack@google.com      assert(is_valid(cache_entry));
67614184Sgabeblack@google.com      out_msg.addr := address;
67714184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:DATA;
67814184Sgabeblack@google.com      out_msg.DataBlk := cache_entry.DataBlk;
67914184Sgabeblack@google.com      out_msg.Dirty := cache_entry.Dirty;
68014184Sgabeblack@google.com      out_msg.Sender := machineID;
68114184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address, MachineType:L2Cache,
68214184Sgabeblack@google.com                          l2_select_low_bit, l2_select_num_bits, intToID(0)));
68314184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
68414184Sgabeblack@google.com    }
68514184Sgabeblack@google.com  }
68614184Sgabeblack@google.com
68714184Sgabeblack@google.com  action(dt_sendDataToRequestor_fromTBE, "dt", desc="send data to requestor") {
68814184Sgabeblack@google.com    peek(requestL1Network_in, RequestMsg) {
68914184Sgabeblack@google.com      enqueue(responseL1Network_out, ResponseMsg, l1_response_latency) {
69014184Sgabeblack@google.com        assert(is_valid(tbe));
69114184Sgabeblack@google.com        out_msg.addr := address;
69214184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:DATA;
69314184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
69414184Sgabeblack@google.com        out_msg.Dirty := tbe.Dirty;
69514184Sgabeblack@google.com        out_msg.Sender := machineID;
69614184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
69714184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
69814184Sgabeblack@google.com      }
69914184Sgabeblack@google.com    }
70014184Sgabeblack@google.com  }
70114184Sgabeblack@google.com
70214184Sgabeblack@google.com  action(d2t_sendDataToL2_fromTBE, "d2t", desc="send data to the L2 cache") {
70314184Sgabeblack@google.com    enqueue(responseL1Network_out, ResponseMsg, l1_response_latency) {
70414184Sgabeblack@google.com      assert(is_valid(tbe));
70514184Sgabeblack@google.com      out_msg.addr := address;
70614184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:DATA;
70714184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
70814184Sgabeblack@google.com      out_msg.Dirty := tbe.Dirty;
70914184Sgabeblack@google.com      out_msg.Sender := machineID;
71014184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address, MachineType:L2Cache,
71114184Sgabeblack@google.com                          l2_select_low_bit, l2_select_num_bits, intToID(0)));
71214184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Data;
71314184Sgabeblack@google.com    }
71414184Sgabeblack@google.com  }
71514184Sgabeblack@google.com
71614184Sgabeblack@google.com  action(e_sendAckToRequestor, "e", desc="send invalidate ack to requestor (could be L2 or L1)") {
71714184Sgabeblack@google.com    peek(requestL1Network_in, RequestMsg) {
71814184Sgabeblack@google.com      enqueue(responseL1Network_out, ResponseMsg, l1_response_latency) {
71914184Sgabeblack@google.com        out_msg.addr := address;
72014184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:ACK;
72114184Sgabeblack@google.com        out_msg.Sender := machineID;
72214184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
72314184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Control;
72414184Sgabeblack@google.com      }
72514184Sgabeblack@google.com    }
72614184Sgabeblack@google.com  }
72714184Sgabeblack@google.com
72814184Sgabeblack@google.com  action(f_sendDataToL2, "f", desc="send data to the L2 cache") {
72914184Sgabeblack@google.com    enqueue(responseL1Network_out, ResponseMsg, l1_response_latency) {
73014184Sgabeblack@google.com      assert(is_valid(cache_entry));
73114184Sgabeblack@google.com      out_msg.addr := address;
73214184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:DATA;
73314184Sgabeblack@google.com      out_msg.DataBlk := cache_entry.DataBlk;
73414184Sgabeblack@google.com      out_msg.Dirty := cache_entry.Dirty;
73514184Sgabeblack@google.com      out_msg.Sender := machineID;
73614184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address, MachineType:L2Cache,
73714184Sgabeblack@google.com                          l2_select_low_bit, l2_select_num_bits, intToID(0)));
73814184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Writeback_Data;
73914184Sgabeblack@google.com    }
74014184Sgabeblack@google.com  }
74114184Sgabeblack@google.com
74214184Sgabeblack@google.com  action(ft_sendDataToL2_fromTBE, "ft", desc="send data to the L2 cache") {
74314184Sgabeblack@google.com    enqueue(responseL1Network_out, ResponseMsg, l1_response_latency) {
74414184Sgabeblack@google.com      assert(is_valid(tbe));
74514184Sgabeblack@google.com      out_msg.addr := address;
74614184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:DATA;
74714184Sgabeblack@google.com      out_msg.DataBlk := tbe.DataBlk;
74814184Sgabeblack@google.com      out_msg.Dirty := tbe.Dirty;
74914184Sgabeblack@google.com      out_msg.Sender := machineID;
75014184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address, MachineType:L2Cache,
75114184Sgabeblack@google.com                          l2_select_low_bit, l2_select_num_bits, intToID(0)));
75214184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Writeback_Data;
75314184Sgabeblack@google.com    }
75414184Sgabeblack@google.com  }
75514184Sgabeblack@google.com
75614184Sgabeblack@google.com  action(fi_sendInvAck, "fi", desc="send data to the L2 cache") {
75714184Sgabeblack@google.com    peek(requestL1Network_in, RequestMsg) {
75814184Sgabeblack@google.com      enqueue(responseL1Network_out, ResponseMsg, l1_response_latency) {
75914184Sgabeblack@google.com        out_msg.addr := address;
76014184Sgabeblack@google.com        out_msg.Type := CoherenceResponseType:ACK;
76114184Sgabeblack@google.com        out_msg.Sender := machineID;
76214184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
76314184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Control;
76414184Sgabeblack@google.com        out_msg.AckCount := 1;
76514184Sgabeblack@google.com      }
76614184Sgabeblack@google.com    }
76714184Sgabeblack@google.com  }
76814184Sgabeblack@google.com
76914184Sgabeblack@google.com  action(forward_eviction_to_cpu, "\cc", desc="sends eviction information to the processor") {
77014184Sgabeblack@google.com    if (send_evictions) {
77114184Sgabeblack@google.com      DPRINTF(RubySlicc, "Sending invalidation for %#x to the CPU\n", address);
77214184Sgabeblack@google.com      sequencer.evictionCallback(address);
77314184Sgabeblack@google.com    }
77414184Sgabeblack@google.com  }
77514184Sgabeblack@google.com
77614184Sgabeblack@google.com  action(g_issuePUTX, "g", desc="send data to the L2 cache") {
77714184Sgabeblack@google.com    enqueue(requestL1Network_out, RequestMsg, l1_response_latency) {
77814184Sgabeblack@google.com      assert(is_valid(cache_entry));
77914184Sgabeblack@google.com      out_msg.addr := address;
78014184Sgabeblack@google.com      out_msg.Type := CoherenceRequestType:PUTX;
78114184Sgabeblack@google.com      out_msg.DataBlk := cache_entry.DataBlk;
78214184Sgabeblack@google.com      out_msg.Dirty := cache_entry.Dirty;
78314184Sgabeblack@google.com      out_msg.Requestor:= machineID;
78414184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address, MachineType:L2Cache,
78514184Sgabeblack@google.com                          l2_select_low_bit, l2_select_num_bits, intToID(0)));
78614184Sgabeblack@google.com      if (cache_entry.Dirty) {
78714184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Data;
78814184Sgabeblack@google.com      } else {
78914184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Control;
79014184Sgabeblack@google.com      }
79114184Sgabeblack@google.com    }
79214184Sgabeblack@google.com  }
79314184Sgabeblack@google.com
79414184Sgabeblack@google.com  action(j_sendUnblock, "j", desc="send unblock to the L2 cache") {
79514184Sgabeblack@google.com    enqueue(unblockNetwork_out, ResponseMsg, to_l2_latency) {
79614184Sgabeblack@google.com      out_msg.addr := address;
79714184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:UNBLOCK;
79814184Sgabeblack@google.com      out_msg.Sender := machineID;
79914184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address, MachineType:L2Cache,
80014184Sgabeblack@google.com                          l2_select_low_bit, l2_select_num_bits, intToID(0)));
80114184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Control;
80214184Sgabeblack@google.com      DPRINTF(RubySlicc, "%#x\n", address);
80314184Sgabeblack@google.com    }
80414184Sgabeblack@google.com  }
80514184Sgabeblack@google.com
80614184Sgabeblack@google.com  action(jj_sendExclusiveUnblock, "\j", desc="send unblock to the L2 cache") {
80714184Sgabeblack@google.com    enqueue(unblockNetwork_out, ResponseMsg, to_l2_latency) {
80814184Sgabeblack@google.com      out_msg.addr := address;
80914184Sgabeblack@google.com      out_msg.Type := CoherenceResponseType:EXCLUSIVE_UNBLOCK;
81014184Sgabeblack@google.com      out_msg.Sender := machineID;
81114184Sgabeblack@google.com      out_msg.Destination.add(mapAddressToRange(address, MachineType:L2Cache,
81214184Sgabeblack@google.com                          l2_select_low_bit, l2_select_num_bits, intToID(0)));
81314184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Response_Control;
81414184Sgabeblack@google.com      DPRINTF(RubySlicc, "%#x\n", address);
81514184Sgabeblack@google.com
81614184Sgabeblack@google.com    }
81714184Sgabeblack@google.com  }
81814184Sgabeblack@google.com
81914184Sgabeblack@google.com  action(dg_invalidate_sc, "dg",
82014184Sgabeblack@google.com         desc="Invalidate store conditional as the cache lost permissions") {
82114184Sgabeblack@google.com    sequencer.invalidateSC(address);
82214184Sgabeblack@google.com  }
82314184Sgabeblack@google.com
82414184Sgabeblack@google.com  action(h_load_hit, "hd",
82514184Sgabeblack@google.com         desc="Notify sequencer the load completed.")
82614184Sgabeblack@google.com  {
82714184Sgabeblack@google.com    assert(is_valid(cache_entry));
82814184Sgabeblack@google.com    DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
82914184Sgabeblack@google.com    L1Dcache.setMRU(cache_entry);
83014184Sgabeblack@google.com    sequencer.readCallback(address, cache_entry.DataBlk);
83114184Sgabeblack@google.com  }
83214184Sgabeblack@google.com
83314184Sgabeblack@google.com  action(h_ifetch_hit, "hi", desc="Notify sequencer the instruction fetch completed.")
83414184Sgabeblack@google.com  {
83514184Sgabeblack@google.com    assert(is_valid(cache_entry));
83614184Sgabeblack@google.com    DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
83714184Sgabeblack@google.com    L1Icache.setMRU(cache_entry);
83814184Sgabeblack@google.com    sequencer.readCallback(address, cache_entry.DataBlk);
83914184Sgabeblack@google.com  }
84014184Sgabeblack@google.com
84114184Sgabeblack@google.com  action(hx_load_hit, "hx", desc="Notify sequencer the load completed.")
84214184Sgabeblack@google.com  {
84314184Sgabeblack@google.com    assert(is_valid(cache_entry));
84414184Sgabeblack@google.com    DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
84514184Sgabeblack@google.com    L1Icache.setMRU(address);
84614184Sgabeblack@google.com    L1Dcache.setMRU(address);
84714184Sgabeblack@google.com    sequencer.readCallback(address, cache_entry.DataBlk, true);
84814184Sgabeblack@google.com  }
84914184Sgabeblack@google.com
85014184Sgabeblack@google.com  action(hh_store_hit, "\h", desc="Notify sequencer that store completed.")
85114184Sgabeblack@google.com  {
85214184Sgabeblack@google.com    assert(is_valid(cache_entry));
85314184Sgabeblack@google.com    DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
85414184Sgabeblack@google.com    L1Dcache.setMRU(cache_entry);
85514184Sgabeblack@google.com    sequencer.writeCallback(address, cache_entry.DataBlk);
85614184Sgabeblack@google.com    cache_entry.Dirty := true;
85714184Sgabeblack@google.com  }
85814184Sgabeblack@google.com
85914184Sgabeblack@google.com  action(hhx_store_hit, "\hx", desc="Notify sequencer that store completed.")
86014184Sgabeblack@google.com  {
86114184Sgabeblack@google.com    assert(is_valid(cache_entry));
86214184Sgabeblack@google.com    DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
86314184Sgabeblack@google.com    L1Icache.setMRU(address);
86414184Sgabeblack@google.com    L1Dcache.setMRU(address);
86514184Sgabeblack@google.com    sequencer.writeCallback(address, cache_entry.DataBlk, true);
86614184Sgabeblack@google.com    cache_entry.Dirty := true;
86714184Sgabeblack@google.com  }
86814184Sgabeblack@google.com
86914184Sgabeblack@google.com  action(i_allocateTBE, "i", desc="Allocate TBE (isPrefetch=0, number of invalidates=0)") {
87014184Sgabeblack@google.com    check_allocate(TBEs);
87114184Sgabeblack@google.com    assert(is_valid(cache_entry));
87214184Sgabeblack@google.com    TBEs.allocate(address);
87314184Sgabeblack@google.com    set_tbe(TBEs[address]);
87414184Sgabeblack@google.com    tbe.isPrefetch := false;
87514184Sgabeblack@google.com    tbe.Dirty := cache_entry.Dirty;
87614184Sgabeblack@google.com    tbe.DataBlk := cache_entry.DataBlk;
87714184Sgabeblack@google.com  }
87814184Sgabeblack@google.com
87914184Sgabeblack@google.com  action(k_popMandatoryQueue, "k", desc="Pop mandatory queue.") {
88014184Sgabeblack@google.com    mandatoryQueue_in.dequeue(clockEdge());
88114184Sgabeblack@google.com  }
88214184Sgabeblack@google.com
88314184Sgabeblack@google.com  action(l_popRequestQueue, "l",
88414184Sgabeblack@google.com    desc="Pop incoming request queue and profile the delay within this virtual network") {
88514184Sgabeblack@google.com    Tick delay := requestL1Network_in.dequeue(clockEdge());
88614184Sgabeblack@google.com    profileMsgDelay(2, ticksToCycles(delay));
88714184Sgabeblack@google.com  }
88814184Sgabeblack@google.com
88914184Sgabeblack@google.com  action(o_popIncomingResponseQueue, "o",
89014184Sgabeblack@google.com    desc="Pop Incoming Response queue and profile the delay within this virtual network") {
89114184Sgabeblack@google.com    Tick delay := responseL1Network_in.dequeue(clockEdge());
89214184Sgabeblack@google.com    profileMsgDelay(1, ticksToCycles(delay));
89314184Sgabeblack@google.com  }
89414184Sgabeblack@google.com
89514184Sgabeblack@google.com  action(s_deallocateTBE, "s", desc="Deallocate TBE") {
89614184Sgabeblack@google.com    TBEs.deallocate(address);
89714184Sgabeblack@google.com    unset_tbe();
89814184Sgabeblack@google.com  }
89914184Sgabeblack@google.com
90014184Sgabeblack@google.com  action(u_writeDataToL1Cache, "u", desc="Write data to cache") {
90114184Sgabeblack@google.com    peek(responseL1Network_in, ResponseMsg) {
90214184Sgabeblack@google.com      assert(is_valid(cache_entry));
90314184Sgabeblack@google.com      cache_entry.DataBlk := in_msg.DataBlk;
90414184Sgabeblack@google.com      cache_entry.Dirty := in_msg.Dirty;
90514184Sgabeblack@google.com    }
90614184Sgabeblack@google.com  }
90714184Sgabeblack@google.com
90814184Sgabeblack@google.com  action(q_updateAckCount, "q", desc="Update ack count") {
90914184Sgabeblack@google.com    peek(responseL1Network_in, ResponseMsg) {
91014184Sgabeblack@google.com      assert(is_valid(tbe));
91114184Sgabeblack@google.com      tbe.pendingAcks := tbe.pendingAcks - in_msg.AckCount;
91214184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(in_msg.AckCount);
91314184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(" p: ");
91414184Sgabeblack@google.com      APPEND_TRANSITION_COMMENT(tbe.pendingAcks);
91514184Sgabeblack@google.com    }
91614184Sgabeblack@google.com  }
91714184Sgabeblack@google.com
91814184Sgabeblack@google.com  action(ff_deallocateL1CacheBlock, "\f", desc="Deallocate L1 cache block.  Sets the cache to not present, allowing a replacement in parallel with a fetch.") {
91914184Sgabeblack@google.com    if (L1Dcache.isTagPresent(address)) {
92014184Sgabeblack@google.com      L1Dcache.deallocate(address);
92114184Sgabeblack@google.com    } else {
92214184Sgabeblack@google.com      L1Icache.deallocate(address);
92314184Sgabeblack@google.com    }
92414184Sgabeblack@google.com    unset_cache_entry();
92514184Sgabeblack@google.com  }
92614184Sgabeblack@google.com
92714184Sgabeblack@google.com  action(oo_allocateL1DCacheBlock, "\o", desc="Set L1 D-cache tag equal to tag of block B.") {
92814184Sgabeblack@google.com    if (is_invalid(cache_entry)) {
92914184Sgabeblack@google.com      set_cache_entry(L1Dcache.allocate(address, new Entry));
93014184Sgabeblack@google.com    }
93114184Sgabeblack@google.com  }
93214184Sgabeblack@google.com
93314184Sgabeblack@google.com  action(pp_allocateL1ICacheBlock, "\p", desc="Set L1 I-cache tag equal to tag of block B.") {
93414184Sgabeblack@google.com    if (is_invalid(cache_entry)) {
93514184Sgabeblack@google.com      set_cache_entry(L1Icache.allocate(address, new Entry));
93614184Sgabeblack@google.com    }
93714184Sgabeblack@google.com  }
93814184Sgabeblack@google.com
93914184Sgabeblack@google.com  action(z_stallAndWaitMandatoryQueue, "\z", desc="Stall and wait the L1 mandatory request queue") {
94014184Sgabeblack@google.com    stall_and_wait(mandatoryQueue_in, address);
94114184Sgabeblack@google.com  }
94214184Sgabeblack@google.com
94314184Sgabeblack@google.com  action(z_stallAndWaitOptionalQueue, "\pz", desc="Stall and wait the L1 prefetch request queue") {
94414184Sgabeblack@google.com    stall_and_wait(optionalQueue_in, address);
94514184Sgabeblack@google.com  }
94614184Sgabeblack@google.com
94714184Sgabeblack@google.com  action(kd_wakeUpDependents, "kd", desc="wake-up dependents") {
94814184Sgabeblack@google.com    wakeUpBuffers(address);
94914184Sgabeblack@google.com  }
95014184Sgabeblack@google.com
95114184Sgabeblack@google.com  action(uu_profileInstMiss, "\uim", desc="Profile the demand miss") {
95214184Sgabeblack@google.com      ++L1Icache.demand_misses;
95314184Sgabeblack@google.com  }
95414184Sgabeblack@google.com
95514184Sgabeblack@google.com  action(uu_profileInstHit, "\uih", desc="Profile the demand hit") {
95614184Sgabeblack@google.com      ++L1Icache.demand_hits;
95714184Sgabeblack@google.com  }
95814184Sgabeblack@google.com
95914184Sgabeblack@google.com  action(uu_profileDataMiss, "\udm", desc="Profile the demand miss") {
96014184Sgabeblack@google.com      ++L1Dcache.demand_misses;
96114184Sgabeblack@google.com  }
96214184Sgabeblack@google.com
96314184Sgabeblack@google.com  action(uu_profileDataHit, "\udh", desc="Profile the demand hit") {
96414184Sgabeblack@google.com      ++L1Dcache.demand_hits;
96514184Sgabeblack@google.com  }
96614184Sgabeblack@google.com
96714184Sgabeblack@google.com  action(po_observeHit, "\ph", desc="Inform the prefetcher about the hit") {
96814184Sgabeblack@google.com      peek(mandatoryQueue_in, RubyRequest) {
96914184Sgabeblack@google.com          if (cache_entry.isPrefetch) {
97014184Sgabeblack@google.com              prefetcher.observePfHit(in_msg.LineAddress);
97114184Sgabeblack@google.com              cache_entry.isPrefetch := false;
97214184Sgabeblack@google.com          }
97314184Sgabeblack@google.com      }
97414184Sgabeblack@google.com  }
97514184Sgabeblack@google.com
97614184Sgabeblack@google.com  action(po_observeMiss, "\po", desc="Inform the prefetcher about the miss") {
97714184Sgabeblack@google.com      peek(mandatoryQueue_in, RubyRequest) {
97814184Sgabeblack@google.com          if (enable_prefetch) {
97914184Sgabeblack@google.com              prefetcher.observeMiss(in_msg.LineAddress, in_msg.Type);
98014184Sgabeblack@google.com          }
98114184Sgabeblack@google.com      }
98214184Sgabeblack@google.com  }
98314184Sgabeblack@google.com
98414184Sgabeblack@google.com  action(ppm_observePfMiss, "\ppm",
98514184Sgabeblack@google.com         desc="Inform the prefetcher about the partial miss") {
98614184Sgabeblack@google.com      peek(mandatoryQueue_in, RubyRequest) {
98714184Sgabeblack@google.com          prefetcher.observePfMiss(in_msg.LineAddress);
98814184Sgabeblack@google.com      }
98914184Sgabeblack@google.com  }
99014184Sgabeblack@google.com
99114184Sgabeblack@google.com  action(pq_popPrefetchQueue, "\pq", desc="Pop the prefetch request queue") {
99214184Sgabeblack@google.com      optionalQueue_in.dequeue(clockEdge());
99314184Sgabeblack@google.com  }
99414184Sgabeblack@google.com
99514184Sgabeblack@google.com  action(mp_markPrefetched, "mp", desc="Set the isPrefetch flag") {
99614184Sgabeblack@google.com      assert(is_valid(cache_entry));
99714184Sgabeblack@google.com      cache_entry.isPrefetch := true;
99814184Sgabeblack@google.com  }
99914184Sgabeblack@google.com
100014184Sgabeblack@google.com
100114184Sgabeblack@google.com  //*****************************************************
100214184Sgabeblack@google.com  // TRANSITIONS
100314184Sgabeblack@google.com  //*****************************************************
100414184Sgabeblack@google.com
100514184Sgabeblack@google.com  // Transitions for Load/Store/Replacement/WriteBack from transient states
100614184Sgabeblack@google.com  transition({IS, IM, IS_I, M_I, SM, SINK_WB_ACK}, {Load, Ifetch, Store, L1_Replacement}) {
100714184Sgabeblack@google.com    z_stallAndWaitMandatoryQueue;
100814184Sgabeblack@google.com  }
100914184Sgabeblack@google.com
101014184Sgabeblack@google.com  transition({PF_IS, PF_IS_I}, {Store, L1_Replacement}) {
101114184Sgabeblack@google.com    z_stallAndWaitMandatoryQueue;
101214184Sgabeblack@google.com  }
101314184Sgabeblack@google.com
101414184Sgabeblack@google.com  transition({PF_IM, PF_SM}, {Load, Ifetch, L1_Replacement}) {
101514184Sgabeblack@google.com    z_stallAndWaitMandatoryQueue;
101614184Sgabeblack@google.com  }
101714184Sgabeblack@google.com
101814184Sgabeblack@google.com  transition({IS, IM, IS_I, M_I, SM, SINK_WB_ACK, PF_IS, PF_IS_I, PF_IM, PF_SM}, PF_L1_Replacement) {
101914184Sgabeblack@google.com    z_stallAndWaitOptionalQueue;
102014184Sgabeblack@google.com  }
102114184Sgabeblack@google.com
102214184Sgabeblack@google.com  // Transitions from Idle
102314184Sgabeblack@google.com  transition({NP,I}, {L1_Replacement, PF_L1_Replacement}) {
102414184Sgabeblack@google.com    ff_deallocateL1CacheBlock;
102514184Sgabeblack@google.com  }
102614184Sgabeblack@google.com
102714184Sgabeblack@google.com  transition({S,E,M,IS,IM,SM,IS_I,PF_IS_I,M_I,SINK_WB_ACK,PF_IS,PF_IM},
102814184Sgabeblack@google.com             {PF_Load, PF_Store, PF_Ifetch}) {
102914184Sgabeblack@google.com      pq_popPrefetchQueue;
103014184Sgabeblack@google.com  }
103114184Sgabeblack@google.com
103214184Sgabeblack@google.com  transition({NP,I}, Load, IS) {
103314184Sgabeblack@google.com    oo_allocateL1DCacheBlock;
103414184Sgabeblack@google.com    i_allocateTBE;
103514184Sgabeblack@google.com    a_issueGETS;
103614184Sgabeblack@google.com    uu_profileDataMiss;
103714184Sgabeblack@google.com    po_observeMiss;
103814184Sgabeblack@google.com    k_popMandatoryQueue;
103914184Sgabeblack@google.com  }
104014184Sgabeblack@google.com
104114184Sgabeblack@google.com  transition({NP,I}, PF_Load, PF_IS) {
104214184Sgabeblack@google.com    oo_allocateL1DCacheBlock;
104314184Sgabeblack@google.com    i_allocateTBE;
104414184Sgabeblack@google.com    pa_issuePfGETS;
104514184Sgabeblack@google.com    pq_popPrefetchQueue;
104614184Sgabeblack@google.com  }
104714184Sgabeblack@google.com
104814184Sgabeblack@google.com  transition(PF_IS, Load, IS) {
104914184Sgabeblack@google.com    uu_profileDataMiss;
105014184Sgabeblack@google.com    ppm_observePfMiss;
105114184Sgabeblack@google.com    k_popMandatoryQueue;
105214184Sgabeblack@google.com  }
105314184Sgabeblack@google.com
105414184Sgabeblack@google.com  transition(PF_IS_I, Load, IS_I) {
105514184Sgabeblack@google.com    uu_profileDataMiss;
105614184Sgabeblack@google.com    ppm_observePfMiss;
105714184Sgabeblack@google.com    k_popMandatoryQueue;
105814184Sgabeblack@google.com  }
105914184Sgabeblack@google.com
106014184Sgabeblack@google.com  transition(PF_IS_I, Ifetch, IS_I) {
106114184Sgabeblack@google.com    uu_profileInstMiss;
106214184Sgabeblack@google.com    ppm_observePfMiss;
106314184Sgabeblack@google.com    k_popMandatoryQueue;
106414184Sgabeblack@google.com  }
106514184Sgabeblack@google.com
106614184Sgabeblack@google.com  transition({NP,I}, Ifetch, IS) {
106714184Sgabeblack@google.com    pp_allocateL1ICacheBlock;
106814184Sgabeblack@google.com    i_allocateTBE;
106914184Sgabeblack@google.com    ai_issueGETINSTR;
107014184Sgabeblack@google.com    uu_profileInstMiss;
107114184Sgabeblack@google.com    po_observeMiss;
107214184Sgabeblack@google.com    k_popMandatoryQueue;
107314184Sgabeblack@google.com  }
107414184Sgabeblack@google.com
107514184Sgabeblack@google.com  transition({NP,I}, PF_Ifetch, PF_IS) {
107614184Sgabeblack@google.com    pp_allocateL1ICacheBlock;
107714184Sgabeblack@google.com    i_allocateTBE;
107814184Sgabeblack@google.com    pai_issuePfGETINSTR;
107914184Sgabeblack@google.com    pq_popPrefetchQueue;
108014184Sgabeblack@google.com  }
108114184Sgabeblack@google.com
108214184Sgabeblack@google.com  // We proactively assume that the prefetch is in to
108314184Sgabeblack@google.com  // the instruction cache
108414184Sgabeblack@google.com  transition(PF_IS, Ifetch, IS) {
108514184Sgabeblack@google.com    uu_profileDataMiss;
108614184Sgabeblack@google.com    ppm_observePfMiss;
108714184Sgabeblack@google.com    k_popMandatoryQueue;
108814184Sgabeblack@google.com  }
108914184Sgabeblack@google.com
109014184Sgabeblack@google.com  transition({NP,I}, Store, IM) {
109114184Sgabeblack@google.com    oo_allocateL1DCacheBlock;
109214184Sgabeblack@google.com    i_allocateTBE;
109314184Sgabeblack@google.com    b_issueGETX;
109414184Sgabeblack@google.com    uu_profileDataMiss;
109514184Sgabeblack@google.com    po_observeMiss;
109614184Sgabeblack@google.com    k_popMandatoryQueue;
109714184Sgabeblack@google.com  }
109814184Sgabeblack@google.com
109914184Sgabeblack@google.com  transition({NP,I}, PF_Store, PF_IM) {
110014184Sgabeblack@google.com    oo_allocateL1DCacheBlock;
110114184Sgabeblack@google.com    i_allocateTBE;
110214184Sgabeblack@google.com    pb_issuePfGETX;
110314184Sgabeblack@google.com    pq_popPrefetchQueue;
110414184Sgabeblack@google.com  }
110514184Sgabeblack@google.com
110614184Sgabeblack@google.com  transition(PF_IM, Store, IM) {
110714184Sgabeblack@google.com    uu_profileDataMiss;
110814184Sgabeblack@google.com    ppm_observePfMiss;
110914184Sgabeblack@google.com    k_popMandatoryQueue;
111014184Sgabeblack@google.com  }
111114184Sgabeblack@google.com
111214184Sgabeblack@google.com  transition(PF_SM, Store, SM) {
111314184Sgabeblack@google.com    uu_profileDataMiss;
111414184Sgabeblack@google.com    ppm_observePfMiss;
111514184Sgabeblack@google.com    k_popMandatoryQueue;
111614184Sgabeblack@google.com  }
111714184Sgabeblack@google.com
111814184Sgabeblack@google.com  transition({NP, I}, Inv) {
111914184Sgabeblack@google.com    fi_sendInvAck;
112014184Sgabeblack@google.com    l_popRequestQueue;
112114184Sgabeblack@google.com  }
112214184Sgabeblack@google.com
112314184Sgabeblack@google.com  // Transitions from Shared
112414184Sgabeblack@google.com  transition({S,E,M}, Load) {
112514184Sgabeblack@google.com    h_load_hit;
112614184Sgabeblack@google.com    uu_profileDataHit;
112714184Sgabeblack@google.com    po_observeHit;
112814184Sgabeblack@google.com    k_popMandatoryQueue;
112914184Sgabeblack@google.com  }
113014184Sgabeblack@google.com
113114184Sgabeblack@google.com  transition({S,E,M}, Ifetch) {
113214184Sgabeblack@google.com    h_ifetch_hit;
113314184Sgabeblack@google.com    uu_profileInstHit;
113414184Sgabeblack@google.com    po_observeHit;
113514184Sgabeblack@google.com    k_popMandatoryQueue;
113614184Sgabeblack@google.com  }
113714184Sgabeblack@google.com
113814184Sgabeblack@google.com  transition(S, Store, SM) {
113914184Sgabeblack@google.com    i_allocateTBE;
114014184Sgabeblack@google.com    c_issueUPGRADE;
114114184Sgabeblack@google.com    uu_profileDataMiss;
114214184Sgabeblack@google.com    k_popMandatoryQueue;
114314184Sgabeblack@google.com  }
114414184Sgabeblack@google.com
114514184Sgabeblack@google.com  transition(S, {L1_Replacement, PF_L1_Replacement}, I) {
114614184Sgabeblack@google.com    forward_eviction_to_cpu;
114714184Sgabeblack@google.com    ff_deallocateL1CacheBlock;
114814184Sgabeblack@google.com  }
114914184Sgabeblack@google.com
115014184Sgabeblack@google.com  transition(S, Inv, I) {
115114184Sgabeblack@google.com    forward_eviction_to_cpu;
115214184Sgabeblack@google.com    fi_sendInvAck;
115314184Sgabeblack@google.com    l_popRequestQueue;
115414184Sgabeblack@google.com  }
115514184Sgabeblack@google.com
115614184Sgabeblack@google.com  // Transitions from Exclusive
115714184Sgabeblack@google.com
115814184Sgabeblack@google.com  transition({E,M}, Store, M) {
115914184Sgabeblack@google.com    hh_store_hit;
116014184Sgabeblack@google.com    uu_profileDataHit;
116114184Sgabeblack@google.com    po_observeHit;
116214184Sgabeblack@google.com    k_popMandatoryQueue;
116314184Sgabeblack@google.com  }
116414184Sgabeblack@google.com
116514184Sgabeblack@google.com  transition(E, {L1_Replacement, PF_L1_Replacement}, M_I) {
116614184Sgabeblack@google.com    // silent E replacement??
116714184Sgabeblack@google.com    forward_eviction_to_cpu;
116814184Sgabeblack@google.com    i_allocateTBE;
116914184Sgabeblack@google.com    g_issuePUTX;   // send data, but hold in case forwarded request
117014184Sgabeblack@google.com    ff_deallocateL1CacheBlock;
117114184Sgabeblack@google.com  }
117214184Sgabeblack@google.com
117314184Sgabeblack@google.com  transition(E, Inv, I) {
117414184Sgabeblack@google.com    // don't send data
117514184Sgabeblack@google.com    forward_eviction_to_cpu;
117614184Sgabeblack@google.com    fi_sendInvAck;
117714184Sgabeblack@google.com    l_popRequestQueue;
117814184Sgabeblack@google.com  }
117914184Sgabeblack@google.com
118014184Sgabeblack@google.com  transition(E, Fwd_GETX, I) {
118114184Sgabeblack@google.com    forward_eviction_to_cpu;
118214184Sgabeblack@google.com    d_sendDataToRequestor;
118314184Sgabeblack@google.com    l_popRequestQueue;
118414184Sgabeblack@google.com  }
118514184Sgabeblack@google.com
118614184Sgabeblack@google.com  transition(E, {Fwd_GETS, Fwd_GET_INSTR}, S) {
118714184Sgabeblack@google.com    d_sendDataToRequestor;
118814184Sgabeblack@google.com    d2_sendDataToL2;
118914184Sgabeblack@google.com    l_popRequestQueue;
119014184Sgabeblack@google.com  }
119114184Sgabeblack@google.com
119214184Sgabeblack@google.com  // Transitions from Modified
119314184Sgabeblack@google.com
119414184Sgabeblack@google.com  transition(M, {L1_Replacement, PF_L1_Replacement}, M_I) {
119514184Sgabeblack@google.com    forward_eviction_to_cpu;
119614184Sgabeblack@google.com    i_allocateTBE;
119714184Sgabeblack@google.com    g_issuePUTX;   // send data, but hold in case forwarded request
119814184Sgabeblack@google.com    ff_deallocateL1CacheBlock;
119914184Sgabeblack@google.com  }
120014184Sgabeblack@google.com
120114184Sgabeblack@google.com  transition(M_I, WB_Ack, I) {
120214184Sgabeblack@google.com    s_deallocateTBE;
120314184Sgabeblack@google.com    o_popIncomingResponseQueue;
120414184Sgabeblack@google.com    kd_wakeUpDependents;
120514184Sgabeblack@google.com  }
120614184Sgabeblack@google.com
120714184Sgabeblack@google.com  transition(M, Inv, I) {
120814184Sgabeblack@google.com    forward_eviction_to_cpu;
120914184Sgabeblack@google.com    f_sendDataToL2;
121014184Sgabeblack@google.com    l_popRequestQueue;
121114184Sgabeblack@google.com  }
121214184Sgabeblack@google.com
121314184Sgabeblack@google.com  transition(M_I, Inv, SINK_WB_ACK) {
121414184Sgabeblack@google.com    ft_sendDataToL2_fromTBE;
121514184Sgabeblack@google.com    l_popRequestQueue;
121614184Sgabeblack@google.com  }
121714184Sgabeblack@google.com
121814184Sgabeblack@google.com  transition(M, Fwd_GETX, I) {
121914184Sgabeblack@google.com    forward_eviction_to_cpu;
122014184Sgabeblack@google.com    d_sendDataToRequestor;
122114184Sgabeblack@google.com    l_popRequestQueue;
122214184Sgabeblack@google.com  }
122314184Sgabeblack@google.com
122414184Sgabeblack@google.com  transition(M, {Fwd_GETS, Fwd_GET_INSTR}, S) {
122514184Sgabeblack@google.com    d_sendDataToRequestor;
122614184Sgabeblack@google.com    d2_sendDataToL2;
122714184Sgabeblack@google.com    l_popRequestQueue;
122814184Sgabeblack@google.com  }
122914184Sgabeblack@google.com
123014184Sgabeblack@google.com  transition(M_I, Fwd_GETX, SINK_WB_ACK) {
123114184Sgabeblack@google.com    dt_sendDataToRequestor_fromTBE;
123214184Sgabeblack@google.com    l_popRequestQueue;
123314184Sgabeblack@google.com  }
123414184Sgabeblack@google.com
123514184Sgabeblack@google.com  transition(M_I, {Fwd_GETS, Fwd_GET_INSTR}, SINK_WB_ACK) {
123614184Sgabeblack@google.com    dt_sendDataToRequestor_fromTBE;
123714184Sgabeblack@google.com    d2t_sendDataToL2_fromTBE;
123814184Sgabeblack@google.com    l_popRequestQueue;
123914184Sgabeblack@google.com  }
124014184Sgabeblack@google.com
124114184Sgabeblack@google.com  // Transitions from IS
124214184Sgabeblack@google.com  transition({IS, IS_I}, Inv, IS_I) {
124314184Sgabeblack@google.com    fi_sendInvAck;
124414184Sgabeblack@google.com    l_popRequestQueue;
124514184Sgabeblack@google.com  }
124614184Sgabeblack@google.com
124714184Sgabeblack@google.com  transition({PF_IS, PF_IS_I}, Inv, PF_IS_I) {
124814184Sgabeblack@google.com    fi_sendInvAck;
124914184Sgabeblack@google.com    l_popRequestQueue;
125014184Sgabeblack@google.com  }
125114184Sgabeblack@google.com
125214184Sgabeblack@google.com  transition(IS, Data_all_Acks, S) {
125314184Sgabeblack@google.com    u_writeDataToL1Cache;
125414184Sgabeblack@google.com    hx_load_hit;
125514184Sgabeblack@google.com    s_deallocateTBE;
125614184Sgabeblack@google.com    o_popIncomingResponseQueue;
125714184Sgabeblack@google.com    kd_wakeUpDependents;
125814184Sgabeblack@google.com  }
125914184Sgabeblack@google.com
126014184Sgabeblack@google.com  transition(PF_IS, Data_all_Acks, S) {
126114184Sgabeblack@google.com    u_writeDataToL1Cache;
126214184Sgabeblack@google.com    s_deallocateTBE;
126314184Sgabeblack@google.com    mp_markPrefetched;
126414184Sgabeblack@google.com    o_popIncomingResponseQueue;
126514184Sgabeblack@google.com    kd_wakeUpDependents;
126614184Sgabeblack@google.com  }
126714184Sgabeblack@google.com
126814184Sgabeblack@google.com  transition(IS_I, Data_all_Acks, I) {
126914184Sgabeblack@google.com    u_writeDataToL1Cache;
127014184Sgabeblack@google.com    hx_load_hit;
127114184Sgabeblack@google.com    s_deallocateTBE;
127214184Sgabeblack@google.com    o_popIncomingResponseQueue;
127314184Sgabeblack@google.com    kd_wakeUpDependents;
127414184Sgabeblack@google.com  }
127514184Sgabeblack@google.com
127614184Sgabeblack@google.com  transition(PF_IS_I, Data_all_Acks, I) {
127714184Sgabeblack@google.com    s_deallocateTBE;
127814184Sgabeblack@google.com    o_popIncomingResponseQueue;
127914184Sgabeblack@google.com    kd_wakeUpDependents;
128014184Sgabeblack@google.com  }
128114184Sgabeblack@google.com
128214184Sgabeblack@google.com  transition(IS, DataS_fromL1, S) {
128314184Sgabeblack@google.com    u_writeDataToL1Cache;
128414184Sgabeblack@google.com    j_sendUnblock;
128514184Sgabeblack@google.com    hx_load_hit;
128614184Sgabeblack@google.com    s_deallocateTBE;
128714184Sgabeblack@google.com    o_popIncomingResponseQueue;
128814184Sgabeblack@google.com    kd_wakeUpDependents;
128914184Sgabeblack@google.com  }
129014184Sgabeblack@google.com
129114184Sgabeblack@google.com  transition(PF_IS, DataS_fromL1, S) {
129214184Sgabeblack@google.com    u_writeDataToL1Cache;
129314184Sgabeblack@google.com    j_sendUnblock;
129414184Sgabeblack@google.com    s_deallocateTBE;
129514184Sgabeblack@google.com    o_popIncomingResponseQueue;
129614184Sgabeblack@google.com    kd_wakeUpDependents;
129714184Sgabeblack@google.com  }
129814184Sgabeblack@google.com
129914184Sgabeblack@google.com  transition(IS_I, DataS_fromL1, I) {
130014184Sgabeblack@google.com    u_writeDataToL1Cache;
130114184Sgabeblack@google.com    j_sendUnblock;
130214184Sgabeblack@google.com    hx_load_hit;
130314184Sgabeblack@google.com    s_deallocateTBE;
130414184Sgabeblack@google.com    o_popIncomingResponseQueue;
130514184Sgabeblack@google.com    kd_wakeUpDependents;
130614184Sgabeblack@google.com  }
130714184Sgabeblack@google.com
130814184Sgabeblack@google.com  transition(PF_IS_I, DataS_fromL1, I) {
130914184Sgabeblack@google.com    j_sendUnblock;
131014184Sgabeblack@google.com    s_deallocateTBE;
131114184Sgabeblack@google.com    o_popIncomingResponseQueue;
131214184Sgabeblack@google.com    kd_wakeUpDependents;
131314184Sgabeblack@google.com  }
131414184Sgabeblack@google.com
131514184Sgabeblack@google.com  // directory is blocked when sending exclusive data
131614184Sgabeblack@google.com  transition(IS_I, Data_Exclusive, E) {
131714184Sgabeblack@google.com    u_writeDataToL1Cache;
131814184Sgabeblack@google.com    hx_load_hit;
131914184Sgabeblack@google.com    jj_sendExclusiveUnblock;
132014184Sgabeblack@google.com    s_deallocateTBE;
132114184Sgabeblack@google.com    o_popIncomingResponseQueue;
132214184Sgabeblack@google.com    kd_wakeUpDependents;
132314184Sgabeblack@google.com  }
132414184Sgabeblack@google.com
132514184Sgabeblack@google.com  // directory is blocked when sending exclusive data
132614184Sgabeblack@google.com  transition(PF_IS_I, Data_Exclusive, E) {
132714184Sgabeblack@google.com    u_writeDataToL1Cache;
132814184Sgabeblack@google.com    jj_sendExclusiveUnblock;
132914184Sgabeblack@google.com    s_deallocateTBE;
133014184Sgabeblack@google.com    o_popIncomingResponseQueue;
133114184Sgabeblack@google.com    kd_wakeUpDependents;
133214184Sgabeblack@google.com  }
133314184Sgabeblack@google.com
133414184Sgabeblack@google.com  transition(IS, Data_Exclusive, E) {
133514184Sgabeblack@google.com    u_writeDataToL1Cache;
133614184Sgabeblack@google.com    hx_load_hit;
133714184Sgabeblack@google.com    jj_sendExclusiveUnblock;
133814184Sgabeblack@google.com    s_deallocateTBE;
133914184Sgabeblack@google.com    o_popIncomingResponseQueue;
134014184Sgabeblack@google.com    kd_wakeUpDependents;
134114184Sgabeblack@google.com  }
134214184Sgabeblack@google.com
134314184Sgabeblack@google.com  transition(PF_IS, Data_Exclusive, E) {
134414184Sgabeblack@google.com    u_writeDataToL1Cache;
134514184Sgabeblack@google.com    jj_sendExclusiveUnblock;
134614184Sgabeblack@google.com    s_deallocateTBE;
134714184Sgabeblack@google.com    mp_markPrefetched;
134814184Sgabeblack@google.com    o_popIncomingResponseQueue;
134914184Sgabeblack@google.com    kd_wakeUpDependents;
135014184Sgabeblack@google.com  }
135114184Sgabeblack@google.com
135214184Sgabeblack@google.com  // Transitions from IM
135314184Sgabeblack@google.com  transition(IM, Inv, IM) {
135414184Sgabeblack@google.com    fi_sendInvAck;
135514184Sgabeblack@google.com    l_popRequestQueue;
135614184Sgabeblack@google.com  }
135714184Sgabeblack@google.com
135814184Sgabeblack@google.com  transition({PF_IM, PF_SM}, Inv, PF_IM) {
135914184Sgabeblack@google.com    fi_sendInvAck;
136014184Sgabeblack@google.com    l_popRequestQueue;
136114184Sgabeblack@google.com  }
136214184Sgabeblack@google.com
136314184Sgabeblack@google.com  transition(IM, Data, SM) {
136414184Sgabeblack@google.com    u_writeDataToL1Cache;
136514184Sgabeblack@google.com    q_updateAckCount;
136614184Sgabeblack@google.com    o_popIncomingResponseQueue;
136714184Sgabeblack@google.com  }
136814184Sgabeblack@google.com
136914184Sgabeblack@google.com  transition(PF_IM, Data, PF_SM) {
137014184Sgabeblack@google.com    u_writeDataToL1Cache;
137114184Sgabeblack@google.com    q_updateAckCount;
137214184Sgabeblack@google.com    o_popIncomingResponseQueue;
137314184Sgabeblack@google.com  }
137414184Sgabeblack@google.com
137514184Sgabeblack@google.com  transition(IM, Data_all_Acks, M) {
137614184Sgabeblack@google.com    u_writeDataToL1Cache;
137714184Sgabeblack@google.com    hhx_store_hit;
137814184Sgabeblack@google.com    jj_sendExclusiveUnblock;
137914184Sgabeblack@google.com    s_deallocateTBE;
138014184Sgabeblack@google.com    o_popIncomingResponseQueue;
138114184Sgabeblack@google.com    kd_wakeUpDependents;
138214184Sgabeblack@google.com  }
138314184Sgabeblack@google.com
138414184Sgabeblack@google.com  transition(PF_IM, Data_all_Acks, M) {
138514184Sgabeblack@google.com    u_writeDataToL1Cache;
138614184Sgabeblack@google.com    jj_sendExclusiveUnblock;
138714184Sgabeblack@google.com    s_deallocateTBE;
138814184Sgabeblack@google.com    mp_markPrefetched;
138914184Sgabeblack@google.com    o_popIncomingResponseQueue;
139014184Sgabeblack@google.com    kd_wakeUpDependents;
139114184Sgabeblack@google.com  }
139214184Sgabeblack@google.com
139314184Sgabeblack@google.com  // transitions from SM
139414184Sgabeblack@google.com  transition(SM, Inv, IM) {
139514184Sgabeblack@google.com    forward_eviction_to_cpu;
139614184Sgabeblack@google.com    fi_sendInvAck;
139714184Sgabeblack@google.com    dg_invalidate_sc;
139814184Sgabeblack@google.com    l_popRequestQueue;
139914184Sgabeblack@google.com  }
140014184Sgabeblack@google.com
140114184Sgabeblack@google.com  transition({SM, IM, PF_SM, PF_IM}, Ack) {
140214184Sgabeblack@google.com    q_updateAckCount;
140314184Sgabeblack@google.com    o_popIncomingResponseQueue;
140414184Sgabeblack@google.com  }
140514184Sgabeblack@google.com
140614184Sgabeblack@google.com  transition(SM, Ack_all, M) {
140714184Sgabeblack@google.com    jj_sendExclusiveUnblock;
140814184Sgabeblack@google.com    hhx_store_hit;
140914184Sgabeblack@google.com    s_deallocateTBE;
141014184Sgabeblack@google.com    o_popIncomingResponseQueue;
141114184Sgabeblack@google.com    kd_wakeUpDependents;
141214184Sgabeblack@google.com  }
141314184Sgabeblack@google.com
141414184Sgabeblack@google.com  transition(PF_SM, Ack_all, M) {
141514184Sgabeblack@google.com    jj_sendExclusiveUnblock;
141614184Sgabeblack@google.com    s_deallocateTBE;
141714184Sgabeblack@google.com    mp_markPrefetched;
141814184Sgabeblack@google.com    o_popIncomingResponseQueue;
141914184Sgabeblack@google.com    kd_wakeUpDependents;
142014184Sgabeblack@google.com  }
142114184Sgabeblack@google.com
142214184Sgabeblack@google.com  transition(SINK_WB_ACK, Inv){
142314184Sgabeblack@google.com    fi_sendInvAck;
142414184Sgabeblack@google.com    l_popRequestQueue;
142514184Sgabeblack@google.com  }
142614184Sgabeblack@google.com
142714184Sgabeblack@google.com  transition(SINK_WB_ACK, WB_Ack, I){
142814184Sgabeblack@google.com    s_deallocateTBE;
142914184Sgabeblack@google.com    o_popIncomingResponseQueue;
143014184Sgabeblack@google.com    kd_wakeUpDependents;
143114184Sgabeblack@google.com  }
143214184Sgabeblack@google.com}
1433