MOESI_CMP_token-L1cache.sm revision 14184
114184Sgabeblack@google.com/* 214184Sgabeblack@google.com * Copyright (c) 1999-2013 Mark D. Hill and David A. Wood 314184Sgabeblack@google.com * All rights reserved. 414184Sgabeblack@google.com * 514184Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 614184Sgabeblack@google.com * modification, are permitted provided that the following conditions are 714184Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 814184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 914184Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 1014184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1114184Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1214184Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1314184Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1414184Sgabeblack@google.com * this software without specific prior written permission. 1514184Sgabeblack@google.com * 1614184Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1714184Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1814184Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1914184Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2014184Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2114184Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2214184Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2314184Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2414184Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2514184Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2614184Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2714184Sgabeblack@google.com */ 2814184Sgabeblack@google.com 2914184Sgabeblack@google.com/* 3014184Sgabeblack@google.com * $Id: MOESI_CMP_token-L1cache.sm 1.22 05/01/19 15:55:39-06:00 beckmann@s0-28.cs.wisc.edu $ 3114184Sgabeblack@google.com * 3214184Sgabeblack@google.com */ 3314184Sgabeblack@google.com 3414184Sgabeblack@google.commachine(MachineType:L1Cache, "Token protocol") 3514184Sgabeblack@google.com : Sequencer * sequencer; 3614184Sgabeblack@google.com CacheMemory * L1Icache; 3714184Sgabeblack@google.com CacheMemory * L1Dcache; 3814184Sgabeblack@google.com int l2_select_num_bits; 3914184Sgabeblack@google.com int N_tokens; 4014184Sgabeblack@google.com 4114184Sgabeblack@google.com Cycles l1_request_latency := 2; 4214184Sgabeblack@google.com Cycles l1_response_latency := 2; 4314184Sgabeblack@google.com int retry_threshold := 1; 4414184Sgabeblack@google.com Cycles fixed_timeout_latency := 100; 4514184Sgabeblack@google.com Cycles reissue_wakeup_latency := 10; 4614184Sgabeblack@google.com Cycles use_timeout_latency := 50; 4714184Sgabeblack@google.com 4814184Sgabeblack@google.com bool dynamic_timeout_enabled := "True"; 4914184Sgabeblack@google.com bool no_mig_atomic := "True"; 5014184Sgabeblack@google.com bool send_evictions; 5114184Sgabeblack@google.com 5214184Sgabeblack@google.com // Message Queues 5314184Sgabeblack@google.com // From this node's L1 cache TO the network 5414184Sgabeblack@google.com 5514184Sgabeblack@google.com // a local L1 -> this L2 bank 5614184Sgabeblack@google.com MessageBuffer * responseFromL1Cache, network="To", virtual_network="4", 5714184Sgabeblack@google.com vnet_type="response"; 5814184Sgabeblack@google.com MessageBuffer * persistentFromL1Cache, network="To", virtual_network="3", 5914184Sgabeblack@google.com vnet_type="persistent"; 6014184Sgabeblack@google.com // a local L1 -> this L2 bank, currently ordered with directory forwarded requests 6114184Sgabeblack@google.com MessageBuffer * requestFromL1Cache, network="To", virtual_network="1", 6214184Sgabeblack@google.com vnet_type="request"; 6314184Sgabeblack@google.com 6414184Sgabeblack@google.com // To this node's L1 cache FROM the network 6514184Sgabeblack@google.com 6614184Sgabeblack@google.com // a L2 bank -> this L1 6714184Sgabeblack@google.com MessageBuffer * responseToL1Cache, network="From", virtual_network="4", 6814184Sgabeblack@google.com vnet_type="response"; 6914184Sgabeblack@google.com MessageBuffer * persistentToL1Cache, network="From", virtual_network="3", 7014184Sgabeblack@google.com vnet_type="persistent"; 7114184Sgabeblack@google.com // a L2 bank -> this L1 7214184Sgabeblack@google.com MessageBuffer * requestToL1Cache, network="From", virtual_network="1", 7314184Sgabeblack@google.com vnet_type="request"; 7414184Sgabeblack@google.com 7514184Sgabeblack@google.com MessageBuffer * mandatoryQueue; 7614184Sgabeblack@google.com{ 7714184Sgabeblack@google.com // STATES 7814184Sgabeblack@google.com state_declaration(State, desc="Cache states", default="L1Cache_State_I") { 7914184Sgabeblack@google.com // Base states 8014184Sgabeblack@google.com NP, AccessPermission:Invalid, "NP", desc="Not Present"; 8114184Sgabeblack@google.com I, AccessPermission:Invalid, "I", desc="Idle"; 8214184Sgabeblack@google.com S, AccessPermission:Read_Only, "S", desc="Shared"; 8314184Sgabeblack@google.com O, AccessPermission:Read_Only, "O", desc="Owned"; 8414184Sgabeblack@google.com M, AccessPermission:Read_Only, "M", desc="Modified (dirty)"; 8514184Sgabeblack@google.com MM, AccessPermission:Read_Write, "MM", desc="Modified (dirty and locally modified)"; 8614184Sgabeblack@google.com M_W, AccessPermission:Read_Only, "M^W", desc="Modified (dirty), waiting"; 8714184Sgabeblack@google.com MM_W, AccessPermission:Read_Write, "MM^W", desc="Modified (dirty and locally modified), waiting"; 8814184Sgabeblack@google.com 8914184Sgabeblack@google.com // Transient States 9014184Sgabeblack@google.com IM, AccessPermission:Busy, "IM", desc="Issued GetX"; 9114184Sgabeblack@google.com SM, AccessPermission:Read_Only, "SM", desc="Issued GetX, we still have an old copy of the line"; 9214184Sgabeblack@google.com OM, AccessPermission:Read_Only, "OM", desc="Issued GetX, received data"; 9314184Sgabeblack@google.com IS, AccessPermission:Busy, "IS", desc="Issued GetS"; 9414184Sgabeblack@google.com 9514184Sgabeblack@google.com // Locked states 9614184Sgabeblack@google.com I_L, AccessPermission:Busy, "I^L", desc="Invalid, Locked"; 9714184Sgabeblack@google.com S_L, AccessPermission:Busy, "S^L", desc="Shared, Locked"; 9814184Sgabeblack@google.com IM_L, AccessPermission:Busy, "IM^L", desc="Invalid, Locked, trying to go to Modified"; 9914184Sgabeblack@google.com SM_L, AccessPermission:Busy, "SM^L", desc="Shared, Locked, trying to go to Modified"; 10014184Sgabeblack@google.com IS_L, AccessPermission:Busy, "IS^L", desc="Invalid, Locked, trying to go to Shared"; 10114184Sgabeblack@google.com } 10214184Sgabeblack@google.com 10314184Sgabeblack@google.com // EVENTS 10414184Sgabeblack@google.com enumeration(Event, desc="Cache events") { 10514184Sgabeblack@google.com Load, desc="Load request from the processor"; 10614184Sgabeblack@google.com Ifetch, desc="I-fetch request from the processor"; 10714184Sgabeblack@google.com Store, desc="Store request from the processor"; 10814184Sgabeblack@google.com Atomic, desc="Atomic request from the processor"; 10914184Sgabeblack@google.com L1_Replacement, desc="L1 Replacement"; 11014184Sgabeblack@google.com 11114184Sgabeblack@google.com // Responses 11214184Sgabeblack@google.com Data_Shared, desc="Received a data message, we are now a sharer"; 11314184Sgabeblack@google.com Data_Owner, desc="Received a data message, we are now the owner"; 11414184Sgabeblack@google.com Data_All_Tokens, desc="Received a data message, we are now the owner, we now have all the tokens"; 11514184Sgabeblack@google.com Ack, desc="Received an ack message"; 11614184Sgabeblack@google.com Ack_All_Tokens, desc="Received an ack message, we now have all the tokens"; 11714184Sgabeblack@google.com 11814184Sgabeblack@google.com // Requests 11914184Sgabeblack@google.com Transient_GETX, desc="A GetX from another processor"; 12014184Sgabeblack@google.com Transient_Local_GETX, desc="A GetX from another processor"; 12114184Sgabeblack@google.com Transient_GETS, desc="A GetS from another processor"; 12214184Sgabeblack@google.com Transient_Local_GETS, desc="A GetS from another processor"; 12314184Sgabeblack@google.com Transient_GETS_Last_Token, desc="A GetS from another processor"; 12414184Sgabeblack@google.com Transient_Local_GETS_Last_Token, desc="A GetS from another processor"; 12514184Sgabeblack@google.com 12614184Sgabeblack@google.com // Lock/Unlock for distributed 12714184Sgabeblack@google.com Persistent_GETX, desc="Another processor has priority to read/write"; 12814184Sgabeblack@google.com Persistent_GETS, desc="Another processor has priority to read"; 12914184Sgabeblack@google.com Persistent_GETS_Last_Token, desc="Another processor has priority to read, no more tokens"; 13014184Sgabeblack@google.com Own_Lock_or_Unlock, desc="This processor now has priority"; 13114184Sgabeblack@google.com 13214184Sgabeblack@google.com // Triggers 13314184Sgabeblack@google.com Request_Timeout, desc="Timeout"; 13414184Sgabeblack@google.com Use_TimeoutStarverX, desc="Timeout"; 13514184Sgabeblack@google.com Use_TimeoutStarverS, desc="Timeout"; 13614184Sgabeblack@google.com Use_TimeoutNoStarvers, desc="Timeout"; 13714184Sgabeblack@google.com Use_TimeoutNoStarvers_NoMig, desc="Timeout Don't Migrate"; 13814184Sgabeblack@google.com } 13914184Sgabeblack@google.com 14014184Sgabeblack@google.com // TYPES 14114184Sgabeblack@google.com 14214184Sgabeblack@google.com // CacheEntry 14314184Sgabeblack@google.com structure(Entry, desc="...", interface="AbstractCacheEntry") { 14414184Sgabeblack@google.com State CacheState, desc="cache state"; 14514184Sgabeblack@google.com bool Dirty, desc="Is the data dirty (different than memory)?"; 14614184Sgabeblack@google.com int Tokens, desc="The number of tokens we're holding for the line"; 14714184Sgabeblack@google.com DataBlock DataBlk, desc="data for the block"; 14814184Sgabeblack@google.com } 14914184Sgabeblack@google.com 15014184Sgabeblack@google.com 15114184Sgabeblack@google.com // TBE fields 15214184Sgabeblack@google.com structure(TBE, desc="...") { 15314184Sgabeblack@google.com Addr addr, desc="Physical address for this TBE"; 15414184Sgabeblack@google.com State TBEState, desc="Transient state"; 15514184Sgabeblack@google.com int IssueCount, default="0", desc="The number of times we've issued a request for this line."; 15614184Sgabeblack@google.com Addr PC, desc="Program counter of request"; 15714184Sgabeblack@google.com 15814184Sgabeblack@google.com bool WentPersistent, default="false", desc="Request went persistent"; 15914184Sgabeblack@google.com bool ExternalResponse, default="false", desc="Response came from an external controller"; 16014184Sgabeblack@google.com bool IsAtomic, default="false", desc="Request was an atomic request"; 16114184Sgabeblack@google.com 16214184Sgabeblack@google.com AccessType TypeOfAccess, desc="Type of request (used for profiling)"; 16314184Sgabeblack@google.com Cycles IssueTime, desc="Time the request was issued"; 16414184Sgabeblack@google.com RubyAccessMode AccessMode, desc="user/supervisor access type"; 16514184Sgabeblack@google.com PrefetchBit Prefetch, desc="Is this a prefetch request"; 16614184Sgabeblack@google.com } 16714184Sgabeblack@google.com 16814184Sgabeblack@google.com structure(TBETable, external="yes") { 16914184Sgabeblack@google.com TBE lookup(Addr); 17014184Sgabeblack@google.com void allocate(Addr); 17114184Sgabeblack@google.com void deallocate(Addr); 17214184Sgabeblack@google.com bool isPresent(Addr); 17314184Sgabeblack@google.com } 17414184Sgabeblack@google.com 17514184Sgabeblack@google.com structure(PersistentTable, external="yes") { 17614184Sgabeblack@google.com void persistentRequestLock(Addr, MachineID, AccessType); 17714184Sgabeblack@google.com void persistentRequestUnlock(Addr, MachineID); 17814184Sgabeblack@google.com bool okToIssueStarving(Addr, MachineID); 17914184Sgabeblack@google.com MachineID findSmallest(Addr); 18014184Sgabeblack@google.com AccessType typeOfSmallest(Addr); 18114184Sgabeblack@google.com void markEntries(Addr); 18214184Sgabeblack@google.com bool isLocked(Addr); 18314184Sgabeblack@google.com int countStarvingForAddress(Addr); 18414184Sgabeblack@google.com int countReadStarvingForAddress(Addr); 18514184Sgabeblack@google.com } 18614184Sgabeblack@google.com 18714184Sgabeblack@google.com Tick clockEdge(); 18814184Sgabeblack@google.com Tick cyclesToTicks(Cycles c); 18914184Sgabeblack@google.com void set_cache_entry(AbstractCacheEntry b); 19014184Sgabeblack@google.com void unset_cache_entry(); 19114184Sgabeblack@google.com void set_tbe(TBE b); 19214184Sgabeblack@google.com void unset_tbe(); 19314184Sgabeblack@google.com void wakeUpAllBuffers(); 19414184Sgabeblack@google.com void wakeUpBuffers(Addr a); 19514184Sgabeblack@google.com Cycles curCycle(); 19614184Sgabeblack@google.com MachineID mapAddressToMachine(Addr addr, MachineType mtype); 19714184Sgabeblack@google.com 19814184Sgabeblack@google.com TBETable L1_TBEs, template="<L1Cache_TBE>", constructor="m_number_of_TBEs"; 19914184Sgabeblack@google.com 20014184Sgabeblack@google.com bool starving, default="false"; 20114184Sgabeblack@google.com int l2_select_low_bit, default="RubySystem::getBlockSizeBits()"; 20214184Sgabeblack@google.com 20314184Sgabeblack@google.com PersistentTable persistentTable; 20414184Sgabeblack@google.com TimerTable useTimerTable; 20514184Sgabeblack@google.com TimerTable reissueTimerTable; 20614184Sgabeblack@google.com 20714184Sgabeblack@google.com int outstandingRequests, default="0"; 20814184Sgabeblack@google.com int outstandingPersistentRequests, default="0"; 20914184Sgabeblack@google.com 21014184Sgabeblack@google.com // Constant that provides hysteresis for calculated the estimated average 21114184Sgabeblack@google.com int averageLatencyHysteresis, default="(8)"; 21214184Sgabeblack@google.com Cycles averageLatencyCounter, 21314184Sgabeblack@google.com default="(Cycles(500) << (*m_averageLatencyHysteresis_ptr))"; 21414184Sgabeblack@google.com 21514184Sgabeblack@google.com Cycles averageLatencyEstimate() { 21614184Sgabeblack@google.com DPRINTF(RubySlicc, "%d\n", 21714184Sgabeblack@google.com (averageLatencyCounter >> averageLatencyHysteresis)); 21814184Sgabeblack@google.com return averageLatencyCounter >> averageLatencyHysteresis; 21914184Sgabeblack@google.com } 22014184Sgabeblack@google.com 22114184Sgabeblack@google.com void updateAverageLatencyEstimate(Cycles latency) { 22214184Sgabeblack@google.com DPRINTF(RubySlicc, "%d\n", latency); 22314184Sgabeblack@google.com 22414184Sgabeblack@google.com // By subtracting the current average and then adding the most 22514184Sgabeblack@google.com // recent sample, we calculate an estimate of the recent average. 22614184Sgabeblack@google.com // If we simply used a running sum and divided by the total number 22714184Sgabeblack@google.com // of entries, the estimate of the average would adapt very slowly 22814184Sgabeblack@google.com // after the execution has run for a long time. 22914184Sgabeblack@google.com // averageLatencyCounter := averageLatencyCounter - averageLatencyEstimate() + latency; 23014184Sgabeblack@google.com 23114184Sgabeblack@google.com averageLatencyCounter := averageLatencyCounter - averageLatencyEstimate() + latency; 23214184Sgabeblack@google.com } 23314184Sgabeblack@google.com 23414184Sgabeblack@google.com Entry getCacheEntry(Addr addr), return_by_pointer="yes" { 23514184Sgabeblack@google.com Entry L1Dcache_entry := static_cast(Entry, "pointer", L1Dcache.lookup(addr)); 23614184Sgabeblack@google.com if(is_valid(L1Dcache_entry)) { 23714184Sgabeblack@google.com return L1Dcache_entry; 23814184Sgabeblack@google.com } 23914184Sgabeblack@google.com 24014184Sgabeblack@google.com Entry L1Icache_entry := static_cast(Entry, "pointer", L1Icache.lookup(addr)); 24114184Sgabeblack@google.com return L1Icache_entry; 24214184Sgabeblack@google.com } 24314184Sgabeblack@google.com 24414184Sgabeblack@google.com void functionalRead(Addr addr, Packet *pkt) { 24514184Sgabeblack@google.com testAndRead(addr, getCacheEntry(addr).DataBlk, pkt); 24614184Sgabeblack@google.com } 24714184Sgabeblack@google.com 24814184Sgabeblack@google.com int functionalWrite(Addr addr, Packet *pkt) { 24914184Sgabeblack@google.com int num_functional_writes := 0; 25014184Sgabeblack@google.com num_functional_writes := num_functional_writes + 25114184Sgabeblack@google.com testAndWrite(addr, getCacheEntry(addr).DataBlk, pkt); 25214184Sgabeblack@google.com return num_functional_writes; 25314184Sgabeblack@google.com } 25414184Sgabeblack@google.com 25514184Sgabeblack@google.com Entry getL1DCacheEntry(Addr addr), return_by_pointer="yes" { 25614184Sgabeblack@google.com Entry L1Dcache_entry := static_cast(Entry, "pointer", L1Dcache.lookup(addr)); 25714184Sgabeblack@google.com return L1Dcache_entry; 25814184Sgabeblack@google.com } 25914184Sgabeblack@google.com 26014184Sgabeblack@google.com Entry getL1ICacheEntry(Addr addr), return_by_pointer="yes" { 26114184Sgabeblack@google.com Entry L1Icache_entry := static_cast(Entry, "pointer", L1Icache.lookup(addr)); 26214184Sgabeblack@google.com return L1Icache_entry; 26314184Sgabeblack@google.com } 26414184Sgabeblack@google.com 26514184Sgabeblack@google.com int getTokens(Entry cache_entry) { 26614184Sgabeblack@google.com if (is_valid(cache_entry)) { 26714184Sgabeblack@google.com return cache_entry.Tokens; 26814184Sgabeblack@google.com } 26914184Sgabeblack@google.com return 0; 27014184Sgabeblack@google.com } 27114184Sgabeblack@google.com 27214184Sgabeblack@google.com State getState(TBE tbe, Entry cache_entry, Addr addr) { 27314184Sgabeblack@google.com 27414184Sgabeblack@google.com if (is_valid(tbe)) { 27514184Sgabeblack@google.com return tbe.TBEState; 27614184Sgabeblack@google.com } else if (is_valid(cache_entry)) { 27714184Sgabeblack@google.com return cache_entry.CacheState; 27814184Sgabeblack@google.com } else { 27914184Sgabeblack@google.com if (persistentTable.isLocked(addr) && (persistentTable.findSmallest(addr) != machineID)) { 28014184Sgabeblack@google.com // Not in cache, in persistent table, but this processor isn't highest priority 28114184Sgabeblack@google.com return State:I_L; 28214184Sgabeblack@google.com } else { 28314184Sgabeblack@google.com return State:NP; 28414184Sgabeblack@google.com } 28514184Sgabeblack@google.com } 28614184Sgabeblack@google.com } 28714184Sgabeblack@google.com 28814184Sgabeblack@google.com void setState(TBE tbe, Entry cache_entry, Addr addr, State state) { 28914184Sgabeblack@google.com assert((L1Dcache.isTagPresent(addr) && L1Icache.isTagPresent(addr)) == false); 29014184Sgabeblack@google.com 29114184Sgabeblack@google.com if (is_valid(tbe)) { 29214184Sgabeblack@google.com assert(state != State:I); 29314184Sgabeblack@google.com assert(state != State:S); 29414184Sgabeblack@google.com assert(state != State:O); 29514184Sgabeblack@google.com assert(state != State:MM); 29614184Sgabeblack@google.com assert(state != State:M); 29714184Sgabeblack@google.com tbe.TBEState := state; 29814184Sgabeblack@google.com } 29914184Sgabeblack@google.com 30014184Sgabeblack@google.com if (is_valid(cache_entry)) { 30114184Sgabeblack@google.com // Make sure the token count is in range 30214184Sgabeblack@google.com assert(cache_entry.Tokens >= 0); 30314184Sgabeblack@google.com assert(cache_entry.Tokens <= max_tokens()); 30414184Sgabeblack@google.com assert(cache_entry.Tokens != (max_tokens() / 2)); 30514184Sgabeblack@google.com 30614184Sgabeblack@google.com if ((state == State:I_L) || 30714184Sgabeblack@google.com (state == State:IM_L) || 30814184Sgabeblack@google.com (state == State:IS_L)) { 30914184Sgabeblack@google.com // Make sure we have no tokens in the "Invalid, locked" states 31014184Sgabeblack@google.com assert(cache_entry.Tokens == 0); 31114184Sgabeblack@google.com 31214184Sgabeblack@google.com // Make sure the line is locked 31314184Sgabeblack@google.com // assert(persistentTable.isLocked(addr)); 31414184Sgabeblack@google.com 31514184Sgabeblack@google.com // But we shouldn't have highest priority for it 31614184Sgabeblack@google.com // assert(persistentTable.findSmallest(addr) != id); 31714184Sgabeblack@google.com 31814184Sgabeblack@google.com } else if ((state == State:S_L) || 31914184Sgabeblack@google.com (state == State:SM_L)) { 32014184Sgabeblack@google.com assert(cache_entry.Tokens >= 1); 32114184Sgabeblack@google.com assert(cache_entry.Tokens < (max_tokens() / 2)); 32214184Sgabeblack@google.com 32314184Sgabeblack@google.com // Make sure the line is locked... 32414184Sgabeblack@google.com // assert(persistentTable.isLocked(addr)); 32514184Sgabeblack@google.com 32614184Sgabeblack@google.com // ...But we shouldn't have highest priority for it... 32714184Sgabeblack@google.com // assert(persistentTable.findSmallest(addr) != id); 32814184Sgabeblack@google.com 32914184Sgabeblack@google.com // ...And it must be a GETS request 33014184Sgabeblack@google.com // assert(persistentTable.typeOfSmallest(addr) == AccessType:Read); 33114184Sgabeblack@google.com 33214184Sgabeblack@google.com } else { 33314184Sgabeblack@google.com 33414184Sgabeblack@google.com // If there is an entry in the persistent table of this block, 33514184Sgabeblack@google.com // this processor needs to have an entry in the table for this 33614184Sgabeblack@google.com // block, and that entry better be the smallest (highest 33714184Sgabeblack@google.com // priority). Otherwise, the state should have been one of 33814184Sgabeblack@google.com // locked states 33914184Sgabeblack@google.com 34014184Sgabeblack@google.com //if (persistentTable.isLocked(addr)) { 34114184Sgabeblack@google.com // assert(persistentTable.findSmallest(addr) == id); 34214184Sgabeblack@google.com //} 34314184Sgabeblack@google.com } 34414184Sgabeblack@google.com 34514184Sgabeblack@google.com // in M and E you have all the tokens 34614184Sgabeblack@google.com if (state == State:MM || state == State:M || state == State:MM_W || state == State:M_W) { 34714184Sgabeblack@google.com assert(cache_entry.Tokens == max_tokens()); 34814184Sgabeblack@google.com } 34914184Sgabeblack@google.com 35014184Sgabeblack@google.com // in NP you have no tokens 35114184Sgabeblack@google.com if (state == State:NP) { 35214184Sgabeblack@google.com assert(cache_entry.Tokens == 0); 35314184Sgabeblack@google.com } 35414184Sgabeblack@google.com 35514184Sgabeblack@google.com // You have at least one token in S-like states 35614184Sgabeblack@google.com if (state == State:S || state == State:SM) { 35714184Sgabeblack@google.com assert(cache_entry.Tokens > 0); 35814184Sgabeblack@google.com } 35914184Sgabeblack@google.com 36014184Sgabeblack@google.com // You have at least half the token in O-like states 36114184Sgabeblack@google.com if (state == State:O && state == State:OM) { 36214184Sgabeblack@google.com assert(cache_entry.Tokens > (max_tokens() / 2)); 36314184Sgabeblack@google.com } 36414184Sgabeblack@google.com 36514184Sgabeblack@google.com cache_entry.CacheState := state; 36614184Sgabeblack@google.com } 36714184Sgabeblack@google.com } 36814184Sgabeblack@google.com 36914184Sgabeblack@google.com AccessPermission getAccessPermission(Addr addr) { 37014184Sgabeblack@google.com TBE tbe := L1_TBEs[addr]; 37114184Sgabeblack@google.com if(is_valid(tbe)) { 37214184Sgabeblack@google.com return L1Cache_State_to_permission(tbe.TBEState); 37314184Sgabeblack@google.com } 37414184Sgabeblack@google.com 37514184Sgabeblack@google.com Entry cache_entry := getCacheEntry(addr); 37614184Sgabeblack@google.com if(is_valid(cache_entry)) { 37714184Sgabeblack@google.com return L1Cache_State_to_permission(cache_entry.CacheState); 37814184Sgabeblack@google.com } 37914184Sgabeblack@google.com 38014184Sgabeblack@google.com return AccessPermission:NotPresent; 38114184Sgabeblack@google.com } 38214184Sgabeblack@google.com 38314184Sgabeblack@google.com void setAccessPermission(Entry cache_entry, Addr addr, State state) { 38414184Sgabeblack@google.com if (is_valid(cache_entry)) { 38514184Sgabeblack@google.com cache_entry.changePermission(L1Cache_State_to_permission(state)); 38614184Sgabeblack@google.com } 38714184Sgabeblack@google.com } 38814184Sgabeblack@google.com 38914184Sgabeblack@google.com Event mandatory_request_type_to_event(RubyRequestType type) { 39014184Sgabeblack@google.com if (type == RubyRequestType:LD) { 39114184Sgabeblack@google.com return Event:Load; 39214184Sgabeblack@google.com } else if (type == RubyRequestType:IFETCH) { 39314184Sgabeblack@google.com return Event:Ifetch; 39414184Sgabeblack@google.com } else if (type == RubyRequestType:ST) { 39514184Sgabeblack@google.com return Event:Store; 39614184Sgabeblack@google.com } else if (type == RubyRequestType:ATOMIC) { 39714184Sgabeblack@google.com if (no_mig_atomic) { 39814184Sgabeblack@google.com return Event:Atomic; 39914184Sgabeblack@google.com } else { 40014184Sgabeblack@google.com return Event:Store; 40114184Sgabeblack@google.com } 40214184Sgabeblack@google.com } else { 40314184Sgabeblack@google.com error("Invalid RubyRequestType"); 40414184Sgabeblack@google.com } 40514184Sgabeblack@google.com } 40614184Sgabeblack@google.com 40714184Sgabeblack@google.com AccessType cache_request_type_to_access_type(RubyRequestType type) { 40814184Sgabeblack@google.com if ((type == RubyRequestType:LD) || (type == RubyRequestType:IFETCH)) { 40914184Sgabeblack@google.com return AccessType:Read; 41014184Sgabeblack@google.com } else if ((type == RubyRequestType:ST) || (type == RubyRequestType:ATOMIC)) { 41114184Sgabeblack@google.com return AccessType:Write; 41214184Sgabeblack@google.com } else { 41314184Sgabeblack@google.com error("Invalid RubyRequestType"); 41414184Sgabeblack@google.com } 41514184Sgabeblack@google.com } 41614184Sgabeblack@google.com 41714184Sgabeblack@google.com // NOTE: direct local hits should not call this function 41814184Sgabeblack@google.com bool isExternalHit(Addr addr, MachineID sender) { 41914184Sgabeblack@google.com if (machineIDToMachineType(sender) == MachineType:L1Cache) { 42014184Sgabeblack@google.com return true; 42114184Sgabeblack@google.com } else if (machineIDToMachineType(sender) == MachineType:L2Cache) { 42214184Sgabeblack@google.com 42314184Sgabeblack@google.com if (sender == mapAddressToRange(addr, MachineType:L2Cache, 42414184Sgabeblack@google.com l2_select_low_bit, l2_select_num_bits, intToID(0))) { 42514184Sgabeblack@google.com return false; 42614184Sgabeblack@google.com } else { 42714184Sgabeblack@google.com return true; 42814184Sgabeblack@google.com } 42914184Sgabeblack@google.com } 43014184Sgabeblack@google.com 43114184Sgabeblack@google.com return true; 43214184Sgabeblack@google.com } 43314184Sgabeblack@google.com 43414184Sgabeblack@google.com bool okToIssueStarving(Addr addr, MachineID machineID) { 43514184Sgabeblack@google.com return persistentTable.okToIssueStarving(addr, machineID); 43614184Sgabeblack@google.com } 43714184Sgabeblack@google.com 43814184Sgabeblack@google.com void markPersistentEntries(Addr addr) { 43914184Sgabeblack@google.com persistentTable.markEntries(addr); 44014184Sgabeblack@google.com } 44114184Sgabeblack@google.com 44214184Sgabeblack@google.com void setExternalResponse(TBE tbe) { 44314184Sgabeblack@google.com assert(is_valid(tbe)); 44414184Sgabeblack@google.com tbe.ExternalResponse := true; 44514184Sgabeblack@google.com } 44614184Sgabeblack@google.com 44714184Sgabeblack@google.com bool IsAtomic(TBE tbe) { 44814184Sgabeblack@google.com assert(is_valid(tbe)); 44914184Sgabeblack@google.com return tbe.IsAtomic; 45014184Sgabeblack@google.com } 45114184Sgabeblack@google.com 45214184Sgabeblack@google.com // ** OUT_PORTS ** 45314184Sgabeblack@google.com out_port(persistentNetwork_out, PersistentMsg, persistentFromL1Cache); 45414184Sgabeblack@google.com out_port(requestNetwork_out, RequestMsg, requestFromL1Cache); 45514184Sgabeblack@google.com out_port(responseNetwork_out, ResponseMsg, responseFromL1Cache); 45614184Sgabeblack@google.com out_port(requestRecycle_out, RequestMsg, requestToL1Cache); 45714184Sgabeblack@google.com 45814184Sgabeblack@google.com // ** IN_PORTS ** 45914184Sgabeblack@google.com 46014184Sgabeblack@google.com // Use Timer 46114184Sgabeblack@google.com in_port(useTimerTable_in, Addr, useTimerTable, rank=5) { 46214184Sgabeblack@google.com if (useTimerTable_in.isReady(clockEdge())) { 46314184Sgabeblack@google.com Addr readyAddress := useTimerTable.nextAddress(); 46414184Sgabeblack@google.com TBE tbe := L1_TBEs.lookup(readyAddress); 46514184Sgabeblack@google.com 46614184Sgabeblack@google.com if (persistentTable.isLocked(readyAddress) && 46714184Sgabeblack@google.com (persistentTable.findSmallest(readyAddress) != machineID)) { 46814184Sgabeblack@google.com if (persistentTable.typeOfSmallest(readyAddress) == AccessType:Write) { 46914184Sgabeblack@google.com trigger(Event:Use_TimeoutStarverX, readyAddress, 47014184Sgabeblack@google.com getCacheEntry(readyAddress), tbe); 47114184Sgabeblack@google.com } else { 47214184Sgabeblack@google.com trigger(Event:Use_TimeoutStarverS, readyAddress, 47314184Sgabeblack@google.com getCacheEntry(readyAddress), tbe); 47414184Sgabeblack@google.com } 47514184Sgabeblack@google.com } else { 47614184Sgabeblack@google.com if (no_mig_atomic && IsAtomic(tbe)) { 47714184Sgabeblack@google.com trigger(Event:Use_TimeoutNoStarvers_NoMig, readyAddress, 47814184Sgabeblack@google.com getCacheEntry(readyAddress), tbe); 47914184Sgabeblack@google.com } else { 48014184Sgabeblack@google.com trigger(Event:Use_TimeoutNoStarvers, readyAddress, 48114184Sgabeblack@google.com getCacheEntry(readyAddress), tbe); 48214184Sgabeblack@google.com } 48314184Sgabeblack@google.com } 48414184Sgabeblack@google.com } 48514184Sgabeblack@google.com } 48614184Sgabeblack@google.com 48714184Sgabeblack@google.com // Reissue Timer 48814184Sgabeblack@google.com in_port(reissueTimerTable_in, Addr, reissueTimerTable, rank=4) { 48914184Sgabeblack@google.com Tick current_time := clockEdge(); 49014184Sgabeblack@google.com if (reissueTimerTable_in.isReady(current_time)) { 49114184Sgabeblack@google.com Addr addr := reissueTimerTable.nextAddress(); 49214184Sgabeblack@google.com trigger(Event:Request_Timeout, addr, getCacheEntry(addr), 49314184Sgabeblack@google.com L1_TBEs.lookup(addr)); 49414184Sgabeblack@google.com } 49514184Sgabeblack@google.com } 49614184Sgabeblack@google.com 49714184Sgabeblack@google.com // Persistent Network 49814184Sgabeblack@google.com in_port(persistentNetwork_in, PersistentMsg, persistentToL1Cache, rank=3) { 49914184Sgabeblack@google.com if (persistentNetwork_in.isReady(clockEdge())) { 50014184Sgabeblack@google.com peek(persistentNetwork_in, PersistentMsg, block_on="addr") { 50114184Sgabeblack@google.com assert(in_msg.Destination.isElement(machineID)); 50214184Sgabeblack@google.com 50314184Sgabeblack@google.com // Apply the lockdown or unlockdown message to the table 50414184Sgabeblack@google.com if (in_msg.Type == PersistentRequestType:GETX_PERSISTENT) { 50514184Sgabeblack@google.com persistentTable.persistentRequestLock(in_msg.addr, in_msg.Requestor, AccessType:Write); 50614184Sgabeblack@google.com } else if (in_msg.Type == PersistentRequestType:GETS_PERSISTENT) { 50714184Sgabeblack@google.com persistentTable.persistentRequestLock(in_msg.addr, in_msg.Requestor, AccessType:Read); 50814184Sgabeblack@google.com } else if (in_msg.Type == PersistentRequestType:DEACTIVATE_PERSISTENT) { 50914184Sgabeblack@google.com persistentTable.persistentRequestUnlock(in_msg.addr, in_msg.Requestor); 51014184Sgabeblack@google.com } else { 51114184Sgabeblack@google.com error("Unexpected message"); 51214184Sgabeblack@google.com } 51314184Sgabeblack@google.com 51414184Sgabeblack@google.com // React to the message based on the current state of the table 51514184Sgabeblack@google.com Entry cache_entry := getCacheEntry(in_msg.addr); 51614184Sgabeblack@google.com TBE tbe := L1_TBEs[in_msg.addr]; 51714184Sgabeblack@google.com 51814184Sgabeblack@google.com if (persistentTable.isLocked(in_msg.addr)) { 51914184Sgabeblack@google.com if (persistentTable.findSmallest(in_msg.addr) == machineID) { 52014184Sgabeblack@google.com // Our Own Lock - this processor is highest priority 52114184Sgabeblack@google.com trigger(Event:Own_Lock_or_Unlock, in_msg.addr, 52214184Sgabeblack@google.com cache_entry, tbe); 52314184Sgabeblack@google.com } else { 52414184Sgabeblack@google.com if (persistentTable.typeOfSmallest(in_msg.addr) == AccessType:Read) { 52514184Sgabeblack@google.com if (getTokens(cache_entry) == 1 || 52614184Sgabeblack@google.com getTokens(cache_entry) == (max_tokens() / 2) + 1) { 52714184Sgabeblack@google.com trigger(Event:Persistent_GETS_Last_Token, in_msg.addr, 52814184Sgabeblack@google.com cache_entry, tbe); 52914184Sgabeblack@google.com } else { 53014184Sgabeblack@google.com trigger(Event:Persistent_GETS, in_msg.addr, 53114184Sgabeblack@google.com cache_entry, tbe); 53214184Sgabeblack@google.com } 53314184Sgabeblack@google.com } else { 53414184Sgabeblack@google.com trigger(Event:Persistent_GETX, in_msg.addr, 53514184Sgabeblack@google.com cache_entry, tbe); 53614184Sgabeblack@google.com } 53714184Sgabeblack@google.com } 53814184Sgabeblack@google.com } else { 53914184Sgabeblack@google.com // Unlock case - no entries in the table 54014184Sgabeblack@google.com trigger(Event:Own_Lock_or_Unlock, in_msg.addr, 54114184Sgabeblack@google.com cache_entry, tbe); 54214184Sgabeblack@google.com } 54314184Sgabeblack@google.com } 54414184Sgabeblack@google.com } 54514184Sgabeblack@google.com } 54614184Sgabeblack@google.com 54714184Sgabeblack@google.com // Response Network 54814184Sgabeblack@google.com in_port(responseNetwork_in, ResponseMsg, responseToL1Cache, rank=2) { 54914184Sgabeblack@google.com if (responseNetwork_in.isReady(clockEdge())) { 55014184Sgabeblack@google.com peek(responseNetwork_in, ResponseMsg, block_on="addr") { 55114184Sgabeblack@google.com assert(in_msg.Destination.isElement(machineID)); 55214184Sgabeblack@google.com 55314184Sgabeblack@google.com Entry cache_entry := getCacheEntry(in_msg.addr); 55414184Sgabeblack@google.com TBE tbe := L1_TBEs[in_msg.addr]; 55514184Sgabeblack@google.com 55614184Sgabeblack@google.com // Mark TBE flag if response received off-chip. Use this to update average latency estimate 55714184Sgabeblack@google.com if ( machineIDToMachineType(in_msg.Sender) == MachineType:L2Cache ) { 55814184Sgabeblack@google.com 55914184Sgabeblack@google.com if (in_msg.Sender == mapAddressToRange(in_msg.addr, 56014184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 56114184Sgabeblack@google.com l2_select_num_bits, intToID(0))) { 56214184Sgabeblack@google.com 56314184Sgabeblack@google.com // came from an off-chip L2 cache 56414184Sgabeblack@google.com if (is_valid(tbe)) { 56514184Sgabeblack@google.com // L1_TBEs[in_msg.addr].ExternalResponse := true; 56614184Sgabeblack@google.com // profile_offchipL2_response(in_msg.addr); 56714184Sgabeblack@google.com } 56814184Sgabeblack@google.com } 56914184Sgabeblack@google.com else { 57014184Sgabeblack@google.com // profile_onchipL2_response(in_msg.addr ); 57114184Sgabeblack@google.com } 57214184Sgabeblack@google.com } else if ( machineIDToMachineType(in_msg.Sender) == MachineType:Directory ) { 57314184Sgabeblack@google.com if (is_valid(tbe)) { 57414184Sgabeblack@google.com setExternalResponse(tbe); 57514184Sgabeblack@google.com // profile_memory_response( in_msg.addr); 57614184Sgabeblack@google.com } 57714184Sgabeblack@google.com } else if ( machineIDToMachineType(in_msg.Sender) == MachineType:L1Cache) { 57814184Sgabeblack@google.com //if (isLocalProcessor(machineID, in_msg.Sender) == false) { 57914184Sgabeblack@google.com //if (is_valid(tbe)) { 58014184Sgabeblack@google.com // tbe.ExternalResponse := true; 58114184Sgabeblack@google.com // profile_offchipL1_response(in_msg.addr ); 58214184Sgabeblack@google.com //} 58314184Sgabeblack@google.com //} 58414184Sgabeblack@google.com //else { 58514184Sgabeblack@google.com // profile_onchipL1_response(in_msg.addr ); 58614184Sgabeblack@google.com //} 58714184Sgabeblack@google.com } else { 58814184Sgabeblack@google.com error("unexpected SenderMachine"); 58914184Sgabeblack@google.com } 59014184Sgabeblack@google.com 59114184Sgabeblack@google.com 59214184Sgabeblack@google.com if (getTokens(cache_entry) + in_msg.Tokens != max_tokens()) { 59314184Sgabeblack@google.com if (in_msg.Type == CoherenceResponseType:ACK) { 59414184Sgabeblack@google.com assert(in_msg.Tokens < (max_tokens() / 2)); 59514184Sgabeblack@google.com trigger(Event:Ack, in_msg.addr, cache_entry, tbe); 59614184Sgabeblack@google.com } else if (in_msg.Type == CoherenceResponseType:DATA_OWNER) { 59714184Sgabeblack@google.com trigger(Event:Data_Owner, in_msg.addr, cache_entry, tbe); 59814184Sgabeblack@google.com } else if (in_msg.Type == CoherenceResponseType:DATA_SHARED) { 59914184Sgabeblack@google.com assert(in_msg.Tokens < (max_tokens() / 2)); 60014184Sgabeblack@google.com trigger(Event:Data_Shared, in_msg.addr, cache_entry, tbe); 60114184Sgabeblack@google.com } else { 60214184Sgabeblack@google.com error("Unexpected message"); 60314184Sgabeblack@google.com } 60414184Sgabeblack@google.com } else { 60514184Sgabeblack@google.com if (in_msg.Type == CoherenceResponseType:ACK) { 60614184Sgabeblack@google.com assert(in_msg.Tokens < (max_tokens() / 2)); 60714184Sgabeblack@google.com trigger(Event:Ack_All_Tokens, in_msg.addr, cache_entry, tbe); 60814184Sgabeblack@google.com } else if (in_msg.Type == CoherenceResponseType:DATA_OWNER || in_msg.Type == CoherenceResponseType:DATA_SHARED) { 60914184Sgabeblack@google.com trigger(Event:Data_All_Tokens, in_msg.addr, cache_entry, tbe); 61014184Sgabeblack@google.com } else { 61114184Sgabeblack@google.com error("Unexpected message"); 61214184Sgabeblack@google.com } 61314184Sgabeblack@google.com } 61414184Sgabeblack@google.com } 61514184Sgabeblack@google.com } 61614184Sgabeblack@google.com } 61714184Sgabeblack@google.com 61814184Sgabeblack@google.com // Request Network 61914184Sgabeblack@google.com in_port(requestNetwork_in, RequestMsg, requestToL1Cache) { 62014184Sgabeblack@google.com if (requestNetwork_in.isReady(clockEdge())) { 62114184Sgabeblack@google.com peek(requestNetwork_in, RequestMsg, block_on="addr") { 62214184Sgabeblack@google.com assert(in_msg.Destination.isElement(machineID)); 62314184Sgabeblack@google.com 62414184Sgabeblack@google.com Entry cache_entry := getCacheEntry(in_msg.addr); 62514184Sgabeblack@google.com TBE tbe := L1_TBEs[in_msg.addr]; 62614184Sgabeblack@google.com 62714184Sgabeblack@google.com if (in_msg.Type == CoherenceRequestType:GETX) { 62814184Sgabeblack@google.com if (in_msg.isLocal) { 62914184Sgabeblack@google.com trigger(Event:Transient_Local_GETX, in_msg.addr, 63014184Sgabeblack@google.com cache_entry, tbe); 63114184Sgabeblack@google.com } 63214184Sgabeblack@google.com else { 63314184Sgabeblack@google.com trigger(Event:Transient_GETX, in_msg.addr, 63414184Sgabeblack@google.com cache_entry, tbe); 63514184Sgabeblack@google.com } 63614184Sgabeblack@google.com } else if (in_msg.Type == CoherenceRequestType:GETS) { 63714184Sgabeblack@google.com if (getTokens(cache_entry) == 1 || 63814184Sgabeblack@google.com getTokens(cache_entry) == (max_tokens() / 2) + 1) { 63914184Sgabeblack@google.com if (in_msg.isLocal) { 64014184Sgabeblack@google.com trigger(Event:Transient_Local_GETS_Last_Token, in_msg.addr, 64114184Sgabeblack@google.com cache_entry, tbe); 64214184Sgabeblack@google.com } 64314184Sgabeblack@google.com else { 64414184Sgabeblack@google.com trigger(Event:Transient_GETS_Last_Token, in_msg.addr, 64514184Sgabeblack@google.com cache_entry, tbe); 64614184Sgabeblack@google.com } 64714184Sgabeblack@google.com } 64814184Sgabeblack@google.com else { 64914184Sgabeblack@google.com if (in_msg.isLocal) { 65014184Sgabeblack@google.com trigger(Event:Transient_Local_GETS, in_msg.addr, 65114184Sgabeblack@google.com cache_entry, tbe); 65214184Sgabeblack@google.com } 65314184Sgabeblack@google.com else { 65414184Sgabeblack@google.com trigger(Event:Transient_GETS, in_msg.addr, 65514184Sgabeblack@google.com cache_entry, tbe); 65614184Sgabeblack@google.com } 65714184Sgabeblack@google.com } 65814184Sgabeblack@google.com } else { 65914184Sgabeblack@google.com error("Unexpected message"); 66014184Sgabeblack@google.com } 66114184Sgabeblack@google.com } 66214184Sgabeblack@google.com } 66314184Sgabeblack@google.com } 66414184Sgabeblack@google.com 66514184Sgabeblack@google.com // Mandatory Queue 66614184Sgabeblack@google.com in_port(mandatoryQueue_in, RubyRequest, mandatoryQueue, desc="...", rank=0) { 66714184Sgabeblack@google.com if (mandatoryQueue_in.isReady(clockEdge())) { 66814184Sgabeblack@google.com peek(mandatoryQueue_in, RubyRequest, block_on="LineAddress") { 66914184Sgabeblack@google.com // Check for data access to blocks in I-cache and ifetchs to blocks in D-cache 67014184Sgabeblack@google.com 67114184Sgabeblack@google.com TBE tbe := L1_TBEs[in_msg.LineAddress]; 67214184Sgabeblack@google.com 67314184Sgabeblack@google.com if (in_msg.Type == RubyRequestType:IFETCH) { 67414184Sgabeblack@google.com // ** INSTRUCTION ACCESS *** 67514184Sgabeblack@google.com 67614184Sgabeblack@google.com Entry L1Icache_entry := getL1ICacheEntry(in_msg.LineAddress); 67714184Sgabeblack@google.com if (is_valid(L1Icache_entry)) { 67814184Sgabeblack@google.com // The tag matches for the L1, so the L1 fetches the line. 67914184Sgabeblack@google.com // We know it can't be in the L2 due to exclusion. 68014184Sgabeblack@google.com trigger(mandatory_request_type_to_event(in_msg.Type), 68114184Sgabeblack@google.com in_msg.LineAddress, L1Icache_entry, tbe); 68214184Sgabeblack@google.com } else { 68314184Sgabeblack@google.com 68414184Sgabeblack@google.com // Check to see if it is in the OTHER L1 68514184Sgabeblack@google.com Entry L1Dcache_entry := getL1DCacheEntry(in_msg.LineAddress); 68614184Sgabeblack@google.com if (is_valid(L1Dcache_entry)) { 68714184Sgabeblack@google.com // The block is in the wrong L1, try to write it to the L2 68814184Sgabeblack@google.com trigger(Event:L1_Replacement, in_msg.LineAddress, 68914184Sgabeblack@google.com L1Dcache_entry, tbe); 69014184Sgabeblack@google.com } 69114184Sgabeblack@google.com 69214184Sgabeblack@google.com if (L1Icache.cacheAvail(in_msg.LineAddress)) { 69314184Sgabeblack@google.com // L1 does't have the line, but we have space for it in the L1 69414184Sgabeblack@google.com trigger(mandatory_request_type_to_event(in_msg.Type), 69514184Sgabeblack@google.com in_msg.LineAddress, L1Icache_entry, tbe); 69614184Sgabeblack@google.com } else { 69714184Sgabeblack@google.com // No room in the L1, so we need to make room 69814184Sgabeblack@google.com trigger(Event:L1_Replacement, 69914184Sgabeblack@google.com L1Icache.cacheProbe(in_msg.LineAddress), 70014184Sgabeblack@google.com getL1ICacheEntry(L1Icache.cacheProbe(in_msg.LineAddress)), 70114184Sgabeblack@google.com L1_TBEs[L1Icache.cacheProbe(in_msg.LineAddress)]); 70214184Sgabeblack@google.com } 70314184Sgabeblack@google.com } 70414184Sgabeblack@google.com } else { 70514184Sgabeblack@google.com // *** DATA ACCESS *** 70614184Sgabeblack@google.com 70714184Sgabeblack@google.com Entry L1Dcache_entry := getL1DCacheEntry(in_msg.LineAddress); 70814184Sgabeblack@google.com if (is_valid(L1Dcache_entry)) { 70914184Sgabeblack@google.com // The tag matches for the L1, so the L1 fetches the line. 71014184Sgabeblack@google.com // We know it can't be in the L2 due to exclusion. 71114184Sgabeblack@google.com trigger(mandatory_request_type_to_event(in_msg.Type), 71214184Sgabeblack@google.com in_msg.LineAddress, L1Dcache_entry, tbe); 71314184Sgabeblack@google.com } else { 71414184Sgabeblack@google.com 71514184Sgabeblack@google.com // Check to see if it is in the OTHER L1 71614184Sgabeblack@google.com Entry L1Icache_entry := getL1ICacheEntry(in_msg.LineAddress); 71714184Sgabeblack@google.com if (is_valid(L1Icache_entry)) { 71814184Sgabeblack@google.com // The block is in the wrong L1, try to write it to the L2 71914184Sgabeblack@google.com trigger(Event:L1_Replacement, in_msg.LineAddress, 72014184Sgabeblack@google.com L1Icache_entry, tbe); 72114184Sgabeblack@google.com } 72214184Sgabeblack@google.com 72314184Sgabeblack@google.com if (L1Dcache.cacheAvail(in_msg.LineAddress)) { 72414184Sgabeblack@google.com // L1 does't have the line, but we have space for it in the L1 72514184Sgabeblack@google.com trigger(mandatory_request_type_to_event(in_msg.Type), 72614184Sgabeblack@google.com in_msg.LineAddress, L1Dcache_entry, tbe); 72714184Sgabeblack@google.com } else { 72814184Sgabeblack@google.com // No room in the L1, so we need to make room 72914184Sgabeblack@google.com trigger(Event:L1_Replacement, 73014184Sgabeblack@google.com L1Dcache.cacheProbe(in_msg.LineAddress), 73114184Sgabeblack@google.com getL1DCacheEntry(L1Dcache.cacheProbe(in_msg.LineAddress)), 73214184Sgabeblack@google.com L1_TBEs[L1Dcache.cacheProbe(in_msg.LineAddress)]); 73314184Sgabeblack@google.com } 73414184Sgabeblack@google.com } 73514184Sgabeblack@google.com } 73614184Sgabeblack@google.com } 73714184Sgabeblack@google.com } 73814184Sgabeblack@google.com } 73914184Sgabeblack@google.com 74014184Sgabeblack@google.com // ACTIONS 74114184Sgabeblack@google.com 74214184Sgabeblack@google.com action(a_issueReadRequest, "a", desc="Issue GETS") { 74314184Sgabeblack@google.com assert(is_valid(tbe)); 74414184Sgabeblack@google.com if (tbe.IssueCount == 0) { 74514184Sgabeblack@google.com // Update outstanding requests 74614184Sgabeblack@google.com //profile_outstanding_request(outstandingRequests); 74714184Sgabeblack@google.com outstandingRequests := outstandingRequests + 1; 74814184Sgabeblack@google.com } 74914184Sgabeblack@google.com 75014184Sgabeblack@google.com if (tbe.IssueCount >= retry_threshold) { 75114184Sgabeblack@google.com // Issue a persistent request if possible 75214184Sgabeblack@google.com if (okToIssueStarving(address, machineID) && (starving == false)) { 75314184Sgabeblack@google.com enqueue(persistentNetwork_out, PersistentMsg, l1_request_latency) { 75414184Sgabeblack@google.com out_msg.addr := address; 75514184Sgabeblack@google.com out_msg.Type := PersistentRequestType:GETS_PERSISTENT; 75614184Sgabeblack@google.com out_msg.Requestor := machineID; 75714184Sgabeblack@google.com out_msg.Destination.broadcast(MachineType:L1Cache); 75814184Sgabeblack@google.com 75914184Sgabeblack@google.com // 76014184Sgabeblack@google.com // Currently the configuration system limits the system to only one 76114184Sgabeblack@google.com // chip. Therefore, if we assume one shared L2 cache, then only one 76214184Sgabeblack@google.com // pertinent L2 cache exist. 76314184Sgabeblack@google.com // 76414184Sgabeblack@google.com //out_msg.Destination.addNetDest(getAllPertinentL2Banks(address)); 76514184Sgabeblack@google.com 76614184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 76714184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 76814184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 76914184Sgabeblack@google.com 77014184Sgabeblack@google.com out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory)); 77114184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Persistent_Control; 77214184Sgabeblack@google.com out_msg.Prefetch := tbe.Prefetch; 77314184Sgabeblack@google.com out_msg.AccessMode := tbe.AccessMode; 77414184Sgabeblack@google.com } 77514184Sgabeblack@google.com markPersistentEntries(address); 77614184Sgabeblack@google.com starving := true; 77714184Sgabeblack@google.com 77814184Sgabeblack@google.com if (tbe.IssueCount == 0) { 77914184Sgabeblack@google.com //profile_persistent_prediction(address, tbe.TypeOfAccess); 78014184Sgabeblack@google.com } 78114184Sgabeblack@google.com 78214184Sgabeblack@google.com // Update outstanding requests 78314184Sgabeblack@google.com //profile_outstanding_persistent_request(outstandingPersistentRequests); 78414184Sgabeblack@google.com outstandingPersistentRequests := outstandingPersistentRequests + 1; 78514184Sgabeblack@google.com 78614184Sgabeblack@google.com // Increment IssueCount 78714184Sgabeblack@google.com tbe.IssueCount := tbe.IssueCount + 1; 78814184Sgabeblack@google.com 78914184Sgabeblack@google.com tbe.WentPersistent := true; 79014184Sgabeblack@google.com 79114184Sgabeblack@google.com // Do not schedule a wakeup, a persistent requests will always complete 79214184Sgabeblack@google.com } 79314184Sgabeblack@google.com else { 79414184Sgabeblack@google.com 79514184Sgabeblack@google.com // We'd like to issue a persistent request, but are not allowed 79614184Sgabeblack@google.com // to issue a P.R. right now. This, we do not increment the 79714184Sgabeblack@google.com // IssueCount. 79814184Sgabeblack@google.com 79914184Sgabeblack@google.com // Set a wakeup timer 80014184Sgabeblack@google.com reissueTimerTable.set( 80114184Sgabeblack@google.com address, clockEdge() + cyclesToTicks(reissue_wakeup_latency)); 80214184Sgabeblack@google.com 80314184Sgabeblack@google.com } 80414184Sgabeblack@google.com } else { 80514184Sgabeblack@google.com // Make a normal request 80614184Sgabeblack@google.com enqueue(requestNetwork_out, RequestMsg, l1_request_latency) { 80714184Sgabeblack@google.com out_msg.addr := address; 80814184Sgabeblack@google.com out_msg.Type := CoherenceRequestType:GETS; 80914184Sgabeblack@google.com out_msg.Requestor := machineID; 81014184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 81114184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 81214184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 81314184Sgabeblack@google.com 81414184Sgabeblack@google.com out_msg.RetryNum := tbe.IssueCount; 81514184Sgabeblack@google.com if (tbe.IssueCount == 0) { 81614184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Request_Control; 81714184Sgabeblack@google.com } else { 81814184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Reissue_Control; 81914184Sgabeblack@google.com } 82014184Sgabeblack@google.com out_msg.Prefetch := tbe.Prefetch; 82114184Sgabeblack@google.com out_msg.AccessMode := tbe.AccessMode; 82214184Sgabeblack@google.com } 82314184Sgabeblack@google.com 82414184Sgabeblack@google.com // send to other local L1s, with local bit set 82514184Sgabeblack@google.com enqueue(requestNetwork_out, RequestMsg, l1_request_latency) { 82614184Sgabeblack@google.com out_msg.addr := address; 82714184Sgabeblack@google.com out_msg.Type := CoherenceRequestType:GETS; 82814184Sgabeblack@google.com out_msg.Requestor := machineID; 82914184Sgabeblack@google.com // 83014184Sgabeblack@google.com // Since only one chip, assuming all L1 caches are local 83114184Sgabeblack@google.com // 83214184Sgabeblack@google.com //out_msg.Destination := getOtherLocalL1IDs(machineID); 83314184Sgabeblack@google.com out_msg.Destination.broadcast(MachineType:L1Cache); 83414184Sgabeblack@google.com out_msg.Destination.remove(machineID); 83514184Sgabeblack@google.com 83614184Sgabeblack@google.com out_msg.RetryNum := tbe.IssueCount; 83714184Sgabeblack@google.com out_msg.isLocal := true; 83814184Sgabeblack@google.com if (tbe.IssueCount == 0) { 83914184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Broadcast_Control; 84014184Sgabeblack@google.com } else { 84114184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Broadcast_Control; 84214184Sgabeblack@google.com } 84314184Sgabeblack@google.com out_msg.Prefetch := tbe.Prefetch; 84414184Sgabeblack@google.com out_msg.AccessMode := tbe.AccessMode; 84514184Sgabeblack@google.com } 84614184Sgabeblack@google.com 84714184Sgabeblack@google.com // Increment IssueCount 84814184Sgabeblack@google.com tbe.IssueCount := tbe.IssueCount + 1; 84914184Sgabeblack@google.com 85014184Sgabeblack@google.com // Set a wakeup timer 85114184Sgabeblack@google.com 85214184Sgabeblack@google.com if (dynamic_timeout_enabled) { 85314184Sgabeblack@google.com reissueTimerTable.set( 85414184Sgabeblack@google.com address, clockEdge() + cyclesToTicks(averageLatencyEstimate())); 85514184Sgabeblack@google.com } else { 85614184Sgabeblack@google.com reissueTimerTable.set( 85714184Sgabeblack@google.com address, clockEdge() + cyclesToTicks(fixed_timeout_latency)); 85814184Sgabeblack@google.com } 85914184Sgabeblack@google.com 86014184Sgabeblack@google.com } 86114184Sgabeblack@google.com } 86214184Sgabeblack@google.com 86314184Sgabeblack@google.com action(b_issueWriteRequest, "b", desc="Issue GETX") { 86414184Sgabeblack@google.com 86514184Sgabeblack@google.com assert(is_valid(tbe)); 86614184Sgabeblack@google.com if (tbe.IssueCount == 0) { 86714184Sgabeblack@google.com // Update outstanding requests 86814184Sgabeblack@google.com //profile_outstanding_request(outstandingRequests); 86914184Sgabeblack@google.com outstandingRequests := outstandingRequests + 1; 87014184Sgabeblack@google.com } 87114184Sgabeblack@google.com 87214184Sgabeblack@google.com if (tbe.IssueCount >= retry_threshold) { 87314184Sgabeblack@google.com // Issue a persistent request if possible 87414184Sgabeblack@google.com if ( okToIssueStarving(address, machineID) && (starving == false)) { 87514184Sgabeblack@google.com enqueue(persistentNetwork_out, PersistentMsg, l1_request_latency) { 87614184Sgabeblack@google.com out_msg.addr := address; 87714184Sgabeblack@google.com out_msg.Type := PersistentRequestType:GETX_PERSISTENT; 87814184Sgabeblack@google.com out_msg.Requestor := machineID; 87914184Sgabeblack@google.com out_msg.Destination.broadcast(MachineType:L1Cache); 88014184Sgabeblack@google.com 88114184Sgabeblack@google.com // 88214184Sgabeblack@google.com // Currently the configuration system limits the system to only one 88314184Sgabeblack@google.com // chip. Therefore, if we assume one shared L2 cache, then only one 88414184Sgabeblack@google.com // pertinent L2 cache exist. 88514184Sgabeblack@google.com // 88614184Sgabeblack@google.com //out_msg.Destination.addNetDest(getAllPertinentL2Banks(address)); 88714184Sgabeblack@google.com 88814184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 88914184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 89014184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 89114184Sgabeblack@google.com 89214184Sgabeblack@google.com out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory)); 89314184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Persistent_Control; 89414184Sgabeblack@google.com out_msg.Prefetch := tbe.Prefetch; 89514184Sgabeblack@google.com out_msg.AccessMode := tbe.AccessMode; 89614184Sgabeblack@google.com } 89714184Sgabeblack@google.com markPersistentEntries(address); 89814184Sgabeblack@google.com starving := true; 89914184Sgabeblack@google.com 90014184Sgabeblack@google.com // Update outstanding requests 90114184Sgabeblack@google.com //profile_outstanding_persistent_request(outstandingPersistentRequests); 90214184Sgabeblack@google.com outstandingPersistentRequests := outstandingPersistentRequests + 1; 90314184Sgabeblack@google.com 90414184Sgabeblack@google.com if (tbe.IssueCount == 0) { 90514184Sgabeblack@google.com //profile_persistent_prediction(address, tbe.TypeOfAccess); 90614184Sgabeblack@google.com } 90714184Sgabeblack@google.com 90814184Sgabeblack@google.com // Increment IssueCount 90914184Sgabeblack@google.com tbe.IssueCount := tbe.IssueCount + 1; 91014184Sgabeblack@google.com 91114184Sgabeblack@google.com tbe.WentPersistent := true; 91214184Sgabeblack@google.com 91314184Sgabeblack@google.com // Do not schedule a wakeup, a persistent requests will always complete 91414184Sgabeblack@google.com } 91514184Sgabeblack@google.com else { 91614184Sgabeblack@google.com 91714184Sgabeblack@google.com // We'd like to issue a persistent request, but are not allowed 91814184Sgabeblack@google.com // to issue a P.R. right now. This, we do not increment the 91914184Sgabeblack@google.com // IssueCount. 92014184Sgabeblack@google.com 92114184Sgabeblack@google.com // Set a wakeup timer 92214184Sgabeblack@google.com reissueTimerTable.set( 92314184Sgabeblack@google.com address, clockEdge() + cyclesToTicks(reissue_wakeup_latency)); 92414184Sgabeblack@google.com } 92514184Sgabeblack@google.com 92614184Sgabeblack@google.com } else { 92714184Sgabeblack@google.com // Make a normal request 92814184Sgabeblack@google.com enqueue(requestNetwork_out, RequestMsg, l1_request_latency) { 92914184Sgabeblack@google.com out_msg.addr := address; 93014184Sgabeblack@google.com out_msg.Type := CoherenceRequestType:GETX; 93114184Sgabeblack@google.com out_msg.Requestor := machineID; 93214184Sgabeblack@google.com 93314184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 93414184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 93514184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 93614184Sgabeblack@google.com 93714184Sgabeblack@google.com out_msg.RetryNum := tbe.IssueCount; 93814184Sgabeblack@google.com 93914184Sgabeblack@google.com if (tbe.IssueCount == 0) { 94014184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Request_Control; 94114184Sgabeblack@google.com } else { 94214184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Reissue_Control; 94314184Sgabeblack@google.com } 94414184Sgabeblack@google.com out_msg.Prefetch := tbe.Prefetch; 94514184Sgabeblack@google.com out_msg.AccessMode := tbe.AccessMode; 94614184Sgabeblack@google.com } 94714184Sgabeblack@google.com 94814184Sgabeblack@google.com // send to other local L1s too 94914184Sgabeblack@google.com enqueue(requestNetwork_out, RequestMsg, l1_request_latency) { 95014184Sgabeblack@google.com out_msg.addr := address; 95114184Sgabeblack@google.com out_msg.Type := CoherenceRequestType:GETX; 95214184Sgabeblack@google.com out_msg.Requestor := machineID; 95314184Sgabeblack@google.com out_msg.isLocal := true; 95414184Sgabeblack@google.com 95514184Sgabeblack@google.com // 95614184Sgabeblack@google.com // Since only one chip, assuming all L1 caches are local 95714184Sgabeblack@google.com // 95814184Sgabeblack@google.com //out_msg.Destination := getOtherLocalL1IDs(machineID); 95914184Sgabeblack@google.com out_msg.Destination.broadcast(MachineType:L1Cache); 96014184Sgabeblack@google.com out_msg.Destination.remove(machineID); 96114184Sgabeblack@google.com 96214184Sgabeblack@google.com out_msg.RetryNum := tbe.IssueCount; 96314184Sgabeblack@google.com if (tbe.IssueCount == 0) { 96414184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Broadcast_Control; 96514184Sgabeblack@google.com } else { 96614184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Broadcast_Control; 96714184Sgabeblack@google.com } 96814184Sgabeblack@google.com out_msg.Prefetch := tbe.Prefetch; 96914184Sgabeblack@google.com out_msg.AccessMode := tbe.AccessMode; 97014184Sgabeblack@google.com } 97114184Sgabeblack@google.com 97214184Sgabeblack@google.com // Increment IssueCount 97314184Sgabeblack@google.com tbe.IssueCount := tbe.IssueCount + 1; 97414184Sgabeblack@google.com 97514184Sgabeblack@google.com DPRINTF(RubySlicc, "incremented issue count to %d\n", 97614184Sgabeblack@google.com tbe.IssueCount); 97714184Sgabeblack@google.com 97814184Sgabeblack@google.com // Set a wakeup timer 97914184Sgabeblack@google.com if (dynamic_timeout_enabled) { 98014184Sgabeblack@google.com reissueTimerTable.set( 98114184Sgabeblack@google.com address, clockEdge() + cyclesToTicks(averageLatencyEstimate())); 98214184Sgabeblack@google.com } else { 98314184Sgabeblack@google.com reissueTimerTable.set( 98414184Sgabeblack@google.com address, clockEdge() + cyclesToTicks(fixed_timeout_latency)); 98514184Sgabeblack@google.com } 98614184Sgabeblack@google.com } 98714184Sgabeblack@google.com } 98814184Sgabeblack@google.com 98914184Sgabeblack@google.com action(bb_bounceResponse, "\b", desc="Bounce tokens and data to memory") { 99014184Sgabeblack@google.com peek(responseNetwork_in, ResponseMsg) { 99114184Sgabeblack@google.com // FIXME, should use a 3rd vnet 99214184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, 1) { 99314184Sgabeblack@google.com out_msg.addr := address; 99414184Sgabeblack@google.com out_msg.Type := in_msg.Type; 99514184Sgabeblack@google.com out_msg.Sender := machineID; 99614184Sgabeblack@google.com out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory)); 99714184Sgabeblack@google.com out_msg.Tokens := in_msg.Tokens; 99814184Sgabeblack@google.com out_msg.MessageSize := in_msg.MessageSize; 99914184Sgabeblack@google.com out_msg.DataBlk := in_msg.DataBlk; 100014184Sgabeblack@google.com out_msg.Dirty := in_msg.Dirty; 100114184Sgabeblack@google.com } 100214184Sgabeblack@google.com } 100314184Sgabeblack@google.com } 100414184Sgabeblack@google.com 100514184Sgabeblack@google.com action(c_ownedReplacement, "c", desc="Issue writeback") { 100614184Sgabeblack@google.com assert(is_valid(cache_entry)); 100714184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 100814184Sgabeblack@google.com out_msg.addr := address; 100914184Sgabeblack@google.com out_msg.Sender := machineID; 101014184Sgabeblack@google.com 101114184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 101214184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 101314184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 101414184Sgabeblack@google.com 101514184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 101614184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 101714184Sgabeblack@google.com out_msg.Dirty := cache_entry.Dirty; 101814184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:WB_OWNED; 101914184Sgabeblack@google.com 102014184Sgabeblack@google.com // always send the data? 102114184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Writeback_Data; 102214184Sgabeblack@google.com } 102314184Sgabeblack@google.com cache_entry.Tokens := 0; 102414184Sgabeblack@google.com } 102514184Sgabeblack@google.com 102614184Sgabeblack@google.com action(cc_sharedReplacement, "\c", desc="Issue shared writeback") { 102714184Sgabeblack@google.com 102814184Sgabeblack@google.com // don't send writeback if replacing block with no tokens 102914184Sgabeblack@google.com assert(is_valid(cache_entry)); 103014184Sgabeblack@google.com assert (cache_entry.Tokens > 0); 103114184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 103214184Sgabeblack@google.com out_msg.addr := address; 103314184Sgabeblack@google.com out_msg.Sender := machineID; 103414184Sgabeblack@google.com 103514184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 103614184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 103714184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 103814184Sgabeblack@google.com 103914184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 104014184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 104114184Sgabeblack@google.com // assert(cache_entry.Dirty == false); 104214184Sgabeblack@google.com out_msg.Dirty := false; 104314184Sgabeblack@google.com 104414184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Writeback_Data; 104514184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:WB_SHARED_DATA; 104614184Sgabeblack@google.com } 104714184Sgabeblack@google.com cache_entry.Tokens := 0; 104814184Sgabeblack@google.com } 104914184Sgabeblack@google.com 105014184Sgabeblack@google.com action(tr_tokenReplacement, "tr", desc="Issue token writeback") { 105114184Sgabeblack@google.com assert(is_valid(cache_entry)); 105214184Sgabeblack@google.com if (cache_entry.Tokens > 0) { 105314184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 105414184Sgabeblack@google.com out_msg.addr := address; 105514184Sgabeblack@google.com out_msg.Sender := machineID; 105614184Sgabeblack@google.com 105714184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 105814184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 105914184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 106014184Sgabeblack@google.com 106114184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 106214184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 106314184Sgabeblack@google.com // assert(cache_entry.Dirty == false); 106414184Sgabeblack@google.com out_msg.Dirty := false; 106514184Sgabeblack@google.com 106614184Sgabeblack@google.com // always send the data? 106714184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Writeback_Control; 106814184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:WB_TOKENS; 106914184Sgabeblack@google.com } 107014184Sgabeblack@google.com } 107114184Sgabeblack@google.com cache_entry.Tokens := 0; 107214184Sgabeblack@google.com } 107314184Sgabeblack@google.com 107414184Sgabeblack@google.com 107514184Sgabeblack@google.com action(d_sendDataWithToken, "d", desc="Send data and a token from cache to requestor") { 107614184Sgabeblack@google.com assert(is_valid(cache_entry)); 107714184Sgabeblack@google.com peek(requestNetwork_in, RequestMsg) { 107814184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 107914184Sgabeblack@google.com out_msg.addr := address; 108014184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_SHARED; 108114184Sgabeblack@google.com out_msg.Sender := machineID; 108214184Sgabeblack@google.com out_msg.Destination.add(in_msg.Requestor); 108314184Sgabeblack@google.com out_msg.Tokens := 1; 108414184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 108514184Sgabeblack@google.com // out_msg.Dirty := cache_entry.Dirty; 108614184Sgabeblack@google.com out_msg.Dirty := false; 108714184Sgabeblack@google.com if (in_msg.isLocal) { 108814184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:ResponseLocal_Data; 108914184Sgabeblack@google.com } else { 109014184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 109114184Sgabeblack@google.com } 109214184Sgabeblack@google.com } 109314184Sgabeblack@google.com } 109414184Sgabeblack@google.com cache_entry.Tokens := cache_entry.Tokens - 1; 109514184Sgabeblack@google.com assert(cache_entry.Tokens >= 1); 109614184Sgabeblack@google.com } 109714184Sgabeblack@google.com 109814184Sgabeblack@google.com action(d_sendDataWithNTokenIfAvail, "\dd", desc="Send data and a token from cache to requestor") { 109914184Sgabeblack@google.com assert(is_valid(cache_entry)); 110014184Sgabeblack@google.com peek(requestNetwork_in, RequestMsg) { 110114184Sgabeblack@google.com if (cache_entry.Tokens > (N_tokens + (max_tokens() / 2))) { 110214184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 110314184Sgabeblack@google.com out_msg.addr := address; 110414184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_SHARED; 110514184Sgabeblack@google.com out_msg.Sender := machineID; 110614184Sgabeblack@google.com out_msg.Destination.add(in_msg.Requestor); 110714184Sgabeblack@google.com out_msg.Tokens := N_tokens; 110814184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 110914184Sgabeblack@google.com // out_msg.Dirty := cache_entry.Dirty; 111014184Sgabeblack@google.com out_msg.Dirty := false; 111114184Sgabeblack@google.com if (in_msg.isLocal) { 111214184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:ResponseLocal_Data; 111314184Sgabeblack@google.com } else { 111414184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 111514184Sgabeblack@google.com } 111614184Sgabeblack@google.com } 111714184Sgabeblack@google.com cache_entry.Tokens := cache_entry.Tokens - N_tokens; 111814184Sgabeblack@google.com } 111914184Sgabeblack@google.com else if (cache_entry.Tokens > 1) { 112014184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 112114184Sgabeblack@google.com out_msg.addr := address; 112214184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_SHARED; 112314184Sgabeblack@google.com out_msg.Sender := machineID; 112414184Sgabeblack@google.com out_msg.Destination.add(in_msg.Requestor); 112514184Sgabeblack@google.com out_msg.Tokens := 1; 112614184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 112714184Sgabeblack@google.com // out_msg.Dirty := cache_entry.Dirty; 112814184Sgabeblack@google.com out_msg.Dirty := false; 112914184Sgabeblack@google.com if (in_msg.isLocal) { 113014184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:ResponseLocal_Data; 113114184Sgabeblack@google.com } else { 113214184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 113314184Sgabeblack@google.com } 113414184Sgabeblack@google.com } 113514184Sgabeblack@google.com cache_entry.Tokens := cache_entry.Tokens - 1; 113614184Sgabeblack@google.com } 113714184Sgabeblack@google.com } 113814184Sgabeblack@google.com// assert(cache_entry.Tokens >= 1); 113914184Sgabeblack@google.com } 114014184Sgabeblack@google.com 114114184Sgabeblack@google.com action(dd_sendDataWithAllTokens, "\d", desc="Send data and all tokens from cache to requestor") { 114214184Sgabeblack@google.com peek(requestNetwork_in, RequestMsg) { 114314184Sgabeblack@google.com assert(is_valid(cache_entry)); 114414184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 114514184Sgabeblack@google.com out_msg.addr := address; 114614184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_OWNER; 114714184Sgabeblack@google.com out_msg.Sender := machineID; 114814184Sgabeblack@google.com out_msg.Destination.add(in_msg.Requestor); 114914184Sgabeblack@google.com assert(cache_entry.Tokens > (max_tokens() / 2)); 115014184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 115114184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 115214184Sgabeblack@google.com out_msg.Dirty := cache_entry.Dirty; 115314184Sgabeblack@google.com if (in_msg.isLocal) { 115414184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:ResponseLocal_Data; 115514184Sgabeblack@google.com } else { 115614184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 115714184Sgabeblack@google.com } 115814184Sgabeblack@google.com } 115914184Sgabeblack@google.com } 116014184Sgabeblack@google.com cache_entry.Tokens := 0; 116114184Sgabeblack@google.com } 116214184Sgabeblack@google.com 116314184Sgabeblack@google.com action(e_sendAckWithCollectedTokens, "e", desc="Send ack with the tokens we've collected thus far.") { 116414184Sgabeblack@google.com // assert(persistentTable.findSmallest(address) != id); // Make sure we never bounce tokens to ourself 116514184Sgabeblack@google.com assert(is_valid(cache_entry)); 116614184Sgabeblack@google.com if (cache_entry.Tokens > 0) { 116714184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 116814184Sgabeblack@google.com out_msg.addr := address; 116914184Sgabeblack@google.com if (cache_entry.Tokens > (max_tokens() / 2)) { 117014184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_OWNER; 117114184Sgabeblack@google.com } else { 117214184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:ACK; 117314184Sgabeblack@google.com } 117414184Sgabeblack@google.com out_msg.Sender := machineID; 117514184Sgabeblack@google.com out_msg.Destination.add(persistentTable.findSmallest(address)); 117614184Sgabeblack@google.com assert(cache_entry.Tokens >= 1); 117714184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 117814184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 117914184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Control; 118014184Sgabeblack@google.com } 118114184Sgabeblack@google.com } 118214184Sgabeblack@google.com cache_entry.Tokens := 0; 118314184Sgabeblack@google.com } 118414184Sgabeblack@google.com 118514184Sgabeblack@google.com action(ee_sendDataWithAllTokens, "\e", desc="Send data and all tokens from cache to starver") { 118614184Sgabeblack@google.com //assert(persistentTable.findSmallest(address) != id); // Make sure we never bounce tokens to ourself 118714184Sgabeblack@google.com assert(is_valid(cache_entry)); 118814184Sgabeblack@google.com assert(cache_entry.Tokens > 0); 118914184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 119014184Sgabeblack@google.com out_msg.addr := address; 119114184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_OWNER; 119214184Sgabeblack@google.com out_msg.Sender := machineID; 119314184Sgabeblack@google.com out_msg.Destination.add(persistentTable.findSmallest(address)); 119414184Sgabeblack@google.com assert(cache_entry.Tokens > (max_tokens() / 2)); 119514184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 119614184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 119714184Sgabeblack@google.com out_msg.Dirty := cache_entry.Dirty; 119814184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 119914184Sgabeblack@google.com } 120014184Sgabeblack@google.com cache_entry.Tokens := 0; 120114184Sgabeblack@google.com } 120214184Sgabeblack@google.com 120314184Sgabeblack@google.com action(f_sendAckWithAllButNorOneTokens, "f", desc="Send ack with all our tokens but one to starver.") { 120414184Sgabeblack@google.com //assert(persistentTable.findSmallest(address) != id); // Make sure we never bounce tokens to ourself 120514184Sgabeblack@google.com assert(is_valid(cache_entry)); 120614184Sgabeblack@google.com assert(cache_entry.Tokens > 0); 120714184Sgabeblack@google.com if (cache_entry.Tokens > 1) { 120814184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 120914184Sgabeblack@google.com out_msg.addr := address; 121014184Sgabeblack@google.com if (cache_entry.Tokens > (max_tokens() / 2)) { 121114184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_OWNER; 121214184Sgabeblack@google.com } else { 121314184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:ACK; 121414184Sgabeblack@google.com } 121514184Sgabeblack@google.com out_msg.Sender := machineID; 121614184Sgabeblack@google.com out_msg.Destination.add(persistentTable.findSmallest(address)); 121714184Sgabeblack@google.com assert(cache_entry.Tokens >= 1); 121814184Sgabeblack@google.com if (cache_entry.Tokens > N_tokens) { 121914184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens - N_tokens; 122014184Sgabeblack@google.com } else { 122114184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens - 1; 122214184Sgabeblack@google.com } 122314184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 122414184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Control; 122514184Sgabeblack@google.com } 122614184Sgabeblack@google.com } 122714184Sgabeblack@google.com if (cache_entry.Tokens > N_tokens) { 122814184Sgabeblack@google.com cache_entry.Tokens := N_tokens; 122914184Sgabeblack@google.com } else { 123014184Sgabeblack@google.com cache_entry.Tokens := 1; 123114184Sgabeblack@google.com } 123214184Sgabeblack@google.com } 123314184Sgabeblack@google.com 123414184Sgabeblack@google.com action(ff_sendDataWithAllButNorOneTokens, "\f", desc="Send data and out tokens but one to starver") { 123514184Sgabeblack@google.com //assert(persistentTable.findSmallest(address) != id); // Make sure we never bounce tokens to ourself 123614184Sgabeblack@google.com assert(is_valid(cache_entry)); 123714184Sgabeblack@google.com assert(cache_entry.Tokens > ((max_tokens() / 2) + 1)); 123814184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 123914184Sgabeblack@google.com out_msg.addr := address; 124014184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_OWNER; 124114184Sgabeblack@google.com out_msg.Sender := machineID; 124214184Sgabeblack@google.com out_msg.Destination.add(persistentTable.findSmallest(address)); 124314184Sgabeblack@google.com if (cache_entry.Tokens > (N_tokens + (max_tokens() / 2))) { 124414184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens - N_tokens; 124514184Sgabeblack@google.com } else { 124614184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens - 1; 124714184Sgabeblack@google.com } 124814184Sgabeblack@google.com assert(out_msg.Tokens > (max_tokens() / 2)); 124914184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 125014184Sgabeblack@google.com out_msg.Dirty := cache_entry.Dirty; 125114184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 125214184Sgabeblack@google.com } 125314184Sgabeblack@google.com if (cache_entry.Tokens > (N_tokens + (max_tokens() / 2))) { 125414184Sgabeblack@google.com cache_entry.Tokens := N_tokens; 125514184Sgabeblack@google.com } else { 125614184Sgabeblack@google.com cache_entry.Tokens := 1; 125714184Sgabeblack@google.com } 125814184Sgabeblack@google.com } 125914184Sgabeblack@google.com 126014184Sgabeblack@google.com action(fo_sendDataWithOwnerToken, "fo", desc="Send data and owner tokens") { 126114184Sgabeblack@google.com assert(is_valid(cache_entry)); 126214184Sgabeblack@google.com assert(cache_entry.Tokens == ((max_tokens() / 2) + 1)); 126314184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 126414184Sgabeblack@google.com out_msg.addr := address; 126514184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_OWNER; 126614184Sgabeblack@google.com out_msg.Sender := machineID; 126714184Sgabeblack@google.com out_msg.Destination.add(persistentTable.findSmallest(address)); 126814184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 126914184Sgabeblack@google.com assert(out_msg.Tokens > (max_tokens() / 2)); 127014184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 127114184Sgabeblack@google.com out_msg.Dirty := cache_entry.Dirty; 127214184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 127314184Sgabeblack@google.com } 127414184Sgabeblack@google.com cache_entry.Tokens := 0; 127514184Sgabeblack@google.com } 127614184Sgabeblack@google.com 127714184Sgabeblack@google.com action(g_bounceResponseToStarver, "g", desc="Redirect response to starving processor") { 127814184Sgabeblack@google.com // assert(persistentTable.isLocked(address)); 127914184Sgabeblack@google.com 128014184Sgabeblack@google.com peek(responseNetwork_in, ResponseMsg) { 128114184Sgabeblack@google.com // assert(persistentTable.findSmallest(address) != id); // Make sure we never bounce tokens to ourself 128214184Sgabeblack@google.com // FIXME, should use a 3rd vnet in some cases 128314184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, 1) { 128414184Sgabeblack@google.com out_msg.addr := address; 128514184Sgabeblack@google.com out_msg.Type := in_msg.Type; 128614184Sgabeblack@google.com out_msg.Sender := machineID; 128714184Sgabeblack@google.com out_msg.Destination.add(persistentTable.findSmallest(address)); 128814184Sgabeblack@google.com out_msg.Tokens := in_msg.Tokens; 128914184Sgabeblack@google.com out_msg.DataBlk := in_msg.DataBlk; 129014184Sgabeblack@google.com out_msg.Dirty := in_msg.Dirty; 129114184Sgabeblack@google.com out_msg.MessageSize := in_msg.MessageSize; 129214184Sgabeblack@google.com } 129314184Sgabeblack@google.com } 129414184Sgabeblack@google.com } 129514184Sgabeblack@google.com 129614184Sgabeblack@google.com action(h_load_hit, "hd", desc="Notify sequencer the load completed.") { 129714184Sgabeblack@google.com assert(is_valid(cache_entry)); 129814184Sgabeblack@google.com DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n", 129914184Sgabeblack@google.com address, cache_entry.DataBlk); 130014184Sgabeblack@google.com 130114184Sgabeblack@google.com L1Dcache.setMRU(cache_entry); 130214184Sgabeblack@google.com sequencer.readCallback(address, cache_entry.DataBlk, false, 130314184Sgabeblack@google.com MachineType:L1Cache); 130414184Sgabeblack@google.com } 130514184Sgabeblack@google.com 130614184Sgabeblack@google.com action(h_ifetch_hit, "hi", desc="Notify sequencer the load completed.") { 130714184Sgabeblack@google.com assert(is_valid(cache_entry)); 130814184Sgabeblack@google.com DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n", 130914184Sgabeblack@google.com address, cache_entry.DataBlk); 131014184Sgabeblack@google.com 131114184Sgabeblack@google.com L1Icache.setMRU(cache_entry); 131214184Sgabeblack@google.com sequencer.readCallback(address, cache_entry.DataBlk, false, 131314184Sgabeblack@google.com MachineType:L1Cache); 131414184Sgabeblack@google.com } 131514184Sgabeblack@google.com 131614184Sgabeblack@google.com action(x_external_load_hit, "x", desc="Notify sequencer the load completed.") { 131714184Sgabeblack@google.com assert(is_valid(cache_entry)); 131814184Sgabeblack@google.com DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n", 131914184Sgabeblack@google.com address, cache_entry.DataBlk); 132014184Sgabeblack@google.com peek(responseNetwork_in, ResponseMsg) { 132114184Sgabeblack@google.com L1Icache.setMRU(address); 132214184Sgabeblack@google.com L1Dcache.setMRU(address); 132314184Sgabeblack@google.com sequencer.readCallback(address, cache_entry.DataBlk, 132414184Sgabeblack@google.com isExternalHit(address, in_msg.Sender), 132514184Sgabeblack@google.com machineIDToMachineType(in_msg.Sender)); 132614184Sgabeblack@google.com } 132714184Sgabeblack@google.com } 132814184Sgabeblack@google.com 132914184Sgabeblack@google.com action(hh_store_hit, "\h", desc="Notify sequencer that store completed.") { 133014184Sgabeblack@google.com assert(is_valid(cache_entry)); 133114184Sgabeblack@google.com DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n", 133214184Sgabeblack@google.com address, cache_entry.DataBlk); 133314184Sgabeblack@google.com 133414184Sgabeblack@google.com L1Dcache.setMRU(cache_entry); 133514184Sgabeblack@google.com sequencer.writeCallback(address, cache_entry.DataBlk, false, 133614184Sgabeblack@google.com MachineType:L1Cache); 133714184Sgabeblack@google.com cache_entry.Dirty := true; 133814184Sgabeblack@google.com DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk); 133914184Sgabeblack@google.com } 134014184Sgabeblack@google.com 134114184Sgabeblack@google.com action(xx_external_store_hit, "\x", desc="Notify sequencer that store completed.") { 134214184Sgabeblack@google.com assert(is_valid(cache_entry)); 134314184Sgabeblack@google.com DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n", 134414184Sgabeblack@google.com address, cache_entry.DataBlk); 134514184Sgabeblack@google.com peek(responseNetwork_in, ResponseMsg) { 134614184Sgabeblack@google.com L1Icache.setMRU(address); 134714184Sgabeblack@google.com L1Dcache.setMRU(address); 134814184Sgabeblack@google.com sequencer.writeCallback(address, cache_entry.DataBlk, 134914184Sgabeblack@google.com isExternalHit(address, in_msg.Sender), 135014184Sgabeblack@google.com machineIDToMachineType(in_msg.Sender)); 135114184Sgabeblack@google.com } 135214184Sgabeblack@google.com cache_entry.Dirty := true; 135314184Sgabeblack@google.com DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk); 135414184Sgabeblack@google.com } 135514184Sgabeblack@google.com 135614184Sgabeblack@google.com action(i_allocateTBE, "i", desc="Allocate TBE") { 135714184Sgabeblack@google.com check_allocate(L1_TBEs); 135814184Sgabeblack@google.com L1_TBEs.allocate(address); 135914184Sgabeblack@google.com set_tbe(L1_TBEs[address]); 136014184Sgabeblack@google.com tbe.IssueCount := 0; 136114184Sgabeblack@google.com peek(mandatoryQueue_in, RubyRequest) { 136214184Sgabeblack@google.com tbe.PC := in_msg.ProgramCounter; 136314184Sgabeblack@google.com tbe.TypeOfAccess := cache_request_type_to_access_type(in_msg.Type); 136414184Sgabeblack@google.com if (in_msg.Type == RubyRequestType:ATOMIC) { 136514184Sgabeblack@google.com tbe.IsAtomic := true; 136614184Sgabeblack@google.com } 136714184Sgabeblack@google.com tbe.Prefetch := in_msg.Prefetch; 136814184Sgabeblack@google.com tbe.AccessMode := in_msg.AccessMode; 136914184Sgabeblack@google.com } 137014184Sgabeblack@google.com tbe.IssueTime := curCycle(); 137114184Sgabeblack@google.com } 137214184Sgabeblack@google.com 137314184Sgabeblack@google.com action(ta_traceStalledAddress, "ta", desc="Trace Stalled Address") { 137414184Sgabeblack@google.com peek(mandatoryQueue_in, RubyRequest) { 137514184Sgabeblack@google.com APPEND_TRANSITION_COMMENT(in_msg.LineAddress); 137614184Sgabeblack@google.com } 137714184Sgabeblack@google.com } 137814184Sgabeblack@google.com 137914184Sgabeblack@google.com action(j_unsetReissueTimer, "j", desc="Unset reissue timer.") { 138014184Sgabeblack@google.com if (reissueTimerTable.isSet(address)) { 138114184Sgabeblack@google.com reissueTimerTable.unset(address); 138214184Sgabeblack@google.com } 138314184Sgabeblack@google.com } 138414184Sgabeblack@google.com 138514184Sgabeblack@google.com action(jj_unsetUseTimer, "\j", desc="Unset use timer.") { 138614184Sgabeblack@google.com useTimerTable.unset(address); 138714184Sgabeblack@google.com } 138814184Sgabeblack@google.com 138914184Sgabeblack@google.com action(k_popMandatoryQueue, "k", desc="Pop mandatory queue.") { 139014184Sgabeblack@google.com mandatoryQueue_in.dequeue(clockEdge()); 139114184Sgabeblack@google.com } 139214184Sgabeblack@google.com 139314184Sgabeblack@google.com action(l_popPersistentQueue, "l", desc="Pop persistent queue.") { 139414184Sgabeblack@google.com persistentNetwork_in.dequeue(clockEdge()); 139514184Sgabeblack@google.com } 139614184Sgabeblack@google.com 139714184Sgabeblack@google.com action(m_popRequestQueue, "m", desc="Pop request queue.") { 139814184Sgabeblack@google.com requestNetwork_in.dequeue(clockEdge()); 139914184Sgabeblack@google.com } 140014184Sgabeblack@google.com 140114184Sgabeblack@google.com action(n_popResponseQueue, "n", desc="Pop response queue") { 140214184Sgabeblack@google.com responseNetwork_in.dequeue(clockEdge()); 140314184Sgabeblack@google.com } 140414184Sgabeblack@google.com 140514184Sgabeblack@google.com action(o_scheduleUseTimeout, "o", desc="Schedule a use timeout.") { 140614184Sgabeblack@google.com useTimerTable.set( 140714184Sgabeblack@google.com address, clockEdge() + cyclesToTicks(use_timeout_latency)); 140814184Sgabeblack@google.com } 140914184Sgabeblack@google.com 141014184Sgabeblack@google.com action(p_informL2AboutTokenLoss, "p", desc="Inform L2 about loss of all tokens") { 141114184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 141214184Sgabeblack@google.com out_msg.addr := address; 141314184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:INV; 141414184Sgabeblack@google.com out_msg.Tokens := 0; 141514184Sgabeblack@google.com out_msg.Sender := machineID; 141614184Sgabeblack@google.com 141714184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 141814184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 141914184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 142014184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Control; 142114184Sgabeblack@google.com } 142214184Sgabeblack@google.com } 142314184Sgabeblack@google.com 142414184Sgabeblack@google.com action(q_updateTokensFromResponse, "q", desc="Update the token count based on the incoming response message") { 142514184Sgabeblack@google.com peek(responseNetwork_in, ResponseMsg) { 142614184Sgabeblack@google.com assert(is_valid(cache_entry)); 142714184Sgabeblack@google.com assert(in_msg.Tokens != 0); 142814184Sgabeblack@google.com DPRINTF(RubySlicc, "L1 received tokens for address: %#x, tokens: %d\n", 142914184Sgabeblack@google.com in_msg.addr, in_msg.Tokens); 143014184Sgabeblack@google.com cache_entry.Tokens := cache_entry.Tokens + in_msg.Tokens; 143114184Sgabeblack@google.com DPRINTF(RubySlicc, "%d\n", cache_entry.Tokens); 143214184Sgabeblack@google.com 143314184Sgabeblack@google.com if (cache_entry.Dirty == false && in_msg.Dirty) { 143414184Sgabeblack@google.com cache_entry.Dirty := true; 143514184Sgabeblack@google.com } 143614184Sgabeblack@google.com } 143714184Sgabeblack@google.com } 143814184Sgabeblack@google.com 143914184Sgabeblack@google.com action(s_deallocateTBE, "s", desc="Deallocate TBE") { 144014184Sgabeblack@google.com 144114184Sgabeblack@google.com assert(is_valid(tbe)); 144214184Sgabeblack@google.com if (tbe.WentPersistent) { 144314184Sgabeblack@google.com // assert(starving); 144414184Sgabeblack@google.com outstandingRequests := outstandingRequests - 1; 144514184Sgabeblack@google.com enqueue(persistentNetwork_out, PersistentMsg, l1_request_latency) { 144614184Sgabeblack@google.com out_msg.addr := address; 144714184Sgabeblack@google.com out_msg.Type := PersistentRequestType:DEACTIVATE_PERSISTENT; 144814184Sgabeblack@google.com out_msg.Requestor := machineID; 144914184Sgabeblack@google.com out_msg.Destination.broadcast(MachineType:L1Cache); 145014184Sgabeblack@google.com 145114184Sgabeblack@google.com // 145214184Sgabeblack@google.com // Currently the configuration system limits the system to only one 145314184Sgabeblack@google.com // chip. Therefore, if we assume one shared L2 cache, then only one 145414184Sgabeblack@google.com // pertinent L2 cache exist. 145514184Sgabeblack@google.com // 145614184Sgabeblack@google.com //out_msg.Destination.addNetDest(getAllPertinentL2Banks(address)); 145714184Sgabeblack@google.com 145814184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 145914184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 146014184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 146114184Sgabeblack@google.com 146214184Sgabeblack@google.com out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory)); 146314184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Persistent_Control; 146414184Sgabeblack@google.com } 146514184Sgabeblack@google.com starving := false; 146614184Sgabeblack@google.com } 146714184Sgabeblack@google.com 146814184Sgabeblack@google.com // Update average latency 146914184Sgabeblack@google.com if (tbe.IssueCount <= 1) { 147014184Sgabeblack@google.com if (tbe.ExternalResponse) { 147114184Sgabeblack@google.com updateAverageLatencyEstimate(curCycle() - tbe.IssueTime); 147214184Sgabeblack@google.com } 147314184Sgabeblack@google.com } 147414184Sgabeblack@google.com 147514184Sgabeblack@google.com // Profile 147614184Sgabeblack@google.com //if (tbe.WentPersistent) { 147714184Sgabeblack@google.com // profile_token_retry(address, tbe.TypeOfAccess, 2); 147814184Sgabeblack@google.com //} 147914184Sgabeblack@google.com //else { 148014184Sgabeblack@google.com // profile_token_retry(address, tbe.TypeOfAccess, 1); 148114184Sgabeblack@google.com //} 148214184Sgabeblack@google.com 148314184Sgabeblack@google.com //profile_token_retry(address, tbe.TypeOfAccess, tbe.IssueCount); 148414184Sgabeblack@google.com L1_TBEs.deallocate(address); 148514184Sgabeblack@google.com unset_tbe(); 148614184Sgabeblack@google.com } 148714184Sgabeblack@google.com 148814184Sgabeblack@google.com action(t_sendAckWithCollectedTokens, "t", desc="Send ack with the tokens we've collected thus far.") { 148914184Sgabeblack@google.com assert(is_valid(cache_entry)); 149014184Sgabeblack@google.com if (cache_entry.Tokens > 0) { 149114184Sgabeblack@google.com peek(requestNetwork_in, RequestMsg) { 149214184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 149314184Sgabeblack@google.com out_msg.addr := address; 149414184Sgabeblack@google.com if (cache_entry.Tokens > (max_tokens() / 2)) { 149514184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_OWNER; 149614184Sgabeblack@google.com } else { 149714184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:ACK; 149814184Sgabeblack@google.com } 149914184Sgabeblack@google.com out_msg.Sender := machineID; 150014184Sgabeblack@google.com out_msg.Destination.add(in_msg.Requestor); 150114184Sgabeblack@google.com assert(cache_entry.Tokens >= 1); 150214184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 150314184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 150414184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Control; 150514184Sgabeblack@google.com } 150614184Sgabeblack@google.com } 150714184Sgabeblack@google.com } 150814184Sgabeblack@google.com cache_entry.Tokens := 0; 150914184Sgabeblack@google.com } 151014184Sgabeblack@google.com 151114184Sgabeblack@google.com action(u_writeDataToCache, "u", desc="Write data to cache") { 151214184Sgabeblack@google.com peek(responseNetwork_in, ResponseMsg) { 151314184Sgabeblack@google.com assert(is_valid(cache_entry)); 151414184Sgabeblack@google.com cache_entry.DataBlk := in_msg.DataBlk; 151514184Sgabeblack@google.com if (cache_entry.Dirty == false && in_msg.Dirty) { 151614184Sgabeblack@google.com cache_entry.Dirty := in_msg.Dirty; 151714184Sgabeblack@google.com } 151814184Sgabeblack@google.com 151914184Sgabeblack@google.com } 152014184Sgabeblack@google.com } 152114184Sgabeblack@google.com 152214184Sgabeblack@google.com action(gg_deallocateL1CacheBlock, "\g", desc="Deallocate cache block. Sets the cache to invalid, allowing a replacement in parallel with a fetch.") { 152314184Sgabeblack@google.com assert(getTokens(cache_entry) == 0); 152414184Sgabeblack@google.com if (L1Dcache.isTagPresent(address)) { 152514184Sgabeblack@google.com L1Dcache.deallocate(address); 152614184Sgabeblack@google.com } else { 152714184Sgabeblack@google.com L1Icache.deallocate(address); 152814184Sgabeblack@google.com } 152914184Sgabeblack@google.com unset_cache_entry(); 153014184Sgabeblack@google.com } 153114184Sgabeblack@google.com 153214184Sgabeblack@google.com action(ii_allocateL1DCacheBlock, "\i", desc="Set L1 D-cache tag equal to tag of block B.") { 153314184Sgabeblack@google.com if (is_valid(cache_entry)) { 153414184Sgabeblack@google.com } else { 153514184Sgabeblack@google.com set_cache_entry(L1Dcache.allocate(address, new Entry)); 153614184Sgabeblack@google.com } 153714184Sgabeblack@google.com } 153814184Sgabeblack@google.com 153914184Sgabeblack@google.com action(pp_allocateL1ICacheBlock, "\p", desc="Set L1 I-cache tag equal to tag of block B.") { 154014184Sgabeblack@google.com if (is_valid(cache_entry)) { 154114184Sgabeblack@google.com } else { 154214184Sgabeblack@google.com set_cache_entry(L1Icache.allocate(address, new Entry)); 154314184Sgabeblack@google.com } 154414184Sgabeblack@google.com } 154514184Sgabeblack@google.com 154614184Sgabeblack@google.com action(forward_eviction_to_cpu, "\cc", desc="sends eviction information to the processor") { 154714184Sgabeblack@google.com if (send_evictions) { 154814184Sgabeblack@google.com DPRINTF(RubySlicc, "Sending invalidation for %#x to the CPU\n", address); 154914184Sgabeblack@google.com sequencer.evictionCallback(address); 155014184Sgabeblack@google.com } 155114184Sgabeblack@google.com } 155214184Sgabeblack@google.com 155314184Sgabeblack@google.com action(uu_profileInstMiss, "\uim", desc="Profile the demand miss") { 155414184Sgabeblack@google.com ++L1Icache.demand_misses; 155514184Sgabeblack@google.com } 155614184Sgabeblack@google.com 155714184Sgabeblack@google.com action(uu_profileInstHit, "\uih", desc="Profile the demand hit") { 155814184Sgabeblack@google.com ++L1Icache.demand_hits; 155914184Sgabeblack@google.com } 156014184Sgabeblack@google.com 156114184Sgabeblack@google.com action(uu_profileDataMiss, "\udm", desc="Profile the demand miss") { 156214184Sgabeblack@google.com ++L1Dcache.demand_misses; 156314184Sgabeblack@google.com } 156414184Sgabeblack@google.com 156514184Sgabeblack@google.com action(uu_profileDataHit, "\udh", desc="Profile the demand hit") { 156614184Sgabeblack@google.com ++L1Dcache.demand_hits; 156714184Sgabeblack@google.com } 156814184Sgabeblack@google.com 156914184Sgabeblack@google.com action(w_assertIncomingDataAndCacheDataMatch, "w", desc="Assert that the incoming data and the data in the cache match") { 157014184Sgabeblack@google.com peek(responseNetwork_in, ResponseMsg) { 157114184Sgabeblack@google.com assert(is_valid(cache_entry)); 157214184Sgabeblack@google.com assert(cache_entry.DataBlk == in_msg.DataBlk); 157314184Sgabeblack@google.com } 157414184Sgabeblack@google.com } 157514184Sgabeblack@google.com 157614184Sgabeblack@google.com action(zz_stallAndWaitMandatoryQueue, "\z", desc="Send the head of the mandatory queue to the back of the queue.") { 157714184Sgabeblack@google.com peek(mandatoryQueue_in, RubyRequest) { 157814184Sgabeblack@google.com APPEND_TRANSITION_COMMENT(in_msg.LineAddress); 157914184Sgabeblack@google.com } 158014184Sgabeblack@google.com stall_and_wait(mandatoryQueue_in, address); 158114184Sgabeblack@google.com } 158214184Sgabeblack@google.com 158314184Sgabeblack@google.com action(kd_wakeUpDependents, "kd", desc="wake-up dependents") { 158414184Sgabeblack@google.com wakeUpBuffers(address); 158514184Sgabeblack@google.com } 158614184Sgabeblack@google.com 158714184Sgabeblack@google.com action(ka_wakeUpAllDependents, "ka", desc="wake-up all dependents") { 158814184Sgabeblack@google.com wakeUpAllBuffers(); 158914184Sgabeblack@google.com } 159014184Sgabeblack@google.com 159114184Sgabeblack@google.com //***************************************************** 159214184Sgabeblack@google.com // TRANSITIONS 159314184Sgabeblack@google.com //***************************************************** 159414184Sgabeblack@google.com 159514184Sgabeblack@google.com // Transitions for Load/Store/L2_Replacement from transient states 159614184Sgabeblack@google.com transition({IM, SM, OM, IS, IM_L, IS_L, I_L, S_L, SM_L, M_W, MM_W}, L1_Replacement) { 159714184Sgabeblack@google.com ta_traceStalledAddress; 159814184Sgabeblack@google.com zz_stallAndWaitMandatoryQueue; 159914184Sgabeblack@google.com } 160014184Sgabeblack@google.com 160114184Sgabeblack@google.com transition({IM, SM, OM, IS, IM_L, IS_L, SM_L}, {Store, Atomic}) { 160214184Sgabeblack@google.com zz_stallAndWaitMandatoryQueue; 160314184Sgabeblack@google.com } 160414184Sgabeblack@google.com 160514184Sgabeblack@google.com transition({IM, IS, IM_L, IS_L}, {Load, Ifetch}) { 160614184Sgabeblack@google.com zz_stallAndWaitMandatoryQueue; 160714184Sgabeblack@google.com } 160814184Sgabeblack@google.com 160914184Sgabeblack@google.com // Lockdowns 161014184Sgabeblack@google.com transition({NP, I, S, O, M, MM, M_W, MM_W, IM, SM, OM, IS}, Own_Lock_or_Unlock) { 161114184Sgabeblack@google.com l_popPersistentQueue; 161214184Sgabeblack@google.com } 161314184Sgabeblack@google.com 161414184Sgabeblack@google.com // Transitions from NP 161514184Sgabeblack@google.com transition(NP, Load, IS) { 161614184Sgabeblack@google.com ii_allocateL1DCacheBlock; 161714184Sgabeblack@google.com i_allocateTBE; 161814184Sgabeblack@google.com a_issueReadRequest; 161914184Sgabeblack@google.com uu_profileDataMiss; 162014184Sgabeblack@google.com k_popMandatoryQueue; 162114184Sgabeblack@google.com } 162214184Sgabeblack@google.com 162314184Sgabeblack@google.com transition(NP, Ifetch, IS) { 162414184Sgabeblack@google.com pp_allocateL1ICacheBlock; 162514184Sgabeblack@google.com i_allocateTBE; 162614184Sgabeblack@google.com a_issueReadRequest; 162714184Sgabeblack@google.com uu_profileInstMiss; 162814184Sgabeblack@google.com k_popMandatoryQueue; 162914184Sgabeblack@google.com } 163014184Sgabeblack@google.com 163114184Sgabeblack@google.com transition(NP, {Store, Atomic}, IM) { 163214184Sgabeblack@google.com ii_allocateL1DCacheBlock; 163314184Sgabeblack@google.com i_allocateTBE; 163414184Sgabeblack@google.com b_issueWriteRequest; 163514184Sgabeblack@google.com uu_profileDataMiss; 163614184Sgabeblack@google.com k_popMandatoryQueue; 163714184Sgabeblack@google.com } 163814184Sgabeblack@google.com 163914184Sgabeblack@google.com transition(NP, {Ack, Data_Shared, Data_Owner, Data_All_Tokens}) { 164014184Sgabeblack@google.com bb_bounceResponse; 164114184Sgabeblack@google.com n_popResponseQueue; 164214184Sgabeblack@google.com } 164314184Sgabeblack@google.com 164414184Sgabeblack@google.com transition(NP, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_Local_GETS}) { 164514184Sgabeblack@google.com m_popRequestQueue; 164614184Sgabeblack@google.com } 164714184Sgabeblack@google.com 164814184Sgabeblack@google.com transition(NP, {Persistent_GETX, Persistent_GETS, Persistent_GETS_Last_Token}, I_L) { 164914184Sgabeblack@google.com l_popPersistentQueue; 165014184Sgabeblack@google.com } 165114184Sgabeblack@google.com 165214184Sgabeblack@google.com // Transitions from Idle 165314184Sgabeblack@google.com transition(I, Load, IS) { 165414184Sgabeblack@google.com i_allocateTBE; 165514184Sgabeblack@google.com a_issueReadRequest; 165614184Sgabeblack@google.com uu_profileDataMiss; 165714184Sgabeblack@google.com k_popMandatoryQueue; 165814184Sgabeblack@google.com } 165914184Sgabeblack@google.com 166014184Sgabeblack@google.com transition(I, Ifetch, IS) { 166114184Sgabeblack@google.com i_allocateTBE; 166214184Sgabeblack@google.com a_issueReadRequest; 166314184Sgabeblack@google.com uu_profileInstMiss; 166414184Sgabeblack@google.com k_popMandatoryQueue; 166514184Sgabeblack@google.com } 166614184Sgabeblack@google.com 166714184Sgabeblack@google.com transition(I, {Store, Atomic}, IM) { 166814184Sgabeblack@google.com i_allocateTBE; 166914184Sgabeblack@google.com b_issueWriteRequest; 167014184Sgabeblack@google.com uu_profileDataMiss; 167114184Sgabeblack@google.com k_popMandatoryQueue; 167214184Sgabeblack@google.com } 167314184Sgabeblack@google.com 167414184Sgabeblack@google.com transition(I, L1_Replacement) { 167514184Sgabeblack@google.com ta_traceStalledAddress; 167614184Sgabeblack@google.com tr_tokenReplacement; 167714184Sgabeblack@google.com gg_deallocateL1CacheBlock; 167814184Sgabeblack@google.com ka_wakeUpAllDependents; 167914184Sgabeblack@google.com } 168014184Sgabeblack@google.com 168114184Sgabeblack@google.com transition(I, {Transient_GETX, Transient_Local_GETX}) { 168214184Sgabeblack@google.com t_sendAckWithCollectedTokens; 168314184Sgabeblack@google.com m_popRequestQueue; 168414184Sgabeblack@google.com } 168514184Sgabeblack@google.com 168614184Sgabeblack@google.com transition(I, {Transient_GETS, Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token, Transient_Local_GETS}) { 168714184Sgabeblack@google.com m_popRequestQueue; 168814184Sgabeblack@google.com } 168914184Sgabeblack@google.com 169014184Sgabeblack@google.com transition(I, {Persistent_GETX, Persistent_GETS, Persistent_GETS_Last_Token}, I_L) { 169114184Sgabeblack@google.com e_sendAckWithCollectedTokens; 169214184Sgabeblack@google.com l_popPersistentQueue; 169314184Sgabeblack@google.com } 169414184Sgabeblack@google.com 169514184Sgabeblack@google.com transition(I_L, {Persistent_GETX, Persistent_GETS, Persistent_GETS_Last_Token}) { 169614184Sgabeblack@google.com l_popPersistentQueue; 169714184Sgabeblack@google.com } 169814184Sgabeblack@google.com 169914184Sgabeblack@google.com transition(I, Ack) { 170014184Sgabeblack@google.com q_updateTokensFromResponse; 170114184Sgabeblack@google.com n_popResponseQueue; 170214184Sgabeblack@google.com } 170314184Sgabeblack@google.com 170414184Sgabeblack@google.com transition(I, Data_Shared, S) { 170514184Sgabeblack@google.com u_writeDataToCache; 170614184Sgabeblack@google.com q_updateTokensFromResponse; 170714184Sgabeblack@google.com n_popResponseQueue; 170814184Sgabeblack@google.com } 170914184Sgabeblack@google.com 171014184Sgabeblack@google.com transition(I, Data_Owner, O) { 171114184Sgabeblack@google.com u_writeDataToCache; 171214184Sgabeblack@google.com q_updateTokensFromResponse; 171314184Sgabeblack@google.com n_popResponseQueue; 171414184Sgabeblack@google.com } 171514184Sgabeblack@google.com 171614184Sgabeblack@google.com transition(I, Data_All_Tokens, M) { 171714184Sgabeblack@google.com u_writeDataToCache; 171814184Sgabeblack@google.com q_updateTokensFromResponse; 171914184Sgabeblack@google.com n_popResponseQueue; 172014184Sgabeblack@google.com } 172114184Sgabeblack@google.com 172214184Sgabeblack@google.com // Transitions from Shared 172314184Sgabeblack@google.com transition({S, SM, S_L, SM_L}, Load) { 172414184Sgabeblack@google.com h_load_hit; 172514184Sgabeblack@google.com uu_profileDataHit; 172614184Sgabeblack@google.com k_popMandatoryQueue; 172714184Sgabeblack@google.com } 172814184Sgabeblack@google.com 172914184Sgabeblack@google.com transition({S, SM, S_L, SM_L}, Ifetch) { 173014184Sgabeblack@google.com h_ifetch_hit; 173114184Sgabeblack@google.com uu_profileInstHit; 173214184Sgabeblack@google.com k_popMandatoryQueue; 173314184Sgabeblack@google.com } 173414184Sgabeblack@google.com 173514184Sgabeblack@google.com transition(S, {Store, Atomic}, SM) { 173614184Sgabeblack@google.com i_allocateTBE; 173714184Sgabeblack@google.com b_issueWriteRequest; 173814184Sgabeblack@google.com uu_profileDataMiss; 173914184Sgabeblack@google.com k_popMandatoryQueue; 174014184Sgabeblack@google.com } 174114184Sgabeblack@google.com 174214184Sgabeblack@google.com transition(S, L1_Replacement, I) { 174314184Sgabeblack@google.com ta_traceStalledAddress; 174414184Sgabeblack@google.com cc_sharedReplacement; // Only needed in some cases 174514184Sgabeblack@google.com forward_eviction_to_cpu; 174614184Sgabeblack@google.com gg_deallocateL1CacheBlock; 174714184Sgabeblack@google.com ka_wakeUpAllDependents; 174814184Sgabeblack@google.com } 174914184Sgabeblack@google.com 175014184Sgabeblack@google.com transition(S, {Transient_GETX, Transient_Local_GETX}, I) { 175114184Sgabeblack@google.com t_sendAckWithCollectedTokens; 175214184Sgabeblack@google.com p_informL2AboutTokenLoss; 175314184Sgabeblack@google.com forward_eviction_to_cpu 175414184Sgabeblack@google.com m_popRequestQueue; 175514184Sgabeblack@google.com } 175614184Sgabeblack@google.com 175714184Sgabeblack@google.com // only owner responds to non-local requests 175814184Sgabeblack@google.com transition(S, Transient_GETS) { 175914184Sgabeblack@google.com m_popRequestQueue; 176014184Sgabeblack@google.com } 176114184Sgabeblack@google.com 176214184Sgabeblack@google.com transition(S, Transient_Local_GETS) { 176314184Sgabeblack@google.com d_sendDataWithToken; 176414184Sgabeblack@google.com m_popRequestQueue; 176514184Sgabeblack@google.com } 176614184Sgabeblack@google.com 176714184Sgabeblack@google.com transition(S, {Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token}) { 176814184Sgabeblack@google.com m_popRequestQueue; 176914184Sgabeblack@google.com } 177014184Sgabeblack@google.com 177114184Sgabeblack@google.com transition({S, S_L}, Persistent_GETX, I_L) { 177214184Sgabeblack@google.com e_sendAckWithCollectedTokens; 177314184Sgabeblack@google.com p_informL2AboutTokenLoss; 177414184Sgabeblack@google.com forward_eviction_to_cpu 177514184Sgabeblack@google.com l_popPersistentQueue; 177614184Sgabeblack@google.com } 177714184Sgabeblack@google.com 177814184Sgabeblack@google.com transition(S, {Persistent_GETS, Persistent_GETS_Last_Token}, S_L) { 177914184Sgabeblack@google.com f_sendAckWithAllButNorOneTokens; 178014184Sgabeblack@google.com l_popPersistentQueue; 178114184Sgabeblack@google.com } 178214184Sgabeblack@google.com 178314184Sgabeblack@google.com transition(S_L, {Persistent_GETS, Persistent_GETS_Last_Token}) { 178414184Sgabeblack@google.com l_popPersistentQueue; 178514184Sgabeblack@google.com } 178614184Sgabeblack@google.com 178714184Sgabeblack@google.com transition(S, Ack) { 178814184Sgabeblack@google.com q_updateTokensFromResponse; 178914184Sgabeblack@google.com n_popResponseQueue; 179014184Sgabeblack@google.com } 179114184Sgabeblack@google.com 179214184Sgabeblack@google.com transition(S, Data_Shared) { 179314184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 179414184Sgabeblack@google.com q_updateTokensFromResponse; 179514184Sgabeblack@google.com n_popResponseQueue; 179614184Sgabeblack@google.com } 179714184Sgabeblack@google.com 179814184Sgabeblack@google.com transition(S, Data_Owner, O) { 179914184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 180014184Sgabeblack@google.com q_updateTokensFromResponse; 180114184Sgabeblack@google.com n_popResponseQueue; 180214184Sgabeblack@google.com } 180314184Sgabeblack@google.com 180414184Sgabeblack@google.com transition(S, Data_All_Tokens, M) { 180514184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 180614184Sgabeblack@google.com q_updateTokensFromResponse; 180714184Sgabeblack@google.com n_popResponseQueue; 180814184Sgabeblack@google.com } 180914184Sgabeblack@google.com 181014184Sgabeblack@google.com // Transitions from Owned 181114184Sgabeblack@google.com transition({O, OM}, Ifetch) { 181214184Sgabeblack@google.com h_ifetch_hit; 181314184Sgabeblack@google.com uu_profileInstHit; 181414184Sgabeblack@google.com k_popMandatoryQueue; 181514184Sgabeblack@google.com } 181614184Sgabeblack@google.com 181714184Sgabeblack@google.com transition({O, OM}, Load) { 181814184Sgabeblack@google.com h_load_hit; 181914184Sgabeblack@google.com uu_profileDataHit; 182014184Sgabeblack@google.com k_popMandatoryQueue; 182114184Sgabeblack@google.com } 182214184Sgabeblack@google.com 182314184Sgabeblack@google.com transition(O, {Store, Atomic}, OM) { 182414184Sgabeblack@google.com i_allocateTBE; 182514184Sgabeblack@google.com b_issueWriteRequest; 182614184Sgabeblack@google.com uu_profileDataMiss; 182714184Sgabeblack@google.com k_popMandatoryQueue; 182814184Sgabeblack@google.com } 182914184Sgabeblack@google.com 183014184Sgabeblack@google.com transition(O, L1_Replacement, I) { 183114184Sgabeblack@google.com ta_traceStalledAddress; 183214184Sgabeblack@google.com c_ownedReplacement; 183314184Sgabeblack@google.com forward_eviction_to_cpu 183414184Sgabeblack@google.com gg_deallocateL1CacheBlock; 183514184Sgabeblack@google.com ka_wakeUpAllDependents; 183614184Sgabeblack@google.com } 183714184Sgabeblack@google.com 183814184Sgabeblack@google.com transition(O, {Transient_GETX, Transient_Local_GETX}, I) { 183914184Sgabeblack@google.com dd_sendDataWithAllTokens; 184014184Sgabeblack@google.com p_informL2AboutTokenLoss; 184114184Sgabeblack@google.com forward_eviction_to_cpu 184214184Sgabeblack@google.com m_popRequestQueue; 184314184Sgabeblack@google.com } 184414184Sgabeblack@google.com 184514184Sgabeblack@google.com transition(O, Persistent_GETX, I_L) { 184614184Sgabeblack@google.com ee_sendDataWithAllTokens; 184714184Sgabeblack@google.com p_informL2AboutTokenLoss; 184814184Sgabeblack@google.com forward_eviction_to_cpu 184914184Sgabeblack@google.com l_popPersistentQueue; 185014184Sgabeblack@google.com } 185114184Sgabeblack@google.com 185214184Sgabeblack@google.com transition(O, Persistent_GETS, S_L) { 185314184Sgabeblack@google.com ff_sendDataWithAllButNorOneTokens; 185414184Sgabeblack@google.com l_popPersistentQueue; 185514184Sgabeblack@google.com } 185614184Sgabeblack@google.com 185714184Sgabeblack@google.com transition(O, Persistent_GETS_Last_Token, I_L) { 185814184Sgabeblack@google.com fo_sendDataWithOwnerToken; 185914184Sgabeblack@google.com forward_eviction_to_cpu 186014184Sgabeblack@google.com l_popPersistentQueue; 186114184Sgabeblack@google.com } 186214184Sgabeblack@google.com 186314184Sgabeblack@google.com transition(O, Transient_GETS) { 186414184Sgabeblack@google.com d_sendDataWithToken; 186514184Sgabeblack@google.com m_popRequestQueue; 186614184Sgabeblack@google.com } 186714184Sgabeblack@google.com 186814184Sgabeblack@google.com transition(O, Transient_Local_GETS) { 186914184Sgabeblack@google.com d_sendDataWithToken; 187014184Sgabeblack@google.com m_popRequestQueue; 187114184Sgabeblack@google.com } 187214184Sgabeblack@google.com 187314184Sgabeblack@google.com // ran out of tokens, wait for it to go persistent 187414184Sgabeblack@google.com transition(O, {Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token}) { 187514184Sgabeblack@google.com m_popRequestQueue; 187614184Sgabeblack@google.com } 187714184Sgabeblack@google.com 187814184Sgabeblack@google.com transition(O, Ack) { 187914184Sgabeblack@google.com q_updateTokensFromResponse; 188014184Sgabeblack@google.com n_popResponseQueue; 188114184Sgabeblack@google.com } 188214184Sgabeblack@google.com 188314184Sgabeblack@google.com transition(O, Ack_All_Tokens, M) { 188414184Sgabeblack@google.com q_updateTokensFromResponse; 188514184Sgabeblack@google.com n_popResponseQueue; 188614184Sgabeblack@google.com } 188714184Sgabeblack@google.com 188814184Sgabeblack@google.com transition(O, Data_Shared) { 188914184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 189014184Sgabeblack@google.com q_updateTokensFromResponse; 189114184Sgabeblack@google.com n_popResponseQueue; 189214184Sgabeblack@google.com } 189314184Sgabeblack@google.com 189414184Sgabeblack@google.com transition(O, Data_All_Tokens, M) { 189514184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 189614184Sgabeblack@google.com q_updateTokensFromResponse; 189714184Sgabeblack@google.com n_popResponseQueue; 189814184Sgabeblack@google.com } 189914184Sgabeblack@google.com 190014184Sgabeblack@google.com // Transitions from Modified 190114184Sgabeblack@google.com transition({MM, MM_W}, Ifetch) { 190214184Sgabeblack@google.com h_ifetch_hit; 190314184Sgabeblack@google.com uu_profileInstHit; 190414184Sgabeblack@google.com k_popMandatoryQueue; 190514184Sgabeblack@google.com } 190614184Sgabeblack@google.com 190714184Sgabeblack@google.com transition({MM, MM_W}, Load) { 190814184Sgabeblack@google.com h_load_hit; 190914184Sgabeblack@google.com uu_profileDataHit; 191014184Sgabeblack@google.com k_popMandatoryQueue; 191114184Sgabeblack@google.com } 191214184Sgabeblack@google.com 191314184Sgabeblack@google.com transition({MM_W}, {Store, Atomic}) { 191414184Sgabeblack@google.com hh_store_hit; 191514184Sgabeblack@google.com uu_profileDataHit; 191614184Sgabeblack@google.com k_popMandatoryQueue; 191714184Sgabeblack@google.com } 191814184Sgabeblack@google.com 191914184Sgabeblack@google.com transition(MM, Store) { 192014184Sgabeblack@google.com hh_store_hit; 192114184Sgabeblack@google.com uu_profileDataHit; 192214184Sgabeblack@google.com k_popMandatoryQueue; 192314184Sgabeblack@google.com } 192414184Sgabeblack@google.com 192514184Sgabeblack@google.com transition(MM, Atomic, M) { 192614184Sgabeblack@google.com hh_store_hit; 192714184Sgabeblack@google.com uu_profileDataHit; 192814184Sgabeblack@google.com k_popMandatoryQueue; 192914184Sgabeblack@google.com } 193014184Sgabeblack@google.com 193114184Sgabeblack@google.com transition(MM, L1_Replacement, I) { 193214184Sgabeblack@google.com ta_traceStalledAddress; 193314184Sgabeblack@google.com c_ownedReplacement; 193414184Sgabeblack@google.com forward_eviction_to_cpu 193514184Sgabeblack@google.com gg_deallocateL1CacheBlock; 193614184Sgabeblack@google.com ka_wakeUpAllDependents; 193714184Sgabeblack@google.com } 193814184Sgabeblack@google.com 193914184Sgabeblack@google.com transition(MM, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_Local_GETS}, I) { 194014184Sgabeblack@google.com dd_sendDataWithAllTokens; 194114184Sgabeblack@google.com p_informL2AboutTokenLoss; 194214184Sgabeblack@google.com forward_eviction_to_cpu 194314184Sgabeblack@google.com m_popRequestQueue; 194414184Sgabeblack@google.com } 194514184Sgabeblack@google.com 194614184Sgabeblack@google.com transition({MM_W}, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_Local_GETS}) { // Ignore the request 194714184Sgabeblack@google.com m_popRequestQueue; 194814184Sgabeblack@google.com } 194914184Sgabeblack@google.com 195014184Sgabeblack@google.com // Implement the migratory sharing optimization, even for persistent requests 195114184Sgabeblack@google.com transition(MM, {Persistent_GETX, Persistent_GETS}, I_L) { 195214184Sgabeblack@google.com ee_sendDataWithAllTokens; 195314184Sgabeblack@google.com p_informL2AboutTokenLoss; 195414184Sgabeblack@google.com forward_eviction_to_cpu 195514184Sgabeblack@google.com l_popPersistentQueue; 195614184Sgabeblack@google.com } 195714184Sgabeblack@google.com 195814184Sgabeblack@google.com // ignore persistent requests in lockout period 195914184Sgabeblack@google.com transition(MM_W, {Persistent_GETX, Persistent_GETS}) { 196014184Sgabeblack@google.com l_popPersistentQueue; 196114184Sgabeblack@google.com } 196214184Sgabeblack@google.com 196314184Sgabeblack@google.com transition(MM_W, Use_TimeoutNoStarvers, MM) { 196414184Sgabeblack@google.com s_deallocateTBE; 196514184Sgabeblack@google.com jj_unsetUseTimer; 196614184Sgabeblack@google.com kd_wakeUpDependents; 196714184Sgabeblack@google.com } 196814184Sgabeblack@google.com 196914184Sgabeblack@google.com transition(MM_W, Use_TimeoutNoStarvers_NoMig, M) { 197014184Sgabeblack@google.com s_deallocateTBE; 197114184Sgabeblack@google.com jj_unsetUseTimer; 197214184Sgabeblack@google.com kd_wakeUpDependents; 197314184Sgabeblack@google.com } 197414184Sgabeblack@google.com 197514184Sgabeblack@google.com // Transitions from Dirty Exclusive 197614184Sgabeblack@google.com transition({M, M_W}, Ifetch) { 197714184Sgabeblack@google.com h_ifetch_hit; 197814184Sgabeblack@google.com uu_profileInstHit; 197914184Sgabeblack@google.com k_popMandatoryQueue; 198014184Sgabeblack@google.com } 198114184Sgabeblack@google.com 198214184Sgabeblack@google.com transition({M, M_W}, Load) { 198314184Sgabeblack@google.com h_load_hit; 198414184Sgabeblack@google.com uu_profileDataHit; 198514184Sgabeblack@google.com k_popMandatoryQueue; 198614184Sgabeblack@google.com } 198714184Sgabeblack@google.com 198814184Sgabeblack@google.com transition(M, Store, MM) { 198914184Sgabeblack@google.com hh_store_hit; 199014184Sgabeblack@google.com uu_profileDataHit; 199114184Sgabeblack@google.com k_popMandatoryQueue; 199214184Sgabeblack@google.com } 199314184Sgabeblack@google.com 199414184Sgabeblack@google.com transition(M, Atomic) { 199514184Sgabeblack@google.com hh_store_hit; 199614184Sgabeblack@google.com uu_profileDataHit; 199714184Sgabeblack@google.com k_popMandatoryQueue; 199814184Sgabeblack@google.com } 199914184Sgabeblack@google.com 200014184Sgabeblack@google.com transition(M_W, Store, MM_W) { 200114184Sgabeblack@google.com hh_store_hit; 200214184Sgabeblack@google.com uu_profileDataHit; 200314184Sgabeblack@google.com k_popMandatoryQueue; 200414184Sgabeblack@google.com } 200514184Sgabeblack@google.com 200614184Sgabeblack@google.com transition(M_W, Atomic) { 200714184Sgabeblack@google.com hh_store_hit; 200814184Sgabeblack@google.com uu_profileDataHit; 200914184Sgabeblack@google.com k_popMandatoryQueue; 201014184Sgabeblack@google.com } 201114184Sgabeblack@google.com 201214184Sgabeblack@google.com transition(M, L1_Replacement, I) { 201314184Sgabeblack@google.com ta_traceStalledAddress; 201414184Sgabeblack@google.com c_ownedReplacement; 201514184Sgabeblack@google.com forward_eviction_to_cpu 201614184Sgabeblack@google.com gg_deallocateL1CacheBlock; 201714184Sgabeblack@google.com ka_wakeUpAllDependents; 201814184Sgabeblack@google.com } 201914184Sgabeblack@google.com 202014184Sgabeblack@google.com transition(M, {Transient_GETX, Transient_Local_GETX}, I) { 202114184Sgabeblack@google.com dd_sendDataWithAllTokens; 202214184Sgabeblack@google.com p_informL2AboutTokenLoss; 202314184Sgabeblack@google.com forward_eviction_to_cpu 202414184Sgabeblack@google.com m_popRequestQueue; 202514184Sgabeblack@google.com } 202614184Sgabeblack@google.com 202714184Sgabeblack@google.com transition(M, Transient_Local_GETS, O) { 202814184Sgabeblack@google.com d_sendDataWithToken; 202914184Sgabeblack@google.com m_popRequestQueue; 203014184Sgabeblack@google.com } 203114184Sgabeblack@google.com 203214184Sgabeblack@google.com transition(M, Transient_GETS, O) { 203314184Sgabeblack@google.com d_sendDataWithNTokenIfAvail; 203414184Sgabeblack@google.com m_popRequestQueue; 203514184Sgabeblack@google.com } 203614184Sgabeblack@google.com 203714184Sgabeblack@google.com transition(M_W, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_Local_GETS}) { // Ignore the request 203814184Sgabeblack@google.com m_popRequestQueue; 203914184Sgabeblack@google.com } 204014184Sgabeblack@google.com 204114184Sgabeblack@google.com transition(M, Persistent_GETX, I_L) { 204214184Sgabeblack@google.com ee_sendDataWithAllTokens; 204314184Sgabeblack@google.com p_informL2AboutTokenLoss; 204414184Sgabeblack@google.com forward_eviction_to_cpu 204514184Sgabeblack@google.com l_popPersistentQueue; 204614184Sgabeblack@google.com } 204714184Sgabeblack@google.com 204814184Sgabeblack@google.com transition(M, Persistent_GETS, S_L) { 204914184Sgabeblack@google.com ff_sendDataWithAllButNorOneTokens; 205014184Sgabeblack@google.com l_popPersistentQueue; 205114184Sgabeblack@google.com } 205214184Sgabeblack@google.com 205314184Sgabeblack@google.com // ignore persistent requests in lockout period 205414184Sgabeblack@google.com transition(M_W, {Persistent_GETX, Persistent_GETS}) { 205514184Sgabeblack@google.com l_popPersistentQueue; 205614184Sgabeblack@google.com } 205714184Sgabeblack@google.com 205814184Sgabeblack@google.com transition(M_W, Use_TimeoutStarverS, S_L) { 205914184Sgabeblack@google.com s_deallocateTBE; 206014184Sgabeblack@google.com ff_sendDataWithAllButNorOneTokens; 206114184Sgabeblack@google.com jj_unsetUseTimer; 206214184Sgabeblack@google.com } 206314184Sgabeblack@google.com 206414184Sgabeblack@google.com // someone unlocked during timeout 206514184Sgabeblack@google.com transition(M_W, {Use_TimeoutNoStarvers, Use_TimeoutNoStarvers_NoMig}, M) { 206614184Sgabeblack@google.com s_deallocateTBE; 206714184Sgabeblack@google.com jj_unsetUseTimer; 206814184Sgabeblack@google.com kd_wakeUpDependents; 206914184Sgabeblack@google.com } 207014184Sgabeblack@google.com 207114184Sgabeblack@google.com transition(M_W, Use_TimeoutStarverX, I_L) { 207214184Sgabeblack@google.com s_deallocateTBE; 207314184Sgabeblack@google.com ee_sendDataWithAllTokens; 207414184Sgabeblack@google.com forward_eviction_to_cpu; 207514184Sgabeblack@google.com p_informL2AboutTokenLoss; 207614184Sgabeblack@google.com jj_unsetUseTimer; 207714184Sgabeblack@google.com } 207814184Sgabeblack@google.com 207914184Sgabeblack@google.com // migratory 208014184Sgabeblack@google.com transition(MM_W, {Use_TimeoutStarverX, Use_TimeoutStarverS}, I_L) { 208114184Sgabeblack@google.com s_deallocateTBE; 208214184Sgabeblack@google.com ee_sendDataWithAllTokens; 208314184Sgabeblack@google.com forward_eviction_to_cpu; 208414184Sgabeblack@google.com p_informL2AboutTokenLoss; 208514184Sgabeblack@google.com jj_unsetUseTimer; 208614184Sgabeblack@google.com 208714184Sgabeblack@google.com } 208814184Sgabeblack@google.com 208914184Sgabeblack@google.com // Transient_GETX and Transient_GETS in transient states 209014184Sgabeblack@google.com transition(OM, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token, Transient_Local_GETS}) { 209114184Sgabeblack@google.com m_popRequestQueue; // Even if we have the data, we can pretend we don't have it yet. 209214184Sgabeblack@google.com } 209314184Sgabeblack@google.com 209414184Sgabeblack@google.com transition(IS, {Transient_GETX, Transient_Local_GETX}) { 209514184Sgabeblack@google.com t_sendAckWithCollectedTokens; 209614184Sgabeblack@google.com m_popRequestQueue; 209714184Sgabeblack@google.com } 209814184Sgabeblack@google.com 209914184Sgabeblack@google.com transition(IS, {Transient_GETS, Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token, Transient_Local_GETS}) { 210014184Sgabeblack@google.com m_popRequestQueue; 210114184Sgabeblack@google.com } 210214184Sgabeblack@google.com 210314184Sgabeblack@google.com transition(IS, {Persistent_GETX, Persistent_GETS, Persistent_GETS_Last_Token}, IS_L) { 210414184Sgabeblack@google.com e_sendAckWithCollectedTokens; 210514184Sgabeblack@google.com l_popPersistentQueue; 210614184Sgabeblack@google.com } 210714184Sgabeblack@google.com 210814184Sgabeblack@google.com transition(IS_L, {Persistent_GETX, Persistent_GETS}) { 210914184Sgabeblack@google.com l_popPersistentQueue; 211014184Sgabeblack@google.com } 211114184Sgabeblack@google.com 211214184Sgabeblack@google.com transition(IM, {Persistent_GETX, Persistent_GETS, Persistent_GETS_Last_Token}, IM_L) { 211314184Sgabeblack@google.com e_sendAckWithCollectedTokens; 211414184Sgabeblack@google.com l_popPersistentQueue; 211514184Sgabeblack@google.com } 211614184Sgabeblack@google.com 211714184Sgabeblack@google.com transition(IM_L, {Persistent_GETX, Persistent_GETS}) { 211814184Sgabeblack@google.com l_popPersistentQueue; 211914184Sgabeblack@google.com } 212014184Sgabeblack@google.com 212114184Sgabeblack@google.com transition({SM, SM_L}, Persistent_GETX, IM_L) { 212214184Sgabeblack@google.com e_sendAckWithCollectedTokens; 212314184Sgabeblack@google.com forward_eviction_to_cpu 212414184Sgabeblack@google.com l_popPersistentQueue; 212514184Sgabeblack@google.com } 212614184Sgabeblack@google.com 212714184Sgabeblack@google.com transition(SM, {Persistent_GETS, Persistent_GETS_Last_Token}, SM_L) { 212814184Sgabeblack@google.com f_sendAckWithAllButNorOneTokens; 212914184Sgabeblack@google.com l_popPersistentQueue; 213014184Sgabeblack@google.com } 213114184Sgabeblack@google.com 213214184Sgabeblack@google.com transition(SM_L, {Persistent_GETS, Persistent_GETS_Last_Token}) { 213314184Sgabeblack@google.com l_popPersistentQueue; 213414184Sgabeblack@google.com } 213514184Sgabeblack@google.com 213614184Sgabeblack@google.com transition(OM, Persistent_GETX, IM_L) { 213714184Sgabeblack@google.com ee_sendDataWithAllTokens; 213814184Sgabeblack@google.com forward_eviction_to_cpu 213914184Sgabeblack@google.com l_popPersistentQueue; 214014184Sgabeblack@google.com } 214114184Sgabeblack@google.com 214214184Sgabeblack@google.com transition(OM, Persistent_GETS, SM_L) { 214314184Sgabeblack@google.com ff_sendDataWithAllButNorOneTokens; 214414184Sgabeblack@google.com l_popPersistentQueue; 214514184Sgabeblack@google.com } 214614184Sgabeblack@google.com 214714184Sgabeblack@google.com transition(OM, Persistent_GETS_Last_Token, IM_L) { 214814184Sgabeblack@google.com fo_sendDataWithOwnerToken; 214914184Sgabeblack@google.com l_popPersistentQueue; 215014184Sgabeblack@google.com } 215114184Sgabeblack@google.com 215214184Sgabeblack@google.com // Transitions from IM/SM 215314184Sgabeblack@google.com 215414184Sgabeblack@google.com transition({IM, SM}, Ack) { 215514184Sgabeblack@google.com q_updateTokensFromResponse; 215614184Sgabeblack@google.com n_popResponseQueue; 215714184Sgabeblack@google.com } 215814184Sgabeblack@google.com 215914184Sgabeblack@google.com transition(IM, Data_Shared, SM) { 216014184Sgabeblack@google.com u_writeDataToCache; 216114184Sgabeblack@google.com q_updateTokensFromResponse; 216214184Sgabeblack@google.com n_popResponseQueue; 216314184Sgabeblack@google.com } 216414184Sgabeblack@google.com 216514184Sgabeblack@google.com transition(IM, Data_Owner, OM) { 216614184Sgabeblack@google.com u_writeDataToCache; 216714184Sgabeblack@google.com q_updateTokensFromResponse; 216814184Sgabeblack@google.com n_popResponseQueue; 216914184Sgabeblack@google.com } 217014184Sgabeblack@google.com 217114184Sgabeblack@google.com transition(IM, Data_All_Tokens, MM_W) { 217214184Sgabeblack@google.com u_writeDataToCache; 217314184Sgabeblack@google.com q_updateTokensFromResponse; 217414184Sgabeblack@google.com xx_external_store_hit; 217514184Sgabeblack@google.com o_scheduleUseTimeout; 217614184Sgabeblack@google.com j_unsetReissueTimer; 217714184Sgabeblack@google.com n_popResponseQueue; 217814184Sgabeblack@google.com kd_wakeUpDependents; 217914184Sgabeblack@google.com } 218014184Sgabeblack@google.com 218114184Sgabeblack@google.com transition(SM, Data_Shared) { 218214184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 218314184Sgabeblack@google.com q_updateTokensFromResponse; 218414184Sgabeblack@google.com n_popResponseQueue; 218514184Sgabeblack@google.com } 218614184Sgabeblack@google.com 218714184Sgabeblack@google.com transition(SM, Data_Owner, OM) { 218814184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 218914184Sgabeblack@google.com q_updateTokensFromResponse; 219014184Sgabeblack@google.com n_popResponseQueue; 219114184Sgabeblack@google.com } 219214184Sgabeblack@google.com 219314184Sgabeblack@google.com transition(SM, Data_All_Tokens, MM_W) { 219414184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 219514184Sgabeblack@google.com q_updateTokensFromResponse; 219614184Sgabeblack@google.com xx_external_store_hit; 219714184Sgabeblack@google.com o_scheduleUseTimeout; 219814184Sgabeblack@google.com j_unsetReissueTimer; 219914184Sgabeblack@google.com n_popResponseQueue; 220014184Sgabeblack@google.com kd_wakeUpDependents; 220114184Sgabeblack@google.com } 220214184Sgabeblack@google.com 220314184Sgabeblack@google.com transition({IM, SM}, {Transient_GETX, Transient_Local_GETX}, IM) { // We don't have the data yet, but we might have collected some tokens. We give them up here to avoid livelock 220414184Sgabeblack@google.com t_sendAckWithCollectedTokens; 220514184Sgabeblack@google.com forward_eviction_to_cpu; 220614184Sgabeblack@google.com m_popRequestQueue; 220714184Sgabeblack@google.com } 220814184Sgabeblack@google.com 220914184Sgabeblack@google.com transition({IM, SM}, {Transient_GETS, Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token, Transient_Local_GETS}) { 221014184Sgabeblack@google.com m_popRequestQueue; 221114184Sgabeblack@google.com } 221214184Sgabeblack@google.com 221314184Sgabeblack@google.com transition({IM, SM}, Request_Timeout) { 221414184Sgabeblack@google.com j_unsetReissueTimer; 221514184Sgabeblack@google.com b_issueWriteRequest; 221614184Sgabeblack@google.com } 221714184Sgabeblack@google.com 221814184Sgabeblack@google.com // Transitions from OM 221914184Sgabeblack@google.com 222014184Sgabeblack@google.com transition(OM, Ack) { 222114184Sgabeblack@google.com q_updateTokensFromResponse; 222214184Sgabeblack@google.com n_popResponseQueue; 222314184Sgabeblack@google.com } 222414184Sgabeblack@google.com 222514184Sgabeblack@google.com transition(OM, Ack_All_Tokens, MM_W) { 222614184Sgabeblack@google.com q_updateTokensFromResponse; 222714184Sgabeblack@google.com xx_external_store_hit; 222814184Sgabeblack@google.com o_scheduleUseTimeout; 222914184Sgabeblack@google.com j_unsetReissueTimer; 223014184Sgabeblack@google.com n_popResponseQueue; 223114184Sgabeblack@google.com kd_wakeUpDependents; 223214184Sgabeblack@google.com } 223314184Sgabeblack@google.com 223414184Sgabeblack@google.com transition(OM, Data_Shared) { 223514184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 223614184Sgabeblack@google.com q_updateTokensFromResponse; 223714184Sgabeblack@google.com n_popResponseQueue; 223814184Sgabeblack@google.com } 223914184Sgabeblack@google.com 224014184Sgabeblack@google.com transition(OM, Data_All_Tokens, MM_W) { 224114184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 224214184Sgabeblack@google.com q_updateTokensFromResponse; 224314184Sgabeblack@google.com xx_external_store_hit; 224414184Sgabeblack@google.com o_scheduleUseTimeout; 224514184Sgabeblack@google.com j_unsetReissueTimer; 224614184Sgabeblack@google.com n_popResponseQueue; 224714184Sgabeblack@google.com kd_wakeUpDependents; 224814184Sgabeblack@google.com } 224914184Sgabeblack@google.com 225014184Sgabeblack@google.com transition(OM, Request_Timeout) { 225114184Sgabeblack@google.com j_unsetReissueTimer; 225214184Sgabeblack@google.com b_issueWriteRequest; 225314184Sgabeblack@google.com } 225414184Sgabeblack@google.com 225514184Sgabeblack@google.com // Transitions from IS 225614184Sgabeblack@google.com 225714184Sgabeblack@google.com transition(IS, Ack) { 225814184Sgabeblack@google.com q_updateTokensFromResponse; 225914184Sgabeblack@google.com n_popResponseQueue; 226014184Sgabeblack@google.com } 226114184Sgabeblack@google.com 226214184Sgabeblack@google.com transition(IS, Data_Shared, S) { 226314184Sgabeblack@google.com u_writeDataToCache; 226414184Sgabeblack@google.com q_updateTokensFromResponse; 226514184Sgabeblack@google.com x_external_load_hit; 226614184Sgabeblack@google.com s_deallocateTBE; 226714184Sgabeblack@google.com j_unsetReissueTimer; 226814184Sgabeblack@google.com n_popResponseQueue; 226914184Sgabeblack@google.com kd_wakeUpDependents; 227014184Sgabeblack@google.com } 227114184Sgabeblack@google.com 227214184Sgabeblack@google.com transition(IS, Data_Owner, O) { 227314184Sgabeblack@google.com u_writeDataToCache; 227414184Sgabeblack@google.com q_updateTokensFromResponse; 227514184Sgabeblack@google.com x_external_load_hit; 227614184Sgabeblack@google.com s_deallocateTBE; 227714184Sgabeblack@google.com j_unsetReissueTimer; 227814184Sgabeblack@google.com n_popResponseQueue; 227914184Sgabeblack@google.com kd_wakeUpDependents; 228014184Sgabeblack@google.com } 228114184Sgabeblack@google.com 228214184Sgabeblack@google.com transition(IS, Data_All_Tokens, M_W) { 228314184Sgabeblack@google.com u_writeDataToCache; 228414184Sgabeblack@google.com q_updateTokensFromResponse; 228514184Sgabeblack@google.com x_external_load_hit; 228614184Sgabeblack@google.com o_scheduleUseTimeout; 228714184Sgabeblack@google.com j_unsetReissueTimer; 228814184Sgabeblack@google.com n_popResponseQueue; 228914184Sgabeblack@google.com kd_wakeUpDependents; 229014184Sgabeblack@google.com } 229114184Sgabeblack@google.com 229214184Sgabeblack@google.com transition(IS, Request_Timeout) { 229314184Sgabeblack@google.com j_unsetReissueTimer; 229414184Sgabeblack@google.com a_issueReadRequest; 229514184Sgabeblack@google.com } 229614184Sgabeblack@google.com 229714184Sgabeblack@google.com // Transitions from I_L 229814184Sgabeblack@google.com 229914184Sgabeblack@google.com transition(I_L, Load, IS_L) { 230014184Sgabeblack@google.com ii_allocateL1DCacheBlock; 230114184Sgabeblack@google.com i_allocateTBE; 230214184Sgabeblack@google.com a_issueReadRequest; 230314184Sgabeblack@google.com uu_profileDataMiss; 230414184Sgabeblack@google.com k_popMandatoryQueue; 230514184Sgabeblack@google.com } 230614184Sgabeblack@google.com 230714184Sgabeblack@google.com transition(I_L, Ifetch, IS_L) { 230814184Sgabeblack@google.com pp_allocateL1ICacheBlock; 230914184Sgabeblack@google.com i_allocateTBE; 231014184Sgabeblack@google.com a_issueReadRequest; 231114184Sgabeblack@google.com uu_profileInstMiss; 231214184Sgabeblack@google.com k_popMandatoryQueue; 231314184Sgabeblack@google.com } 231414184Sgabeblack@google.com 231514184Sgabeblack@google.com transition(I_L, {Store, Atomic}, IM_L) { 231614184Sgabeblack@google.com ii_allocateL1DCacheBlock; 231714184Sgabeblack@google.com i_allocateTBE; 231814184Sgabeblack@google.com b_issueWriteRequest; 231914184Sgabeblack@google.com uu_profileDataMiss; 232014184Sgabeblack@google.com k_popMandatoryQueue; 232114184Sgabeblack@google.com } 232214184Sgabeblack@google.com 232314184Sgabeblack@google.com 232414184Sgabeblack@google.com // Transitions from S_L 232514184Sgabeblack@google.com 232614184Sgabeblack@google.com transition(S_L, {Store, Atomic}, SM_L) { 232714184Sgabeblack@google.com i_allocateTBE; 232814184Sgabeblack@google.com b_issueWriteRequest; 232914184Sgabeblack@google.com uu_profileDataMiss; 233014184Sgabeblack@google.com k_popMandatoryQueue; 233114184Sgabeblack@google.com } 233214184Sgabeblack@google.com 233314184Sgabeblack@google.com // Other transitions from *_L states 233414184Sgabeblack@google.com 233514184Sgabeblack@google.com transition({I_L, IM_L, IS_L, S_L, SM_L}, {Transient_GETS, Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token, Transient_Local_GETS, Transient_GETX, Transient_Local_GETX}) { 233614184Sgabeblack@google.com m_popRequestQueue; 233714184Sgabeblack@google.com } 233814184Sgabeblack@google.com 233914184Sgabeblack@google.com transition({I_L, IM_L, IS_L, S_L, SM_L}, Ack) { 234014184Sgabeblack@google.com g_bounceResponseToStarver; 234114184Sgabeblack@google.com n_popResponseQueue; 234214184Sgabeblack@google.com } 234314184Sgabeblack@google.com 234414184Sgabeblack@google.com transition({I_L, IM_L, S_L, SM_L}, {Data_Shared, Data_Owner}) { 234514184Sgabeblack@google.com g_bounceResponseToStarver; 234614184Sgabeblack@google.com n_popResponseQueue; 234714184Sgabeblack@google.com } 234814184Sgabeblack@google.com 234914184Sgabeblack@google.com transition({I_L, S_L}, Data_All_Tokens) { 235014184Sgabeblack@google.com g_bounceResponseToStarver; 235114184Sgabeblack@google.com n_popResponseQueue; 235214184Sgabeblack@google.com } 235314184Sgabeblack@google.com 235414184Sgabeblack@google.com transition(IS_L, Request_Timeout) { 235514184Sgabeblack@google.com j_unsetReissueTimer; 235614184Sgabeblack@google.com a_issueReadRequest; 235714184Sgabeblack@google.com } 235814184Sgabeblack@google.com 235914184Sgabeblack@google.com transition({IM_L, SM_L}, Request_Timeout) { 236014184Sgabeblack@google.com j_unsetReissueTimer; 236114184Sgabeblack@google.com b_issueWriteRequest; 236214184Sgabeblack@google.com } 236314184Sgabeblack@google.com 236414184Sgabeblack@google.com // Opportunisticly Complete the memory operation in the following 236514184Sgabeblack@google.com // cases. Note: these transitions could just use 236614184Sgabeblack@google.com // g_bounceResponseToStarver, but if we have the data and tokens, we 236714184Sgabeblack@google.com // might as well complete the memory request while we have the 236814184Sgabeblack@google.com // chance (and then immediately forward on the data) 236914184Sgabeblack@google.com 237014184Sgabeblack@google.com transition(IM_L, Data_All_Tokens, MM_W) { 237114184Sgabeblack@google.com u_writeDataToCache; 237214184Sgabeblack@google.com q_updateTokensFromResponse; 237314184Sgabeblack@google.com xx_external_store_hit; 237414184Sgabeblack@google.com j_unsetReissueTimer; 237514184Sgabeblack@google.com o_scheduleUseTimeout; 237614184Sgabeblack@google.com n_popResponseQueue; 237714184Sgabeblack@google.com kd_wakeUpDependents; 237814184Sgabeblack@google.com } 237914184Sgabeblack@google.com 238014184Sgabeblack@google.com transition(SM_L, Data_All_Tokens, S_L) { 238114184Sgabeblack@google.com u_writeDataToCache; 238214184Sgabeblack@google.com q_updateTokensFromResponse; 238314184Sgabeblack@google.com xx_external_store_hit; 238414184Sgabeblack@google.com ff_sendDataWithAllButNorOneTokens; 238514184Sgabeblack@google.com s_deallocateTBE; 238614184Sgabeblack@google.com j_unsetReissueTimer; 238714184Sgabeblack@google.com n_popResponseQueue; 238814184Sgabeblack@google.com } 238914184Sgabeblack@google.com 239014184Sgabeblack@google.com transition(IS_L, Data_Shared, I_L) { 239114184Sgabeblack@google.com u_writeDataToCache; 239214184Sgabeblack@google.com q_updateTokensFromResponse; 239314184Sgabeblack@google.com x_external_load_hit; 239414184Sgabeblack@google.com s_deallocateTBE; 239514184Sgabeblack@google.com e_sendAckWithCollectedTokens; 239614184Sgabeblack@google.com p_informL2AboutTokenLoss; 239714184Sgabeblack@google.com j_unsetReissueTimer; 239814184Sgabeblack@google.com n_popResponseQueue; 239914184Sgabeblack@google.com } 240014184Sgabeblack@google.com 240114184Sgabeblack@google.com transition(IS_L, Data_Owner, I_L) { 240214184Sgabeblack@google.com u_writeDataToCache; 240314184Sgabeblack@google.com q_updateTokensFromResponse; 240414184Sgabeblack@google.com x_external_load_hit; 240514184Sgabeblack@google.com ee_sendDataWithAllTokens; 240614184Sgabeblack@google.com s_deallocateTBE; 240714184Sgabeblack@google.com p_informL2AboutTokenLoss; 240814184Sgabeblack@google.com j_unsetReissueTimer; 240914184Sgabeblack@google.com n_popResponseQueue; 241014184Sgabeblack@google.com } 241114184Sgabeblack@google.com 241214184Sgabeblack@google.com transition(IS_L, Data_All_Tokens, M_W) { 241314184Sgabeblack@google.com u_writeDataToCache; 241414184Sgabeblack@google.com q_updateTokensFromResponse; 241514184Sgabeblack@google.com x_external_load_hit; 241614184Sgabeblack@google.com j_unsetReissueTimer; 241714184Sgabeblack@google.com o_scheduleUseTimeout; 241814184Sgabeblack@google.com n_popResponseQueue; 241914184Sgabeblack@google.com kd_wakeUpDependents; 242014184Sgabeblack@google.com } 242114184Sgabeblack@google.com 242214184Sgabeblack@google.com // Own_Lock_or_Unlock 242314184Sgabeblack@google.com 242414184Sgabeblack@google.com transition(I_L, Own_Lock_or_Unlock, I) { 242514184Sgabeblack@google.com l_popPersistentQueue; 242614184Sgabeblack@google.com kd_wakeUpDependents; 242714184Sgabeblack@google.com } 242814184Sgabeblack@google.com 242914184Sgabeblack@google.com transition(S_L, Own_Lock_or_Unlock, S) { 243014184Sgabeblack@google.com l_popPersistentQueue; 243114184Sgabeblack@google.com kd_wakeUpDependents; 243214184Sgabeblack@google.com } 243314184Sgabeblack@google.com 243414184Sgabeblack@google.com transition(IM_L, Own_Lock_or_Unlock, IM) { 243514184Sgabeblack@google.com l_popPersistentQueue; 243614184Sgabeblack@google.com kd_wakeUpDependents; 243714184Sgabeblack@google.com } 243814184Sgabeblack@google.com 243914184Sgabeblack@google.com transition(IS_L, Own_Lock_or_Unlock, IS) { 244014184Sgabeblack@google.com l_popPersistentQueue; 244114184Sgabeblack@google.com kd_wakeUpDependents; 244214184Sgabeblack@google.com } 244314184Sgabeblack@google.com 244414184Sgabeblack@google.com transition(SM_L, Own_Lock_or_Unlock, SM) { 244514184Sgabeblack@google.com l_popPersistentQueue; 244614184Sgabeblack@google.com kd_wakeUpDependents; 244714184Sgabeblack@google.com } 244814184Sgabeblack@google.com} 2449