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, 69914300Sjqu32@wisc.edu Addr victim := L1Icache.cacheProbe(in_msg.LineAddress); 70014300Sjqu32@wisc.edu trigger(Event:L1_Replacement, 70114300Sjqu32@wisc.edu victim, getL1ICacheEntry(victim), L1_TBEs[victim]); 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 72914300Sjqu32@wisc.edu Addr victim := L1Dcache.cacheProbe(in_msg.LineAddress); 73014184Sgabeblack@google.com trigger(Event:L1_Replacement, 73114300Sjqu32@wisc.edu victim, getL1DCacheEntry(victim), L1_TBEs[victim]); 73214184Sgabeblack@google.com } 73314184Sgabeblack@google.com } 73414184Sgabeblack@google.com } 73514184Sgabeblack@google.com } 73614184Sgabeblack@google.com } 73714184Sgabeblack@google.com } 73814184Sgabeblack@google.com 73914184Sgabeblack@google.com // ACTIONS 74014184Sgabeblack@google.com 74114184Sgabeblack@google.com action(a_issueReadRequest, "a", desc="Issue GETS") { 74214184Sgabeblack@google.com assert(is_valid(tbe)); 74314184Sgabeblack@google.com if (tbe.IssueCount == 0) { 74414184Sgabeblack@google.com // Update outstanding requests 74514184Sgabeblack@google.com //profile_outstanding_request(outstandingRequests); 74614184Sgabeblack@google.com outstandingRequests := outstandingRequests + 1; 74714184Sgabeblack@google.com } 74814184Sgabeblack@google.com 74914184Sgabeblack@google.com if (tbe.IssueCount >= retry_threshold) { 75014184Sgabeblack@google.com // Issue a persistent request if possible 75114184Sgabeblack@google.com if (okToIssueStarving(address, machineID) && (starving == false)) { 75214184Sgabeblack@google.com enqueue(persistentNetwork_out, PersistentMsg, l1_request_latency) { 75314184Sgabeblack@google.com out_msg.addr := address; 75414184Sgabeblack@google.com out_msg.Type := PersistentRequestType:GETS_PERSISTENT; 75514184Sgabeblack@google.com out_msg.Requestor := machineID; 75614184Sgabeblack@google.com out_msg.Destination.broadcast(MachineType:L1Cache); 75714184Sgabeblack@google.com 75814184Sgabeblack@google.com // 75914184Sgabeblack@google.com // Currently the configuration system limits the system to only one 76014184Sgabeblack@google.com // chip. Therefore, if we assume one shared L2 cache, then only one 76114184Sgabeblack@google.com // pertinent L2 cache exist. 76214184Sgabeblack@google.com // 76314184Sgabeblack@google.com //out_msg.Destination.addNetDest(getAllPertinentL2Banks(address)); 76414184Sgabeblack@google.com 76514184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 76614184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 76714184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 76814184Sgabeblack@google.com 76914184Sgabeblack@google.com out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory)); 77014184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Persistent_Control; 77114184Sgabeblack@google.com out_msg.Prefetch := tbe.Prefetch; 77214184Sgabeblack@google.com out_msg.AccessMode := tbe.AccessMode; 77314184Sgabeblack@google.com } 77414184Sgabeblack@google.com markPersistentEntries(address); 77514184Sgabeblack@google.com starving := true; 77614184Sgabeblack@google.com 77714184Sgabeblack@google.com if (tbe.IssueCount == 0) { 77814184Sgabeblack@google.com //profile_persistent_prediction(address, tbe.TypeOfAccess); 77914184Sgabeblack@google.com } 78014184Sgabeblack@google.com 78114184Sgabeblack@google.com // Update outstanding requests 78214184Sgabeblack@google.com //profile_outstanding_persistent_request(outstandingPersistentRequests); 78314184Sgabeblack@google.com outstandingPersistentRequests := outstandingPersistentRequests + 1; 78414184Sgabeblack@google.com 78514184Sgabeblack@google.com // Increment IssueCount 78614184Sgabeblack@google.com tbe.IssueCount := tbe.IssueCount + 1; 78714184Sgabeblack@google.com 78814184Sgabeblack@google.com tbe.WentPersistent := true; 78914184Sgabeblack@google.com 79014184Sgabeblack@google.com // Do not schedule a wakeup, a persistent requests will always complete 79114184Sgabeblack@google.com } 79214184Sgabeblack@google.com else { 79314184Sgabeblack@google.com 79414184Sgabeblack@google.com // We'd like to issue a persistent request, but are not allowed 79514184Sgabeblack@google.com // to issue a P.R. right now. This, we do not increment the 79614184Sgabeblack@google.com // IssueCount. 79714184Sgabeblack@google.com 79814184Sgabeblack@google.com // Set a wakeup timer 79914184Sgabeblack@google.com reissueTimerTable.set( 80014184Sgabeblack@google.com address, clockEdge() + cyclesToTicks(reissue_wakeup_latency)); 80114184Sgabeblack@google.com 80214184Sgabeblack@google.com } 80314184Sgabeblack@google.com } else { 80414184Sgabeblack@google.com // Make a normal request 80514184Sgabeblack@google.com enqueue(requestNetwork_out, RequestMsg, l1_request_latency) { 80614184Sgabeblack@google.com out_msg.addr := address; 80714184Sgabeblack@google.com out_msg.Type := CoherenceRequestType:GETS; 80814184Sgabeblack@google.com out_msg.Requestor := machineID; 80914184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 81014184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 81114184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 81214184Sgabeblack@google.com 81314184Sgabeblack@google.com out_msg.RetryNum := tbe.IssueCount; 81414184Sgabeblack@google.com if (tbe.IssueCount == 0) { 81514184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Request_Control; 81614184Sgabeblack@google.com } else { 81714184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Reissue_Control; 81814184Sgabeblack@google.com } 81914184Sgabeblack@google.com out_msg.Prefetch := tbe.Prefetch; 82014184Sgabeblack@google.com out_msg.AccessMode := tbe.AccessMode; 82114184Sgabeblack@google.com } 82214184Sgabeblack@google.com 82314184Sgabeblack@google.com // send to other local L1s, with local bit set 82414184Sgabeblack@google.com enqueue(requestNetwork_out, RequestMsg, l1_request_latency) { 82514184Sgabeblack@google.com out_msg.addr := address; 82614184Sgabeblack@google.com out_msg.Type := CoherenceRequestType:GETS; 82714184Sgabeblack@google.com out_msg.Requestor := machineID; 82814184Sgabeblack@google.com // 82914184Sgabeblack@google.com // Since only one chip, assuming all L1 caches are local 83014184Sgabeblack@google.com // 83114184Sgabeblack@google.com //out_msg.Destination := getOtherLocalL1IDs(machineID); 83214184Sgabeblack@google.com out_msg.Destination.broadcast(MachineType:L1Cache); 83314184Sgabeblack@google.com out_msg.Destination.remove(machineID); 83414184Sgabeblack@google.com 83514184Sgabeblack@google.com out_msg.RetryNum := tbe.IssueCount; 83614184Sgabeblack@google.com out_msg.isLocal := true; 83714184Sgabeblack@google.com if (tbe.IssueCount == 0) { 83814184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Broadcast_Control; 83914184Sgabeblack@google.com } else { 84014184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Broadcast_Control; 84114184Sgabeblack@google.com } 84214184Sgabeblack@google.com out_msg.Prefetch := tbe.Prefetch; 84314184Sgabeblack@google.com out_msg.AccessMode := tbe.AccessMode; 84414184Sgabeblack@google.com } 84514184Sgabeblack@google.com 84614184Sgabeblack@google.com // Increment IssueCount 84714184Sgabeblack@google.com tbe.IssueCount := tbe.IssueCount + 1; 84814184Sgabeblack@google.com 84914184Sgabeblack@google.com // Set a wakeup timer 85014184Sgabeblack@google.com 85114184Sgabeblack@google.com if (dynamic_timeout_enabled) { 85214184Sgabeblack@google.com reissueTimerTable.set( 85314184Sgabeblack@google.com address, clockEdge() + cyclesToTicks(averageLatencyEstimate())); 85414184Sgabeblack@google.com } else { 85514184Sgabeblack@google.com reissueTimerTable.set( 85614184Sgabeblack@google.com address, clockEdge() + cyclesToTicks(fixed_timeout_latency)); 85714184Sgabeblack@google.com } 85814184Sgabeblack@google.com 85914184Sgabeblack@google.com } 86014184Sgabeblack@google.com } 86114184Sgabeblack@google.com 86214184Sgabeblack@google.com action(b_issueWriteRequest, "b", desc="Issue GETX") { 86314184Sgabeblack@google.com 86414184Sgabeblack@google.com assert(is_valid(tbe)); 86514184Sgabeblack@google.com if (tbe.IssueCount == 0) { 86614184Sgabeblack@google.com // Update outstanding requests 86714184Sgabeblack@google.com //profile_outstanding_request(outstandingRequests); 86814184Sgabeblack@google.com outstandingRequests := outstandingRequests + 1; 86914184Sgabeblack@google.com } 87014184Sgabeblack@google.com 87114184Sgabeblack@google.com if (tbe.IssueCount >= retry_threshold) { 87214184Sgabeblack@google.com // Issue a persistent request if possible 87314184Sgabeblack@google.com if ( okToIssueStarving(address, machineID) && (starving == false)) { 87414184Sgabeblack@google.com enqueue(persistentNetwork_out, PersistentMsg, l1_request_latency) { 87514184Sgabeblack@google.com out_msg.addr := address; 87614184Sgabeblack@google.com out_msg.Type := PersistentRequestType:GETX_PERSISTENT; 87714184Sgabeblack@google.com out_msg.Requestor := machineID; 87814184Sgabeblack@google.com out_msg.Destination.broadcast(MachineType:L1Cache); 87914184Sgabeblack@google.com 88014184Sgabeblack@google.com // 88114184Sgabeblack@google.com // Currently the configuration system limits the system to only one 88214184Sgabeblack@google.com // chip. Therefore, if we assume one shared L2 cache, then only one 88314184Sgabeblack@google.com // pertinent L2 cache exist. 88414184Sgabeblack@google.com // 88514184Sgabeblack@google.com //out_msg.Destination.addNetDest(getAllPertinentL2Banks(address)); 88614184Sgabeblack@google.com 88714184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 88814184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 88914184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 89014184Sgabeblack@google.com 89114184Sgabeblack@google.com out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory)); 89214184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Persistent_Control; 89314184Sgabeblack@google.com out_msg.Prefetch := tbe.Prefetch; 89414184Sgabeblack@google.com out_msg.AccessMode := tbe.AccessMode; 89514184Sgabeblack@google.com } 89614184Sgabeblack@google.com markPersistentEntries(address); 89714184Sgabeblack@google.com starving := true; 89814184Sgabeblack@google.com 89914184Sgabeblack@google.com // Update outstanding requests 90014184Sgabeblack@google.com //profile_outstanding_persistent_request(outstandingPersistentRequests); 90114184Sgabeblack@google.com outstandingPersistentRequests := outstandingPersistentRequests + 1; 90214184Sgabeblack@google.com 90314184Sgabeblack@google.com if (tbe.IssueCount == 0) { 90414184Sgabeblack@google.com //profile_persistent_prediction(address, tbe.TypeOfAccess); 90514184Sgabeblack@google.com } 90614184Sgabeblack@google.com 90714184Sgabeblack@google.com // Increment IssueCount 90814184Sgabeblack@google.com tbe.IssueCount := tbe.IssueCount + 1; 90914184Sgabeblack@google.com 91014184Sgabeblack@google.com tbe.WentPersistent := true; 91114184Sgabeblack@google.com 91214184Sgabeblack@google.com // Do not schedule a wakeup, a persistent requests will always complete 91314184Sgabeblack@google.com } 91414184Sgabeblack@google.com else { 91514184Sgabeblack@google.com 91614184Sgabeblack@google.com // We'd like to issue a persistent request, but are not allowed 91714184Sgabeblack@google.com // to issue a P.R. right now. This, we do not increment the 91814184Sgabeblack@google.com // IssueCount. 91914184Sgabeblack@google.com 92014184Sgabeblack@google.com // Set a wakeup timer 92114184Sgabeblack@google.com reissueTimerTable.set( 92214184Sgabeblack@google.com address, clockEdge() + cyclesToTicks(reissue_wakeup_latency)); 92314184Sgabeblack@google.com } 92414184Sgabeblack@google.com 92514184Sgabeblack@google.com } else { 92614184Sgabeblack@google.com // Make a normal request 92714184Sgabeblack@google.com enqueue(requestNetwork_out, RequestMsg, l1_request_latency) { 92814184Sgabeblack@google.com out_msg.addr := address; 92914184Sgabeblack@google.com out_msg.Type := CoherenceRequestType:GETX; 93014184Sgabeblack@google.com out_msg.Requestor := machineID; 93114184Sgabeblack@google.com 93214184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 93314184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 93414184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 93514184Sgabeblack@google.com 93614184Sgabeblack@google.com out_msg.RetryNum := tbe.IssueCount; 93714184Sgabeblack@google.com 93814184Sgabeblack@google.com if (tbe.IssueCount == 0) { 93914184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Request_Control; 94014184Sgabeblack@google.com } else { 94114184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Reissue_Control; 94214184Sgabeblack@google.com } 94314184Sgabeblack@google.com out_msg.Prefetch := tbe.Prefetch; 94414184Sgabeblack@google.com out_msg.AccessMode := tbe.AccessMode; 94514184Sgabeblack@google.com } 94614184Sgabeblack@google.com 94714184Sgabeblack@google.com // send to other local L1s too 94814184Sgabeblack@google.com enqueue(requestNetwork_out, RequestMsg, l1_request_latency) { 94914184Sgabeblack@google.com out_msg.addr := address; 95014184Sgabeblack@google.com out_msg.Type := CoherenceRequestType:GETX; 95114184Sgabeblack@google.com out_msg.Requestor := machineID; 95214184Sgabeblack@google.com out_msg.isLocal := true; 95314184Sgabeblack@google.com 95414184Sgabeblack@google.com // 95514184Sgabeblack@google.com // Since only one chip, assuming all L1 caches are local 95614184Sgabeblack@google.com // 95714184Sgabeblack@google.com //out_msg.Destination := getOtherLocalL1IDs(machineID); 95814184Sgabeblack@google.com out_msg.Destination.broadcast(MachineType:L1Cache); 95914184Sgabeblack@google.com out_msg.Destination.remove(machineID); 96014184Sgabeblack@google.com 96114184Sgabeblack@google.com out_msg.RetryNum := tbe.IssueCount; 96214184Sgabeblack@google.com if (tbe.IssueCount == 0) { 96314184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Broadcast_Control; 96414184Sgabeblack@google.com } else { 96514184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Broadcast_Control; 96614184Sgabeblack@google.com } 96714184Sgabeblack@google.com out_msg.Prefetch := tbe.Prefetch; 96814184Sgabeblack@google.com out_msg.AccessMode := tbe.AccessMode; 96914184Sgabeblack@google.com } 97014184Sgabeblack@google.com 97114184Sgabeblack@google.com // Increment IssueCount 97214184Sgabeblack@google.com tbe.IssueCount := tbe.IssueCount + 1; 97314184Sgabeblack@google.com 97414184Sgabeblack@google.com DPRINTF(RubySlicc, "incremented issue count to %d\n", 97514184Sgabeblack@google.com tbe.IssueCount); 97614184Sgabeblack@google.com 97714184Sgabeblack@google.com // Set a wakeup timer 97814184Sgabeblack@google.com if (dynamic_timeout_enabled) { 97914184Sgabeblack@google.com reissueTimerTable.set( 98014184Sgabeblack@google.com address, clockEdge() + cyclesToTicks(averageLatencyEstimate())); 98114184Sgabeblack@google.com } else { 98214184Sgabeblack@google.com reissueTimerTable.set( 98314184Sgabeblack@google.com address, clockEdge() + cyclesToTicks(fixed_timeout_latency)); 98414184Sgabeblack@google.com } 98514184Sgabeblack@google.com } 98614184Sgabeblack@google.com } 98714184Sgabeblack@google.com 98814184Sgabeblack@google.com action(bb_bounceResponse, "\b", desc="Bounce tokens and data to memory") { 98914184Sgabeblack@google.com peek(responseNetwork_in, ResponseMsg) { 99014184Sgabeblack@google.com // FIXME, should use a 3rd vnet 99114184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, 1) { 99214184Sgabeblack@google.com out_msg.addr := address; 99314184Sgabeblack@google.com out_msg.Type := in_msg.Type; 99414184Sgabeblack@google.com out_msg.Sender := machineID; 99514184Sgabeblack@google.com out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory)); 99614184Sgabeblack@google.com out_msg.Tokens := in_msg.Tokens; 99714184Sgabeblack@google.com out_msg.MessageSize := in_msg.MessageSize; 99814184Sgabeblack@google.com out_msg.DataBlk := in_msg.DataBlk; 99914184Sgabeblack@google.com out_msg.Dirty := in_msg.Dirty; 100014184Sgabeblack@google.com } 100114184Sgabeblack@google.com } 100214184Sgabeblack@google.com } 100314184Sgabeblack@google.com 100414184Sgabeblack@google.com action(c_ownedReplacement, "c", desc="Issue writeback") { 100514184Sgabeblack@google.com assert(is_valid(cache_entry)); 100614184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 100714184Sgabeblack@google.com out_msg.addr := address; 100814184Sgabeblack@google.com out_msg.Sender := machineID; 100914184Sgabeblack@google.com 101014184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 101114184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 101214184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 101314184Sgabeblack@google.com 101414184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 101514184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 101614184Sgabeblack@google.com out_msg.Dirty := cache_entry.Dirty; 101714184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:WB_OWNED; 101814184Sgabeblack@google.com 101914184Sgabeblack@google.com // always send the data? 102014184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Writeback_Data; 102114184Sgabeblack@google.com } 102214184Sgabeblack@google.com cache_entry.Tokens := 0; 102314184Sgabeblack@google.com } 102414184Sgabeblack@google.com 102514184Sgabeblack@google.com action(cc_sharedReplacement, "\c", desc="Issue shared writeback") { 102614184Sgabeblack@google.com 102714184Sgabeblack@google.com // don't send writeback if replacing block with no tokens 102814184Sgabeblack@google.com assert(is_valid(cache_entry)); 102914184Sgabeblack@google.com assert (cache_entry.Tokens > 0); 103014184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 103114184Sgabeblack@google.com out_msg.addr := address; 103214184Sgabeblack@google.com out_msg.Sender := machineID; 103314184Sgabeblack@google.com 103414184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 103514184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 103614184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 103714184Sgabeblack@google.com 103814184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 103914184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 104014184Sgabeblack@google.com // assert(cache_entry.Dirty == false); 104114184Sgabeblack@google.com out_msg.Dirty := false; 104214184Sgabeblack@google.com 104314184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Writeback_Data; 104414184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:WB_SHARED_DATA; 104514184Sgabeblack@google.com } 104614184Sgabeblack@google.com cache_entry.Tokens := 0; 104714184Sgabeblack@google.com } 104814184Sgabeblack@google.com 104914184Sgabeblack@google.com action(tr_tokenReplacement, "tr", desc="Issue token writeback") { 105014184Sgabeblack@google.com assert(is_valid(cache_entry)); 105114184Sgabeblack@google.com if (cache_entry.Tokens > 0) { 105214184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 105314184Sgabeblack@google.com out_msg.addr := address; 105414184Sgabeblack@google.com out_msg.Sender := machineID; 105514184Sgabeblack@google.com 105614184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 105714184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 105814184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 105914184Sgabeblack@google.com 106014184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 106114184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 106214184Sgabeblack@google.com // assert(cache_entry.Dirty == false); 106314184Sgabeblack@google.com out_msg.Dirty := false; 106414184Sgabeblack@google.com 106514184Sgabeblack@google.com // always send the data? 106614184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Writeback_Control; 106714184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:WB_TOKENS; 106814184Sgabeblack@google.com } 106914184Sgabeblack@google.com } 107014184Sgabeblack@google.com cache_entry.Tokens := 0; 107114184Sgabeblack@google.com } 107214184Sgabeblack@google.com 107314184Sgabeblack@google.com 107414184Sgabeblack@google.com action(d_sendDataWithToken, "d", desc="Send data and a token from cache to requestor") { 107514184Sgabeblack@google.com assert(is_valid(cache_entry)); 107614184Sgabeblack@google.com peek(requestNetwork_in, RequestMsg) { 107714184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 107814184Sgabeblack@google.com out_msg.addr := address; 107914184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_SHARED; 108014184Sgabeblack@google.com out_msg.Sender := machineID; 108114184Sgabeblack@google.com out_msg.Destination.add(in_msg.Requestor); 108214184Sgabeblack@google.com out_msg.Tokens := 1; 108314184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 108414184Sgabeblack@google.com // out_msg.Dirty := cache_entry.Dirty; 108514184Sgabeblack@google.com out_msg.Dirty := false; 108614184Sgabeblack@google.com if (in_msg.isLocal) { 108714184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:ResponseLocal_Data; 108814184Sgabeblack@google.com } else { 108914184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 109014184Sgabeblack@google.com } 109114184Sgabeblack@google.com } 109214184Sgabeblack@google.com } 109314184Sgabeblack@google.com cache_entry.Tokens := cache_entry.Tokens - 1; 109414184Sgabeblack@google.com assert(cache_entry.Tokens >= 1); 109514184Sgabeblack@google.com } 109614184Sgabeblack@google.com 109714184Sgabeblack@google.com action(d_sendDataWithNTokenIfAvail, "\dd", desc="Send data and a token from cache to requestor") { 109814184Sgabeblack@google.com assert(is_valid(cache_entry)); 109914184Sgabeblack@google.com peek(requestNetwork_in, RequestMsg) { 110014184Sgabeblack@google.com if (cache_entry.Tokens > (N_tokens + (max_tokens() / 2))) { 110114184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 110214184Sgabeblack@google.com out_msg.addr := address; 110314184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_SHARED; 110414184Sgabeblack@google.com out_msg.Sender := machineID; 110514184Sgabeblack@google.com out_msg.Destination.add(in_msg.Requestor); 110614184Sgabeblack@google.com out_msg.Tokens := N_tokens; 110714184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 110814184Sgabeblack@google.com // out_msg.Dirty := cache_entry.Dirty; 110914184Sgabeblack@google.com out_msg.Dirty := false; 111014184Sgabeblack@google.com if (in_msg.isLocal) { 111114184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:ResponseLocal_Data; 111214184Sgabeblack@google.com } else { 111314184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 111414184Sgabeblack@google.com } 111514184Sgabeblack@google.com } 111614184Sgabeblack@google.com cache_entry.Tokens := cache_entry.Tokens - N_tokens; 111714184Sgabeblack@google.com } 111814184Sgabeblack@google.com else if (cache_entry.Tokens > 1) { 111914184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 112014184Sgabeblack@google.com out_msg.addr := address; 112114184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_SHARED; 112214184Sgabeblack@google.com out_msg.Sender := machineID; 112314184Sgabeblack@google.com out_msg.Destination.add(in_msg.Requestor); 112414184Sgabeblack@google.com out_msg.Tokens := 1; 112514184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 112614184Sgabeblack@google.com // out_msg.Dirty := cache_entry.Dirty; 112714184Sgabeblack@google.com out_msg.Dirty := false; 112814184Sgabeblack@google.com if (in_msg.isLocal) { 112914184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:ResponseLocal_Data; 113014184Sgabeblack@google.com } else { 113114184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 113214184Sgabeblack@google.com } 113314184Sgabeblack@google.com } 113414184Sgabeblack@google.com cache_entry.Tokens := cache_entry.Tokens - 1; 113514184Sgabeblack@google.com } 113614184Sgabeblack@google.com } 113714184Sgabeblack@google.com// assert(cache_entry.Tokens >= 1); 113814184Sgabeblack@google.com } 113914184Sgabeblack@google.com 114014184Sgabeblack@google.com action(dd_sendDataWithAllTokens, "\d", desc="Send data and all tokens from cache to requestor") { 114114184Sgabeblack@google.com peek(requestNetwork_in, RequestMsg) { 114214184Sgabeblack@google.com assert(is_valid(cache_entry)); 114314184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 114414184Sgabeblack@google.com out_msg.addr := address; 114514184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_OWNER; 114614184Sgabeblack@google.com out_msg.Sender := machineID; 114714184Sgabeblack@google.com out_msg.Destination.add(in_msg.Requestor); 114814184Sgabeblack@google.com assert(cache_entry.Tokens > (max_tokens() / 2)); 114914184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 115014184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 115114184Sgabeblack@google.com out_msg.Dirty := cache_entry.Dirty; 115214184Sgabeblack@google.com if (in_msg.isLocal) { 115314184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:ResponseLocal_Data; 115414184Sgabeblack@google.com } else { 115514184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 115614184Sgabeblack@google.com } 115714184Sgabeblack@google.com } 115814184Sgabeblack@google.com } 115914184Sgabeblack@google.com cache_entry.Tokens := 0; 116014184Sgabeblack@google.com } 116114184Sgabeblack@google.com 116214184Sgabeblack@google.com action(e_sendAckWithCollectedTokens, "e", desc="Send ack with the tokens we've collected thus far.") { 116314184Sgabeblack@google.com // assert(persistentTable.findSmallest(address) != id); // Make sure we never bounce tokens to ourself 116414184Sgabeblack@google.com assert(is_valid(cache_entry)); 116514184Sgabeblack@google.com if (cache_entry.Tokens > 0) { 116614184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 116714184Sgabeblack@google.com out_msg.addr := address; 116814184Sgabeblack@google.com if (cache_entry.Tokens > (max_tokens() / 2)) { 116914184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_OWNER; 117014184Sgabeblack@google.com } else { 117114184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:ACK; 117214184Sgabeblack@google.com } 117314184Sgabeblack@google.com out_msg.Sender := machineID; 117414184Sgabeblack@google.com out_msg.Destination.add(persistentTable.findSmallest(address)); 117514184Sgabeblack@google.com assert(cache_entry.Tokens >= 1); 117614184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 117714184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 117814184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Control; 117914184Sgabeblack@google.com } 118014184Sgabeblack@google.com } 118114184Sgabeblack@google.com cache_entry.Tokens := 0; 118214184Sgabeblack@google.com } 118314184Sgabeblack@google.com 118414184Sgabeblack@google.com action(ee_sendDataWithAllTokens, "\e", desc="Send data and all tokens from cache to starver") { 118514184Sgabeblack@google.com //assert(persistentTable.findSmallest(address) != id); // Make sure we never bounce tokens to ourself 118614184Sgabeblack@google.com assert(is_valid(cache_entry)); 118714184Sgabeblack@google.com assert(cache_entry.Tokens > 0); 118814184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 118914184Sgabeblack@google.com out_msg.addr := address; 119014184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_OWNER; 119114184Sgabeblack@google.com out_msg.Sender := machineID; 119214184Sgabeblack@google.com out_msg.Destination.add(persistentTable.findSmallest(address)); 119314184Sgabeblack@google.com assert(cache_entry.Tokens > (max_tokens() / 2)); 119414184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 119514184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 119614184Sgabeblack@google.com out_msg.Dirty := cache_entry.Dirty; 119714184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 119814184Sgabeblack@google.com } 119914184Sgabeblack@google.com cache_entry.Tokens := 0; 120014184Sgabeblack@google.com } 120114184Sgabeblack@google.com 120214184Sgabeblack@google.com action(f_sendAckWithAllButNorOneTokens, "f", desc="Send ack with all our tokens but one to starver.") { 120314184Sgabeblack@google.com //assert(persistentTable.findSmallest(address) != id); // Make sure we never bounce tokens to ourself 120414184Sgabeblack@google.com assert(is_valid(cache_entry)); 120514184Sgabeblack@google.com assert(cache_entry.Tokens > 0); 120614184Sgabeblack@google.com if (cache_entry.Tokens > 1) { 120714184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 120814184Sgabeblack@google.com out_msg.addr := address; 120914184Sgabeblack@google.com if (cache_entry.Tokens > (max_tokens() / 2)) { 121014184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_OWNER; 121114184Sgabeblack@google.com } else { 121214184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:ACK; 121314184Sgabeblack@google.com } 121414184Sgabeblack@google.com out_msg.Sender := machineID; 121514184Sgabeblack@google.com out_msg.Destination.add(persistentTable.findSmallest(address)); 121614184Sgabeblack@google.com assert(cache_entry.Tokens >= 1); 121714184Sgabeblack@google.com if (cache_entry.Tokens > N_tokens) { 121814184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens - N_tokens; 121914184Sgabeblack@google.com } else { 122014184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens - 1; 122114184Sgabeblack@google.com } 122214184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 122314184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Control; 122414184Sgabeblack@google.com } 122514184Sgabeblack@google.com } 122614184Sgabeblack@google.com if (cache_entry.Tokens > N_tokens) { 122714184Sgabeblack@google.com cache_entry.Tokens := N_tokens; 122814184Sgabeblack@google.com } else { 122914184Sgabeblack@google.com cache_entry.Tokens := 1; 123014184Sgabeblack@google.com } 123114184Sgabeblack@google.com } 123214184Sgabeblack@google.com 123314184Sgabeblack@google.com action(ff_sendDataWithAllButNorOneTokens, "\f", desc="Send data and out tokens but one to starver") { 123414184Sgabeblack@google.com //assert(persistentTable.findSmallest(address) != id); // Make sure we never bounce tokens to ourself 123514184Sgabeblack@google.com assert(is_valid(cache_entry)); 123614184Sgabeblack@google.com assert(cache_entry.Tokens > ((max_tokens() / 2) + 1)); 123714184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 123814184Sgabeblack@google.com out_msg.addr := address; 123914184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_OWNER; 124014184Sgabeblack@google.com out_msg.Sender := machineID; 124114184Sgabeblack@google.com out_msg.Destination.add(persistentTable.findSmallest(address)); 124214184Sgabeblack@google.com if (cache_entry.Tokens > (N_tokens + (max_tokens() / 2))) { 124314184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens - N_tokens; 124414184Sgabeblack@google.com } else { 124514184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens - 1; 124614184Sgabeblack@google.com } 124714184Sgabeblack@google.com assert(out_msg.Tokens > (max_tokens() / 2)); 124814184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 124914184Sgabeblack@google.com out_msg.Dirty := cache_entry.Dirty; 125014184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 125114184Sgabeblack@google.com } 125214184Sgabeblack@google.com if (cache_entry.Tokens > (N_tokens + (max_tokens() / 2))) { 125314184Sgabeblack@google.com cache_entry.Tokens := N_tokens; 125414184Sgabeblack@google.com } else { 125514184Sgabeblack@google.com cache_entry.Tokens := 1; 125614184Sgabeblack@google.com } 125714184Sgabeblack@google.com } 125814184Sgabeblack@google.com 125914184Sgabeblack@google.com action(fo_sendDataWithOwnerToken, "fo", desc="Send data and owner tokens") { 126014184Sgabeblack@google.com assert(is_valid(cache_entry)); 126114184Sgabeblack@google.com assert(cache_entry.Tokens == ((max_tokens() / 2) + 1)); 126214184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 126314184Sgabeblack@google.com out_msg.addr := address; 126414184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_OWNER; 126514184Sgabeblack@google.com out_msg.Sender := machineID; 126614184Sgabeblack@google.com out_msg.Destination.add(persistentTable.findSmallest(address)); 126714184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 126814184Sgabeblack@google.com assert(out_msg.Tokens > (max_tokens() / 2)); 126914184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 127014184Sgabeblack@google.com out_msg.Dirty := cache_entry.Dirty; 127114184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 127214184Sgabeblack@google.com } 127314184Sgabeblack@google.com cache_entry.Tokens := 0; 127414184Sgabeblack@google.com } 127514184Sgabeblack@google.com 127614184Sgabeblack@google.com action(g_bounceResponseToStarver, "g", desc="Redirect response to starving processor") { 127714184Sgabeblack@google.com // assert(persistentTable.isLocked(address)); 127814184Sgabeblack@google.com 127914184Sgabeblack@google.com peek(responseNetwork_in, ResponseMsg) { 128014184Sgabeblack@google.com // assert(persistentTable.findSmallest(address) != id); // Make sure we never bounce tokens to ourself 128114184Sgabeblack@google.com // FIXME, should use a 3rd vnet in some cases 128214184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, 1) { 128314184Sgabeblack@google.com out_msg.addr := address; 128414184Sgabeblack@google.com out_msg.Type := in_msg.Type; 128514184Sgabeblack@google.com out_msg.Sender := machineID; 128614184Sgabeblack@google.com out_msg.Destination.add(persistentTable.findSmallest(address)); 128714184Sgabeblack@google.com out_msg.Tokens := in_msg.Tokens; 128814184Sgabeblack@google.com out_msg.DataBlk := in_msg.DataBlk; 128914184Sgabeblack@google.com out_msg.Dirty := in_msg.Dirty; 129014184Sgabeblack@google.com out_msg.MessageSize := in_msg.MessageSize; 129114184Sgabeblack@google.com } 129214184Sgabeblack@google.com } 129314184Sgabeblack@google.com } 129414184Sgabeblack@google.com 129514184Sgabeblack@google.com action(h_load_hit, "hd", desc="Notify sequencer the load completed.") { 129614184Sgabeblack@google.com assert(is_valid(cache_entry)); 129714184Sgabeblack@google.com DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n", 129814184Sgabeblack@google.com address, cache_entry.DataBlk); 129914184Sgabeblack@google.com 130014184Sgabeblack@google.com L1Dcache.setMRU(cache_entry); 130114184Sgabeblack@google.com sequencer.readCallback(address, cache_entry.DataBlk, false, 130214184Sgabeblack@google.com MachineType:L1Cache); 130314184Sgabeblack@google.com } 130414184Sgabeblack@google.com 130514184Sgabeblack@google.com action(h_ifetch_hit, "hi", desc="Notify sequencer the load completed.") { 130614184Sgabeblack@google.com assert(is_valid(cache_entry)); 130714184Sgabeblack@google.com DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n", 130814184Sgabeblack@google.com address, cache_entry.DataBlk); 130914184Sgabeblack@google.com 131014184Sgabeblack@google.com L1Icache.setMRU(cache_entry); 131114184Sgabeblack@google.com sequencer.readCallback(address, cache_entry.DataBlk, false, 131214184Sgabeblack@google.com MachineType:L1Cache); 131314184Sgabeblack@google.com } 131414184Sgabeblack@google.com 131514184Sgabeblack@google.com action(x_external_load_hit, "x", desc="Notify sequencer the load completed.") { 131614184Sgabeblack@google.com assert(is_valid(cache_entry)); 131714184Sgabeblack@google.com DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n", 131814184Sgabeblack@google.com address, cache_entry.DataBlk); 131914184Sgabeblack@google.com peek(responseNetwork_in, ResponseMsg) { 132014184Sgabeblack@google.com L1Icache.setMRU(address); 132114184Sgabeblack@google.com L1Dcache.setMRU(address); 132214184Sgabeblack@google.com sequencer.readCallback(address, cache_entry.DataBlk, 132314184Sgabeblack@google.com isExternalHit(address, in_msg.Sender), 132414184Sgabeblack@google.com machineIDToMachineType(in_msg.Sender)); 132514184Sgabeblack@google.com } 132614184Sgabeblack@google.com } 132714184Sgabeblack@google.com 132814184Sgabeblack@google.com action(hh_store_hit, "\h", desc="Notify sequencer that store completed.") { 132914184Sgabeblack@google.com assert(is_valid(cache_entry)); 133014184Sgabeblack@google.com DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n", 133114184Sgabeblack@google.com address, cache_entry.DataBlk); 133214184Sgabeblack@google.com 133314184Sgabeblack@google.com L1Dcache.setMRU(cache_entry); 133414184Sgabeblack@google.com sequencer.writeCallback(address, cache_entry.DataBlk, false, 133514184Sgabeblack@google.com MachineType:L1Cache); 133614184Sgabeblack@google.com cache_entry.Dirty := true; 133714184Sgabeblack@google.com DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk); 133814184Sgabeblack@google.com } 133914184Sgabeblack@google.com 134014184Sgabeblack@google.com action(xx_external_store_hit, "\x", desc="Notify sequencer that store completed.") { 134114184Sgabeblack@google.com assert(is_valid(cache_entry)); 134214184Sgabeblack@google.com DPRINTF(RubySlicc, "Address: %#x, Data Block: %s\n", 134314184Sgabeblack@google.com address, cache_entry.DataBlk); 134414184Sgabeblack@google.com peek(responseNetwork_in, ResponseMsg) { 134514184Sgabeblack@google.com L1Icache.setMRU(address); 134614184Sgabeblack@google.com L1Dcache.setMRU(address); 134714184Sgabeblack@google.com sequencer.writeCallback(address, cache_entry.DataBlk, 134814184Sgabeblack@google.com isExternalHit(address, in_msg.Sender), 134914184Sgabeblack@google.com machineIDToMachineType(in_msg.Sender)); 135014184Sgabeblack@google.com } 135114184Sgabeblack@google.com cache_entry.Dirty := true; 135214184Sgabeblack@google.com DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk); 135314184Sgabeblack@google.com } 135414184Sgabeblack@google.com 135514184Sgabeblack@google.com action(i_allocateTBE, "i", desc="Allocate TBE") { 135614184Sgabeblack@google.com check_allocate(L1_TBEs); 135714184Sgabeblack@google.com L1_TBEs.allocate(address); 135814184Sgabeblack@google.com set_tbe(L1_TBEs[address]); 135914184Sgabeblack@google.com tbe.IssueCount := 0; 136014184Sgabeblack@google.com peek(mandatoryQueue_in, RubyRequest) { 136114184Sgabeblack@google.com tbe.PC := in_msg.ProgramCounter; 136214184Sgabeblack@google.com tbe.TypeOfAccess := cache_request_type_to_access_type(in_msg.Type); 136314184Sgabeblack@google.com if (in_msg.Type == RubyRequestType:ATOMIC) { 136414184Sgabeblack@google.com tbe.IsAtomic := true; 136514184Sgabeblack@google.com } 136614184Sgabeblack@google.com tbe.Prefetch := in_msg.Prefetch; 136714184Sgabeblack@google.com tbe.AccessMode := in_msg.AccessMode; 136814184Sgabeblack@google.com } 136914184Sgabeblack@google.com tbe.IssueTime := curCycle(); 137014184Sgabeblack@google.com } 137114184Sgabeblack@google.com 137214184Sgabeblack@google.com action(ta_traceStalledAddress, "ta", desc="Trace Stalled Address") { 137314184Sgabeblack@google.com peek(mandatoryQueue_in, RubyRequest) { 137414184Sgabeblack@google.com APPEND_TRANSITION_COMMENT(in_msg.LineAddress); 137514184Sgabeblack@google.com } 137614184Sgabeblack@google.com } 137714184Sgabeblack@google.com 137814184Sgabeblack@google.com action(j_unsetReissueTimer, "j", desc="Unset reissue timer.") { 137914184Sgabeblack@google.com if (reissueTimerTable.isSet(address)) { 138014184Sgabeblack@google.com reissueTimerTable.unset(address); 138114184Sgabeblack@google.com } 138214184Sgabeblack@google.com } 138314184Sgabeblack@google.com 138414184Sgabeblack@google.com action(jj_unsetUseTimer, "\j", desc="Unset use timer.") { 138514184Sgabeblack@google.com useTimerTable.unset(address); 138614184Sgabeblack@google.com } 138714184Sgabeblack@google.com 138814184Sgabeblack@google.com action(k_popMandatoryQueue, "k", desc="Pop mandatory queue.") { 138914184Sgabeblack@google.com mandatoryQueue_in.dequeue(clockEdge()); 139014184Sgabeblack@google.com } 139114184Sgabeblack@google.com 139214184Sgabeblack@google.com action(l_popPersistentQueue, "l", desc="Pop persistent queue.") { 139314184Sgabeblack@google.com persistentNetwork_in.dequeue(clockEdge()); 139414184Sgabeblack@google.com } 139514184Sgabeblack@google.com 139614184Sgabeblack@google.com action(m_popRequestQueue, "m", desc="Pop request queue.") { 139714184Sgabeblack@google.com requestNetwork_in.dequeue(clockEdge()); 139814184Sgabeblack@google.com } 139914184Sgabeblack@google.com 140014184Sgabeblack@google.com action(n_popResponseQueue, "n", desc="Pop response queue") { 140114184Sgabeblack@google.com responseNetwork_in.dequeue(clockEdge()); 140214184Sgabeblack@google.com } 140314184Sgabeblack@google.com 140414184Sgabeblack@google.com action(o_scheduleUseTimeout, "o", desc="Schedule a use timeout.") { 140514184Sgabeblack@google.com useTimerTable.set( 140614184Sgabeblack@google.com address, clockEdge() + cyclesToTicks(use_timeout_latency)); 140714184Sgabeblack@google.com } 140814184Sgabeblack@google.com 140914184Sgabeblack@google.com action(p_informL2AboutTokenLoss, "p", desc="Inform L2 about loss of all tokens") { 141014184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 141114184Sgabeblack@google.com out_msg.addr := address; 141214184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:INV; 141314184Sgabeblack@google.com out_msg.Tokens := 0; 141414184Sgabeblack@google.com out_msg.Sender := machineID; 141514184Sgabeblack@google.com 141614184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 141714184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 141814184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 141914184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Control; 142014184Sgabeblack@google.com } 142114184Sgabeblack@google.com } 142214184Sgabeblack@google.com 142314184Sgabeblack@google.com action(q_updateTokensFromResponse, "q", desc="Update the token count based on the incoming response message") { 142414184Sgabeblack@google.com peek(responseNetwork_in, ResponseMsg) { 142514184Sgabeblack@google.com assert(is_valid(cache_entry)); 142614184Sgabeblack@google.com assert(in_msg.Tokens != 0); 142714184Sgabeblack@google.com DPRINTF(RubySlicc, "L1 received tokens for address: %#x, tokens: %d\n", 142814184Sgabeblack@google.com in_msg.addr, in_msg.Tokens); 142914184Sgabeblack@google.com cache_entry.Tokens := cache_entry.Tokens + in_msg.Tokens; 143014184Sgabeblack@google.com DPRINTF(RubySlicc, "%d\n", cache_entry.Tokens); 143114184Sgabeblack@google.com 143214184Sgabeblack@google.com if (cache_entry.Dirty == false && in_msg.Dirty) { 143314184Sgabeblack@google.com cache_entry.Dirty := true; 143414184Sgabeblack@google.com } 143514184Sgabeblack@google.com } 143614184Sgabeblack@google.com } 143714184Sgabeblack@google.com 143814184Sgabeblack@google.com action(s_deallocateTBE, "s", desc="Deallocate TBE") { 143914184Sgabeblack@google.com 144014184Sgabeblack@google.com assert(is_valid(tbe)); 144114184Sgabeblack@google.com if (tbe.WentPersistent) { 144214184Sgabeblack@google.com // assert(starving); 144314184Sgabeblack@google.com outstandingRequests := outstandingRequests - 1; 144414184Sgabeblack@google.com enqueue(persistentNetwork_out, PersistentMsg, l1_request_latency) { 144514184Sgabeblack@google.com out_msg.addr := address; 144614184Sgabeblack@google.com out_msg.Type := PersistentRequestType:DEACTIVATE_PERSISTENT; 144714184Sgabeblack@google.com out_msg.Requestor := machineID; 144814184Sgabeblack@google.com out_msg.Destination.broadcast(MachineType:L1Cache); 144914184Sgabeblack@google.com 145014184Sgabeblack@google.com // 145114184Sgabeblack@google.com // Currently the configuration system limits the system to only one 145214184Sgabeblack@google.com // chip. Therefore, if we assume one shared L2 cache, then only one 145314184Sgabeblack@google.com // pertinent L2 cache exist. 145414184Sgabeblack@google.com // 145514184Sgabeblack@google.com //out_msg.Destination.addNetDest(getAllPertinentL2Banks(address)); 145614184Sgabeblack@google.com 145714184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address, 145814184Sgabeblack@google.com MachineType:L2Cache, l2_select_low_bit, 145914184Sgabeblack@google.com l2_select_num_bits, intToID(0))); 146014184Sgabeblack@google.com 146114184Sgabeblack@google.com out_msg.Destination.add(mapAddressToMachine(address, MachineType:Directory)); 146214184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Persistent_Control; 146314184Sgabeblack@google.com } 146414184Sgabeblack@google.com starving := false; 146514184Sgabeblack@google.com } 146614184Sgabeblack@google.com 146714184Sgabeblack@google.com // Update average latency 146814184Sgabeblack@google.com if (tbe.IssueCount <= 1) { 146914184Sgabeblack@google.com if (tbe.ExternalResponse) { 147014184Sgabeblack@google.com updateAverageLatencyEstimate(curCycle() - tbe.IssueTime); 147114184Sgabeblack@google.com } 147214184Sgabeblack@google.com } 147314184Sgabeblack@google.com 147414184Sgabeblack@google.com // Profile 147514184Sgabeblack@google.com //if (tbe.WentPersistent) { 147614184Sgabeblack@google.com // profile_token_retry(address, tbe.TypeOfAccess, 2); 147714184Sgabeblack@google.com //} 147814184Sgabeblack@google.com //else { 147914184Sgabeblack@google.com // profile_token_retry(address, tbe.TypeOfAccess, 1); 148014184Sgabeblack@google.com //} 148114184Sgabeblack@google.com 148214184Sgabeblack@google.com //profile_token_retry(address, tbe.TypeOfAccess, tbe.IssueCount); 148314184Sgabeblack@google.com L1_TBEs.deallocate(address); 148414184Sgabeblack@google.com unset_tbe(); 148514184Sgabeblack@google.com } 148614184Sgabeblack@google.com 148714184Sgabeblack@google.com action(t_sendAckWithCollectedTokens, "t", desc="Send ack with the tokens we've collected thus far.") { 148814184Sgabeblack@google.com assert(is_valid(cache_entry)); 148914184Sgabeblack@google.com if (cache_entry.Tokens > 0) { 149014184Sgabeblack@google.com peek(requestNetwork_in, RequestMsg) { 149114184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, l1_response_latency) { 149214184Sgabeblack@google.com out_msg.addr := address; 149314184Sgabeblack@google.com if (cache_entry.Tokens > (max_tokens() / 2)) { 149414184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:DATA_OWNER; 149514184Sgabeblack@google.com } else { 149614184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:ACK; 149714184Sgabeblack@google.com } 149814184Sgabeblack@google.com out_msg.Sender := machineID; 149914184Sgabeblack@google.com out_msg.Destination.add(in_msg.Requestor); 150014184Sgabeblack@google.com assert(cache_entry.Tokens >= 1); 150114184Sgabeblack@google.com out_msg.Tokens := cache_entry.Tokens; 150214184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 150314184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Control; 150414184Sgabeblack@google.com } 150514184Sgabeblack@google.com } 150614184Sgabeblack@google.com } 150714184Sgabeblack@google.com cache_entry.Tokens := 0; 150814184Sgabeblack@google.com } 150914184Sgabeblack@google.com 151014184Sgabeblack@google.com action(u_writeDataToCache, "u", desc="Write data to cache") { 151114184Sgabeblack@google.com peek(responseNetwork_in, ResponseMsg) { 151214184Sgabeblack@google.com assert(is_valid(cache_entry)); 151314184Sgabeblack@google.com cache_entry.DataBlk := in_msg.DataBlk; 151414184Sgabeblack@google.com if (cache_entry.Dirty == false && in_msg.Dirty) { 151514184Sgabeblack@google.com cache_entry.Dirty := in_msg.Dirty; 151614184Sgabeblack@google.com } 151714184Sgabeblack@google.com 151814184Sgabeblack@google.com } 151914184Sgabeblack@google.com } 152014184Sgabeblack@google.com 152114184Sgabeblack@google.com action(gg_deallocateL1CacheBlock, "\g", desc="Deallocate cache block. Sets the cache to invalid, allowing a replacement in parallel with a fetch.") { 152214184Sgabeblack@google.com assert(getTokens(cache_entry) == 0); 152314184Sgabeblack@google.com if (L1Dcache.isTagPresent(address)) { 152414184Sgabeblack@google.com L1Dcache.deallocate(address); 152514184Sgabeblack@google.com } else { 152614184Sgabeblack@google.com L1Icache.deallocate(address); 152714184Sgabeblack@google.com } 152814184Sgabeblack@google.com unset_cache_entry(); 152914184Sgabeblack@google.com } 153014184Sgabeblack@google.com 153114184Sgabeblack@google.com action(ii_allocateL1DCacheBlock, "\i", desc="Set L1 D-cache tag equal to tag of block B.") { 153214184Sgabeblack@google.com if (is_valid(cache_entry)) { 153314184Sgabeblack@google.com } else { 153414184Sgabeblack@google.com set_cache_entry(L1Dcache.allocate(address, new Entry)); 153514184Sgabeblack@google.com } 153614184Sgabeblack@google.com } 153714184Sgabeblack@google.com 153814184Sgabeblack@google.com action(pp_allocateL1ICacheBlock, "\p", desc="Set L1 I-cache tag equal to tag of block B.") { 153914184Sgabeblack@google.com if (is_valid(cache_entry)) { 154014184Sgabeblack@google.com } else { 154114184Sgabeblack@google.com set_cache_entry(L1Icache.allocate(address, new Entry)); 154214184Sgabeblack@google.com } 154314184Sgabeblack@google.com } 154414184Sgabeblack@google.com 154514184Sgabeblack@google.com action(forward_eviction_to_cpu, "\cc", desc="sends eviction information to the processor") { 154614184Sgabeblack@google.com if (send_evictions) { 154714184Sgabeblack@google.com DPRINTF(RubySlicc, "Sending invalidation for %#x to the CPU\n", address); 154814184Sgabeblack@google.com sequencer.evictionCallback(address); 154914184Sgabeblack@google.com } 155014184Sgabeblack@google.com } 155114184Sgabeblack@google.com 155214184Sgabeblack@google.com action(uu_profileInstMiss, "\uim", desc="Profile the demand miss") { 155314184Sgabeblack@google.com ++L1Icache.demand_misses; 155414184Sgabeblack@google.com } 155514184Sgabeblack@google.com 155614184Sgabeblack@google.com action(uu_profileInstHit, "\uih", desc="Profile the demand hit") { 155714184Sgabeblack@google.com ++L1Icache.demand_hits; 155814184Sgabeblack@google.com } 155914184Sgabeblack@google.com 156014184Sgabeblack@google.com action(uu_profileDataMiss, "\udm", desc="Profile the demand miss") { 156114184Sgabeblack@google.com ++L1Dcache.demand_misses; 156214184Sgabeblack@google.com } 156314184Sgabeblack@google.com 156414184Sgabeblack@google.com action(uu_profileDataHit, "\udh", desc="Profile the demand hit") { 156514184Sgabeblack@google.com ++L1Dcache.demand_hits; 156614184Sgabeblack@google.com } 156714184Sgabeblack@google.com 156814184Sgabeblack@google.com action(w_assertIncomingDataAndCacheDataMatch, "w", desc="Assert that the incoming data and the data in the cache match") { 156914184Sgabeblack@google.com peek(responseNetwork_in, ResponseMsg) { 157014184Sgabeblack@google.com assert(is_valid(cache_entry)); 157114184Sgabeblack@google.com assert(cache_entry.DataBlk == in_msg.DataBlk); 157214184Sgabeblack@google.com } 157314184Sgabeblack@google.com } 157414184Sgabeblack@google.com 157514184Sgabeblack@google.com action(zz_stallAndWaitMandatoryQueue, "\z", desc="Send the head of the mandatory queue to the back of the queue.") { 157614184Sgabeblack@google.com peek(mandatoryQueue_in, RubyRequest) { 157714184Sgabeblack@google.com APPEND_TRANSITION_COMMENT(in_msg.LineAddress); 157814184Sgabeblack@google.com } 157914184Sgabeblack@google.com stall_and_wait(mandatoryQueue_in, address); 158014184Sgabeblack@google.com } 158114184Sgabeblack@google.com 158214184Sgabeblack@google.com action(kd_wakeUpDependents, "kd", desc="wake-up dependents") { 158314184Sgabeblack@google.com wakeUpBuffers(address); 158414184Sgabeblack@google.com } 158514184Sgabeblack@google.com 158614184Sgabeblack@google.com action(ka_wakeUpAllDependents, "ka", desc="wake-up all dependents") { 158714184Sgabeblack@google.com wakeUpAllBuffers(); 158814184Sgabeblack@google.com } 158914184Sgabeblack@google.com 159014184Sgabeblack@google.com //***************************************************** 159114184Sgabeblack@google.com // TRANSITIONS 159214184Sgabeblack@google.com //***************************************************** 159314184Sgabeblack@google.com 159414184Sgabeblack@google.com // Transitions for Load/Store/L2_Replacement from transient states 159514184Sgabeblack@google.com transition({IM, SM, OM, IS, IM_L, IS_L, I_L, S_L, SM_L, M_W, MM_W}, L1_Replacement) { 159614184Sgabeblack@google.com ta_traceStalledAddress; 159714184Sgabeblack@google.com zz_stallAndWaitMandatoryQueue; 159814184Sgabeblack@google.com } 159914184Sgabeblack@google.com 160014184Sgabeblack@google.com transition({IM, SM, OM, IS, IM_L, IS_L, SM_L}, {Store, Atomic}) { 160114184Sgabeblack@google.com zz_stallAndWaitMandatoryQueue; 160214184Sgabeblack@google.com } 160314184Sgabeblack@google.com 160414184Sgabeblack@google.com transition({IM, IS, IM_L, IS_L}, {Load, Ifetch}) { 160514184Sgabeblack@google.com zz_stallAndWaitMandatoryQueue; 160614184Sgabeblack@google.com } 160714184Sgabeblack@google.com 160814184Sgabeblack@google.com // Lockdowns 160914184Sgabeblack@google.com transition({NP, I, S, O, M, MM, M_W, MM_W, IM, SM, OM, IS}, Own_Lock_or_Unlock) { 161014184Sgabeblack@google.com l_popPersistentQueue; 161114184Sgabeblack@google.com } 161214184Sgabeblack@google.com 161314184Sgabeblack@google.com // Transitions from NP 161414184Sgabeblack@google.com transition(NP, Load, IS) { 161514184Sgabeblack@google.com ii_allocateL1DCacheBlock; 161614184Sgabeblack@google.com i_allocateTBE; 161714184Sgabeblack@google.com a_issueReadRequest; 161814184Sgabeblack@google.com uu_profileDataMiss; 161914184Sgabeblack@google.com k_popMandatoryQueue; 162014184Sgabeblack@google.com } 162114184Sgabeblack@google.com 162214184Sgabeblack@google.com transition(NP, Ifetch, IS) { 162314184Sgabeblack@google.com pp_allocateL1ICacheBlock; 162414184Sgabeblack@google.com i_allocateTBE; 162514184Sgabeblack@google.com a_issueReadRequest; 162614184Sgabeblack@google.com uu_profileInstMiss; 162714184Sgabeblack@google.com k_popMandatoryQueue; 162814184Sgabeblack@google.com } 162914184Sgabeblack@google.com 163014184Sgabeblack@google.com transition(NP, {Store, Atomic}, IM) { 163114184Sgabeblack@google.com ii_allocateL1DCacheBlock; 163214184Sgabeblack@google.com i_allocateTBE; 163314184Sgabeblack@google.com b_issueWriteRequest; 163414184Sgabeblack@google.com uu_profileDataMiss; 163514184Sgabeblack@google.com k_popMandatoryQueue; 163614184Sgabeblack@google.com } 163714184Sgabeblack@google.com 163814184Sgabeblack@google.com transition(NP, {Ack, Data_Shared, Data_Owner, Data_All_Tokens}) { 163914184Sgabeblack@google.com bb_bounceResponse; 164014184Sgabeblack@google.com n_popResponseQueue; 164114184Sgabeblack@google.com } 164214184Sgabeblack@google.com 164314184Sgabeblack@google.com transition(NP, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_Local_GETS}) { 164414184Sgabeblack@google.com m_popRequestQueue; 164514184Sgabeblack@google.com } 164614184Sgabeblack@google.com 164714184Sgabeblack@google.com transition(NP, {Persistent_GETX, Persistent_GETS, Persistent_GETS_Last_Token}, I_L) { 164814184Sgabeblack@google.com l_popPersistentQueue; 164914184Sgabeblack@google.com } 165014184Sgabeblack@google.com 165114184Sgabeblack@google.com // Transitions from Idle 165214184Sgabeblack@google.com transition(I, Load, IS) { 165314184Sgabeblack@google.com i_allocateTBE; 165414184Sgabeblack@google.com a_issueReadRequest; 165514184Sgabeblack@google.com uu_profileDataMiss; 165614184Sgabeblack@google.com k_popMandatoryQueue; 165714184Sgabeblack@google.com } 165814184Sgabeblack@google.com 165914184Sgabeblack@google.com transition(I, Ifetch, IS) { 166014184Sgabeblack@google.com i_allocateTBE; 166114184Sgabeblack@google.com a_issueReadRequest; 166214184Sgabeblack@google.com uu_profileInstMiss; 166314184Sgabeblack@google.com k_popMandatoryQueue; 166414184Sgabeblack@google.com } 166514184Sgabeblack@google.com 166614184Sgabeblack@google.com transition(I, {Store, Atomic}, IM) { 166714184Sgabeblack@google.com i_allocateTBE; 166814184Sgabeblack@google.com b_issueWriteRequest; 166914184Sgabeblack@google.com uu_profileDataMiss; 167014184Sgabeblack@google.com k_popMandatoryQueue; 167114184Sgabeblack@google.com } 167214184Sgabeblack@google.com 167314184Sgabeblack@google.com transition(I, L1_Replacement) { 167414184Sgabeblack@google.com ta_traceStalledAddress; 167514184Sgabeblack@google.com tr_tokenReplacement; 167614184Sgabeblack@google.com gg_deallocateL1CacheBlock; 167714184Sgabeblack@google.com ka_wakeUpAllDependents; 167814184Sgabeblack@google.com } 167914184Sgabeblack@google.com 168014184Sgabeblack@google.com transition(I, {Transient_GETX, Transient_Local_GETX}) { 168114184Sgabeblack@google.com t_sendAckWithCollectedTokens; 168214184Sgabeblack@google.com m_popRequestQueue; 168314184Sgabeblack@google.com } 168414184Sgabeblack@google.com 168514184Sgabeblack@google.com transition(I, {Transient_GETS, Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token, Transient_Local_GETS}) { 168614184Sgabeblack@google.com m_popRequestQueue; 168714184Sgabeblack@google.com } 168814184Sgabeblack@google.com 168914184Sgabeblack@google.com transition(I, {Persistent_GETX, Persistent_GETS, Persistent_GETS_Last_Token}, I_L) { 169014184Sgabeblack@google.com e_sendAckWithCollectedTokens; 169114184Sgabeblack@google.com l_popPersistentQueue; 169214184Sgabeblack@google.com } 169314184Sgabeblack@google.com 169414184Sgabeblack@google.com transition(I_L, {Persistent_GETX, Persistent_GETS, Persistent_GETS_Last_Token}) { 169514184Sgabeblack@google.com l_popPersistentQueue; 169614184Sgabeblack@google.com } 169714184Sgabeblack@google.com 169814184Sgabeblack@google.com transition(I, Ack) { 169914184Sgabeblack@google.com q_updateTokensFromResponse; 170014184Sgabeblack@google.com n_popResponseQueue; 170114184Sgabeblack@google.com } 170214184Sgabeblack@google.com 170314184Sgabeblack@google.com transition(I, Data_Shared, S) { 170414184Sgabeblack@google.com u_writeDataToCache; 170514184Sgabeblack@google.com q_updateTokensFromResponse; 170614184Sgabeblack@google.com n_popResponseQueue; 170714184Sgabeblack@google.com } 170814184Sgabeblack@google.com 170914184Sgabeblack@google.com transition(I, Data_Owner, O) { 171014184Sgabeblack@google.com u_writeDataToCache; 171114184Sgabeblack@google.com q_updateTokensFromResponse; 171214184Sgabeblack@google.com n_popResponseQueue; 171314184Sgabeblack@google.com } 171414184Sgabeblack@google.com 171514184Sgabeblack@google.com transition(I, Data_All_Tokens, M) { 171614184Sgabeblack@google.com u_writeDataToCache; 171714184Sgabeblack@google.com q_updateTokensFromResponse; 171814184Sgabeblack@google.com n_popResponseQueue; 171914184Sgabeblack@google.com } 172014184Sgabeblack@google.com 172114184Sgabeblack@google.com // Transitions from Shared 172214184Sgabeblack@google.com transition({S, SM, S_L, SM_L}, Load) { 172314184Sgabeblack@google.com h_load_hit; 172414184Sgabeblack@google.com uu_profileDataHit; 172514184Sgabeblack@google.com k_popMandatoryQueue; 172614184Sgabeblack@google.com } 172714184Sgabeblack@google.com 172814184Sgabeblack@google.com transition({S, SM, S_L, SM_L}, Ifetch) { 172914184Sgabeblack@google.com h_ifetch_hit; 173014184Sgabeblack@google.com uu_profileInstHit; 173114184Sgabeblack@google.com k_popMandatoryQueue; 173214184Sgabeblack@google.com } 173314184Sgabeblack@google.com 173414184Sgabeblack@google.com transition(S, {Store, Atomic}, SM) { 173514184Sgabeblack@google.com i_allocateTBE; 173614184Sgabeblack@google.com b_issueWriteRequest; 173714184Sgabeblack@google.com uu_profileDataMiss; 173814184Sgabeblack@google.com k_popMandatoryQueue; 173914184Sgabeblack@google.com } 174014184Sgabeblack@google.com 174114184Sgabeblack@google.com transition(S, L1_Replacement, I) { 174214184Sgabeblack@google.com ta_traceStalledAddress; 174314184Sgabeblack@google.com cc_sharedReplacement; // Only needed in some cases 174414184Sgabeblack@google.com forward_eviction_to_cpu; 174514184Sgabeblack@google.com gg_deallocateL1CacheBlock; 174614184Sgabeblack@google.com ka_wakeUpAllDependents; 174714184Sgabeblack@google.com } 174814184Sgabeblack@google.com 174914184Sgabeblack@google.com transition(S, {Transient_GETX, Transient_Local_GETX}, I) { 175014184Sgabeblack@google.com t_sendAckWithCollectedTokens; 175114184Sgabeblack@google.com p_informL2AboutTokenLoss; 175214184Sgabeblack@google.com forward_eviction_to_cpu 175314184Sgabeblack@google.com m_popRequestQueue; 175414184Sgabeblack@google.com } 175514184Sgabeblack@google.com 175614184Sgabeblack@google.com // only owner responds to non-local requests 175714184Sgabeblack@google.com transition(S, Transient_GETS) { 175814184Sgabeblack@google.com m_popRequestQueue; 175914184Sgabeblack@google.com } 176014184Sgabeblack@google.com 176114184Sgabeblack@google.com transition(S, Transient_Local_GETS) { 176214184Sgabeblack@google.com d_sendDataWithToken; 176314184Sgabeblack@google.com m_popRequestQueue; 176414184Sgabeblack@google.com } 176514184Sgabeblack@google.com 176614184Sgabeblack@google.com transition(S, {Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token}) { 176714184Sgabeblack@google.com m_popRequestQueue; 176814184Sgabeblack@google.com } 176914184Sgabeblack@google.com 177014184Sgabeblack@google.com transition({S, S_L}, Persistent_GETX, I_L) { 177114184Sgabeblack@google.com e_sendAckWithCollectedTokens; 177214184Sgabeblack@google.com p_informL2AboutTokenLoss; 177314184Sgabeblack@google.com forward_eviction_to_cpu 177414184Sgabeblack@google.com l_popPersistentQueue; 177514184Sgabeblack@google.com } 177614184Sgabeblack@google.com 177714184Sgabeblack@google.com transition(S, {Persistent_GETS, Persistent_GETS_Last_Token}, S_L) { 177814184Sgabeblack@google.com f_sendAckWithAllButNorOneTokens; 177914184Sgabeblack@google.com l_popPersistentQueue; 178014184Sgabeblack@google.com } 178114184Sgabeblack@google.com 178214184Sgabeblack@google.com transition(S_L, {Persistent_GETS, Persistent_GETS_Last_Token}) { 178314184Sgabeblack@google.com l_popPersistentQueue; 178414184Sgabeblack@google.com } 178514184Sgabeblack@google.com 178614184Sgabeblack@google.com transition(S, Ack) { 178714184Sgabeblack@google.com q_updateTokensFromResponse; 178814184Sgabeblack@google.com n_popResponseQueue; 178914184Sgabeblack@google.com } 179014184Sgabeblack@google.com 179114184Sgabeblack@google.com transition(S, Data_Shared) { 179214184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 179314184Sgabeblack@google.com q_updateTokensFromResponse; 179414184Sgabeblack@google.com n_popResponseQueue; 179514184Sgabeblack@google.com } 179614184Sgabeblack@google.com 179714184Sgabeblack@google.com transition(S, Data_Owner, O) { 179814184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 179914184Sgabeblack@google.com q_updateTokensFromResponse; 180014184Sgabeblack@google.com n_popResponseQueue; 180114184Sgabeblack@google.com } 180214184Sgabeblack@google.com 180314184Sgabeblack@google.com transition(S, Data_All_Tokens, M) { 180414184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 180514184Sgabeblack@google.com q_updateTokensFromResponse; 180614184Sgabeblack@google.com n_popResponseQueue; 180714184Sgabeblack@google.com } 180814184Sgabeblack@google.com 180914184Sgabeblack@google.com // Transitions from Owned 181014184Sgabeblack@google.com transition({O, OM}, Ifetch) { 181114184Sgabeblack@google.com h_ifetch_hit; 181214184Sgabeblack@google.com uu_profileInstHit; 181314184Sgabeblack@google.com k_popMandatoryQueue; 181414184Sgabeblack@google.com } 181514184Sgabeblack@google.com 181614184Sgabeblack@google.com transition({O, OM}, Load) { 181714184Sgabeblack@google.com h_load_hit; 181814184Sgabeblack@google.com uu_profileDataHit; 181914184Sgabeblack@google.com k_popMandatoryQueue; 182014184Sgabeblack@google.com } 182114184Sgabeblack@google.com 182214184Sgabeblack@google.com transition(O, {Store, Atomic}, OM) { 182314184Sgabeblack@google.com i_allocateTBE; 182414184Sgabeblack@google.com b_issueWriteRequest; 182514184Sgabeblack@google.com uu_profileDataMiss; 182614184Sgabeblack@google.com k_popMandatoryQueue; 182714184Sgabeblack@google.com } 182814184Sgabeblack@google.com 182914184Sgabeblack@google.com transition(O, L1_Replacement, I) { 183014184Sgabeblack@google.com ta_traceStalledAddress; 183114184Sgabeblack@google.com c_ownedReplacement; 183214184Sgabeblack@google.com forward_eviction_to_cpu 183314184Sgabeblack@google.com gg_deallocateL1CacheBlock; 183414184Sgabeblack@google.com ka_wakeUpAllDependents; 183514184Sgabeblack@google.com } 183614184Sgabeblack@google.com 183714184Sgabeblack@google.com transition(O, {Transient_GETX, Transient_Local_GETX}, I) { 183814184Sgabeblack@google.com dd_sendDataWithAllTokens; 183914184Sgabeblack@google.com p_informL2AboutTokenLoss; 184014184Sgabeblack@google.com forward_eviction_to_cpu 184114184Sgabeblack@google.com m_popRequestQueue; 184214184Sgabeblack@google.com } 184314184Sgabeblack@google.com 184414184Sgabeblack@google.com transition(O, Persistent_GETX, I_L) { 184514184Sgabeblack@google.com ee_sendDataWithAllTokens; 184614184Sgabeblack@google.com p_informL2AboutTokenLoss; 184714184Sgabeblack@google.com forward_eviction_to_cpu 184814184Sgabeblack@google.com l_popPersistentQueue; 184914184Sgabeblack@google.com } 185014184Sgabeblack@google.com 185114184Sgabeblack@google.com transition(O, Persistent_GETS, S_L) { 185214184Sgabeblack@google.com ff_sendDataWithAllButNorOneTokens; 185314184Sgabeblack@google.com l_popPersistentQueue; 185414184Sgabeblack@google.com } 185514184Sgabeblack@google.com 185614184Sgabeblack@google.com transition(O, Persistent_GETS_Last_Token, I_L) { 185714184Sgabeblack@google.com fo_sendDataWithOwnerToken; 185814184Sgabeblack@google.com forward_eviction_to_cpu 185914184Sgabeblack@google.com l_popPersistentQueue; 186014184Sgabeblack@google.com } 186114184Sgabeblack@google.com 186214184Sgabeblack@google.com transition(O, Transient_GETS) { 186314184Sgabeblack@google.com d_sendDataWithToken; 186414184Sgabeblack@google.com m_popRequestQueue; 186514184Sgabeblack@google.com } 186614184Sgabeblack@google.com 186714184Sgabeblack@google.com transition(O, Transient_Local_GETS) { 186814184Sgabeblack@google.com d_sendDataWithToken; 186914184Sgabeblack@google.com m_popRequestQueue; 187014184Sgabeblack@google.com } 187114184Sgabeblack@google.com 187214184Sgabeblack@google.com // ran out of tokens, wait for it to go persistent 187314184Sgabeblack@google.com transition(O, {Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token}) { 187414184Sgabeblack@google.com m_popRequestQueue; 187514184Sgabeblack@google.com } 187614184Sgabeblack@google.com 187714184Sgabeblack@google.com transition(O, Ack) { 187814184Sgabeblack@google.com q_updateTokensFromResponse; 187914184Sgabeblack@google.com n_popResponseQueue; 188014184Sgabeblack@google.com } 188114184Sgabeblack@google.com 188214184Sgabeblack@google.com transition(O, Ack_All_Tokens, M) { 188314184Sgabeblack@google.com q_updateTokensFromResponse; 188414184Sgabeblack@google.com n_popResponseQueue; 188514184Sgabeblack@google.com } 188614184Sgabeblack@google.com 188714184Sgabeblack@google.com transition(O, Data_Shared) { 188814184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 188914184Sgabeblack@google.com q_updateTokensFromResponse; 189014184Sgabeblack@google.com n_popResponseQueue; 189114184Sgabeblack@google.com } 189214184Sgabeblack@google.com 189314184Sgabeblack@google.com transition(O, Data_All_Tokens, M) { 189414184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 189514184Sgabeblack@google.com q_updateTokensFromResponse; 189614184Sgabeblack@google.com n_popResponseQueue; 189714184Sgabeblack@google.com } 189814184Sgabeblack@google.com 189914184Sgabeblack@google.com // Transitions from Modified 190014184Sgabeblack@google.com transition({MM, MM_W}, Ifetch) { 190114184Sgabeblack@google.com h_ifetch_hit; 190214184Sgabeblack@google.com uu_profileInstHit; 190314184Sgabeblack@google.com k_popMandatoryQueue; 190414184Sgabeblack@google.com } 190514184Sgabeblack@google.com 190614184Sgabeblack@google.com transition({MM, MM_W}, Load) { 190714184Sgabeblack@google.com h_load_hit; 190814184Sgabeblack@google.com uu_profileDataHit; 190914184Sgabeblack@google.com k_popMandatoryQueue; 191014184Sgabeblack@google.com } 191114184Sgabeblack@google.com 191214184Sgabeblack@google.com transition({MM_W}, {Store, Atomic}) { 191314184Sgabeblack@google.com hh_store_hit; 191414184Sgabeblack@google.com uu_profileDataHit; 191514184Sgabeblack@google.com k_popMandatoryQueue; 191614184Sgabeblack@google.com } 191714184Sgabeblack@google.com 191814184Sgabeblack@google.com transition(MM, Store) { 191914184Sgabeblack@google.com hh_store_hit; 192014184Sgabeblack@google.com uu_profileDataHit; 192114184Sgabeblack@google.com k_popMandatoryQueue; 192214184Sgabeblack@google.com } 192314184Sgabeblack@google.com 192414184Sgabeblack@google.com transition(MM, Atomic, M) { 192514184Sgabeblack@google.com hh_store_hit; 192614184Sgabeblack@google.com uu_profileDataHit; 192714184Sgabeblack@google.com k_popMandatoryQueue; 192814184Sgabeblack@google.com } 192914184Sgabeblack@google.com 193014184Sgabeblack@google.com transition(MM, L1_Replacement, I) { 193114184Sgabeblack@google.com ta_traceStalledAddress; 193214184Sgabeblack@google.com c_ownedReplacement; 193314184Sgabeblack@google.com forward_eviction_to_cpu 193414184Sgabeblack@google.com gg_deallocateL1CacheBlock; 193514184Sgabeblack@google.com ka_wakeUpAllDependents; 193614184Sgabeblack@google.com } 193714184Sgabeblack@google.com 193814184Sgabeblack@google.com transition(MM, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_Local_GETS}, I) { 193914184Sgabeblack@google.com dd_sendDataWithAllTokens; 194014184Sgabeblack@google.com p_informL2AboutTokenLoss; 194114184Sgabeblack@google.com forward_eviction_to_cpu 194214184Sgabeblack@google.com m_popRequestQueue; 194314184Sgabeblack@google.com } 194414184Sgabeblack@google.com 194514184Sgabeblack@google.com transition({MM_W}, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_Local_GETS}) { // Ignore the request 194614184Sgabeblack@google.com m_popRequestQueue; 194714184Sgabeblack@google.com } 194814184Sgabeblack@google.com 194914184Sgabeblack@google.com // Implement the migratory sharing optimization, even for persistent requests 195014184Sgabeblack@google.com transition(MM, {Persistent_GETX, Persistent_GETS}, I_L) { 195114184Sgabeblack@google.com ee_sendDataWithAllTokens; 195214184Sgabeblack@google.com p_informL2AboutTokenLoss; 195314184Sgabeblack@google.com forward_eviction_to_cpu 195414184Sgabeblack@google.com l_popPersistentQueue; 195514184Sgabeblack@google.com } 195614184Sgabeblack@google.com 195714184Sgabeblack@google.com // ignore persistent requests in lockout period 195814184Sgabeblack@google.com transition(MM_W, {Persistent_GETX, Persistent_GETS}) { 195914184Sgabeblack@google.com l_popPersistentQueue; 196014184Sgabeblack@google.com } 196114184Sgabeblack@google.com 196214184Sgabeblack@google.com transition(MM_W, Use_TimeoutNoStarvers, MM) { 196314184Sgabeblack@google.com s_deallocateTBE; 196414184Sgabeblack@google.com jj_unsetUseTimer; 196514184Sgabeblack@google.com kd_wakeUpDependents; 196614184Sgabeblack@google.com } 196714184Sgabeblack@google.com 196814184Sgabeblack@google.com transition(MM_W, Use_TimeoutNoStarvers_NoMig, M) { 196914184Sgabeblack@google.com s_deallocateTBE; 197014184Sgabeblack@google.com jj_unsetUseTimer; 197114184Sgabeblack@google.com kd_wakeUpDependents; 197214184Sgabeblack@google.com } 197314184Sgabeblack@google.com 197414184Sgabeblack@google.com // Transitions from Dirty Exclusive 197514184Sgabeblack@google.com transition({M, M_W}, Ifetch) { 197614184Sgabeblack@google.com h_ifetch_hit; 197714184Sgabeblack@google.com uu_profileInstHit; 197814184Sgabeblack@google.com k_popMandatoryQueue; 197914184Sgabeblack@google.com } 198014184Sgabeblack@google.com 198114184Sgabeblack@google.com transition({M, M_W}, Load) { 198214184Sgabeblack@google.com h_load_hit; 198314184Sgabeblack@google.com uu_profileDataHit; 198414184Sgabeblack@google.com k_popMandatoryQueue; 198514184Sgabeblack@google.com } 198614184Sgabeblack@google.com 198714184Sgabeblack@google.com transition(M, Store, MM) { 198814184Sgabeblack@google.com hh_store_hit; 198914184Sgabeblack@google.com uu_profileDataHit; 199014184Sgabeblack@google.com k_popMandatoryQueue; 199114184Sgabeblack@google.com } 199214184Sgabeblack@google.com 199314184Sgabeblack@google.com transition(M, Atomic) { 199414184Sgabeblack@google.com hh_store_hit; 199514184Sgabeblack@google.com uu_profileDataHit; 199614184Sgabeblack@google.com k_popMandatoryQueue; 199714184Sgabeblack@google.com } 199814184Sgabeblack@google.com 199914184Sgabeblack@google.com transition(M_W, Store, MM_W) { 200014184Sgabeblack@google.com hh_store_hit; 200114184Sgabeblack@google.com uu_profileDataHit; 200214184Sgabeblack@google.com k_popMandatoryQueue; 200314184Sgabeblack@google.com } 200414184Sgabeblack@google.com 200514184Sgabeblack@google.com transition(M_W, Atomic) { 200614184Sgabeblack@google.com hh_store_hit; 200714184Sgabeblack@google.com uu_profileDataHit; 200814184Sgabeblack@google.com k_popMandatoryQueue; 200914184Sgabeblack@google.com } 201014184Sgabeblack@google.com 201114184Sgabeblack@google.com transition(M, L1_Replacement, I) { 201214184Sgabeblack@google.com ta_traceStalledAddress; 201314184Sgabeblack@google.com c_ownedReplacement; 201414184Sgabeblack@google.com forward_eviction_to_cpu 201514184Sgabeblack@google.com gg_deallocateL1CacheBlock; 201614184Sgabeblack@google.com ka_wakeUpAllDependents; 201714184Sgabeblack@google.com } 201814184Sgabeblack@google.com 201914184Sgabeblack@google.com transition(M, {Transient_GETX, Transient_Local_GETX}, I) { 202014184Sgabeblack@google.com dd_sendDataWithAllTokens; 202114184Sgabeblack@google.com p_informL2AboutTokenLoss; 202214184Sgabeblack@google.com forward_eviction_to_cpu 202314184Sgabeblack@google.com m_popRequestQueue; 202414184Sgabeblack@google.com } 202514184Sgabeblack@google.com 202614184Sgabeblack@google.com transition(M, Transient_Local_GETS, O) { 202714184Sgabeblack@google.com d_sendDataWithToken; 202814184Sgabeblack@google.com m_popRequestQueue; 202914184Sgabeblack@google.com } 203014184Sgabeblack@google.com 203114184Sgabeblack@google.com transition(M, Transient_GETS, O) { 203214184Sgabeblack@google.com d_sendDataWithNTokenIfAvail; 203314184Sgabeblack@google.com m_popRequestQueue; 203414184Sgabeblack@google.com } 203514184Sgabeblack@google.com 203614184Sgabeblack@google.com transition(M_W, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_Local_GETS}) { // Ignore the request 203714184Sgabeblack@google.com m_popRequestQueue; 203814184Sgabeblack@google.com } 203914184Sgabeblack@google.com 204014184Sgabeblack@google.com transition(M, Persistent_GETX, I_L) { 204114184Sgabeblack@google.com ee_sendDataWithAllTokens; 204214184Sgabeblack@google.com p_informL2AboutTokenLoss; 204314184Sgabeblack@google.com forward_eviction_to_cpu 204414184Sgabeblack@google.com l_popPersistentQueue; 204514184Sgabeblack@google.com } 204614184Sgabeblack@google.com 204714184Sgabeblack@google.com transition(M, Persistent_GETS, S_L) { 204814184Sgabeblack@google.com ff_sendDataWithAllButNorOneTokens; 204914184Sgabeblack@google.com l_popPersistentQueue; 205014184Sgabeblack@google.com } 205114184Sgabeblack@google.com 205214184Sgabeblack@google.com // ignore persistent requests in lockout period 205314184Sgabeblack@google.com transition(M_W, {Persistent_GETX, Persistent_GETS}) { 205414184Sgabeblack@google.com l_popPersistentQueue; 205514184Sgabeblack@google.com } 205614184Sgabeblack@google.com 205714184Sgabeblack@google.com transition(M_W, Use_TimeoutStarverS, S_L) { 205814184Sgabeblack@google.com s_deallocateTBE; 205914184Sgabeblack@google.com ff_sendDataWithAllButNorOneTokens; 206014184Sgabeblack@google.com jj_unsetUseTimer; 206114184Sgabeblack@google.com } 206214184Sgabeblack@google.com 206314184Sgabeblack@google.com // someone unlocked during timeout 206414184Sgabeblack@google.com transition(M_W, {Use_TimeoutNoStarvers, Use_TimeoutNoStarvers_NoMig}, M) { 206514184Sgabeblack@google.com s_deallocateTBE; 206614184Sgabeblack@google.com jj_unsetUseTimer; 206714184Sgabeblack@google.com kd_wakeUpDependents; 206814184Sgabeblack@google.com } 206914184Sgabeblack@google.com 207014184Sgabeblack@google.com transition(M_W, Use_TimeoutStarverX, I_L) { 207114184Sgabeblack@google.com s_deallocateTBE; 207214184Sgabeblack@google.com ee_sendDataWithAllTokens; 207314184Sgabeblack@google.com forward_eviction_to_cpu; 207414184Sgabeblack@google.com p_informL2AboutTokenLoss; 207514184Sgabeblack@google.com jj_unsetUseTimer; 207614184Sgabeblack@google.com } 207714184Sgabeblack@google.com 207814184Sgabeblack@google.com // migratory 207914184Sgabeblack@google.com transition(MM_W, {Use_TimeoutStarverX, Use_TimeoutStarverS}, I_L) { 208014184Sgabeblack@google.com s_deallocateTBE; 208114184Sgabeblack@google.com ee_sendDataWithAllTokens; 208214184Sgabeblack@google.com forward_eviction_to_cpu; 208314184Sgabeblack@google.com p_informL2AboutTokenLoss; 208414184Sgabeblack@google.com jj_unsetUseTimer; 208514184Sgabeblack@google.com 208614184Sgabeblack@google.com } 208714184Sgabeblack@google.com 208814184Sgabeblack@google.com // Transient_GETX and Transient_GETS in transient states 208914184Sgabeblack@google.com transition(OM, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token, Transient_Local_GETS}) { 209014184Sgabeblack@google.com m_popRequestQueue; // Even if we have the data, we can pretend we don't have it yet. 209114184Sgabeblack@google.com } 209214184Sgabeblack@google.com 209314184Sgabeblack@google.com transition(IS, {Transient_GETX, Transient_Local_GETX}) { 209414184Sgabeblack@google.com t_sendAckWithCollectedTokens; 209514184Sgabeblack@google.com m_popRequestQueue; 209614184Sgabeblack@google.com } 209714184Sgabeblack@google.com 209814184Sgabeblack@google.com transition(IS, {Transient_GETS, Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token, Transient_Local_GETS}) { 209914184Sgabeblack@google.com m_popRequestQueue; 210014184Sgabeblack@google.com } 210114184Sgabeblack@google.com 210214184Sgabeblack@google.com transition(IS, {Persistent_GETX, Persistent_GETS, Persistent_GETS_Last_Token}, IS_L) { 210314184Sgabeblack@google.com e_sendAckWithCollectedTokens; 210414184Sgabeblack@google.com l_popPersistentQueue; 210514184Sgabeblack@google.com } 210614184Sgabeblack@google.com 210714184Sgabeblack@google.com transition(IS_L, {Persistent_GETX, Persistent_GETS}) { 210814184Sgabeblack@google.com l_popPersistentQueue; 210914184Sgabeblack@google.com } 211014184Sgabeblack@google.com 211114184Sgabeblack@google.com transition(IM, {Persistent_GETX, Persistent_GETS, Persistent_GETS_Last_Token}, IM_L) { 211214184Sgabeblack@google.com e_sendAckWithCollectedTokens; 211314184Sgabeblack@google.com l_popPersistentQueue; 211414184Sgabeblack@google.com } 211514184Sgabeblack@google.com 211614184Sgabeblack@google.com transition(IM_L, {Persistent_GETX, Persistent_GETS}) { 211714184Sgabeblack@google.com l_popPersistentQueue; 211814184Sgabeblack@google.com } 211914184Sgabeblack@google.com 212014184Sgabeblack@google.com transition({SM, SM_L}, Persistent_GETX, IM_L) { 212114184Sgabeblack@google.com e_sendAckWithCollectedTokens; 212214184Sgabeblack@google.com forward_eviction_to_cpu 212314184Sgabeblack@google.com l_popPersistentQueue; 212414184Sgabeblack@google.com } 212514184Sgabeblack@google.com 212614184Sgabeblack@google.com transition(SM, {Persistent_GETS, Persistent_GETS_Last_Token}, SM_L) { 212714184Sgabeblack@google.com f_sendAckWithAllButNorOneTokens; 212814184Sgabeblack@google.com l_popPersistentQueue; 212914184Sgabeblack@google.com } 213014184Sgabeblack@google.com 213114184Sgabeblack@google.com transition(SM_L, {Persistent_GETS, Persistent_GETS_Last_Token}) { 213214184Sgabeblack@google.com l_popPersistentQueue; 213314184Sgabeblack@google.com } 213414184Sgabeblack@google.com 213514184Sgabeblack@google.com transition(OM, Persistent_GETX, IM_L) { 213614184Sgabeblack@google.com ee_sendDataWithAllTokens; 213714184Sgabeblack@google.com forward_eviction_to_cpu 213814184Sgabeblack@google.com l_popPersistentQueue; 213914184Sgabeblack@google.com } 214014184Sgabeblack@google.com 214114184Sgabeblack@google.com transition(OM, Persistent_GETS, SM_L) { 214214184Sgabeblack@google.com ff_sendDataWithAllButNorOneTokens; 214314184Sgabeblack@google.com l_popPersistentQueue; 214414184Sgabeblack@google.com } 214514184Sgabeblack@google.com 214614184Sgabeblack@google.com transition(OM, Persistent_GETS_Last_Token, IM_L) { 214714184Sgabeblack@google.com fo_sendDataWithOwnerToken; 214814184Sgabeblack@google.com l_popPersistentQueue; 214914184Sgabeblack@google.com } 215014184Sgabeblack@google.com 215114184Sgabeblack@google.com // Transitions from IM/SM 215214184Sgabeblack@google.com 215314184Sgabeblack@google.com transition({IM, SM}, Ack) { 215414184Sgabeblack@google.com q_updateTokensFromResponse; 215514184Sgabeblack@google.com n_popResponseQueue; 215614184Sgabeblack@google.com } 215714184Sgabeblack@google.com 215814184Sgabeblack@google.com transition(IM, Data_Shared, SM) { 215914184Sgabeblack@google.com u_writeDataToCache; 216014184Sgabeblack@google.com q_updateTokensFromResponse; 216114184Sgabeblack@google.com n_popResponseQueue; 216214184Sgabeblack@google.com } 216314184Sgabeblack@google.com 216414184Sgabeblack@google.com transition(IM, Data_Owner, OM) { 216514184Sgabeblack@google.com u_writeDataToCache; 216614184Sgabeblack@google.com q_updateTokensFromResponse; 216714184Sgabeblack@google.com n_popResponseQueue; 216814184Sgabeblack@google.com } 216914184Sgabeblack@google.com 217014184Sgabeblack@google.com transition(IM, Data_All_Tokens, MM_W) { 217114184Sgabeblack@google.com u_writeDataToCache; 217214184Sgabeblack@google.com q_updateTokensFromResponse; 217314184Sgabeblack@google.com xx_external_store_hit; 217414184Sgabeblack@google.com o_scheduleUseTimeout; 217514184Sgabeblack@google.com j_unsetReissueTimer; 217614184Sgabeblack@google.com n_popResponseQueue; 217714184Sgabeblack@google.com kd_wakeUpDependents; 217814184Sgabeblack@google.com } 217914184Sgabeblack@google.com 218014184Sgabeblack@google.com transition(SM, Data_Shared) { 218114184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 218214184Sgabeblack@google.com q_updateTokensFromResponse; 218314184Sgabeblack@google.com n_popResponseQueue; 218414184Sgabeblack@google.com } 218514184Sgabeblack@google.com 218614184Sgabeblack@google.com transition(SM, Data_Owner, OM) { 218714184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 218814184Sgabeblack@google.com q_updateTokensFromResponse; 218914184Sgabeblack@google.com n_popResponseQueue; 219014184Sgabeblack@google.com } 219114184Sgabeblack@google.com 219214184Sgabeblack@google.com transition(SM, Data_All_Tokens, MM_W) { 219314184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 219414184Sgabeblack@google.com q_updateTokensFromResponse; 219514184Sgabeblack@google.com xx_external_store_hit; 219614184Sgabeblack@google.com o_scheduleUseTimeout; 219714184Sgabeblack@google.com j_unsetReissueTimer; 219814184Sgabeblack@google.com n_popResponseQueue; 219914184Sgabeblack@google.com kd_wakeUpDependents; 220014184Sgabeblack@google.com } 220114184Sgabeblack@google.com 220214184Sgabeblack@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 220314184Sgabeblack@google.com t_sendAckWithCollectedTokens; 220414184Sgabeblack@google.com forward_eviction_to_cpu; 220514184Sgabeblack@google.com m_popRequestQueue; 220614184Sgabeblack@google.com } 220714184Sgabeblack@google.com 220814184Sgabeblack@google.com transition({IM, SM}, {Transient_GETS, Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token, Transient_Local_GETS}) { 220914184Sgabeblack@google.com m_popRequestQueue; 221014184Sgabeblack@google.com } 221114184Sgabeblack@google.com 221214184Sgabeblack@google.com transition({IM, SM}, Request_Timeout) { 221314184Sgabeblack@google.com j_unsetReissueTimer; 221414184Sgabeblack@google.com b_issueWriteRequest; 221514184Sgabeblack@google.com } 221614184Sgabeblack@google.com 221714184Sgabeblack@google.com // Transitions from OM 221814184Sgabeblack@google.com 221914184Sgabeblack@google.com transition(OM, Ack) { 222014184Sgabeblack@google.com q_updateTokensFromResponse; 222114184Sgabeblack@google.com n_popResponseQueue; 222214184Sgabeblack@google.com } 222314184Sgabeblack@google.com 222414184Sgabeblack@google.com transition(OM, Ack_All_Tokens, MM_W) { 222514184Sgabeblack@google.com q_updateTokensFromResponse; 222614184Sgabeblack@google.com xx_external_store_hit; 222714184Sgabeblack@google.com o_scheduleUseTimeout; 222814184Sgabeblack@google.com j_unsetReissueTimer; 222914184Sgabeblack@google.com n_popResponseQueue; 223014184Sgabeblack@google.com kd_wakeUpDependents; 223114184Sgabeblack@google.com } 223214184Sgabeblack@google.com 223314184Sgabeblack@google.com transition(OM, Data_Shared) { 223414184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 223514184Sgabeblack@google.com q_updateTokensFromResponse; 223614184Sgabeblack@google.com n_popResponseQueue; 223714184Sgabeblack@google.com } 223814184Sgabeblack@google.com 223914184Sgabeblack@google.com transition(OM, Data_All_Tokens, MM_W) { 224014184Sgabeblack@google.com w_assertIncomingDataAndCacheDataMatch; 224114184Sgabeblack@google.com q_updateTokensFromResponse; 224214184Sgabeblack@google.com xx_external_store_hit; 224314184Sgabeblack@google.com o_scheduleUseTimeout; 224414184Sgabeblack@google.com j_unsetReissueTimer; 224514184Sgabeblack@google.com n_popResponseQueue; 224614184Sgabeblack@google.com kd_wakeUpDependents; 224714184Sgabeblack@google.com } 224814184Sgabeblack@google.com 224914184Sgabeblack@google.com transition(OM, Request_Timeout) { 225014184Sgabeblack@google.com j_unsetReissueTimer; 225114184Sgabeblack@google.com b_issueWriteRequest; 225214184Sgabeblack@google.com } 225314184Sgabeblack@google.com 225414184Sgabeblack@google.com // Transitions from IS 225514184Sgabeblack@google.com 225614184Sgabeblack@google.com transition(IS, Ack) { 225714184Sgabeblack@google.com q_updateTokensFromResponse; 225814184Sgabeblack@google.com n_popResponseQueue; 225914184Sgabeblack@google.com } 226014184Sgabeblack@google.com 226114184Sgabeblack@google.com transition(IS, Data_Shared, S) { 226214184Sgabeblack@google.com u_writeDataToCache; 226314184Sgabeblack@google.com q_updateTokensFromResponse; 226414184Sgabeblack@google.com x_external_load_hit; 226514184Sgabeblack@google.com s_deallocateTBE; 226614184Sgabeblack@google.com j_unsetReissueTimer; 226714184Sgabeblack@google.com n_popResponseQueue; 226814184Sgabeblack@google.com kd_wakeUpDependents; 226914184Sgabeblack@google.com } 227014184Sgabeblack@google.com 227114184Sgabeblack@google.com transition(IS, Data_Owner, O) { 227214184Sgabeblack@google.com u_writeDataToCache; 227314184Sgabeblack@google.com q_updateTokensFromResponse; 227414184Sgabeblack@google.com x_external_load_hit; 227514184Sgabeblack@google.com s_deallocateTBE; 227614184Sgabeblack@google.com j_unsetReissueTimer; 227714184Sgabeblack@google.com n_popResponseQueue; 227814184Sgabeblack@google.com kd_wakeUpDependents; 227914184Sgabeblack@google.com } 228014184Sgabeblack@google.com 228114184Sgabeblack@google.com transition(IS, Data_All_Tokens, M_W) { 228214184Sgabeblack@google.com u_writeDataToCache; 228314184Sgabeblack@google.com q_updateTokensFromResponse; 228414184Sgabeblack@google.com x_external_load_hit; 228514184Sgabeblack@google.com o_scheduleUseTimeout; 228614184Sgabeblack@google.com j_unsetReissueTimer; 228714184Sgabeblack@google.com n_popResponseQueue; 228814184Sgabeblack@google.com kd_wakeUpDependents; 228914184Sgabeblack@google.com } 229014184Sgabeblack@google.com 229114184Sgabeblack@google.com transition(IS, Request_Timeout) { 229214184Sgabeblack@google.com j_unsetReissueTimer; 229314184Sgabeblack@google.com a_issueReadRequest; 229414184Sgabeblack@google.com } 229514184Sgabeblack@google.com 229614184Sgabeblack@google.com // Transitions from I_L 229714184Sgabeblack@google.com 229814184Sgabeblack@google.com transition(I_L, Load, IS_L) { 229914184Sgabeblack@google.com ii_allocateL1DCacheBlock; 230014184Sgabeblack@google.com i_allocateTBE; 230114184Sgabeblack@google.com a_issueReadRequest; 230214184Sgabeblack@google.com uu_profileDataMiss; 230314184Sgabeblack@google.com k_popMandatoryQueue; 230414184Sgabeblack@google.com } 230514184Sgabeblack@google.com 230614184Sgabeblack@google.com transition(I_L, Ifetch, IS_L) { 230714184Sgabeblack@google.com pp_allocateL1ICacheBlock; 230814184Sgabeblack@google.com i_allocateTBE; 230914184Sgabeblack@google.com a_issueReadRequest; 231014184Sgabeblack@google.com uu_profileInstMiss; 231114184Sgabeblack@google.com k_popMandatoryQueue; 231214184Sgabeblack@google.com } 231314184Sgabeblack@google.com 231414184Sgabeblack@google.com transition(I_L, {Store, Atomic}, IM_L) { 231514184Sgabeblack@google.com ii_allocateL1DCacheBlock; 231614184Sgabeblack@google.com i_allocateTBE; 231714184Sgabeblack@google.com b_issueWriteRequest; 231814184Sgabeblack@google.com uu_profileDataMiss; 231914184Sgabeblack@google.com k_popMandatoryQueue; 232014184Sgabeblack@google.com } 232114184Sgabeblack@google.com 232214184Sgabeblack@google.com 232314184Sgabeblack@google.com // Transitions from S_L 232414184Sgabeblack@google.com 232514184Sgabeblack@google.com transition(S_L, {Store, Atomic}, SM_L) { 232614184Sgabeblack@google.com i_allocateTBE; 232714184Sgabeblack@google.com b_issueWriteRequest; 232814184Sgabeblack@google.com uu_profileDataMiss; 232914184Sgabeblack@google.com k_popMandatoryQueue; 233014184Sgabeblack@google.com } 233114184Sgabeblack@google.com 233214184Sgabeblack@google.com // Other transitions from *_L states 233314184Sgabeblack@google.com 233414184Sgabeblack@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}) { 233514184Sgabeblack@google.com m_popRequestQueue; 233614184Sgabeblack@google.com } 233714184Sgabeblack@google.com 233814184Sgabeblack@google.com transition({I_L, IM_L, IS_L, S_L, SM_L}, Ack) { 233914184Sgabeblack@google.com g_bounceResponseToStarver; 234014184Sgabeblack@google.com n_popResponseQueue; 234114184Sgabeblack@google.com } 234214184Sgabeblack@google.com 234314184Sgabeblack@google.com transition({I_L, IM_L, S_L, SM_L}, {Data_Shared, Data_Owner}) { 234414184Sgabeblack@google.com g_bounceResponseToStarver; 234514184Sgabeblack@google.com n_popResponseQueue; 234614184Sgabeblack@google.com } 234714184Sgabeblack@google.com 234814184Sgabeblack@google.com transition({I_L, S_L}, Data_All_Tokens) { 234914184Sgabeblack@google.com g_bounceResponseToStarver; 235014184Sgabeblack@google.com n_popResponseQueue; 235114184Sgabeblack@google.com } 235214184Sgabeblack@google.com 235314184Sgabeblack@google.com transition(IS_L, Request_Timeout) { 235414184Sgabeblack@google.com j_unsetReissueTimer; 235514184Sgabeblack@google.com a_issueReadRequest; 235614184Sgabeblack@google.com } 235714184Sgabeblack@google.com 235814184Sgabeblack@google.com transition({IM_L, SM_L}, Request_Timeout) { 235914184Sgabeblack@google.com j_unsetReissueTimer; 236014184Sgabeblack@google.com b_issueWriteRequest; 236114184Sgabeblack@google.com } 236214184Sgabeblack@google.com 236314184Sgabeblack@google.com // Opportunisticly Complete the memory operation in the following 236414184Sgabeblack@google.com // cases. Note: these transitions could just use 236514184Sgabeblack@google.com // g_bounceResponseToStarver, but if we have the data and tokens, we 236614184Sgabeblack@google.com // might as well complete the memory request while we have the 236714184Sgabeblack@google.com // chance (and then immediately forward on the data) 236814184Sgabeblack@google.com 236914184Sgabeblack@google.com transition(IM_L, Data_All_Tokens, MM_W) { 237014184Sgabeblack@google.com u_writeDataToCache; 237114184Sgabeblack@google.com q_updateTokensFromResponse; 237214184Sgabeblack@google.com xx_external_store_hit; 237314184Sgabeblack@google.com j_unsetReissueTimer; 237414184Sgabeblack@google.com o_scheduleUseTimeout; 237514184Sgabeblack@google.com n_popResponseQueue; 237614184Sgabeblack@google.com kd_wakeUpDependents; 237714184Sgabeblack@google.com } 237814184Sgabeblack@google.com 237914184Sgabeblack@google.com transition(SM_L, Data_All_Tokens, S_L) { 238014184Sgabeblack@google.com u_writeDataToCache; 238114184Sgabeblack@google.com q_updateTokensFromResponse; 238214184Sgabeblack@google.com xx_external_store_hit; 238314184Sgabeblack@google.com ff_sendDataWithAllButNorOneTokens; 238414184Sgabeblack@google.com s_deallocateTBE; 238514184Sgabeblack@google.com j_unsetReissueTimer; 238614184Sgabeblack@google.com n_popResponseQueue; 238714184Sgabeblack@google.com } 238814184Sgabeblack@google.com 238914184Sgabeblack@google.com transition(IS_L, Data_Shared, I_L) { 239014184Sgabeblack@google.com u_writeDataToCache; 239114184Sgabeblack@google.com q_updateTokensFromResponse; 239214184Sgabeblack@google.com x_external_load_hit; 239314184Sgabeblack@google.com s_deallocateTBE; 239414184Sgabeblack@google.com e_sendAckWithCollectedTokens; 239514184Sgabeblack@google.com p_informL2AboutTokenLoss; 239614184Sgabeblack@google.com j_unsetReissueTimer; 239714184Sgabeblack@google.com n_popResponseQueue; 239814184Sgabeblack@google.com } 239914184Sgabeblack@google.com 240014184Sgabeblack@google.com transition(IS_L, Data_Owner, I_L) { 240114184Sgabeblack@google.com u_writeDataToCache; 240214184Sgabeblack@google.com q_updateTokensFromResponse; 240314184Sgabeblack@google.com x_external_load_hit; 240414184Sgabeblack@google.com ee_sendDataWithAllTokens; 240514184Sgabeblack@google.com s_deallocateTBE; 240614184Sgabeblack@google.com p_informL2AboutTokenLoss; 240714184Sgabeblack@google.com j_unsetReissueTimer; 240814184Sgabeblack@google.com n_popResponseQueue; 240914184Sgabeblack@google.com } 241014184Sgabeblack@google.com 241114184Sgabeblack@google.com transition(IS_L, Data_All_Tokens, M_W) { 241214184Sgabeblack@google.com u_writeDataToCache; 241314184Sgabeblack@google.com q_updateTokensFromResponse; 241414184Sgabeblack@google.com x_external_load_hit; 241514184Sgabeblack@google.com j_unsetReissueTimer; 241614184Sgabeblack@google.com o_scheduleUseTimeout; 241714184Sgabeblack@google.com n_popResponseQueue; 241814184Sgabeblack@google.com kd_wakeUpDependents; 241914184Sgabeblack@google.com } 242014184Sgabeblack@google.com 242114184Sgabeblack@google.com // Own_Lock_or_Unlock 242214184Sgabeblack@google.com 242314184Sgabeblack@google.com transition(I_L, Own_Lock_or_Unlock, I) { 242414184Sgabeblack@google.com l_popPersistentQueue; 242514184Sgabeblack@google.com kd_wakeUpDependents; 242614184Sgabeblack@google.com } 242714184Sgabeblack@google.com 242814184Sgabeblack@google.com transition(S_L, Own_Lock_or_Unlock, S) { 242914184Sgabeblack@google.com l_popPersistentQueue; 243014184Sgabeblack@google.com kd_wakeUpDependents; 243114184Sgabeblack@google.com } 243214184Sgabeblack@google.com 243314184Sgabeblack@google.com transition(IM_L, Own_Lock_or_Unlock, IM) { 243414184Sgabeblack@google.com l_popPersistentQueue; 243514184Sgabeblack@google.com kd_wakeUpDependents; 243614184Sgabeblack@google.com } 243714184Sgabeblack@google.com 243814184Sgabeblack@google.com transition(IS_L, Own_Lock_or_Unlock, IS) { 243914184Sgabeblack@google.com l_popPersistentQueue; 244014184Sgabeblack@google.com kd_wakeUpDependents; 244114184Sgabeblack@google.com } 244214184Sgabeblack@google.com 244314184Sgabeblack@google.com transition(SM_L, Own_Lock_or_Unlock, SM) { 244414184Sgabeblack@google.com l_popPersistentQueue; 244514184Sgabeblack@google.com kd_wakeUpDependents; 244614184Sgabeblack@google.com } 244714184Sgabeblack@google.com} 2448