114184Sgabeblack@google.com/*
214184Sgabeblack@google.com * Copyright (c) 1999-2008 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:Directory, "AMD Hammer-like protocol") 
3714184Sgabeblack@google.com    : DirectoryMemory * directory;
3814184Sgabeblack@google.com      CacheMemory * probeFilter;
3914184Sgabeblack@google.com      Cycles from_memory_controller_latency := 2;
4014184Sgabeblack@google.com      Cycles to_memory_controller_latency := 1;
4114184Sgabeblack@google.com      bool probe_filter_enabled := "False";
4214184Sgabeblack@google.com      bool full_bit_dir_enabled := "False";
4314184Sgabeblack@google.com
4414184Sgabeblack@google.com      MessageBuffer * forwardFromDir, network="To", virtual_network="3",
4514184Sgabeblack@google.com            vnet_type="forward";
4614184Sgabeblack@google.com
4714184Sgabeblack@google.com      MessageBuffer * responseFromDir, network="To", virtual_network="4",
4814184Sgabeblack@google.com            vnet_type="response";
4914184Sgabeblack@google.com
5014184Sgabeblack@google.com      // For a finite buffered network, note that the DMA response network only 
5114184Sgabeblack@google.com      // works at this relatively lower numbered (lower priority) virtual network
5214184Sgabeblack@google.com      // because the trigger queue decouples cache responses from DMA responses.
5314184Sgabeblack@google.com      MessageBuffer * dmaResponseFromDir, network="To", virtual_network="1",
5414184Sgabeblack@google.com            vnet_type="response";
5514184Sgabeblack@google.com
5614184Sgabeblack@google.com      MessageBuffer * unblockToDir, network="From", virtual_network="5",
5714184Sgabeblack@google.com            vnet_type="unblock";
5814184Sgabeblack@google.com
5914184Sgabeblack@google.com      MessageBuffer * responseToDir, network="From", virtual_network="4",
6014184Sgabeblack@google.com            vnet_type="response";
6114184Sgabeblack@google.com
6214184Sgabeblack@google.com      MessageBuffer * requestToDir, network="From", virtual_network="2",
6314184Sgabeblack@google.com            vnet_type="request";
6414184Sgabeblack@google.com
6514184Sgabeblack@google.com      MessageBuffer * dmaRequestToDir, network="From", virtual_network="0",
6614184Sgabeblack@google.com            vnet_type="request";
6714184Sgabeblack@google.com
6814184Sgabeblack@google.com      MessageBuffer * triggerQueue;
6914184Sgabeblack@google.com      MessageBuffer * responseFromMemory;
7014184Sgabeblack@google.com{
7114184Sgabeblack@google.com  // STATES
7214184Sgabeblack@google.com  state_declaration(State, desc="Directory states", default="Directory_State_E") {
7314184Sgabeblack@google.com    // Base states
7414184Sgabeblack@google.com    NX, AccessPermission:Maybe_Stale, desc="Not Owner, probe filter entry exists, block in O at Owner";
7514184Sgabeblack@google.com    NO, AccessPermission:Maybe_Stale, desc="Not Owner, probe filter entry exists, block in E/M at Owner";
7614184Sgabeblack@google.com    S, AccessPermission:Read_Only, desc="Data clean, probe filter entry exists pointing to the current owner";
7714184Sgabeblack@google.com    O, AccessPermission:Read_Only, desc="Data clean, probe filter entry exists";
7814184Sgabeblack@google.com    E, AccessPermission:Read_Write, desc="Exclusive Owner, no probe filter entry";
7914184Sgabeblack@google.com
8014184Sgabeblack@google.com    O_R, AccessPermission:Read_Only, desc="Was data Owner, replacing probe filter entry";
8114184Sgabeblack@google.com    S_R, AccessPermission:Read_Only, desc="Was Not Owner or Sharer, replacing probe filter entry";
8214184Sgabeblack@google.com    NO_R, AccessPermission:Busy, desc="Was Not Owner or Sharer, replacing probe filter entry";
8314184Sgabeblack@google.com
8414184Sgabeblack@google.com    NO_B, AccessPermission:Busy, "NO^B", desc="Not Owner, Blocked";
8514184Sgabeblack@google.com    NO_B_X, AccessPermission:Busy, "NO^B", desc="Not Owner, Blocked, next queued request GETX";
8614184Sgabeblack@google.com    NO_B_S, AccessPermission:Busy, "NO^B", desc="Not Owner, Blocked, next queued request GETS";
8714184Sgabeblack@google.com    NO_B_S_W, AccessPermission:Busy, "NO^B", desc="Not Owner, Blocked, forwarded merged GETS, waiting for responses";
8814184Sgabeblack@google.com    O_B, AccessPermission:Busy, "O^B", desc="Owner, Blocked";
8914184Sgabeblack@google.com    NO_B_W, AccessPermission:Busy, desc="Not Owner, Blocked, waiting for Dram";
9014184Sgabeblack@google.com    O_B_W, AccessPermission:Busy, desc="Owner, Blocked, waiting for Dram";
9114184Sgabeblack@google.com    NO_W, AccessPermission:Busy, desc="Not Owner, waiting for Dram";
9214184Sgabeblack@google.com    O_W, AccessPermission:Busy, desc="Owner, waiting for Dram";
9314184Sgabeblack@google.com    NO_DW_B_W, AccessPermission:Busy, desc="Not Owner, Dma Write waiting for Dram and cache responses";
9414184Sgabeblack@google.com    NO_DR_B_W, AccessPermission:Busy, desc="Not Owner, Dma Read waiting for Dram and cache responses";
9514184Sgabeblack@google.com    NO_DR_B_D, AccessPermission:Busy, desc="Not Owner, Dma Read waiting for cache responses including dirty data";
9614184Sgabeblack@google.com    NO_DR_B, AccessPermission:Busy, desc="Not Owner, Dma Read waiting for cache responses";
9714184Sgabeblack@google.com    NO_DW_W, AccessPermission:Busy, desc="Not Owner, Dma Write waiting for Dram";
9814184Sgabeblack@google.com    O_DR_B_W, AccessPermission:Busy, desc="Owner, Dma Read waiting for Dram and cache responses";
9914184Sgabeblack@google.com    O_DR_B, AccessPermission:Busy, desc="Owner, Dma Read waiting for cache responses";
10014184Sgabeblack@google.com    WB, AccessPermission:Busy, desc="Blocked on a writeback";
10114184Sgabeblack@google.com    WB_O_W, AccessPermission:Busy, desc="Blocked on memory write, will go to O";
10214184Sgabeblack@google.com    WB_E_W, AccessPermission:Busy, desc="Blocked on memory write, will go to E";
10314184Sgabeblack@google.com
10414184Sgabeblack@google.com    NO_F,  AccessPermission:Busy, desc="Blocked on a flush";
10514184Sgabeblack@google.com    NO_F_W, AccessPermission:Busy, desc="Not Owner, Blocked, waiting for Dram";
10614184Sgabeblack@google.com  }
10714184Sgabeblack@google.com
10814184Sgabeblack@google.com  // Events
10914184Sgabeblack@google.com  enumeration(Event, desc="Directory events") {
11014184Sgabeblack@google.com    GETX,                      desc="A GETX arrives";
11114184Sgabeblack@google.com    GETS,                      desc="A GETS arrives";
11214184Sgabeblack@google.com    PUT,                       desc="A PUT arrives"; 
11314184Sgabeblack@google.com    Unblock,                   desc="An unblock message arrives";
11414184Sgabeblack@google.com    UnblockS,                   desc="An unblock message arrives";
11514184Sgabeblack@google.com    UnblockM,                   desc="An unblock message arrives";
11614184Sgabeblack@google.com    Writeback_Clean,           desc="The final part of a PutX (no data)";
11714184Sgabeblack@google.com    Writeback_Dirty,           desc="The final part of a PutX (data)";
11814184Sgabeblack@google.com    Writeback_Exclusive_Clean, desc="The final part of a PutX (no data, exclusive)";
11914184Sgabeblack@google.com    Writeback_Exclusive_Dirty, desc="The final part of a PutX (data, exclusive)";
12014184Sgabeblack@google.com
12114184Sgabeblack@google.com    // Probe filter
12214184Sgabeblack@google.com    Pf_Replacement,            desc="probe filter replacement";
12314184Sgabeblack@google.com
12414184Sgabeblack@google.com    // DMA requests
12514184Sgabeblack@google.com    DMA_READ, desc="A DMA Read memory request";
12614184Sgabeblack@google.com    DMA_WRITE, desc="A DMA Write memory request";
12714184Sgabeblack@google.com
12814184Sgabeblack@google.com    // Memory Controller
12914184Sgabeblack@google.com    Memory_Data, desc="Fetched data from memory arrives";
13014184Sgabeblack@google.com    Memory_Ack, desc="Writeback Ack from memory arrives";
13114184Sgabeblack@google.com
13214184Sgabeblack@google.com    // Cache responses required to handle DMA
13314184Sgabeblack@google.com    Ack,             desc="Received an ack message";
13414184Sgabeblack@google.com    Shared_Ack,      desc="Received an ack message, responder has a shared copy";
13514184Sgabeblack@google.com    Shared_Data,     desc="Received a data message, responder has a shared copy";
13614184Sgabeblack@google.com    Data,            desc="Received a data message, responder had a owner or exclusive copy, they gave it to us";
13714184Sgabeblack@google.com    Exclusive_Data,  desc="Received a data message, responder had an exclusive copy, they gave it to us";
13814184Sgabeblack@google.com
13914184Sgabeblack@google.com    // Triggers
14014184Sgabeblack@google.com    All_acks_and_shared_data,     desc="Received shared data and message acks";
14114184Sgabeblack@google.com    All_acks_and_owner_data,     desc="Received shared data and message acks";
14214184Sgabeblack@google.com    All_acks_and_data_no_sharers, desc="Received all acks and no other processor has a shared copy";
14314184Sgabeblack@google.com    All_Unblocks, desc="Received all unblocks for a merged gets request";
14414184Sgabeblack@google.com    GETF,  desc="A GETF arrives";
14514184Sgabeblack@google.com    PUTF,  desc="A PUTF arrives";
14614184Sgabeblack@google.com  }
14714184Sgabeblack@google.com
14814184Sgabeblack@google.com  // TYPES
14914184Sgabeblack@google.com
15014184Sgabeblack@google.com  // DirectoryEntry
15114184Sgabeblack@google.com  structure(Entry, desc="...", interface="AbstractEntry") {
15214184Sgabeblack@google.com    State DirectoryState,          desc="Directory state";
15314184Sgabeblack@google.com  }
15414184Sgabeblack@google.com
15514184Sgabeblack@google.com  // ProbeFilterEntry
15614184Sgabeblack@google.com  structure(PfEntry, desc="...", interface="AbstractCacheEntry") {
15714184Sgabeblack@google.com    State PfState,                 desc="Directory state";
15814184Sgabeblack@google.com    MachineID Owner,               desc="Owner node";
15914184Sgabeblack@google.com    Set Sharers,                   desc="sharing vector for full bit directory";
16014184Sgabeblack@google.com  }
16114184Sgabeblack@google.com
16214184Sgabeblack@google.com  // TBE entries for DMA requests
16314184Sgabeblack@google.com  structure(TBE, desc="TBE entries for outstanding DMA requests") {
16414184Sgabeblack@google.com    Addr PhysicalAddress, desc="physical address";
16514184Sgabeblack@google.com    State TBEState,        desc="Transient State";
16614184Sgabeblack@google.com    CoherenceResponseType ResponseType, desc="The type for the subsequent response message";
16714184Sgabeblack@google.com    int Acks, default="0", desc="The number of acks that the waiting response represents";
16814184Sgabeblack@google.com    int SilentAcks, default="0", desc="The number of silent acks associated with this transaction";
16914184Sgabeblack@google.com    DataBlock DmaDataBlk,  desc="DMA Data to be written.  Partial blocks need to merged with system memory";
17014184Sgabeblack@google.com    DataBlock DataBlk,     desc="The current view of system memory";
17114184Sgabeblack@google.com    int Len,               desc="...";
17214184Sgabeblack@google.com    MachineID DmaRequestor, desc="DMA requestor";
17314184Sgabeblack@google.com    NetDest GetSRequestors, desc="GETS merged requestors";
17414184Sgabeblack@google.com    int NumPendingMsgs,    desc="Number of pending acks/messages";
17514184Sgabeblack@google.com    bool CacheDirty, default="false", desc="Indicates whether a cache has responded with dirty data";
17614184Sgabeblack@google.com    bool Sharers, default="false", desc="Indicates whether a cache has indicated it is currently a sharer";
17714184Sgabeblack@google.com    bool Owned, default="false", desc="Indicates whether a cache has indicated it is currently a sharer";
17814184Sgabeblack@google.com  }
17914184Sgabeblack@google.com
18014184Sgabeblack@google.com  structure(TBETable, external="yes") {
18114184Sgabeblack@google.com    TBE lookup(Addr);
18214184Sgabeblack@google.com    void allocate(Addr);
18314184Sgabeblack@google.com    void deallocate(Addr);
18414184Sgabeblack@google.com    bool isPresent(Addr);
18514184Sgabeblack@google.com  }
18614184Sgabeblack@google.com
18714184Sgabeblack@google.com  Tick clockEdge();
18814184Sgabeblack@google.com  void set_cache_entry(AbstractCacheEntry b);
18914184Sgabeblack@google.com  void unset_cache_entry();
19014184Sgabeblack@google.com  void set_tbe(TBE a);
19114184Sgabeblack@google.com  void unset_tbe();
19214184Sgabeblack@google.com  void wakeUpBuffers(Addr a);
19314184Sgabeblack@google.com  Cycles curCycle();
19414184Sgabeblack@google.com
19514184Sgabeblack@google.com  // ** OBJECTS **
19614184Sgabeblack@google.com
19714184Sgabeblack@google.com  Set fwd_set;
19814184Sgabeblack@google.com
19914184Sgabeblack@google.com  TBETable TBEs, template="<Directory_TBE>", constructor="m_number_of_TBEs";
20014184Sgabeblack@google.com
20114184Sgabeblack@google.com  Entry getDirectoryEntry(Addr addr), return_by_pointer="yes" {
20214184Sgabeblack@google.com    Entry dir_entry := static_cast(Entry, "pointer", directory[addr]);
20314184Sgabeblack@google.com
20414184Sgabeblack@google.com    if (is_valid(dir_entry)) {
20514184Sgabeblack@google.com      return dir_entry;
20614184Sgabeblack@google.com    }
20714184Sgabeblack@google.com
20814184Sgabeblack@google.com    dir_entry :=  static_cast(Entry, "pointer",
20914184Sgabeblack@google.com                              directory.allocate(addr, new Entry));
21014184Sgabeblack@google.com    return dir_entry;
21114184Sgabeblack@google.com  }
21214184Sgabeblack@google.com
21314184Sgabeblack@google.com  PfEntry getProbeFilterEntry(Addr addr), return_by_pointer="yes" {
21414184Sgabeblack@google.com    if (probe_filter_enabled || full_bit_dir_enabled) {
21514184Sgabeblack@google.com      PfEntry pfEntry := static_cast(PfEntry, "pointer", probeFilter.lookup(addr));
21614184Sgabeblack@google.com      return pfEntry;
21714184Sgabeblack@google.com    }
21814184Sgabeblack@google.com    return OOD;
21914184Sgabeblack@google.com  }
22014184Sgabeblack@google.com
22114184Sgabeblack@google.com  State getState(TBE tbe, PfEntry pf_entry, Addr addr) {
22214184Sgabeblack@google.com    if (is_valid(tbe)) {
22314184Sgabeblack@google.com      return tbe.TBEState;
22414184Sgabeblack@google.com    } else {
22514184Sgabeblack@google.com      if (probe_filter_enabled || full_bit_dir_enabled) {
22614184Sgabeblack@google.com        if (is_valid(pf_entry)) {
22714184Sgabeblack@google.com          assert(pf_entry.PfState == getDirectoryEntry(addr).DirectoryState);
22814184Sgabeblack@google.com        }
22914184Sgabeblack@google.com      }
23014184Sgabeblack@google.com      return getDirectoryEntry(addr).DirectoryState;
23114184Sgabeblack@google.com    }
23214184Sgabeblack@google.com  }
23314184Sgabeblack@google.com
23414184Sgabeblack@google.com  void setState(TBE tbe, PfEntry pf_entry, Addr addr, State state) {
23514184Sgabeblack@google.com    if (is_valid(tbe)) {
23614184Sgabeblack@google.com      tbe.TBEState := state;
23714184Sgabeblack@google.com    }
23814184Sgabeblack@google.com    if (probe_filter_enabled || full_bit_dir_enabled) {
23914184Sgabeblack@google.com      if (is_valid(pf_entry)) {
24014184Sgabeblack@google.com        pf_entry.PfState := state;
24114184Sgabeblack@google.com      }
24214184Sgabeblack@google.com      if (state == State:NX || state == State:NO || state == State:S || state == State:O) {
24314184Sgabeblack@google.com        assert(is_valid(pf_entry));
24414184Sgabeblack@google.com      }
24514184Sgabeblack@google.com      if (state == State:E) {
24614184Sgabeblack@google.com        assert(is_valid(pf_entry) == false);
24714184Sgabeblack@google.com      }
24814184Sgabeblack@google.com    }
24914184Sgabeblack@google.com    if (state == State:E || state == State:NX || state == State:NO || state == State:S || 
25014184Sgabeblack@google.com        state == State:O) {
25114184Sgabeblack@google.com      assert(is_valid(tbe) == false);
25214184Sgabeblack@google.com    }
25314184Sgabeblack@google.com    getDirectoryEntry(addr).DirectoryState := state;
25414184Sgabeblack@google.com  }
25514184Sgabeblack@google.com
25614184Sgabeblack@google.com  AccessPermission getAccessPermission(Addr addr) {
25714184Sgabeblack@google.com    TBE tbe := TBEs[addr];
25814184Sgabeblack@google.com    if(is_valid(tbe)) {
25914184Sgabeblack@google.com      return Directory_State_to_permission(tbe.TBEState);
26014184Sgabeblack@google.com    }
26114184Sgabeblack@google.com
26214184Sgabeblack@google.com    if(directory.isPresent(addr)) {
26314184Sgabeblack@google.com      return Directory_State_to_permission(getDirectoryEntry(addr).DirectoryState);
26414184Sgabeblack@google.com    }
26514184Sgabeblack@google.com
26614184Sgabeblack@google.com    return AccessPermission:NotPresent;
26714184Sgabeblack@google.com  }
26814184Sgabeblack@google.com
26914184Sgabeblack@google.com  void setAccessPermission(PfEntry pf_entry, Addr addr, State state) {
27014184Sgabeblack@google.com    getDirectoryEntry(addr).changePermission(Directory_State_to_permission(state));
27114184Sgabeblack@google.com  }
27214184Sgabeblack@google.com
27314184Sgabeblack@google.com  void functionalRead(Addr addr, Packet *pkt) {
27414184Sgabeblack@google.com    TBE tbe := TBEs[addr];
27514184Sgabeblack@google.com    if(is_valid(tbe)) {
27614184Sgabeblack@google.com      testAndRead(addr, tbe.DataBlk, pkt);
27714184Sgabeblack@google.com    } else {
27814184Sgabeblack@google.com      functionalMemoryRead(pkt);
27914184Sgabeblack@google.com    }
28014184Sgabeblack@google.com  }
28114184Sgabeblack@google.com
28214184Sgabeblack@google.com  int functionalWrite(Addr addr, Packet *pkt) {
28314184Sgabeblack@google.com    int num_functional_writes := 0;
28414184Sgabeblack@google.com
28514184Sgabeblack@google.com    TBE tbe := TBEs[addr];
28614184Sgabeblack@google.com    if(is_valid(tbe)) {
28714184Sgabeblack@google.com      num_functional_writes := num_functional_writes +
28814184Sgabeblack@google.com        testAndWrite(addr, tbe.DataBlk, pkt);
28914184Sgabeblack@google.com    }
29014184Sgabeblack@google.com
29114184Sgabeblack@google.com    num_functional_writes := num_functional_writes + functionalMemoryWrite(pkt);
29214184Sgabeblack@google.com    return num_functional_writes;
29314184Sgabeblack@google.com  }
29414184Sgabeblack@google.com
29514184Sgabeblack@google.com  Event cache_request_to_event(CoherenceRequestType type) {
29614184Sgabeblack@google.com    if (type == CoherenceRequestType:GETS) {
29714184Sgabeblack@google.com      return Event:GETS;
29814184Sgabeblack@google.com    } else if (type == CoherenceRequestType:GETX) {
29914184Sgabeblack@google.com      return Event:GETX;
30014184Sgabeblack@google.com    } else if (type == CoherenceRequestType:GETF) {
30114184Sgabeblack@google.com      return Event:GETF;
30214184Sgabeblack@google.com    } else {
30314184Sgabeblack@google.com      error("Invalid CoherenceRequestType");
30414184Sgabeblack@google.com    }
30514184Sgabeblack@google.com  }
30614184Sgabeblack@google.com
30714184Sgabeblack@google.com  // ** OUT_PORTS **
30814184Sgabeblack@google.com  out_port(requestQueue_out, ResponseMsg, requestToDir); // For recycling requests
30914184Sgabeblack@google.com  out_port(forwardNetwork_out, RequestMsg, forwardFromDir);
31014184Sgabeblack@google.com  out_port(responseNetwork_out, ResponseMsg, responseFromDir);
31114184Sgabeblack@google.com  out_port(dmaResponseNetwork_out, DMAResponseMsg, dmaResponseFromDir);
31214184Sgabeblack@google.com  out_port(triggerQueue_out, TriggerMsg, triggerQueue);
31314184Sgabeblack@google.com  
31414184Sgabeblack@google.com  // ** IN_PORTS **
31514184Sgabeblack@google.com  
31614184Sgabeblack@google.com  // Trigger Queue
31714184Sgabeblack@google.com  in_port(triggerQueue_in, TriggerMsg, triggerQueue, rank=5) {
31814184Sgabeblack@google.com    if (triggerQueue_in.isReady(clockEdge())) {
31914184Sgabeblack@google.com      peek(triggerQueue_in, TriggerMsg) {
32014184Sgabeblack@google.com        PfEntry pf_entry := getProbeFilterEntry(in_msg.addr);
32114184Sgabeblack@google.com        TBE tbe := TBEs[in_msg.addr];
32214184Sgabeblack@google.com        if (in_msg.Type == TriggerType:ALL_ACKS) {
32314184Sgabeblack@google.com          trigger(Event:All_acks_and_owner_data, in_msg.addr,
32414184Sgabeblack@google.com                  pf_entry, tbe);
32514184Sgabeblack@google.com        } else if (in_msg.Type == TriggerType:ALL_ACKS_OWNER_EXISTS) {
32614184Sgabeblack@google.com          trigger(Event:All_acks_and_shared_data, in_msg.addr,
32714184Sgabeblack@google.com                  pf_entry, tbe);
32814184Sgabeblack@google.com        } else if (in_msg.Type == TriggerType:ALL_ACKS_NO_SHARERS) {
32914184Sgabeblack@google.com          trigger(Event:All_acks_and_data_no_sharers, in_msg.addr,
33014184Sgabeblack@google.com                  pf_entry, tbe);
33114184Sgabeblack@google.com        } else if (in_msg.Type == TriggerType:ALL_UNBLOCKS) {
33214184Sgabeblack@google.com          trigger(Event:All_Unblocks, in_msg.addr,
33314184Sgabeblack@google.com                  pf_entry, tbe);
33414184Sgabeblack@google.com        } else {
33514184Sgabeblack@google.com          error("Unexpected message");
33614184Sgabeblack@google.com        }
33714184Sgabeblack@google.com      }
33814184Sgabeblack@google.com    }
33914184Sgabeblack@google.com  }
34014184Sgabeblack@google.com
34114184Sgabeblack@google.com  in_port(unblockNetwork_in, ResponseMsg, unblockToDir, rank=4) {
34214184Sgabeblack@google.com    if (unblockNetwork_in.isReady(clockEdge())) {
34314184Sgabeblack@google.com      peek(unblockNetwork_in, ResponseMsg) {
34414184Sgabeblack@google.com        PfEntry pf_entry := getProbeFilterEntry(in_msg.addr);
34514184Sgabeblack@google.com        TBE tbe := TBEs[in_msg.addr];
34614184Sgabeblack@google.com        if (in_msg.Type == CoherenceResponseType:UNBLOCK) {
34714184Sgabeblack@google.com          trigger(Event:Unblock, in_msg.addr, pf_entry, tbe);
34814184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:UNBLOCKS) {
34914184Sgabeblack@google.com          trigger(Event:UnblockS, in_msg.addr, pf_entry, tbe);
35014184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:UNBLOCKM) {
35114184Sgabeblack@google.com          trigger(Event:UnblockM, in_msg.addr, pf_entry, tbe);
35214184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:WB_CLEAN) {
35314184Sgabeblack@google.com          trigger(Event:Writeback_Clean, in_msg.addr, pf_entry, tbe);
35414184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:WB_DIRTY) {
35514184Sgabeblack@google.com          trigger(Event:Writeback_Dirty, in_msg.addr, pf_entry, tbe);
35614184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:WB_EXCLUSIVE_CLEAN) {
35714184Sgabeblack@google.com          trigger(Event:Writeback_Exclusive_Clean, in_msg.addr,
35814184Sgabeblack@google.com                  pf_entry, tbe);
35914184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:WB_EXCLUSIVE_DIRTY) {
36014184Sgabeblack@google.com          trigger(Event:Writeback_Exclusive_Dirty, in_msg.addr,
36114184Sgabeblack@google.com                  pf_entry, tbe);
36214184Sgabeblack@google.com        } else {
36314184Sgabeblack@google.com          error("Invalid message");
36414184Sgabeblack@google.com        }
36514184Sgabeblack@google.com      }
36614184Sgabeblack@google.com    }
36714184Sgabeblack@google.com  }
36814184Sgabeblack@google.com
36914184Sgabeblack@google.com  // Response Network
37014184Sgabeblack@google.com  in_port(responseToDir_in, ResponseMsg, responseToDir, rank=3) {
37114184Sgabeblack@google.com    if (responseToDir_in.isReady(clockEdge())) {
37214184Sgabeblack@google.com      peek(responseToDir_in, ResponseMsg) {
37314184Sgabeblack@google.com        PfEntry pf_entry := getProbeFilterEntry(in_msg.addr);
37414184Sgabeblack@google.com        TBE tbe := TBEs[in_msg.addr];
37514184Sgabeblack@google.com        if (in_msg.Type == CoherenceResponseType:ACK) {
37614184Sgabeblack@google.com          trigger(Event:Ack, in_msg.addr, pf_entry, tbe);
37714184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:ACK_SHARED) {
37814184Sgabeblack@google.com          trigger(Event:Shared_Ack, in_msg.addr, pf_entry, tbe);
37914184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:DATA_SHARED) {
38014184Sgabeblack@google.com          trigger(Event:Shared_Data, in_msg.addr, pf_entry, tbe);
38114184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:DATA) {
38214184Sgabeblack@google.com          trigger(Event:Data, in_msg.addr, pf_entry, tbe);
38314184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceResponseType:DATA_EXCLUSIVE) {
38414184Sgabeblack@google.com          trigger(Event:Exclusive_Data, in_msg.addr, pf_entry, tbe);
38514184Sgabeblack@google.com        } else {
38614184Sgabeblack@google.com          error("Unexpected message");
38714184Sgabeblack@google.com        }
38814184Sgabeblack@google.com      }
38914184Sgabeblack@google.com    }
39014184Sgabeblack@google.com  }
39114184Sgabeblack@google.com
39214184Sgabeblack@google.com  // off-chip memory request/response is done
39314184Sgabeblack@google.com  in_port(memQueue_in, MemoryMsg, responseFromMemory, rank=2) {
39414184Sgabeblack@google.com    if (memQueue_in.isReady(clockEdge())) {
39514184Sgabeblack@google.com      peek(memQueue_in, MemoryMsg) {
39614184Sgabeblack@google.com        PfEntry pf_entry := getProbeFilterEntry(in_msg.addr);
39714184Sgabeblack@google.com        TBE tbe := TBEs[in_msg.addr];
39814184Sgabeblack@google.com        if (in_msg.Type == MemoryRequestType:MEMORY_READ) {
39914184Sgabeblack@google.com          trigger(Event:Memory_Data, in_msg.addr, pf_entry, tbe);
40014184Sgabeblack@google.com        } else if (in_msg.Type == MemoryRequestType:MEMORY_WB) {
40114184Sgabeblack@google.com          trigger(Event:Memory_Ack, in_msg.addr, pf_entry, tbe);
40214184Sgabeblack@google.com        } else {
40314184Sgabeblack@google.com          DPRINTF(RubySlicc, "%d\n", in_msg.Type);
40414184Sgabeblack@google.com          error("Invalid message");
40514184Sgabeblack@google.com        }
40614184Sgabeblack@google.com      }
40714184Sgabeblack@google.com    }
40814184Sgabeblack@google.com  }
40914184Sgabeblack@google.com
41014184Sgabeblack@google.com  in_port(requestQueue_in, RequestMsg, requestToDir, rank=1) {
41114184Sgabeblack@google.com    if (requestQueue_in.isReady(clockEdge())) {
41214184Sgabeblack@google.com      peek(requestQueue_in, RequestMsg) {
41314184Sgabeblack@google.com        PfEntry pf_entry := getProbeFilterEntry(in_msg.addr);
41414184Sgabeblack@google.com        TBE tbe := TBEs[in_msg.addr];
41514184Sgabeblack@google.com        if (in_msg.Type == CoherenceRequestType:PUT) {
41614184Sgabeblack@google.com          trigger(Event:PUT, in_msg.addr, pf_entry, tbe);
41714184Sgabeblack@google.com        } else if (in_msg.Type == CoherenceRequestType:PUTF) {
41814184Sgabeblack@google.com          trigger(Event:PUTF, in_msg.addr, pf_entry, tbe);
41914184Sgabeblack@google.com        } else {
42014184Sgabeblack@google.com          if (probe_filter_enabled || full_bit_dir_enabled) {
42114184Sgabeblack@google.com            if (is_valid(pf_entry)) {
42214184Sgabeblack@google.com              trigger(cache_request_to_event(in_msg.Type), in_msg.addr,
42314184Sgabeblack@google.com                      pf_entry, tbe);
42414184Sgabeblack@google.com            } else {
42514184Sgabeblack@google.com              if (probeFilter.cacheAvail(in_msg.addr)) {
42614184Sgabeblack@google.com                trigger(cache_request_to_event(in_msg.Type), in_msg.addr,
42714184Sgabeblack@google.com                        pf_entry, tbe);
42814184Sgabeblack@google.com              } else {
42914184Sgabeblack@google.com                trigger(Event:Pf_Replacement,
43014300Sjqu32@wisc.edu                Addr victim := probeFilter.cacheProbe(in_msg.addr);
43114300Sjqu32@wisc.edu                trigger(Event:Pf_Replacement,
43214300Sjqu32@wisc.edu                        victim, getProbeFilterEntry(victim), TBEs[victim]);
43314184Sgabeblack@google.com              }
43414184Sgabeblack@google.com            }
43514184Sgabeblack@google.com          } else {
43614184Sgabeblack@google.com            trigger(cache_request_to_event(in_msg.Type), in_msg.addr,
43714184Sgabeblack@google.com                    pf_entry, tbe);
43814184Sgabeblack@google.com          }
43914184Sgabeblack@google.com        }
44014184Sgabeblack@google.com      }
44114184Sgabeblack@google.com    }
44214184Sgabeblack@google.com  }
44314184Sgabeblack@google.com
44414184Sgabeblack@google.com  in_port(dmaRequestQueue_in, DMARequestMsg, dmaRequestToDir, rank=0) {
44514184Sgabeblack@google.com    if (dmaRequestQueue_in.isReady(clockEdge())) {
44614184Sgabeblack@google.com      peek(dmaRequestQueue_in, DMARequestMsg) {
44714184Sgabeblack@google.com        PfEntry pf_entry := getProbeFilterEntry(in_msg.LineAddress);
44814184Sgabeblack@google.com        TBE tbe := TBEs[in_msg.LineAddress];
44914184Sgabeblack@google.com        if (in_msg.Type == DMARequestType:READ) {
45014184Sgabeblack@google.com          trigger(Event:DMA_READ, in_msg.LineAddress, pf_entry, tbe);
45114184Sgabeblack@google.com        } else if (in_msg.Type == DMARequestType:WRITE) {
45214184Sgabeblack@google.com          trigger(Event:DMA_WRITE, in_msg.LineAddress, pf_entry, tbe);
45314184Sgabeblack@google.com        } else {
45414184Sgabeblack@google.com          error("Invalid message");
45514184Sgabeblack@google.com        }
45614184Sgabeblack@google.com      }
45714184Sgabeblack@google.com    }
45814184Sgabeblack@google.com  }
45914184Sgabeblack@google.com
46014184Sgabeblack@google.com  // Actions
46114184Sgabeblack@google.com  
46214184Sgabeblack@google.com  action(r_setMRU, "\rr", desc="manually set the MRU bit for pf entry" ) {
46314184Sgabeblack@google.com    if (probe_filter_enabled || full_bit_dir_enabled) {
46414184Sgabeblack@google.com      assert(is_valid(cache_entry)); 
46514184Sgabeblack@google.com      probeFilter.setMRU(address);
46614184Sgabeblack@google.com    }
46714184Sgabeblack@google.com  }
46814184Sgabeblack@google.com
46914184Sgabeblack@google.com  action(auno_assertUnblockerNotOwner, "auno", desc="assert unblocker not owner") {
47014184Sgabeblack@google.com    if (probe_filter_enabled || full_bit_dir_enabled) {
47114184Sgabeblack@google.com      assert(is_valid(cache_entry)); 
47214184Sgabeblack@google.com      peek(unblockNetwork_in, ResponseMsg) {
47314184Sgabeblack@google.com        assert(cache_entry.Owner != in_msg.Sender);
47414184Sgabeblack@google.com        if (full_bit_dir_enabled) {
47514184Sgabeblack@google.com          assert(cache_entry.Sharers.isElement(machineIDToNodeID(in_msg.Sender)) == false);
47614184Sgabeblack@google.com        }
47714184Sgabeblack@google.com      }
47814184Sgabeblack@google.com    }
47914184Sgabeblack@google.com  }
48014184Sgabeblack@google.com
48114184Sgabeblack@google.com  action(uo_updateOwnerIfPf, "uo", desc="update owner") {
48214184Sgabeblack@google.com    if (probe_filter_enabled || full_bit_dir_enabled) {
48314184Sgabeblack@google.com      assert(is_valid(cache_entry)); 
48414184Sgabeblack@google.com      peek(unblockNetwork_in, ResponseMsg) {
48514184Sgabeblack@google.com        cache_entry.Owner := in_msg.Sender;
48614184Sgabeblack@google.com        if (full_bit_dir_enabled) {
48714184Sgabeblack@google.com          cache_entry.Sharers.clear();
48814184Sgabeblack@google.com          cache_entry.Sharers.add(machineIDToNodeID(in_msg.Sender));
48914184Sgabeblack@google.com          APPEND_TRANSITION_COMMENT(cache_entry.Sharers);
49014184Sgabeblack@google.com          DPRINTF(RubySlicc, "Sharers = %d\n", cache_entry.Sharers);
49114184Sgabeblack@google.com        }
49214184Sgabeblack@google.com      }
49314184Sgabeblack@google.com    }
49414184Sgabeblack@google.com  }
49514184Sgabeblack@google.com
49614184Sgabeblack@google.com  action(us_updateSharerIfFBD, "us", desc="update sharer if full-bit directory") {
49714184Sgabeblack@google.com   if (full_bit_dir_enabled) {
49814184Sgabeblack@google.com      assert(probeFilter.isTagPresent(address));
49914184Sgabeblack@google.com      peek(unblockNetwork_in, ResponseMsg) {
50014184Sgabeblack@google.com        cache_entry.Sharers.add(machineIDToNodeID(in_msg.Sender));
50114184Sgabeblack@google.com      }
50214184Sgabeblack@google.com    }
50314184Sgabeblack@google.com  }
50414184Sgabeblack@google.com
50514184Sgabeblack@google.com  action(a_sendWriteBackAck, "a", desc="Send writeback ack to requestor") {
50614184Sgabeblack@google.com    peek(requestQueue_in, RequestMsg) {
50714184Sgabeblack@google.com      enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
50814184Sgabeblack@google.com        out_msg.addr := address;
50914184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:WB_ACK;
51014184Sgabeblack@google.com        out_msg.Requestor := in_msg.Requestor;
51114184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
51214184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Control;
51314184Sgabeblack@google.com      }
51414184Sgabeblack@google.com    }
51514184Sgabeblack@google.com  }
51614184Sgabeblack@google.com
51714184Sgabeblack@google.com  action(oc_sendBlockAck, "oc", desc="Send block ack to the owner") {
51814184Sgabeblack@google.com    peek(requestQueue_in, RequestMsg) {
51914184Sgabeblack@google.com        if (((probe_filter_enabled || full_bit_dir_enabled) && (in_msg.Requestor == cache_entry.Owner)) || machineCount(MachineType:L1Cache) == 1) {
52014184Sgabeblack@google.com        enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
52114184Sgabeblack@google.com          out_msg.addr := address;
52214184Sgabeblack@google.com          out_msg.Type := CoherenceRequestType:BLOCK_ACK;
52314184Sgabeblack@google.com          out_msg.Requestor := in_msg.Requestor;
52414184Sgabeblack@google.com          out_msg.Destination.add(in_msg.Requestor);
52514184Sgabeblack@google.com          out_msg.MessageSize := MessageSizeType:Writeback_Control;
52614184Sgabeblack@google.com        }
52714184Sgabeblack@google.com      }
52814184Sgabeblack@google.com    }
52914184Sgabeblack@google.com  }
53014184Sgabeblack@google.com
53114184Sgabeblack@google.com  action(b_sendWriteBackNack, "b", desc="Send writeback nack to requestor") {
53214184Sgabeblack@google.com    peek(requestQueue_in, RequestMsg) {
53314184Sgabeblack@google.com      enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
53414184Sgabeblack@google.com        out_msg.addr := address;
53514184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:WB_NACK;
53614184Sgabeblack@google.com        out_msg.Requestor := in_msg.Requestor;
53714184Sgabeblack@google.com        out_msg.Destination.add(in_msg.Requestor);
53814184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Writeback_Control;
53914184Sgabeblack@google.com      }
54014184Sgabeblack@google.com    }
54114184Sgabeblack@google.com  }
54214184Sgabeblack@google.com
54314184Sgabeblack@google.com  action(pfa_probeFilterAllocate, "pfa", desc="Allocate ProbeFilterEntry") {
54414184Sgabeblack@google.com    if (probe_filter_enabled || full_bit_dir_enabled) {
54514184Sgabeblack@google.com      peek(requestQueue_in, RequestMsg) {
54614184Sgabeblack@google.com        set_cache_entry(probeFilter.allocate(address, new PfEntry));
54714184Sgabeblack@google.com        cache_entry.Owner := in_msg.Requestor;
54814184Sgabeblack@google.com        cache_entry.Sharers.setSize(machineCount(MachineType:L1Cache));
54914184Sgabeblack@google.com      }
55014184Sgabeblack@google.com    }
55114184Sgabeblack@google.com  }
55214184Sgabeblack@google.com
55314184Sgabeblack@google.com  action(pfd_probeFilterDeallocate, "pfd", desc="Deallocate ProbeFilterEntry") {
55414184Sgabeblack@google.com    if (probe_filter_enabled || full_bit_dir_enabled) {
55514184Sgabeblack@google.com      probeFilter.deallocate(address);
55614184Sgabeblack@google.com      unset_cache_entry();
55714184Sgabeblack@google.com    }
55814184Sgabeblack@google.com  }
55914184Sgabeblack@google.com
56014184Sgabeblack@google.com  action(ppfd_possibleProbeFilterDeallocate, "ppfd", desc="Deallocate ProbeFilterEntry") {
56114184Sgabeblack@google.com    if ((probe_filter_enabled || full_bit_dir_enabled) && is_valid(cache_entry)) {
56214184Sgabeblack@google.com      probeFilter.deallocate(address);
56314184Sgabeblack@google.com      unset_cache_entry();
56414184Sgabeblack@google.com    }
56514184Sgabeblack@google.com  }
56614184Sgabeblack@google.com
56714184Sgabeblack@google.com  action(v_allocateTBE, "v", desc="Allocate TBE") {
56814184Sgabeblack@google.com    check_allocate(TBEs);
56914184Sgabeblack@google.com    peek(requestQueue_in, RequestMsg) {
57014184Sgabeblack@google.com      TBEs.allocate(address);
57114184Sgabeblack@google.com      set_tbe(TBEs[address]);
57214184Sgabeblack@google.com      tbe.PhysicalAddress := address;
57314184Sgabeblack@google.com      tbe.ResponseType := CoherenceResponseType:NULL;
57414184Sgabeblack@google.com    }
57514184Sgabeblack@google.com  }
57614184Sgabeblack@google.com
57714184Sgabeblack@google.com  action(vd_allocateDmaRequestInTBE, "vd", desc="Record Data in TBE") {
57814184Sgabeblack@google.com    check_allocate(TBEs);
57914184Sgabeblack@google.com    peek(dmaRequestQueue_in, DMARequestMsg) {
58014184Sgabeblack@google.com      TBEs.allocate(address);
58114184Sgabeblack@google.com      set_tbe(TBEs[address]);
58214184Sgabeblack@google.com      tbe.DmaDataBlk := in_msg.DataBlk;
58314184Sgabeblack@google.com      tbe.PhysicalAddress := in_msg.PhysicalAddress;
58414184Sgabeblack@google.com      tbe.Len := in_msg.Len;
58514184Sgabeblack@google.com      tbe.DmaRequestor := in_msg.Requestor;
58614184Sgabeblack@google.com      tbe.ResponseType := CoherenceResponseType:DATA_EXCLUSIVE;
58714184Sgabeblack@google.com      //
58814184Sgabeblack@google.com      // One ack for each last-level cache
58914184Sgabeblack@google.com      //
59014184Sgabeblack@google.com      tbe.NumPendingMsgs := machineCount(MachineType:L1Cache);
59114184Sgabeblack@google.com      //
59214184Sgabeblack@google.com      // Assume initially that the caches store a clean copy and that memory
59314184Sgabeblack@google.com      // will provide the data
59414184Sgabeblack@google.com      //
59514184Sgabeblack@google.com      tbe.CacheDirty := false;
59614184Sgabeblack@google.com    }
59714184Sgabeblack@google.com  }
59814184Sgabeblack@google.com
59914184Sgabeblack@google.com  action(pa_setPendingMsgsToAll, "pa", desc="set pending msgs to all") {
60014184Sgabeblack@google.com    assert(is_valid(tbe));
60114184Sgabeblack@google.com    if (full_bit_dir_enabled) {
60214184Sgabeblack@google.com      assert(is_valid(cache_entry));
60314184Sgabeblack@google.com      tbe.NumPendingMsgs := cache_entry.Sharers.count();
60414184Sgabeblack@google.com    } else {
60514184Sgabeblack@google.com      tbe.NumPendingMsgs := machineCount(MachineType:L1Cache);
60614184Sgabeblack@google.com    }
60714184Sgabeblack@google.com  }
60814184Sgabeblack@google.com
60914184Sgabeblack@google.com  action(po_setPendingMsgsToOne, "po", desc="set pending msgs to one") {
61014184Sgabeblack@google.com    assert(is_valid(tbe));
61114184Sgabeblack@google.com    tbe.NumPendingMsgs := 1;
61214184Sgabeblack@google.com  }
61314184Sgabeblack@google.com
61414184Sgabeblack@google.com  action(w_deallocateTBE, "w", desc="Deallocate TBE") {
61514184Sgabeblack@google.com    TBEs.deallocate(address);
61614184Sgabeblack@google.com    unset_tbe();
61714184Sgabeblack@google.com  }
61814184Sgabeblack@google.com
61914184Sgabeblack@google.com  action(sa_setAcksToOne, "sa", desc="Forwarded request, set the ack amount to one") {
62014184Sgabeblack@google.com    assert(is_valid(tbe));
62114184Sgabeblack@google.com    peek(requestQueue_in, RequestMsg) {
62214184Sgabeblack@google.com      if (full_bit_dir_enabled) {
62314184Sgabeblack@google.com        assert(is_valid(cache_entry));
62414184Sgabeblack@google.com        //
62514184Sgabeblack@google.com        // If we are using the full-bit directory and no sharers exists beyond
62614184Sgabeblack@google.com        // the requestor, then we must set the ack number to all, not one
62714184Sgabeblack@google.com        //
62814184Sgabeblack@google.com        fwd_set := cache_entry.Sharers;
62914184Sgabeblack@google.com        fwd_set.remove(machineIDToNodeID(in_msg.Requestor));
63014184Sgabeblack@google.com        if (fwd_set.count() > 0) {
63114184Sgabeblack@google.com          tbe.Acks := 1;
63214184Sgabeblack@google.com          tbe.SilentAcks := machineCount(MachineType:L1Cache) - fwd_set.count();
63314184Sgabeblack@google.com          tbe.SilentAcks := tbe.SilentAcks - 1;
63414184Sgabeblack@google.com        } else {
63514184Sgabeblack@google.com          tbe.Acks := machineCount(MachineType:L1Cache);
63614184Sgabeblack@google.com          tbe.SilentAcks := 0;
63714184Sgabeblack@google.com        }
63814184Sgabeblack@google.com      } else {
63914184Sgabeblack@google.com        tbe.Acks := 1;
64014184Sgabeblack@google.com      }
64114184Sgabeblack@google.com    }
64214184Sgabeblack@google.com  } 
64314184Sgabeblack@google.com
64414184Sgabeblack@google.com  action(saa_setAcksToAllIfPF, "saa", desc="Non-forwarded request, set the ack amount to all") {
64514184Sgabeblack@google.com    assert(is_valid(tbe));
64614184Sgabeblack@google.com    if (probe_filter_enabled || full_bit_dir_enabled) {
64714184Sgabeblack@google.com      tbe.Acks := machineCount(MachineType:L1Cache);
64814184Sgabeblack@google.com      tbe.SilentAcks := 0;
64914184Sgabeblack@google.com    } else {
65014184Sgabeblack@google.com      tbe.Acks := 1;
65114184Sgabeblack@google.com    }
65214184Sgabeblack@google.com  }   
65314184Sgabeblack@google.com
65414184Sgabeblack@google.com  action(m_decrementNumberOfMessages, "m", desc="Decrement the number of messages for which we're waiting") {
65514184Sgabeblack@google.com    peek(responseToDir_in, ResponseMsg) {
65614184Sgabeblack@google.com      assert(is_valid(tbe));
65714184Sgabeblack@google.com      assert(in_msg.Acks > 0);
65814184Sgabeblack@google.com      DPRINTF(RubySlicc, "%d\n", tbe.NumPendingMsgs);
65914184Sgabeblack@google.com      //
66014184Sgabeblack@google.com      // Note that cache data responses will have an ack count of 2.  However, 
66114184Sgabeblack@google.com      // directory DMA requests must wait for acks from all LLC caches, so 
66214184Sgabeblack@google.com      // only decrement by 1.
66314184Sgabeblack@google.com      //
66414184Sgabeblack@google.com      if ((in_msg.Type == CoherenceResponseType:DATA_SHARED) ||
66514184Sgabeblack@google.com          (in_msg.Type == CoherenceResponseType:DATA) ||
66614184Sgabeblack@google.com          (in_msg.Type == CoherenceResponseType:DATA_EXCLUSIVE)) {
66714184Sgabeblack@google.com        tbe.NumPendingMsgs := tbe.NumPendingMsgs - 1;
66814184Sgabeblack@google.com      } else {
66914184Sgabeblack@google.com        tbe.NumPendingMsgs := tbe.NumPendingMsgs - in_msg.Acks;
67014184Sgabeblack@google.com      }
67114184Sgabeblack@google.com      DPRINTF(RubySlicc, "%d\n", tbe.NumPendingMsgs);
67214184Sgabeblack@google.com    }
67314184Sgabeblack@google.com  }
67414184Sgabeblack@google.com
67514184Sgabeblack@google.com  action(mu_decrementNumberOfUnblocks, "mu", desc="Decrement the number of messages for which we're waiting") {
67614184Sgabeblack@google.com    peek(unblockNetwork_in, ResponseMsg) {
67714184Sgabeblack@google.com      assert(is_valid(tbe));
67814184Sgabeblack@google.com      assert(in_msg.Type == CoherenceResponseType:UNBLOCKS);
67914184Sgabeblack@google.com      DPRINTF(RubySlicc, "%d\n", tbe.NumPendingMsgs);
68014184Sgabeblack@google.com      tbe.NumPendingMsgs := tbe.NumPendingMsgs - 1;
68114184Sgabeblack@google.com      DPRINTF(RubySlicc, "%d\n", tbe.NumPendingMsgs);
68214184Sgabeblack@google.com    }
68314184Sgabeblack@google.com  }
68414184Sgabeblack@google.com
68514184Sgabeblack@google.com  action(n_popResponseQueue, "n", desc="Pop response queue") {
68614184Sgabeblack@google.com    responseToDir_in.dequeue(clockEdge());
68714184Sgabeblack@google.com  }
68814184Sgabeblack@google.com
68914184Sgabeblack@google.com  action(o_checkForCompletion, "o", desc="Check if we have received all the messages required for completion") {
69014184Sgabeblack@google.com    assert(is_valid(tbe));
69114184Sgabeblack@google.com    if (tbe.NumPendingMsgs == 0) {
69214184Sgabeblack@google.com      enqueue(triggerQueue_out, TriggerMsg) {
69314184Sgabeblack@google.com        out_msg.addr := address;
69414184Sgabeblack@google.com        if (tbe.Sharers) {
69514184Sgabeblack@google.com          if (tbe.Owned) {
69614184Sgabeblack@google.com            out_msg.Type := TriggerType:ALL_ACKS_OWNER_EXISTS;
69714184Sgabeblack@google.com          } else {
69814184Sgabeblack@google.com            out_msg.Type := TriggerType:ALL_ACKS;
69914184Sgabeblack@google.com          }
70014184Sgabeblack@google.com        } else {
70114184Sgabeblack@google.com          out_msg.Type := TriggerType:ALL_ACKS_NO_SHARERS;
70214184Sgabeblack@google.com        }
70314184Sgabeblack@google.com      }
70414184Sgabeblack@google.com    }
70514184Sgabeblack@google.com  }
70614184Sgabeblack@google.com
70714184Sgabeblack@google.com  action(os_checkForMergedGetSCompletion, "os", desc="Check for merged GETS completion") {
70814184Sgabeblack@google.com    assert(is_valid(tbe));
70914184Sgabeblack@google.com    if (tbe.NumPendingMsgs == 0) {
71014184Sgabeblack@google.com      enqueue(triggerQueue_out, TriggerMsg) {
71114184Sgabeblack@google.com        out_msg.addr := address;
71214184Sgabeblack@google.com        out_msg.Type := TriggerType:ALL_UNBLOCKS;
71314184Sgabeblack@google.com      }
71414184Sgabeblack@google.com    }
71514184Sgabeblack@google.com  }
71614184Sgabeblack@google.com
71714184Sgabeblack@google.com  action(sp_setPendingMsgsToMergedSharers, "sp", desc="Set pending messages to waiting sharers") {
71814184Sgabeblack@google.com    assert(is_valid(tbe));
71914184Sgabeblack@google.com    tbe.NumPendingMsgs := tbe.GetSRequestors.count();
72014184Sgabeblack@google.com  }
72114184Sgabeblack@google.com
72214184Sgabeblack@google.com  action(spa_setPendingAcksToZeroIfPF, "spa", desc="if probe filter, no need to wait for acks") {
72314184Sgabeblack@google.com    if (probe_filter_enabled || full_bit_dir_enabled) {
72414184Sgabeblack@google.com      assert(is_valid(tbe));
72514184Sgabeblack@google.com      tbe.NumPendingMsgs := 0;
72614184Sgabeblack@google.com    }
72714184Sgabeblack@google.com  }
72814184Sgabeblack@google.com
72914184Sgabeblack@google.com  action(sc_signalCompletionIfPF, "sc", desc="indicate that we should skip waiting for cpu acks") {
73014184Sgabeblack@google.com    assert(is_valid(tbe));
73114184Sgabeblack@google.com    if (tbe.NumPendingMsgs == 0) {
73214184Sgabeblack@google.com      assert(probe_filter_enabled || full_bit_dir_enabled);
73314184Sgabeblack@google.com      enqueue(triggerQueue_out, TriggerMsg) {
73414184Sgabeblack@google.com        out_msg.addr := address;
73514184Sgabeblack@google.com        out_msg.Type := TriggerType:ALL_ACKS_NO_SHARERS;
73614184Sgabeblack@google.com      }
73714184Sgabeblack@google.com    }
73814184Sgabeblack@google.com  }
73914184Sgabeblack@google.com
74014184Sgabeblack@google.com  action(d_sendData, "d", desc="Send data to requestor") {
74114184Sgabeblack@google.com    peek(memQueue_in, MemoryMsg) {
74214184Sgabeblack@google.com      enqueue(responseNetwork_out, ResponseMsg, 1) {
74314184Sgabeblack@google.com        assert(is_valid(tbe));
74414184Sgabeblack@google.com        out_msg.addr := address;
74514184Sgabeblack@google.com        out_msg.Type := tbe.ResponseType;
74614184Sgabeblack@google.com        out_msg.Sender := machineID;
74714184Sgabeblack@google.com        out_msg.Destination.add(in_msg.OriginalRequestorMachId);
74814184Sgabeblack@google.com        out_msg.DataBlk := in_msg.DataBlk;
74914184Sgabeblack@google.com        DPRINTF(RubySlicc, "%s\n", out_msg.DataBlk);
75014184Sgabeblack@google.com        out_msg.Dirty := false; // By definition, the block is now clean
75114184Sgabeblack@google.com        out_msg.Acks := tbe.Acks;
75214184Sgabeblack@google.com        out_msg.SilentAcks := tbe.SilentAcks;
75314184Sgabeblack@google.com        DPRINTF(RubySlicc, "%d\n", out_msg.Acks);
75414184Sgabeblack@google.com        assert(out_msg.Acks > 0);
75514184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
75614184Sgabeblack@google.com      }
75714184Sgabeblack@google.com    }
75814184Sgabeblack@google.com  }
75914184Sgabeblack@google.com
76014184Sgabeblack@google.com  action(dr_sendDmaData, "dr", desc="Send Data to DMA controller from memory") {
76114184Sgabeblack@google.com    peek(memQueue_in, MemoryMsg) {
76214184Sgabeblack@google.com      enqueue(dmaResponseNetwork_out, DMAResponseMsg, 1) {
76314184Sgabeblack@google.com        assert(is_valid(tbe));
76414184Sgabeblack@google.com        out_msg.PhysicalAddress := address;
76514184Sgabeblack@google.com        out_msg.LineAddress := address;
76614184Sgabeblack@google.com        out_msg.Type := DMAResponseType:DATA;
76714184Sgabeblack@google.com        //
76814184Sgabeblack@google.com        // we send the entire data block and rely on the dma controller to 
76914184Sgabeblack@google.com        // split it up if need be
77014184Sgabeblack@google.com        //
77114184Sgabeblack@google.com        out_msg.DataBlk := in_msg.DataBlk;
77214184Sgabeblack@google.com        out_msg.Destination.add(tbe.DmaRequestor);
77314184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
77414184Sgabeblack@google.com      }
77514184Sgabeblack@google.com    }
77614184Sgabeblack@google.com  }
77714184Sgabeblack@google.com
77814184Sgabeblack@google.com  action(dt_sendDmaDataFromTbe, "dt", desc="Send Data to DMA controller from tbe") {
77914184Sgabeblack@google.com    peek(triggerQueue_in, TriggerMsg) {
78014184Sgabeblack@google.com      enqueue(dmaResponseNetwork_out, DMAResponseMsg, 1) {
78114184Sgabeblack@google.com        assert(is_valid(tbe));
78214184Sgabeblack@google.com        out_msg.PhysicalAddress := address;
78314184Sgabeblack@google.com        out_msg.LineAddress := address;
78414184Sgabeblack@google.com        out_msg.Type := DMAResponseType:DATA;
78514184Sgabeblack@google.com        //
78614184Sgabeblack@google.com        // we send the entire data block and rely on the dma controller to 
78714184Sgabeblack@google.com        // split it up if need be
78814184Sgabeblack@google.com        //
78914184Sgabeblack@google.com        out_msg.DataBlk := tbe.DataBlk;
79014184Sgabeblack@google.com        out_msg.Destination.add(tbe.DmaRequestor);
79114184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Response_Data;
79214184Sgabeblack@google.com      }
79314184Sgabeblack@google.com    }
79414184Sgabeblack@google.com  }
79514184Sgabeblack@google.com
79614184Sgabeblack@google.com  action(da_sendDmaAck, "da", desc="Send Ack to DMA controller") {
79714184Sgabeblack@google.com    enqueue(dmaResponseNetwork_out, DMAResponseMsg, 1) {
79814184Sgabeblack@google.com      assert(is_valid(tbe));
79914184Sgabeblack@google.com      out_msg.PhysicalAddress := address;
80014184Sgabeblack@google.com      out_msg.LineAddress := address;
80114184Sgabeblack@google.com      out_msg.Type := DMAResponseType:ACK;
80214184Sgabeblack@google.com      out_msg.Destination.add(tbe.DmaRequestor); 
80314184Sgabeblack@google.com      out_msg.MessageSize := MessageSizeType:Writeback_Control;
80414184Sgabeblack@google.com    }
80514184Sgabeblack@google.com  }
80614184Sgabeblack@google.com
80714184Sgabeblack@google.com  action(rx_recordExclusiveInTBE, "rx", desc="Record Exclusive in TBE") {
80814184Sgabeblack@google.com    peek(requestQueue_in, RequestMsg) {
80914184Sgabeblack@google.com      assert(is_valid(tbe));
81014184Sgabeblack@google.com      tbe.ResponseType := CoherenceResponseType:DATA_EXCLUSIVE;
81114184Sgabeblack@google.com    }
81214184Sgabeblack@google.com  }
81314184Sgabeblack@google.com
81414184Sgabeblack@google.com  action(r_recordDataInTBE, "rt", desc="Record Data in TBE") {
81514184Sgabeblack@google.com    peek(requestQueue_in, RequestMsg) {
81614184Sgabeblack@google.com      assert(is_valid(tbe));
81714184Sgabeblack@google.com      if (full_bit_dir_enabled) {
81814184Sgabeblack@google.com        fwd_set := cache_entry.Sharers;
81914184Sgabeblack@google.com        fwd_set.remove(machineIDToNodeID(in_msg.Requestor));
82014184Sgabeblack@google.com        if (fwd_set.count() > 0) {
82114184Sgabeblack@google.com          tbe.ResponseType := CoherenceResponseType:DATA;
82214184Sgabeblack@google.com        } else {
82314184Sgabeblack@google.com          tbe.ResponseType := CoherenceResponseType:DATA_EXCLUSIVE;
82414184Sgabeblack@google.com        }
82514184Sgabeblack@google.com      } else {
82614184Sgabeblack@google.com        tbe.ResponseType := CoherenceResponseType:DATA;
82714184Sgabeblack@google.com      }
82814184Sgabeblack@google.com    }
82914184Sgabeblack@google.com  }
83014184Sgabeblack@google.com
83114184Sgabeblack@google.com  action(rs_recordGetSRequestor, "rs", desc="Record GETS requestor in TBE") {
83214184Sgabeblack@google.com    peek(requestQueue_in, RequestMsg) {
83314184Sgabeblack@google.com      assert(is_valid(tbe));
83414184Sgabeblack@google.com      tbe.GetSRequestors.add(in_msg.Requestor);
83514184Sgabeblack@google.com    }
83614184Sgabeblack@google.com  }
83714184Sgabeblack@google.com
83814184Sgabeblack@google.com  action(r_setSharerBit, "r", desc="We saw other sharers") {
83914184Sgabeblack@google.com    assert(is_valid(tbe));
84014184Sgabeblack@google.com    tbe.Sharers := true;
84114184Sgabeblack@google.com  }
84214184Sgabeblack@google.com
84314184Sgabeblack@google.com  action(so_setOwnerBit, "so", desc="We saw other sharers") {
84414184Sgabeblack@google.com    assert(is_valid(tbe));
84514184Sgabeblack@google.com    tbe.Sharers := true;
84614184Sgabeblack@google.com    tbe.Owned := true;
84714184Sgabeblack@google.com  }
84814184Sgabeblack@google.com
84914184Sgabeblack@google.com  action(qf_queueMemoryFetchRequest, "qf", desc="Queue off-chip fetch request") {
85014184Sgabeblack@google.com    peek(requestQueue_in, RequestMsg) {
85114184Sgabeblack@google.com      queueMemoryRead(in_msg.Requestor, address, to_memory_controller_latency);
85214184Sgabeblack@google.com    }
85314184Sgabeblack@google.com  }
85414184Sgabeblack@google.com
85514184Sgabeblack@google.com  action(qd_queueMemoryRequestFromDmaRead, "qd", desc="Queue off-chip fetch request") {
85614184Sgabeblack@google.com    peek(dmaRequestQueue_in, DMARequestMsg) {
85714184Sgabeblack@google.com      queueMemoryRead(in_msg.Requestor, address, to_memory_controller_latency);
85814184Sgabeblack@google.com    }
85914184Sgabeblack@google.com  }
86014184Sgabeblack@google.com
86114184Sgabeblack@google.com  action(fn_forwardRequestIfNecessary, "fn", desc="Forward requests if necessary") {
86214184Sgabeblack@google.com    assert(is_valid(tbe));
86314184Sgabeblack@google.com    if ((machineCount(MachineType:L1Cache) > 1) && (tbe.Acks <= 1)) {
86414184Sgabeblack@google.com      if (full_bit_dir_enabled) {
86514184Sgabeblack@google.com        assert(is_valid(cache_entry));
86614184Sgabeblack@google.com        peek(requestQueue_in, RequestMsg) {
86714184Sgabeblack@google.com          fwd_set := cache_entry.Sharers;
86814184Sgabeblack@google.com          fwd_set.remove(machineIDToNodeID(in_msg.Requestor));
86914184Sgabeblack@google.com          if (fwd_set.count() > 0) {
87014184Sgabeblack@google.com            enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
87114184Sgabeblack@google.com              out_msg.addr := address;
87214184Sgabeblack@google.com              out_msg.Type := in_msg.Type;
87314184Sgabeblack@google.com              out_msg.Requestor := in_msg.Requestor;
87414184Sgabeblack@google.com              out_msg.Destination.setNetDest(MachineType:L1Cache, fwd_set);
87514184Sgabeblack@google.com              out_msg.MessageSize := MessageSizeType:Multicast_Control;
87614184Sgabeblack@google.com              out_msg.InitialRequestTime := in_msg.InitialRequestTime;
87714184Sgabeblack@google.com              out_msg.ForwardRequestTime := curCycle();
87814184Sgabeblack@google.com              assert(tbe.SilentAcks > 0);
87914184Sgabeblack@google.com              out_msg.SilentAcks := tbe.SilentAcks;
88014184Sgabeblack@google.com            }
88114184Sgabeblack@google.com          }
88214184Sgabeblack@google.com        }
88314184Sgabeblack@google.com      } else {
88414184Sgabeblack@google.com        peek(requestQueue_in, RequestMsg) {
88514184Sgabeblack@google.com          enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
88614184Sgabeblack@google.com            out_msg.addr := address;
88714184Sgabeblack@google.com            out_msg.Type := in_msg.Type;
88814184Sgabeblack@google.com            out_msg.Requestor := in_msg.Requestor;
88914184Sgabeblack@google.com            out_msg.Destination.broadcast(MachineType:L1Cache); // Send to all L1 caches
89014184Sgabeblack@google.com            out_msg.Destination.remove(in_msg.Requestor); // Don't include the original requestor
89114184Sgabeblack@google.com            out_msg.MessageSize := MessageSizeType:Broadcast_Control;
89214184Sgabeblack@google.com            out_msg.InitialRequestTime := in_msg.InitialRequestTime;
89314184Sgabeblack@google.com            out_msg.ForwardRequestTime := curCycle();
89414184Sgabeblack@google.com          }
89514184Sgabeblack@google.com        }
89614184Sgabeblack@google.com      }
89714184Sgabeblack@google.com    }
89814184Sgabeblack@google.com  }
89914184Sgabeblack@google.com
90014184Sgabeblack@google.com  action(ia_invalidateAllRequest, "ia", desc="invalidate all copies") {
90114184Sgabeblack@google.com    if (machineCount(MachineType:L1Cache) > 1) {
90214184Sgabeblack@google.com      if (full_bit_dir_enabled) {
90314184Sgabeblack@google.com        assert(cache_entry.Sharers.count() > 0);
90414184Sgabeblack@google.com        peek(requestQueue_in, RequestMsg) {
90514184Sgabeblack@google.com          enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
90614184Sgabeblack@google.com            out_msg.addr := address;
90714184Sgabeblack@google.com            out_msg.Type := CoherenceRequestType:INV;
90814184Sgabeblack@google.com            out_msg.Requestor := machineID;
90914184Sgabeblack@google.com            out_msg.Destination.setNetDest(MachineType:L1Cache, cache_entry.Sharers);
91014184Sgabeblack@google.com            out_msg.MessageSize := MessageSizeType:Multicast_Control;
91114184Sgabeblack@google.com          }
91214184Sgabeblack@google.com        }
91314184Sgabeblack@google.com      } else {
91414184Sgabeblack@google.com        enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
91514184Sgabeblack@google.com          out_msg.addr := address;
91614184Sgabeblack@google.com          out_msg.Type := CoherenceRequestType:INV;
91714184Sgabeblack@google.com          out_msg.Requestor := machineID;
91814184Sgabeblack@google.com          out_msg.Destination.broadcast(MachineType:L1Cache); // Send to all L1 caches
91914184Sgabeblack@google.com          out_msg.MessageSize := MessageSizeType:Broadcast_Control;
92014184Sgabeblack@google.com        }
92114184Sgabeblack@google.com      }
92214184Sgabeblack@google.com    }
92314184Sgabeblack@google.com  }
92414184Sgabeblack@google.com
92514184Sgabeblack@google.com  action(io_invalidateOwnerRequest, "io", desc="invalidate all copies") {
92614184Sgabeblack@google.com    if (machineCount(MachineType:L1Cache) > 1) {
92714184Sgabeblack@google.com      enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
92814184Sgabeblack@google.com        assert(is_valid(cache_entry)); 
92914184Sgabeblack@google.com        out_msg.addr := address;
93014184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:INV;
93114184Sgabeblack@google.com        out_msg.Requestor := machineID;
93214184Sgabeblack@google.com        out_msg.Destination.add(cache_entry.Owner);
93314184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Request_Control;
93414184Sgabeblack@google.com        out_msg.DirectedProbe := true;
93514184Sgabeblack@google.com      }
93614184Sgabeblack@google.com    }
93714184Sgabeblack@google.com  }
93814184Sgabeblack@google.com
93914184Sgabeblack@google.com  action(fb_forwardRequestBcast, "fb", desc="Forward requests to all nodes") {
94014184Sgabeblack@google.com    if (machineCount(MachineType:L1Cache) > 1) {
94114184Sgabeblack@google.com      peek(requestQueue_in, RequestMsg) {
94214184Sgabeblack@google.com        if (full_bit_dir_enabled) {
94314184Sgabeblack@google.com          fwd_set := cache_entry.Sharers;
94414184Sgabeblack@google.com          fwd_set.remove(machineIDToNodeID(in_msg.Requestor));
94514184Sgabeblack@google.com          if (fwd_set.count() > 0) {
94614184Sgabeblack@google.com            enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
94714184Sgabeblack@google.com                  out_msg.addr := address;
94814184Sgabeblack@google.com                  out_msg.Type := in_msg.Type;
94914184Sgabeblack@google.com                  out_msg.Requestor := in_msg.Requestor;
95014184Sgabeblack@google.com                  out_msg.Destination.setNetDest(MachineType:L1Cache, fwd_set);
95114184Sgabeblack@google.com                  out_msg.MessageSize := MessageSizeType:Multicast_Control;
95214184Sgabeblack@google.com                  out_msg.InitialRequestTime := in_msg.InitialRequestTime;
95314184Sgabeblack@google.com                  out_msg.ForwardRequestTime := curCycle();
95414184Sgabeblack@google.com                  out_msg.SilentAcks := machineCount(MachineType:L1Cache) - fwd_set.count();
95514184Sgabeblack@google.com                  out_msg.SilentAcks := out_msg.SilentAcks - 1;
95614184Sgabeblack@google.com              }
95714184Sgabeblack@google.com          }
95814184Sgabeblack@google.com        } else {
95914184Sgabeblack@google.com            enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
96014184Sgabeblack@google.com                out_msg.addr := address;
96114184Sgabeblack@google.com                out_msg.Type := in_msg.Type;
96214184Sgabeblack@google.com                out_msg.Requestor := in_msg.Requestor;
96314184Sgabeblack@google.com                out_msg.Destination.broadcast(MachineType:L1Cache); // Send to all L1 caches
96414184Sgabeblack@google.com                out_msg.Destination.remove(in_msg.Requestor); // Don't include the original requestor
96514184Sgabeblack@google.com                out_msg.MessageSize := MessageSizeType:Broadcast_Control;
96614184Sgabeblack@google.com                out_msg.InitialRequestTime := in_msg.InitialRequestTime;
96714184Sgabeblack@google.com                out_msg.ForwardRequestTime := curCycle();
96814184Sgabeblack@google.com            }
96914184Sgabeblack@google.com        }
97014184Sgabeblack@google.com      }
97114184Sgabeblack@google.com    } else {
97214184Sgabeblack@google.com      peek(requestQueue_in, RequestMsg) {
97314184Sgabeblack@google.com          enqueue(responseNetwork_out, ResponseMsg, 1) {
97414184Sgabeblack@google.com            out_msg.addr := address;
97514184Sgabeblack@google.com            out_msg.Type := CoherenceResponseType:ACK;
97614184Sgabeblack@google.com            out_msg.Sender := machineID;
97714184Sgabeblack@google.com            out_msg.Destination.add(in_msg.Requestor);
97814184Sgabeblack@google.com            out_msg.Dirty := false; // By definition, the block is now clean
97914184Sgabeblack@google.com            out_msg.Acks := 0;
98014184Sgabeblack@google.com            out_msg.SilentAcks := 0;
98114184Sgabeblack@google.com            DPRINTF(RubySlicc, "%d\n", out_msg.Acks);
98214184Sgabeblack@google.com            out_msg.MessageSize := MessageSizeType:Response_Control;
98314184Sgabeblack@google.com          }
98414184Sgabeblack@google.com      }
98514184Sgabeblack@google.com    }
98614184Sgabeblack@google.com  }
98714184Sgabeblack@google.com
98814184Sgabeblack@google.com  action(fr_forwardMergeReadRequestsToOwner, "frr", desc="Forward coalesced read request to owner") {
98914184Sgabeblack@google.com    assert(machineCount(MachineType:L1Cache) > 1);
99014184Sgabeblack@google.com    //
99114184Sgabeblack@google.com    // Fixme! The unblock network should not stall on the forward network.  Add a trigger queue to
99214184Sgabeblack@google.com    // decouple the two.
99314184Sgabeblack@google.com    //
99414184Sgabeblack@google.com    peek(unblockNetwork_in, ResponseMsg) {
99514184Sgabeblack@google.com      enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
99614184Sgabeblack@google.com        assert(is_valid(tbe));
99714184Sgabeblack@google.com        out_msg.addr := address;
99814184Sgabeblack@google.com        out_msg.Type := CoherenceRequestType:MERGED_GETS;
99914184Sgabeblack@google.com        out_msg.MergedRequestors := tbe.GetSRequestors;
100014184Sgabeblack@google.com        if (in_msg.Type == CoherenceResponseType:UNBLOCKS) {
100114184Sgabeblack@google.com          out_msg.Destination.add(in_msg.CurOwner);
100214184Sgabeblack@google.com        } else {
100314184Sgabeblack@google.com          out_msg.Destination.add(in_msg.Sender);
100414184Sgabeblack@google.com        }
100514184Sgabeblack@google.com        out_msg.MessageSize := MessageSizeType:Request_Control;
100614184Sgabeblack@google.com        out_msg.InitialRequestTime := zero_time();
100714184Sgabeblack@google.com        out_msg.ForwardRequestTime := curCycle();
100814184Sgabeblack@google.com      }      
100914184Sgabeblack@google.com    }
101014184Sgabeblack@google.com  }
101114184Sgabeblack@google.com
101214184Sgabeblack@google.com  action(fc_forwardRequestConditionalOwner, "fc", desc="Forward request to one or more nodes") {
101314184Sgabeblack@google.com    assert(machineCount(MachineType:L1Cache) > 1);
101414184Sgabeblack@google.com    if (probe_filter_enabled || full_bit_dir_enabled) {
101514184Sgabeblack@google.com      peek(requestQueue_in, RequestMsg) {
101614184Sgabeblack@google.com        enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
101714184Sgabeblack@google.com          assert(is_valid(cache_entry)); 
101814184Sgabeblack@google.com          out_msg.addr := address;
101914184Sgabeblack@google.com          out_msg.Type := in_msg.Type;
102014184Sgabeblack@google.com          out_msg.Requestor := in_msg.Requestor;
102114184Sgabeblack@google.com          out_msg.Destination.add(cache_entry.Owner);
102214184Sgabeblack@google.com          out_msg.MessageSize := MessageSizeType:Request_Control;
102314184Sgabeblack@google.com          out_msg.DirectedProbe := true;
102414184Sgabeblack@google.com          out_msg.InitialRequestTime := in_msg.InitialRequestTime;
102514184Sgabeblack@google.com          out_msg.ForwardRequestTime := curCycle();
102614184Sgabeblack@google.com        }
102714184Sgabeblack@google.com      }      
102814184Sgabeblack@google.com    } else {
102914184Sgabeblack@google.com      peek(requestQueue_in, RequestMsg) {
103014184Sgabeblack@google.com        enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
103114184Sgabeblack@google.com          out_msg.addr := address;
103214184Sgabeblack@google.com          out_msg.Type := in_msg.Type;
103314184Sgabeblack@google.com          out_msg.Requestor := in_msg.Requestor;
103414184Sgabeblack@google.com          out_msg.Destination.broadcast(MachineType:L1Cache); // Send to all L1 caches
103514184Sgabeblack@google.com          out_msg.Destination.remove(in_msg.Requestor); // Don't include the original requestor
103614184Sgabeblack@google.com          out_msg.MessageSize := MessageSizeType:Broadcast_Control;
103714184Sgabeblack@google.com          out_msg.InitialRequestTime := in_msg.InitialRequestTime;
103814184Sgabeblack@google.com          out_msg.ForwardRequestTime := curCycle();
103914184Sgabeblack@google.com        }
104014184Sgabeblack@google.com      }
104114184Sgabeblack@google.com    }
104214184Sgabeblack@google.com  }
104314184Sgabeblack@google.com
104414184Sgabeblack@google.com  action(nofc_forwardRequestConditionalOwner, "nofc", desc="Forward request to one or more nodes if the requestor is not the owner") {
104514184Sgabeblack@google.com   if (machineCount(MachineType:L1Cache) > 1) {
104614184Sgabeblack@google.com
104714184Sgabeblack@google.com     if (probe_filter_enabled || full_bit_dir_enabled) {
104814184Sgabeblack@google.com       peek(requestQueue_in, RequestMsg) {
104914184Sgabeblack@google.com        if (in_msg.Requestor != cache_entry.Owner) {
105014184Sgabeblack@google.com          enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
105114184Sgabeblack@google.com            assert(is_valid(cache_entry));
105214184Sgabeblack@google.com            out_msg.addr := address;
105314184Sgabeblack@google.com            out_msg.Type := in_msg.Type;
105414184Sgabeblack@google.com            out_msg.Requestor := in_msg.Requestor;
105514184Sgabeblack@google.com            out_msg.Destination.add(cache_entry.Owner);
105614184Sgabeblack@google.com            out_msg.MessageSize := MessageSizeType:Request_Control;
105714184Sgabeblack@google.com            out_msg.DirectedProbe := true;
105814184Sgabeblack@google.com            out_msg.InitialRequestTime := in_msg.InitialRequestTime;
105914184Sgabeblack@google.com            out_msg.ForwardRequestTime := curCycle();
106014184Sgabeblack@google.com          }
106114184Sgabeblack@google.com        }
106214184Sgabeblack@google.com       }
106314184Sgabeblack@google.com     } else {
106414184Sgabeblack@google.com      peek(requestQueue_in, RequestMsg) {
106514184Sgabeblack@google.com        enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
106614184Sgabeblack@google.com          out_msg.addr := address;
106714184Sgabeblack@google.com          out_msg.Type := in_msg.Type;
106814184Sgabeblack@google.com          out_msg.Requestor := in_msg.Requestor;
106914184Sgabeblack@google.com          out_msg.Destination.broadcast(MachineType:L1Cache); // Send to all L1 caches
107014184Sgabeblack@google.com          out_msg.Destination.remove(in_msg.Requestor); // Don't include the original requestor
107114184Sgabeblack@google.com          out_msg.MessageSize := MessageSizeType:Broadcast_Control;
107214184Sgabeblack@google.com          out_msg.InitialRequestTime := in_msg.InitialRequestTime;
107314184Sgabeblack@google.com          out_msg.ForwardRequestTime := curCycle();
107414184Sgabeblack@google.com        }
107514184Sgabeblack@google.com      }
107614184Sgabeblack@google.com     }
107714184Sgabeblack@google.com   }
107814184Sgabeblack@google.com  }
107914184Sgabeblack@google.com
108014184Sgabeblack@google.com  action(f_forwardWriteFromDma, "fw", desc="Forward requests") {
108114184Sgabeblack@google.com    assert(is_valid(tbe));
108214184Sgabeblack@google.com    if (tbe.NumPendingMsgs > 0) {
108314184Sgabeblack@google.com      peek(dmaRequestQueue_in, DMARequestMsg) {
108414184Sgabeblack@google.com        enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
108514184Sgabeblack@google.com          out_msg.addr := address;
108614184Sgabeblack@google.com          out_msg.Type := CoherenceRequestType:GETX;
108714184Sgabeblack@google.com          //
108814184Sgabeblack@google.com          // Send to all L1 caches, since the requestor is the memory controller
108914184Sgabeblack@google.com          // itself
109014184Sgabeblack@google.com          //
109114184Sgabeblack@google.com          out_msg.Requestor := machineID;
109214184Sgabeblack@google.com          out_msg.Destination.broadcast(MachineType:L1Cache); 
109314184Sgabeblack@google.com          out_msg.MessageSize := MessageSizeType:Broadcast_Control;
109414184Sgabeblack@google.com        }
109514184Sgabeblack@google.com      }
109614184Sgabeblack@google.com    }
109714184Sgabeblack@google.com  }
109814184Sgabeblack@google.com
109914184Sgabeblack@google.com  action(f_forwardReadFromDma, "fr", desc="Forward requests") {
110014184Sgabeblack@google.com    assert(is_valid(tbe));
110114184Sgabeblack@google.com    if (tbe.NumPendingMsgs > 0) {
110214184Sgabeblack@google.com      peek(dmaRequestQueue_in, DMARequestMsg) {
110314184Sgabeblack@google.com        enqueue(forwardNetwork_out, RequestMsg, from_memory_controller_latency) {
110414184Sgabeblack@google.com          out_msg.addr := address;
110514184Sgabeblack@google.com          out_msg.Type := CoherenceRequestType:GETS;
110614184Sgabeblack@google.com          //
110714184Sgabeblack@google.com          // Send to all L1 caches, since the requestor is the memory controller
110814184Sgabeblack@google.com          // itself
110914184Sgabeblack@google.com          //
111014184Sgabeblack@google.com          out_msg.Requestor := machineID;
111114184Sgabeblack@google.com          out_msg.Destination.broadcast(MachineType:L1Cache); 
111214184Sgabeblack@google.com          out_msg.MessageSize := MessageSizeType:Broadcast_Control;
111314184Sgabeblack@google.com        }
111414184Sgabeblack@google.com      }
111514184Sgabeblack@google.com    }
111614184Sgabeblack@google.com  }
111714184Sgabeblack@google.com
111814184Sgabeblack@google.com  action(i_popIncomingRequestQueue, "i", desc="Pop incoming request queue") {
111914184Sgabeblack@google.com    requestQueue_in.dequeue(clockEdge());
112014184Sgabeblack@google.com  }
112114184Sgabeblack@google.com
112214184Sgabeblack@google.com  action(j_popIncomingUnblockQueue, "j", desc="Pop incoming unblock queue") {
112314184Sgabeblack@google.com    peek(unblockNetwork_in, ResponseMsg) {
112414184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(in_msg.Sender);
112514184Sgabeblack@google.com    } 
112614184Sgabeblack@google.com    unblockNetwork_in.dequeue(clockEdge());
112714184Sgabeblack@google.com  }
112814184Sgabeblack@google.com
112914184Sgabeblack@google.com  action(k_wakeUpDependents, "k", desc="wake-up dependents") {
113014184Sgabeblack@google.com    wakeUpBuffers(address);
113114184Sgabeblack@google.com  }
113214184Sgabeblack@google.com
113314184Sgabeblack@google.com  action(l_popMemQueue, "q", desc="Pop off-chip request queue") {
113414184Sgabeblack@google.com    memQueue_in.dequeue(clockEdge());
113514184Sgabeblack@google.com  }
113614184Sgabeblack@google.com
113714184Sgabeblack@google.com  action(g_popTriggerQueue, "g", desc="Pop trigger queue") {
113814184Sgabeblack@google.com    triggerQueue_in.dequeue(clockEdge());
113914184Sgabeblack@google.com  }
114014184Sgabeblack@google.com
114114184Sgabeblack@google.com  action(p_popDmaRequestQueue, "pd", desc="pop dma request queue") {
114214184Sgabeblack@google.com    dmaRequestQueue_in.dequeue(clockEdge());
114314184Sgabeblack@google.com  }
114414184Sgabeblack@google.com
114514184Sgabeblack@google.com  action(zd_stallAndWaitDMARequest, "zd", desc="Stall and wait the dma request queue") {
114614184Sgabeblack@google.com    peek(dmaRequestQueue_in, DMARequestMsg) {
114714184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(in_msg.Requestor);
114814184Sgabeblack@google.com    } 
114914184Sgabeblack@google.com    stall_and_wait(dmaRequestQueue_in, address);
115014184Sgabeblack@google.com  }
115114184Sgabeblack@google.com
115214184Sgabeblack@google.com  action(r_recordMemoryData, "rd", desc="record data from memory to TBE") {
115314184Sgabeblack@google.com    peek(memQueue_in, MemoryMsg) {
115414184Sgabeblack@google.com      assert(is_valid(tbe));
115514184Sgabeblack@google.com      if (tbe.CacheDirty == false) {
115614184Sgabeblack@google.com        tbe.DataBlk := in_msg.DataBlk;
115714184Sgabeblack@google.com      }
115814184Sgabeblack@google.com    }
115914184Sgabeblack@google.com  }
116014184Sgabeblack@google.com
116114184Sgabeblack@google.com  action(r_recordCacheData, "rc", desc="record data from cache response to TBE") {
116214184Sgabeblack@google.com    peek(responseToDir_in, ResponseMsg) {
116314184Sgabeblack@google.com      assert(is_valid(tbe));
116414184Sgabeblack@google.com      tbe.CacheDirty := true;
116514184Sgabeblack@google.com      tbe.DataBlk := in_msg.DataBlk;
116614184Sgabeblack@google.com    }
116714184Sgabeblack@google.com  }
116814184Sgabeblack@google.com
116914184Sgabeblack@google.com  action(a_assertCacheData, "ac", desc="Assert that a cache provided the data") {
117014184Sgabeblack@google.com    assert(is_valid(tbe));
117114184Sgabeblack@google.com    assert(tbe.CacheDirty);
117214184Sgabeblack@google.com  }
117314184Sgabeblack@google.com
117414184Sgabeblack@google.com  action(ano_assertNotOwner, "ano", desc="Assert that request is not current owner") {
117514184Sgabeblack@google.com    if (probe_filter_enabled || full_bit_dir_enabled) {
117614184Sgabeblack@google.com      peek(requestQueue_in, RequestMsg) {
117714184Sgabeblack@google.com        assert(is_valid(cache_entry)); 
117814184Sgabeblack@google.com        assert(cache_entry.Owner != in_msg.Requestor);
117914184Sgabeblack@google.com      }
118014184Sgabeblack@google.com    }
118114184Sgabeblack@google.com  }
118214184Sgabeblack@google.com
118314184Sgabeblack@google.com  action(ans_assertNotSharer, "ans", desc="Assert that request is not a current sharer") {
118414184Sgabeblack@google.com    if (full_bit_dir_enabled) {
118514184Sgabeblack@google.com      peek(requestQueue_in, RequestMsg) {
118614184Sgabeblack@google.com        assert(cache_entry.Sharers.isElement(machineIDToNodeID(in_msg.Requestor)) == false);
118714184Sgabeblack@google.com      }
118814184Sgabeblack@google.com    }
118914184Sgabeblack@google.com  }
119014184Sgabeblack@google.com
119114184Sgabeblack@google.com  action(rs_removeSharer, "s", desc="remove current sharer") {
119214184Sgabeblack@google.com    if (full_bit_dir_enabled) {
119314184Sgabeblack@google.com      peek(unblockNetwork_in, ResponseMsg) {
119414184Sgabeblack@google.com        assert(cache_entry.Sharers.isElement(machineIDToNodeID(in_msg.Sender)));
119514184Sgabeblack@google.com        cache_entry.Sharers.remove(machineIDToNodeID(in_msg.Sender));
119614184Sgabeblack@google.com      }
119714184Sgabeblack@google.com    }
119814184Sgabeblack@google.com  }
119914184Sgabeblack@google.com
120014184Sgabeblack@google.com  action(cs_clearSharers, "cs", desc="clear current sharers") {
120114184Sgabeblack@google.com    if (full_bit_dir_enabled) {
120214184Sgabeblack@google.com      peek(requestQueue_in, RequestMsg) {
120314184Sgabeblack@google.com        cache_entry.Sharers.clear();
120414184Sgabeblack@google.com        cache_entry.Sharers.add(machineIDToNodeID(in_msg.Requestor));
120514184Sgabeblack@google.com      }
120614184Sgabeblack@google.com    }
120714184Sgabeblack@google.com  }
120814184Sgabeblack@google.com
120914184Sgabeblack@google.com  action(l_queueMemoryWBRequest, "lq", desc="Write PUTX data to memory") {
121014184Sgabeblack@google.com    peek(unblockNetwork_in, ResponseMsg) {
121114184Sgabeblack@google.com      queueMemoryWrite(in_msg.Sender, address, to_memory_controller_latency,
121214184Sgabeblack@google.com                       in_msg.DataBlk);
121314184Sgabeblack@google.com    }
121414184Sgabeblack@google.com  }
121514184Sgabeblack@google.com
121614184Sgabeblack@google.com  action(ld_queueMemoryDmaWrite, "ld", desc="Write DMA data to memory") {
121714184Sgabeblack@google.com    assert(is_valid(tbe));
121814184Sgabeblack@google.com    queueMemoryWritePartial(tbe.DmaRequestor, tbe.PhysicalAddress,
121914184Sgabeblack@google.com                            to_memory_controller_latency, tbe.DmaDataBlk,
122014184Sgabeblack@google.com                            tbe.Len);
122114184Sgabeblack@google.com  }
122214184Sgabeblack@google.com
122314184Sgabeblack@google.com  action(ly_queueMemoryWriteFromTBE, "ly", desc="Write data to memory from TBE") {
122414184Sgabeblack@google.com    queueMemoryWrite(machineID, address, to_memory_controller_latency,
122514184Sgabeblack@google.com                     tbe.DataBlk);
122614184Sgabeblack@google.com  }
122714184Sgabeblack@google.com
122814184Sgabeblack@google.com  action(ll_checkIncomingWriteback, "\l", desc="Check PUTX/PUTO response message") {
122914184Sgabeblack@google.com    peek(unblockNetwork_in, ResponseMsg) {
123014184Sgabeblack@google.com      assert(in_msg.Dirty == false);
123114184Sgabeblack@google.com      assert(in_msg.MessageSize == MessageSizeType:Writeback_Control);
123214184Sgabeblack@google.com      DPRINTF(RubySlicc, "%s\n", in_msg.DataBlk);
123314184Sgabeblack@google.com    }
123414184Sgabeblack@google.com  }
123514184Sgabeblack@google.com
123614184Sgabeblack@google.com  action(z_stallAndWaitRequest, "z", desc="Recycle the request queue") {
123714184Sgabeblack@google.com    peek(requestQueue_in, RequestMsg) {
123814184Sgabeblack@google.com        APPEND_TRANSITION_COMMENT(in_msg.Requestor);
123914184Sgabeblack@google.com    } 
124014184Sgabeblack@google.com    stall_and_wait(requestQueue_in, address);
124114184Sgabeblack@google.com  }
124214184Sgabeblack@google.com
124314184Sgabeblack@google.com  // TRANSITIONS
124414184Sgabeblack@google.com
124514184Sgabeblack@google.com  // Transitions out of E state
124614184Sgabeblack@google.com  transition(E, GETX, NO_B_W) {
124714184Sgabeblack@google.com    pfa_probeFilterAllocate;
124814184Sgabeblack@google.com    v_allocateTBE;
124914184Sgabeblack@google.com    rx_recordExclusiveInTBE;
125014184Sgabeblack@google.com    saa_setAcksToAllIfPF;
125114184Sgabeblack@google.com    qf_queueMemoryFetchRequest;
125214184Sgabeblack@google.com    fn_forwardRequestIfNecessary;
125314184Sgabeblack@google.com    i_popIncomingRequestQueue;
125414184Sgabeblack@google.com  }
125514184Sgabeblack@google.com
125614184Sgabeblack@google.com  transition(E, GETF, NO_F_W) {
125714184Sgabeblack@google.com    pfa_probeFilterAllocate;
125814184Sgabeblack@google.com    v_allocateTBE;
125914184Sgabeblack@google.com    rx_recordExclusiveInTBE;
126014184Sgabeblack@google.com    saa_setAcksToAllIfPF;
126114184Sgabeblack@google.com    qf_queueMemoryFetchRequest;
126214184Sgabeblack@google.com    fn_forwardRequestIfNecessary;
126314184Sgabeblack@google.com    i_popIncomingRequestQueue;
126414184Sgabeblack@google.com  }
126514184Sgabeblack@google.com
126614184Sgabeblack@google.com  transition(E, GETS, NO_B_W) {
126714184Sgabeblack@google.com    pfa_probeFilterAllocate;
126814184Sgabeblack@google.com    v_allocateTBE;
126914184Sgabeblack@google.com    rx_recordExclusiveInTBE;
127014184Sgabeblack@google.com    saa_setAcksToAllIfPF;
127114184Sgabeblack@google.com    qf_queueMemoryFetchRequest;
127214184Sgabeblack@google.com    fn_forwardRequestIfNecessary;
127314184Sgabeblack@google.com    i_popIncomingRequestQueue;
127414184Sgabeblack@google.com  }
127514184Sgabeblack@google.com
127614184Sgabeblack@google.com  transition(E, DMA_READ, NO_DR_B_W) {
127714184Sgabeblack@google.com    vd_allocateDmaRequestInTBE;
127814184Sgabeblack@google.com    qd_queueMemoryRequestFromDmaRead;
127914184Sgabeblack@google.com    spa_setPendingAcksToZeroIfPF;
128014184Sgabeblack@google.com    f_forwardReadFromDma;
128114184Sgabeblack@google.com    p_popDmaRequestQueue;
128214184Sgabeblack@google.com  }
128314184Sgabeblack@google.com
128414184Sgabeblack@google.com  transition(E, DMA_WRITE, NO_DW_B_W) {
128514184Sgabeblack@google.com    vd_allocateDmaRequestInTBE;
128614184Sgabeblack@google.com    spa_setPendingAcksToZeroIfPF;
128714184Sgabeblack@google.com    sc_signalCompletionIfPF;
128814184Sgabeblack@google.com    f_forwardWriteFromDma;
128914184Sgabeblack@google.com    p_popDmaRequestQueue;
129014184Sgabeblack@google.com  }
129114184Sgabeblack@google.com
129214184Sgabeblack@google.com  // Transitions out of O state
129314184Sgabeblack@google.com  transition(O, GETX, NO_B_W) {
129414184Sgabeblack@google.com    r_setMRU;
129514184Sgabeblack@google.com    v_allocateTBE;
129614184Sgabeblack@google.com    r_recordDataInTBE;
129714184Sgabeblack@google.com    sa_setAcksToOne;
129814184Sgabeblack@google.com    qf_queueMemoryFetchRequest;
129914184Sgabeblack@google.com    fb_forwardRequestBcast;
130014184Sgabeblack@google.com    cs_clearSharers;
130114184Sgabeblack@google.com    i_popIncomingRequestQueue;
130214184Sgabeblack@google.com  }
130314184Sgabeblack@google.com
130414184Sgabeblack@google.com  transition(O, GETF, NO_F_W) {
130514184Sgabeblack@google.com    r_setMRU;
130614184Sgabeblack@google.com    v_allocateTBE;
130714184Sgabeblack@google.com    r_recordDataInTBE;
130814184Sgabeblack@google.com    sa_setAcksToOne;
130914184Sgabeblack@google.com    qf_queueMemoryFetchRequest;
131014184Sgabeblack@google.com    fb_forwardRequestBcast;
131114184Sgabeblack@google.com    cs_clearSharers;
131214184Sgabeblack@google.com    i_popIncomingRequestQueue;
131314184Sgabeblack@google.com  }
131414184Sgabeblack@google.com
131514184Sgabeblack@google.com  // This transition is dumb, if a shared copy exists on-chip, then that should
131614184Sgabeblack@google.com  // provide data, not slow off-chip dram.  The problem is that the current
131714184Sgabeblack@google.com  // caches don't provide data in S state
131814184Sgabeblack@google.com  transition(O, GETS, O_B_W) {
131914184Sgabeblack@google.com    r_setMRU;
132014184Sgabeblack@google.com    v_allocateTBE;
132114184Sgabeblack@google.com    r_recordDataInTBE;
132214184Sgabeblack@google.com    saa_setAcksToAllIfPF;
132314184Sgabeblack@google.com    qf_queueMemoryFetchRequest;
132414184Sgabeblack@google.com    fn_forwardRequestIfNecessary;
132514184Sgabeblack@google.com    i_popIncomingRequestQueue;
132614184Sgabeblack@google.com  }
132714184Sgabeblack@google.com
132814184Sgabeblack@google.com  transition(O, DMA_READ, O_DR_B_W) {
132914184Sgabeblack@google.com    vd_allocateDmaRequestInTBE;
133014184Sgabeblack@google.com    spa_setPendingAcksToZeroIfPF;
133114184Sgabeblack@google.com    qd_queueMemoryRequestFromDmaRead;
133214184Sgabeblack@google.com    f_forwardReadFromDma;
133314184Sgabeblack@google.com    p_popDmaRequestQueue;
133414184Sgabeblack@google.com  }
133514184Sgabeblack@google.com
133614184Sgabeblack@google.com  transition(O, Pf_Replacement, O_R) {
133714184Sgabeblack@google.com    v_allocateTBE;
133814184Sgabeblack@google.com    pa_setPendingMsgsToAll;
133914184Sgabeblack@google.com    ia_invalidateAllRequest;
134014184Sgabeblack@google.com    pfd_probeFilterDeallocate;
134114184Sgabeblack@google.com  }
134214184Sgabeblack@google.com
134314184Sgabeblack@google.com  transition(S, Pf_Replacement, S_R) {
134414184Sgabeblack@google.com    v_allocateTBE;
134514184Sgabeblack@google.com    pa_setPendingMsgsToAll;
134614184Sgabeblack@google.com    ia_invalidateAllRequest;
134714184Sgabeblack@google.com    pfd_probeFilterDeallocate;
134814184Sgabeblack@google.com  }
134914184Sgabeblack@google.com
135014184Sgabeblack@google.com  transition(NO, Pf_Replacement, NO_R) {
135114184Sgabeblack@google.com    v_allocateTBE;
135214184Sgabeblack@google.com    po_setPendingMsgsToOne;
135314184Sgabeblack@google.com    io_invalidateOwnerRequest;
135414184Sgabeblack@google.com    pfd_probeFilterDeallocate;
135514184Sgabeblack@google.com  }
135614184Sgabeblack@google.com
135714184Sgabeblack@google.com  transition(NX, Pf_Replacement, NO_R) {
135814184Sgabeblack@google.com    v_allocateTBE;
135914184Sgabeblack@google.com    pa_setPendingMsgsToAll;
136014184Sgabeblack@google.com    ia_invalidateAllRequest;
136114184Sgabeblack@google.com    pfd_probeFilterDeallocate;
136214184Sgabeblack@google.com  }
136314184Sgabeblack@google.com
136414184Sgabeblack@google.com  transition({O, S, NO, NX}, DMA_WRITE, NO_DW_B_W) {
136514184Sgabeblack@google.com    vd_allocateDmaRequestInTBE;
136614184Sgabeblack@google.com    f_forwardWriteFromDma;
136714184Sgabeblack@google.com    p_popDmaRequestQueue;
136814184Sgabeblack@google.com  }
136914184Sgabeblack@google.com
137014184Sgabeblack@google.com  // Transitions out of NO state
137114184Sgabeblack@google.com  transition(NX, GETX, NO_B) {
137214184Sgabeblack@google.com    r_setMRU;
137314184Sgabeblack@google.com    fb_forwardRequestBcast;
137414184Sgabeblack@google.com    cs_clearSharers;
137514184Sgabeblack@google.com    i_popIncomingRequestQueue;
137614184Sgabeblack@google.com  }
137714184Sgabeblack@google.com
137814184Sgabeblack@google.com  transition(NX, GETF, NO_F) {
137914184Sgabeblack@google.com    r_setMRU;
138014184Sgabeblack@google.com    fb_forwardRequestBcast;
138114184Sgabeblack@google.com    cs_clearSharers;
138214184Sgabeblack@google.com    i_popIncomingRequestQueue;
138314184Sgabeblack@google.com  }
138414184Sgabeblack@google.com
138514184Sgabeblack@google.com  // Transitions out of NO state
138614184Sgabeblack@google.com  transition(NO, GETX, NO_B) {
138714184Sgabeblack@google.com    r_setMRU;
138814184Sgabeblack@google.com    ano_assertNotOwner;
138914184Sgabeblack@google.com    fc_forwardRequestConditionalOwner;
139014184Sgabeblack@google.com    cs_clearSharers;
139114184Sgabeblack@google.com    i_popIncomingRequestQueue;
139214184Sgabeblack@google.com  }
139314184Sgabeblack@google.com
139414184Sgabeblack@google.com  transition(NO, GETF, NO_F) {
139514184Sgabeblack@google.com    r_setMRU;
139614184Sgabeblack@google.com    //ano_assertNotOwner;
139714184Sgabeblack@google.com    nofc_forwardRequestConditionalOwner; //forward request if the requester is not the owner
139814184Sgabeblack@google.com    cs_clearSharers;
139914184Sgabeblack@google.com    oc_sendBlockAck; // send ack if the owner
140014184Sgabeblack@google.com    i_popIncomingRequestQueue;
140114184Sgabeblack@google.com  }
140214184Sgabeblack@google.com
140314184Sgabeblack@google.com  transition(S, GETX, NO_B) {
140414184Sgabeblack@google.com    r_setMRU;
140514184Sgabeblack@google.com    fb_forwardRequestBcast;
140614184Sgabeblack@google.com    cs_clearSharers;
140714184Sgabeblack@google.com    i_popIncomingRequestQueue;
140814184Sgabeblack@google.com  }
140914184Sgabeblack@google.com
141014184Sgabeblack@google.com  transition(S, GETF, NO_F) {
141114184Sgabeblack@google.com    r_setMRU;
141214184Sgabeblack@google.com    fb_forwardRequestBcast;
141314184Sgabeblack@google.com    cs_clearSharers;
141414184Sgabeblack@google.com    i_popIncomingRequestQueue;
141514184Sgabeblack@google.com  }
141614184Sgabeblack@google.com
141714184Sgabeblack@google.com  transition(S, GETS, NO_B) {
141814184Sgabeblack@google.com    r_setMRU;
141914184Sgabeblack@google.com    ano_assertNotOwner;
142014184Sgabeblack@google.com    fb_forwardRequestBcast;
142114184Sgabeblack@google.com    i_popIncomingRequestQueue;
142214184Sgabeblack@google.com  }
142314184Sgabeblack@google.com
142414184Sgabeblack@google.com  transition(NO, GETS, NO_B) {
142514184Sgabeblack@google.com    r_setMRU;
142614184Sgabeblack@google.com    ano_assertNotOwner;
142714184Sgabeblack@google.com    ans_assertNotSharer;
142814184Sgabeblack@google.com    fc_forwardRequestConditionalOwner;
142914184Sgabeblack@google.com    i_popIncomingRequestQueue;
143014184Sgabeblack@google.com  }
143114184Sgabeblack@google.com
143214184Sgabeblack@google.com  transition(NX, GETS, NO_B) {
143314184Sgabeblack@google.com    r_setMRU;
143414184Sgabeblack@google.com    ano_assertNotOwner;
143514184Sgabeblack@google.com    fc_forwardRequestConditionalOwner;
143614184Sgabeblack@google.com    i_popIncomingRequestQueue;
143714184Sgabeblack@google.com  }
143814184Sgabeblack@google.com
143914184Sgabeblack@google.com  transition({NO, NX, S}, PUT, WB) {
144014184Sgabeblack@google.com    //
144114184Sgabeblack@google.com    // note that the PUT requestor may not be the current owner if an invalidate
144214184Sgabeblack@google.com    // raced with PUT
144314184Sgabeblack@google.com    //    
144414184Sgabeblack@google.com    a_sendWriteBackAck;
144514184Sgabeblack@google.com    i_popIncomingRequestQueue;
144614184Sgabeblack@google.com  }
144714184Sgabeblack@google.com
144814184Sgabeblack@google.com  transition({NO, NX, S}, DMA_READ, NO_DR_B_D) {
144914184Sgabeblack@google.com    vd_allocateDmaRequestInTBE;
145014184Sgabeblack@google.com    f_forwardReadFromDma;
145114184Sgabeblack@google.com    p_popDmaRequestQueue;
145214184Sgabeblack@google.com  }
145314184Sgabeblack@google.com
145414184Sgabeblack@google.com  // Nack PUT requests when races cause us to believe we own the data
145514184Sgabeblack@google.com  transition({O, E}, PUT) {
145614184Sgabeblack@google.com    b_sendWriteBackNack;
145714184Sgabeblack@google.com    i_popIncomingRequestQueue;
145814184Sgabeblack@google.com  }
145914184Sgabeblack@google.com
146014184Sgabeblack@google.com  // Blocked transient states
146114184Sgabeblack@google.com  transition({NO_B_X, O_B, NO_DR_B_W, NO_DW_B_W, NO_B_W, NO_DR_B_D, 
146214184Sgabeblack@google.com              NO_DR_B, O_DR_B, O_B_W, O_DR_B_W, NO_DW_W, NO_B_S_W,
146314184Sgabeblack@google.com              NO_W, O_W, WB, WB_E_W, WB_O_W, O_R, S_R, NO_R, NO_F_W}, 
146414184Sgabeblack@google.com             {GETS, GETX, GETF, PUT, Pf_Replacement}) {
146514184Sgabeblack@google.com    z_stallAndWaitRequest;
146614184Sgabeblack@google.com  }
146714184Sgabeblack@google.com
146814184Sgabeblack@google.com  transition(NO_F, {GETS, GETX, GETF, PUT, Pf_Replacement}){
146914184Sgabeblack@google.com    z_stallAndWaitRequest;
147014184Sgabeblack@google.com  }
147114184Sgabeblack@google.com
147214184Sgabeblack@google.com  transition(NO_B, {GETX, GETF}, NO_B_X) {
147314184Sgabeblack@google.com    z_stallAndWaitRequest;
147414184Sgabeblack@google.com  }
147514184Sgabeblack@google.com
147614184Sgabeblack@google.com  transition(NO_B, {PUT, Pf_Replacement}) {
147714184Sgabeblack@google.com    z_stallAndWaitRequest;
147814184Sgabeblack@google.com  }
147914184Sgabeblack@google.com
148014184Sgabeblack@google.com  transition(NO_B_S, {GETX, GETF, PUT, Pf_Replacement}) {
148114184Sgabeblack@google.com    z_stallAndWaitRequest;
148214184Sgabeblack@google.com  }
148314184Sgabeblack@google.com
148414184Sgabeblack@google.com  transition({NO_B_X, NO_B, NO_B_S, O_B, NO_DR_B_W, NO_DW_B_W, NO_B_W, NO_DR_B_D, 
148514184Sgabeblack@google.com              NO_DR_B, O_DR_B, O_B_W, O_DR_B_W, NO_DW_W, NO_B_S_W,
148614184Sgabeblack@google.com              NO_W, O_W, WB, WB_E_W, WB_O_W, O_R, S_R, NO_R, NO_F_W}, 
148714184Sgabeblack@google.com             {DMA_READ, DMA_WRITE}) {
148814184Sgabeblack@google.com    zd_stallAndWaitDMARequest;
148914184Sgabeblack@google.com  }
149014184Sgabeblack@google.com
149114184Sgabeblack@google.com  // merge GETS into one response
149214184Sgabeblack@google.com  transition(NO_B, GETS, NO_B_S) {
149314184Sgabeblack@google.com    v_allocateTBE;
149414184Sgabeblack@google.com    rs_recordGetSRequestor;
149514184Sgabeblack@google.com    i_popIncomingRequestQueue;
149614184Sgabeblack@google.com  }
149714184Sgabeblack@google.com
149814184Sgabeblack@google.com  transition(NO_B_S, GETS) {
149914184Sgabeblack@google.com    rs_recordGetSRequestor;
150014184Sgabeblack@google.com    i_popIncomingRequestQueue;
150114184Sgabeblack@google.com  }
150214184Sgabeblack@google.com
150314184Sgabeblack@google.com  // unblock responses
150414184Sgabeblack@google.com  transition({NO_B, NO_B_X}, UnblockS, NX) {
150514184Sgabeblack@google.com    us_updateSharerIfFBD;
150614184Sgabeblack@google.com    k_wakeUpDependents;
150714184Sgabeblack@google.com    j_popIncomingUnblockQueue;
150814184Sgabeblack@google.com  }
150914184Sgabeblack@google.com
151014184Sgabeblack@google.com  transition({NO_B, NO_B_X}, UnblockM, NO) {
151114184Sgabeblack@google.com    uo_updateOwnerIfPf;
151214184Sgabeblack@google.com    us_updateSharerIfFBD;
151314184Sgabeblack@google.com    k_wakeUpDependents;
151414184Sgabeblack@google.com    j_popIncomingUnblockQueue;
151514184Sgabeblack@google.com  }
151614184Sgabeblack@google.com
151714184Sgabeblack@google.com  transition(NO_B_S, UnblockS, NO_B_S_W) {
151814184Sgabeblack@google.com    us_updateSharerIfFBD;
151914184Sgabeblack@google.com    fr_forwardMergeReadRequestsToOwner;
152014184Sgabeblack@google.com    sp_setPendingMsgsToMergedSharers;
152114184Sgabeblack@google.com    j_popIncomingUnblockQueue;
152214184Sgabeblack@google.com  }
152314184Sgabeblack@google.com
152414184Sgabeblack@google.com  transition(NO_B_S, UnblockM, NO_B_S_W) {
152514184Sgabeblack@google.com    uo_updateOwnerIfPf;
152614184Sgabeblack@google.com    fr_forwardMergeReadRequestsToOwner;
152714184Sgabeblack@google.com    sp_setPendingMsgsToMergedSharers;
152814184Sgabeblack@google.com    j_popIncomingUnblockQueue;
152914184Sgabeblack@google.com  }
153014184Sgabeblack@google.com
153114184Sgabeblack@google.com  transition(NO_B_S_W, UnblockS) {
153214184Sgabeblack@google.com    us_updateSharerIfFBD;
153314184Sgabeblack@google.com    mu_decrementNumberOfUnblocks;
153414184Sgabeblack@google.com    os_checkForMergedGetSCompletion;
153514184Sgabeblack@google.com    j_popIncomingUnblockQueue;
153614184Sgabeblack@google.com  }
153714184Sgabeblack@google.com
153814184Sgabeblack@google.com  transition(NO_B_S_W, All_Unblocks, NX) {
153914184Sgabeblack@google.com    w_deallocateTBE;
154014184Sgabeblack@google.com    k_wakeUpDependents;
154114184Sgabeblack@google.com    g_popTriggerQueue;
154214184Sgabeblack@google.com  }
154314184Sgabeblack@google.com
154414184Sgabeblack@google.com  transition(O_B, UnblockS, O) {
154514184Sgabeblack@google.com    us_updateSharerIfFBD;
154614184Sgabeblack@google.com    k_wakeUpDependents;
154714184Sgabeblack@google.com    j_popIncomingUnblockQueue;
154814184Sgabeblack@google.com  }
154914184Sgabeblack@google.com
155014184Sgabeblack@google.com  transition(O_B, UnblockM, NO) {
155114184Sgabeblack@google.com    us_updateSharerIfFBD;
155214184Sgabeblack@google.com    uo_updateOwnerIfPf;
155314184Sgabeblack@google.com    k_wakeUpDependents;
155414184Sgabeblack@google.com    j_popIncomingUnblockQueue;
155514184Sgabeblack@google.com  }
155614184Sgabeblack@google.com
155714184Sgabeblack@google.com  transition(NO_B_W, Memory_Data, NO_B) {
155814184Sgabeblack@google.com    d_sendData;
155914184Sgabeblack@google.com    w_deallocateTBE;
156014184Sgabeblack@google.com    l_popMemQueue;
156114184Sgabeblack@google.com  }
156214184Sgabeblack@google.com
156314184Sgabeblack@google.com  transition(NO_F_W, Memory_Data, NO_F) {
156414184Sgabeblack@google.com    d_sendData;
156514184Sgabeblack@google.com    w_deallocateTBE;
156614184Sgabeblack@google.com    l_popMemQueue;
156714184Sgabeblack@google.com  }
156814184Sgabeblack@google.com
156914184Sgabeblack@google.com  transition(NO_DR_B_W, Memory_Data, NO_DR_B) {
157014184Sgabeblack@google.com    r_recordMemoryData;
157114184Sgabeblack@google.com    o_checkForCompletion;
157214184Sgabeblack@google.com    l_popMemQueue;
157314184Sgabeblack@google.com  }
157414184Sgabeblack@google.com
157514184Sgabeblack@google.com  transition(O_DR_B_W, Memory_Data, O_DR_B) {
157614184Sgabeblack@google.com    r_recordMemoryData;
157714184Sgabeblack@google.com    dr_sendDmaData;
157814184Sgabeblack@google.com    o_checkForCompletion;
157914184Sgabeblack@google.com    l_popMemQueue;
158014184Sgabeblack@google.com  }
158114184Sgabeblack@google.com
158214184Sgabeblack@google.com  transition({NO_DR_B, O_DR_B, NO_DR_B_D, NO_DW_B_W}, Ack) {
158314184Sgabeblack@google.com    m_decrementNumberOfMessages;
158414184Sgabeblack@google.com    o_checkForCompletion;
158514184Sgabeblack@google.com    n_popResponseQueue;
158614184Sgabeblack@google.com  }
158714184Sgabeblack@google.com
158814184Sgabeblack@google.com  transition({O_R, S_R, NO_R}, Ack) {
158914184Sgabeblack@google.com    m_decrementNumberOfMessages;
159014184Sgabeblack@google.com    o_checkForCompletion;
159114184Sgabeblack@google.com    n_popResponseQueue;
159214184Sgabeblack@google.com  }
159314184Sgabeblack@google.com
159414184Sgabeblack@google.com  transition(S_R, Data) {
159514184Sgabeblack@google.com    m_decrementNumberOfMessages;
159614184Sgabeblack@google.com    o_checkForCompletion;
159714184Sgabeblack@google.com    n_popResponseQueue;
159814184Sgabeblack@google.com  }
159914184Sgabeblack@google.com
160014184Sgabeblack@google.com  transition(NO_R, {Data, Exclusive_Data}) {
160114184Sgabeblack@google.com    r_recordCacheData;
160214184Sgabeblack@google.com    m_decrementNumberOfMessages;
160314184Sgabeblack@google.com    o_checkForCompletion;
160414184Sgabeblack@google.com    n_popResponseQueue;
160514184Sgabeblack@google.com  }
160614184Sgabeblack@google.com
160714184Sgabeblack@google.com  transition({O_R, S_R}, All_acks_and_data_no_sharers, E) {
160814184Sgabeblack@google.com    w_deallocateTBE;
160914184Sgabeblack@google.com    k_wakeUpDependents;
161014184Sgabeblack@google.com    g_popTriggerQueue;
161114184Sgabeblack@google.com  }
161214184Sgabeblack@google.com
161314184Sgabeblack@google.com  transition(NO_R, All_acks_and_data_no_sharers, WB_E_W) {
161414184Sgabeblack@google.com    ly_queueMemoryWriteFromTBE;
161514184Sgabeblack@google.com    w_deallocateTBE;
161614184Sgabeblack@google.com    k_wakeUpDependents;
161714184Sgabeblack@google.com    g_popTriggerQueue;
161814184Sgabeblack@google.com  }
161914184Sgabeblack@google.com
162014184Sgabeblack@google.com  transition({NO_DR_B_W, O_DR_B_W}, Ack) {
162114184Sgabeblack@google.com    m_decrementNumberOfMessages;
162214184Sgabeblack@google.com    n_popResponseQueue;
162314184Sgabeblack@google.com  }
162414184Sgabeblack@google.com
162514184Sgabeblack@google.com  transition(NO_DR_B_W, Shared_Ack) {
162614184Sgabeblack@google.com    m_decrementNumberOfMessages;
162714184Sgabeblack@google.com    r_setSharerBit;
162814184Sgabeblack@google.com    n_popResponseQueue;
162914184Sgabeblack@google.com  }
163014184Sgabeblack@google.com
163114184Sgabeblack@google.com  transition(O_DR_B, Shared_Ack) {
163214184Sgabeblack@google.com    m_decrementNumberOfMessages;
163314184Sgabeblack@google.com    r_setSharerBit;
163414184Sgabeblack@google.com    o_checkForCompletion;
163514184Sgabeblack@google.com    n_popResponseQueue;
163614184Sgabeblack@google.com  }
163714184Sgabeblack@google.com
163814184Sgabeblack@google.com  transition(O_DR_B_W, Shared_Ack) {
163914184Sgabeblack@google.com    m_decrementNumberOfMessages;
164014184Sgabeblack@google.com    r_setSharerBit;
164114184Sgabeblack@google.com    n_popResponseQueue;
164214184Sgabeblack@google.com  }
164314184Sgabeblack@google.com
164414184Sgabeblack@google.com  transition({NO_DR_B, NO_DR_B_D}, Shared_Ack) {
164514184Sgabeblack@google.com    m_decrementNumberOfMessages;
164614184Sgabeblack@google.com    r_setSharerBit;
164714184Sgabeblack@google.com    o_checkForCompletion;
164814184Sgabeblack@google.com    n_popResponseQueue;
164914184Sgabeblack@google.com  }
165014184Sgabeblack@google.com
165114184Sgabeblack@google.com  transition(NO_DR_B_W, Shared_Data) {
165214184Sgabeblack@google.com    r_recordCacheData;
165314184Sgabeblack@google.com    m_decrementNumberOfMessages;
165414184Sgabeblack@google.com    so_setOwnerBit;
165514184Sgabeblack@google.com    o_checkForCompletion;
165614184Sgabeblack@google.com    n_popResponseQueue;
165714184Sgabeblack@google.com  }
165814184Sgabeblack@google.com
165914184Sgabeblack@google.com  transition({NO_DR_B, NO_DR_B_D}, Shared_Data) {
166014184Sgabeblack@google.com    r_recordCacheData;
166114184Sgabeblack@google.com    m_decrementNumberOfMessages;
166214184Sgabeblack@google.com    so_setOwnerBit;
166314184Sgabeblack@google.com    o_checkForCompletion;
166414184Sgabeblack@google.com    n_popResponseQueue;
166514184Sgabeblack@google.com  }
166614184Sgabeblack@google.com
166714184Sgabeblack@google.com  transition(NO_DR_B_W, {Exclusive_Data, Data}) {
166814184Sgabeblack@google.com    r_recordCacheData;
166914184Sgabeblack@google.com    m_decrementNumberOfMessages;
167014184Sgabeblack@google.com    n_popResponseQueue;
167114184Sgabeblack@google.com  }
167214184Sgabeblack@google.com
167314184Sgabeblack@google.com  transition({NO_DR_B, NO_DR_B_D, NO_DW_B_W}, {Exclusive_Data, Data}) {
167414184Sgabeblack@google.com    r_recordCacheData;
167514184Sgabeblack@google.com    m_decrementNumberOfMessages;
167614184Sgabeblack@google.com    o_checkForCompletion;
167714184Sgabeblack@google.com    n_popResponseQueue;
167814184Sgabeblack@google.com  }
167914184Sgabeblack@google.com
168014184Sgabeblack@google.com  transition(NO_DR_B, All_acks_and_owner_data, WB_O_W) {
168114184Sgabeblack@google.com    //
168214184Sgabeblack@google.com    // Note that the DMA consistency model allows us to send the DMA device
168314184Sgabeblack@google.com    // a response as soon as we receive valid data and prior to receiving
168414184Sgabeblack@google.com    // all acks.  However, to simplify the protocol we wait for all acks.
168514184Sgabeblack@google.com    //
168614184Sgabeblack@google.com    dt_sendDmaDataFromTbe;
168714184Sgabeblack@google.com    ly_queueMemoryWriteFromTBE;
168814184Sgabeblack@google.com    w_deallocateTBE;
168914184Sgabeblack@google.com    k_wakeUpDependents;
169014184Sgabeblack@google.com    g_popTriggerQueue;
169114184Sgabeblack@google.com  }
169214184Sgabeblack@google.com
169314184Sgabeblack@google.com  transition(NO_DR_B, All_acks_and_shared_data, S) {
169414184Sgabeblack@google.com    //
169514184Sgabeblack@google.com    // Note that the DMA consistency model allows us to send the DMA device
169614184Sgabeblack@google.com    // a response as soon as we receive valid data and prior to receiving
169714184Sgabeblack@google.com    // all acks.  However, to simplify the protocol we wait for all acks.
169814184Sgabeblack@google.com    //
169914184Sgabeblack@google.com    dt_sendDmaDataFromTbe;
170014184Sgabeblack@google.com    w_deallocateTBE;
170114184Sgabeblack@google.com    k_wakeUpDependents;
170214184Sgabeblack@google.com    g_popTriggerQueue;
170314184Sgabeblack@google.com  }
170414184Sgabeblack@google.com
170514184Sgabeblack@google.com  transition(NO_DR_B_D, All_acks_and_owner_data, WB_O_W) {
170614184Sgabeblack@google.com    //
170714184Sgabeblack@google.com    // Note that the DMA consistency model allows us to send the DMA device
170814184Sgabeblack@google.com    // a response as soon as we receive valid data and prior to receiving
170914184Sgabeblack@google.com    // all acks.  However, to simplify the protocol we wait for all acks.
171014184Sgabeblack@google.com    //
171114184Sgabeblack@google.com    dt_sendDmaDataFromTbe;
171214184Sgabeblack@google.com    ly_queueMemoryWriteFromTBE;
171314184Sgabeblack@google.com    w_deallocateTBE;
171414184Sgabeblack@google.com    k_wakeUpDependents;
171514184Sgabeblack@google.com    g_popTriggerQueue;
171614184Sgabeblack@google.com  }
171714184Sgabeblack@google.com
171814184Sgabeblack@google.com  transition(NO_DR_B_D, All_acks_and_shared_data, S) {
171914184Sgabeblack@google.com    //
172014184Sgabeblack@google.com    // Note that the DMA consistency model allows us to send the DMA device
172114184Sgabeblack@google.com    // a response as soon as we receive valid data and prior to receiving
172214184Sgabeblack@google.com    // all acks.  However, to simplify the protocol we wait for all acks.
172314184Sgabeblack@google.com    //
172414184Sgabeblack@google.com    dt_sendDmaDataFromTbe;
172514184Sgabeblack@google.com    w_deallocateTBE;
172614184Sgabeblack@google.com    k_wakeUpDependents;
172714184Sgabeblack@google.com    g_popTriggerQueue;
172814184Sgabeblack@google.com  }
172914184Sgabeblack@google.com
173014184Sgabeblack@google.com  transition(O_DR_B, All_acks_and_owner_data, WB_O_W) {
173114184Sgabeblack@google.com    ly_queueMemoryWriteFromTBE;
173214184Sgabeblack@google.com    w_deallocateTBE;
173314184Sgabeblack@google.com    k_wakeUpDependents;
173414184Sgabeblack@google.com    g_popTriggerQueue;
173514184Sgabeblack@google.com  }
173614184Sgabeblack@google.com
173714184Sgabeblack@google.com  transition(O_DR_B, All_acks_and_data_no_sharers, WB_E_W) {
173814184Sgabeblack@google.com    ly_queueMemoryWriteFromTBE;
173914184Sgabeblack@google.com    w_deallocateTBE;
174014184Sgabeblack@google.com    pfd_probeFilterDeallocate;
174114184Sgabeblack@google.com    k_wakeUpDependents;
174214184Sgabeblack@google.com    g_popTriggerQueue;
174314184Sgabeblack@google.com  }
174414184Sgabeblack@google.com
174514184Sgabeblack@google.com  transition(NO_DR_B, All_acks_and_data_no_sharers, WB_E_W) {
174614184Sgabeblack@google.com    //
174714184Sgabeblack@google.com    // Note that the DMA consistency model allows us to send the DMA device
174814184Sgabeblack@google.com    // a response as soon as we receive valid data and prior to receiving
174914184Sgabeblack@google.com    // all acks.  However, to simplify the protocol we wait for all acks.
175014184Sgabeblack@google.com    //
175114184Sgabeblack@google.com    dt_sendDmaDataFromTbe;
175214184Sgabeblack@google.com    ly_queueMemoryWriteFromTBE;
175314184Sgabeblack@google.com    w_deallocateTBE;
175414184Sgabeblack@google.com    ppfd_possibleProbeFilterDeallocate;
175514184Sgabeblack@google.com    k_wakeUpDependents;
175614184Sgabeblack@google.com    g_popTriggerQueue;
175714184Sgabeblack@google.com  }
175814184Sgabeblack@google.com
175914184Sgabeblack@google.com  transition(NO_DR_B_D, All_acks_and_data_no_sharers, WB_E_W) {
176014184Sgabeblack@google.com    a_assertCacheData;
176114184Sgabeblack@google.com    //
176214184Sgabeblack@google.com    // Note that the DMA consistency model allows us to send the DMA device
176314184Sgabeblack@google.com    // a response as soon as we receive valid data and prior to receiving
176414184Sgabeblack@google.com    // all acks.  However, to simplify the protocol we wait for all acks.
176514184Sgabeblack@google.com    //
176614184Sgabeblack@google.com    dt_sendDmaDataFromTbe;
176714184Sgabeblack@google.com    ly_queueMemoryWriteFromTBE;
176814184Sgabeblack@google.com    w_deallocateTBE;
176914184Sgabeblack@google.com    ppfd_possibleProbeFilterDeallocate;
177014184Sgabeblack@google.com    k_wakeUpDependents;
177114184Sgabeblack@google.com    g_popTriggerQueue;
177214184Sgabeblack@google.com  }
177314184Sgabeblack@google.com
177414184Sgabeblack@google.com  transition(NO_DW_B_W, All_acks_and_data_no_sharers, NO_DW_W) {
177514184Sgabeblack@google.com    ld_queueMemoryDmaWrite;
177614184Sgabeblack@google.com    g_popTriggerQueue;
177714184Sgabeblack@google.com  }
177814184Sgabeblack@google.com
177914184Sgabeblack@google.com  transition(NO_DW_W, Memory_Ack, E) {
178014184Sgabeblack@google.com    da_sendDmaAck;
178114184Sgabeblack@google.com    w_deallocateTBE;
178214184Sgabeblack@google.com    ppfd_possibleProbeFilterDeallocate;
178314184Sgabeblack@google.com    k_wakeUpDependents;
178414184Sgabeblack@google.com    l_popMemQueue;
178514184Sgabeblack@google.com  }
178614184Sgabeblack@google.com
178714184Sgabeblack@google.com  transition(O_B_W, Memory_Data, O_B) {
178814184Sgabeblack@google.com    d_sendData;
178914184Sgabeblack@google.com    w_deallocateTBE;
179014184Sgabeblack@google.com    l_popMemQueue;
179114184Sgabeblack@google.com  }
179214184Sgabeblack@google.com
179314184Sgabeblack@google.com  transition(NO_B_W, UnblockM, NO_W) {
179414184Sgabeblack@google.com    uo_updateOwnerIfPf;
179514184Sgabeblack@google.com    j_popIncomingUnblockQueue;
179614184Sgabeblack@google.com  }
179714184Sgabeblack@google.com
179814184Sgabeblack@google.com  transition(NO_B_W, UnblockS, NO_W) {
179914184Sgabeblack@google.com    us_updateSharerIfFBD;
180014184Sgabeblack@google.com    j_popIncomingUnblockQueue;
180114184Sgabeblack@google.com  }
180214184Sgabeblack@google.com
180314184Sgabeblack@google.com  transition(O_B_W, UnblockS, O_W) {
180414184Sgabeblack@google.com    us_updateSharerIfFBD;
180514184Sgabeblack@google.com    j_popIncomingUnblockQueue;
180614184Sgabeblack@google.com  }
180714184Sgabeblack@google.com
180814184Sgabeblack@google.com  transition(NO_W, Memory_Data, NO) {
180914184Sgabeblack@google.com    w_deallocateTBE;
181014184Sgabeblack@google.com    k_wakeUpDependents;
181114184Sgabeblack@google.com    l_popMemQueue;
181214184Sgabeblack@google.com  }
181314184Sgabeblack@google.com
181414184Sgabeblack@google.com  transition(O_W, Memory_Data, O) {
181514184Sgabeblack@google.com    w_deallocateTBE;
181614184Sgabeblack@google.com    k_wakeUpDependents;
181714184Sgabeblack@google.com    l_popMemQueue;
181814184Sgabeblack@google.com  }
181914184Sgabeblack@google.com
182014184Sgabeblack@google.com  // WB State Transistions
182114184Sgabeblack@google.com  transition(WB, Writeback_Dirty, WB_O_W) {
182214184Sgabeblack@google.com    rs_removeSharer;
182314184Sgabeblack@google.com    l_queueMemoryWBRequest;
182414184Sgabeblack@google.com    j_popIncomingUnblockQueue;
182514184Sgabeblack@google.com  }
182614184Sgabeblack@google.com
182714184Sgabeblack@google.com  transition(WB, Writeback_Exclusive_Dirty, WB_E_W) {
182814184Sgabeblack@google.com    rs_removeSharer;
182914184Sgabeblack@google.com    l_queueMemoryWBRequest;
183014184Sgabeblack@google.com    pfd_probeFilterDeallocate;
183114184Sgabeblack@google.com    j_popIncomingUnblockQueue;
183214184Sgabeblack@google.com  }
183314184Sgabeblack@google.com
183414184Sgabeblack@google.com  transition(WB_E_W, Memory_Ack, E) {
183514184Sgabeblack@google.com    k_wakeUpDependents;
183614184Sgabeblack@google.com    l_popMemQueue;
183714184Sgabeblack@google.com  }
183814184Sgabeblack@google.com
183914184Sgabeblack@google.com  transition(WB_O_W, Memory_Ack, O) {
184014184Sgabeblack@google.com    k_wakeUpDependents;
184114184Sgabeblack@google.com    l_popMemQueue;
184214184Sgabeblack@google.com  }
184314184Sgabeblack@google.com
184414184Sgabeblack@google.com  transition(WB, Writeback_Clean, O) {
184514184Sgabeblack@google.com    ll_checkIncomingWriteback;
184614184Sgabeblack@google.com    rs_removeSharer;
184714184Sgabeblack@google.com    k_wakeUpDependents;
184814184Sgabeblack@google.com    j_popIncomingUnblockQueue;
184914184Sgabeblack@google.com  }
185014184Sgabeblack@google.com
185114184Sgabeblack@google.com  transition(WB, Writeback_Exclusive_Clean, E) {
185214184Sgabeblack@google.com    ll_checkIncomingWriteback;
185314184Sgabeblack@google.com    rs_removeSharer;
185414184Sgabeblack@google.com    pfd_probeFilterDeallocate;
185514184Sgabeblack@google.com    k_wakeUpDependents;
185614184Sgabeblack@google.com    j_popIncomingUnblockQueue;
185714184Sgabeblack@google.com  }
185814184Sgabeblack@google.com
185914184Sgabeblack@google.com  transition(WB, Unblock, NX) {
186014184Sgabeblack@google.com    auno_assertUnblockerNotOwner;
186114184Sgabeblack@google.com    k_wakeUpDependents;
186214184Sgabeblack@google.com    j_popIncomingUnblockQueue;
186314184Sgabeblack@google.com  }
186414184Sgabeblack@google.com
186514184Sgabeblack@google.com  transition(NO_F, PUTF, WB) {
186614184Sgabeblack@google.com    a_sendWriteBackAck;
186714184Sgabeblack@google.com    i_popIncomingRequestQueue;
186814184Sgabeblack@google.com  }
186914184Sgabeblack@google.com
187014184Sgabeblack@google.com  //possible race between GETF and UnblockM -- not sure needed any more?
187114184Sgabeblack@google.com  transition(NO_F, UnblockM) {
187214184Sgabeblack@google.com    us_updateSharerIfFBD;
187314184Sgabeblack@google.com    uo_updateOwnerIfPf;
187414184Sgabeblack@google.com    j_popIncomingUnblockQueue;
187514184Sgabeblack@google.com  }
187614184Sgabeblack@google.com}
1877