114184Sgabeblack@google.com/* 214184Sgabeblack@google.com * Copyright (c) 2011-2015 Advanced Micro Devices, Inc. 314184Sgabeblack@google.com * All rights reserved. 414184Sgabeblack@google.com * 514184Sgabeblack@google.com * For use for simulation and test purposes only 614184Sgabeblack@google.com * 714184Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 814184Sgabeblack@google.com * modification, are permitted provided that the following conditions are met: 914184Sgabeblack@google.com * 1014184Sgabeblack@google.com * 1. Redistributions of source code must retain the above copyright notice, 1114184Sgabeblack@google.com * this list of conditions and the following disclaimer. 1214184Sgabeblack@google.com * 1314184Sgabeblack@google.com * 2. Redistributions in binary form must reproduce the above copyright notice, 1414184Sgabeblack@google.com * this list of conditions and the following disclaimer in the documentation 1514184Sgabeblack@google.com * and/or other materials provided with the distribution. 1614184Sgabeblack@google.com * 1714184Sgabeblack@google.com * 3. Neither the name of the copyright holder nor the names of its 1814184Sgabeblack@google.com * contributors may be used to endorse or promote products derived from this 1914184Sgabeblack@google.com * software without specific prior written permission. 2014184Sgabeblack@google.com * 2114184Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 2214184Sgabeblack@google.com * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2314184Sgabeblack@google.com * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2414184Sgabeblack@google.com * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 2514184Sgabeblack@google.com * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2614184Sgabeblack@google.com * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2714184Sgabeblack@google.com * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2814184Sgabeblack@google.com * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2914184Sgabeblack@google.com * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 3014184Sgabeblack@google.com * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3114184Sgabeblack@google.com * POSSIBILITY OF SUCH DAMAGE. 3214184Sgabeblack@google.com * 3314184Sgabeblack@google.com * Authors: Lisa Hsu 3414184Sgabeblack@google.com */ 3514184Sgabeblack@google.com 3614184Sgabeblack@google.commachine(MachineType:TCP, "GPU TCP (L1 Data Cache)") 3714184Sgabeblack@google.com : GPUCoalescer* coalescer; 3814184Sgabeblack@google.com Sequencer* sequencer; 3914184Sgabeblack@google.com bool use_seq_not_coal; 4014184Sgabeblack@google.com CacheMemory * L1cache; 4114184Sgabeblack@google.com int TCC_select_num_bits; 4214184Sgabeblack@google.com Cycles issue_latency := 40; // time to send data down to TCC 4314184Sgabeblack@google.com Cycles l2_hit_latency := 18; 4414184Sgabeblack@google.com 4514184Sgabeblack@google.com MessageBuffer * requestFromTCP, network="To", virtual_network="1", vnet_type="request"; 4614184Sgabeblack@google.com MessageBuffer * responseFromTCP, network="To", virtual_network="3", vnet_type="response"; 4714184Sgabeblack@google.com MessageBuffer * unblockFromCore, network="To", virtual_network="5", vnet_type="unblock"; 4814184Sgabeblack@google.com 4914184Sgabeblack@google.com MessageBuffer * probeToTCP, network="From", virtual_network="1", vnet_type="request"; 5014184Sgabeblack@google.com MessageBuffer * responseToTCP, network="From", virtual_network="3", vnet_type="response"; 5114184Sgabeblack@google.com 5214184Sgabeblack@google.com MessageBuffer * mandatoryQueue; 5314184Sgabeblack@google.com{ 5414184Sgabeblack@google.com state_declaration(State, desc="TCP Cache States", default="TCP_State_I") { 5514184Sgabeblack@google.com I, AccessPermission:Invalid, desc="Invalid"; 5614184Sgabeblack@google.com S, AccessPermission:Read_Only, desc="Shared"; 5714184Sgabeblack@google.com E, AccessPermission:Read_Write, desc="Exclusive"; 5814184Sgabeblack@google.com O, AccessPermission:Read_Only, desc="Owner state in core, both clusters and other cores may be sharing line"; 5914184Sgabeblack@google.com M, AccessPermission:Read_Write, desc="Modified"; 6014184Sgabeblack@google.com 6114184Sgabeblack@google.com I_M, AccessPermission:Busy, desc="Invalid, issued RdBlkM, have not seen response yet"; 6214184Sgabeblack@google.com I_ES, AccessPermission:Busy, desc="Invalid, issued RdBlk, have not seen response yet"; 6314184Sgabeblack@google.com S_M, AccessPermission:Read_Only, desc="Shared, issued CtoD, have not seen response yet"; 6414184Sgabeblack@google.com O_M, AccessPermission:Read_Only, desc="Shared, issued CtoD, have not seen response yet"; 6514184Sgabeblack@google.com 6614184Sgabeblack@google.com ES_I, AccessPermission:Read_Only, desc="L1 replacement, waiting for clean WB ack"; 6714184Sgabeblack@google.com MO_I, AccessPermission:Read_Only, desc="L1 replacement, waiting for dirty WB ack"; 6814184Sgabeblack@google.com 6914184Sgabeblack@google.com MO_PI, AccessPermission:Read_Only, desc="L1 downgrade, waiting for CtoD ack (or ProbeInvalidateData)"; 7014184Sgabeblack@google.com 7114184Sgabeblack@google.com I_C, AccessPermission:Invalid, desc="Invalid, waiting for WBAck from TCC for canceled WB"; 7214184Sgabeblack@google.com } 7314184Sgabeblack@google.com 7414184Sgabeblack@google.com enumeration(Event, desc="TCP Events") { 7514184Sgabeblack@google.com // Core initiated 7614184Sgabeblack@google.com Load, desc="Load"; 7714184Sgabeblack@google.com Store, desc="Store"; 7814184Sgabeblack@google.com 7914184Sgabeblack@google.com // TCC initiated 8014184Sgabeblack@google.com TCC_AckS, desc="TCC Ack to Core Request"; 8114184Sgabeblack@google.com TCC_AckE, desc="TCC Ack to Core Request"; 8214184Sgabeblack@google.com TCC_AckM, desc="TCC Ack to Core Request"; 8314184Sgabeblack@google.com TCC_AckCtoD, desc="TCC Ack to Core Request"; 8414184Sgabeblack@google.com TCC_AckWB, desc="TCC Ack for clean WB"; 8514184Sgabeblack@google.com TCC_NackWB, desc="TCC Nack for clean WB"; 8614184Sgabeblack@google.com 8714184Sgabeblack@google.com // Mem sys initiated 8814184Sgabeblack@google.com Repl, desc="Replacing block from cache"; 8914184Sgabeblack@google.com 9014184Sgabeblack@google.com // Probe Events 9114184Sgabeblack@google.com PrbInvData, desc="probe, return O or M data"; 9214184Sgabeblack@google.com PrbInv, desc="probe, no need for data"; 9314184Sgabeblack@google.com LocalPrbInv, desc="local probe, no need for data"; 9414184Sgabeblack@google.com PrbShrData, desc="probe downgrade, return O or M data"; 9514184Sgabeblack@google.com } 9614184Sgabeblack@google.com 9714184Sgabeblack@google.com enumeration(RequestType, desc="To communicate stats from transitions to recordStats") { 9814184Sgabeblack@google.com DataArrayRead, desc="Read the data array"; 9914184Sgabeblack@google.com DataArrayWrite, desc="Write the data array"; 10014184Sgabeblack@google.com TagArrayRead, desc="Read the data array"; 10114184Sgabeblack@google.com TagArrayWrite, desc="Write the data array"; 10214184Sgabeblack@google.com } 10314184Sgabeblack@google.com 10414184Sgabeblack@google.com 10514184Sgabeblack@google.com structure(Entry, desc="...", interface="AbstractCacheEntry") { 10614184Sgabeblack@google.com State CacheState, desc="cache state"; 10714184Sgabeblack@google.com bool Dirty, desc="Is the data dirty (diff than memory)?"; 10814184Sgabeblack@google.com DataBlock DataBlk, desc="data for the block"; 10914184Sgabeblack@google.com bool FromL2, default="false", desc="block just moved from L2"; 11014184Sgabeblack@google.com } 11114184Sgabeblack@google.com 11214184Sgabeblack@google.com structure(TBE, desc="...") { 11314184Sgabeblack@google.com State TBEState, desc="Transient state"; 11414184Sgabeblack@google.com DataBlock DataBlk, desc="data for the block, required for concurrent writebacks"; 11514184Sgabeblack@google.com bool Dirty, desc="Is the data dirty (different than memory)?"; 11614184Sgabeblack@google.com int NumPendingMsgs, desc="Number of acks/data messages that this processor is waiting for"; 11714184Sgabeblack@google.com bool Shared, desc="Victim hit by shared probe"; 11814184Sgabeblack@google.com } 11914184Sgabeblack@google.com 12014184Sgabeblack@google.com structure(TBETable, external="yes") { 12114184Sgabeblack@google.com TBE lookup(Addr); 12214184Sgabeblack@google.com void allocate(Addr); 12314184Sgabeblack@google.com void deallocate(Addr); 12414184Sgabeblack@google.com bool isPresent(Addr); 12514184Sgabeblack@google.com } 12614184Sgabeblack@google.com 12714184Sgabeblack@google.com TBETable TBEs, template="<TCP_TBE>", constructor="m_number_of_TBEs"; 12814184Sgabeblack@google.com int TCC_select_low_bit, default="RubySystem::getBlockSizeBits()"; 12914184Sgabeblack@google.com 13014184Sgabeblack@google.com Tick clockEdge(); 13114184Sgabeblack@google.com Tick cyclesToTicks(Cycles c); 13214184Sgabeblack@google.com 13314184Sgabeblack@google.com void set_cache_entry(AbstractCacheEntry b); 13414184Sgabeblack@google.com void unset_cache_entry(); 13514184Sgabeblack@google.com void set_tbe(TBE b); 13614184Sgabeblack@google.com void unset_tbe(); 13714184Sgabeblack@google.com void wakeUpAllBuffers(); 13814184Sgabeblack@google.com void wakeUpBuffers(Addr a); 13914184Sgabeblack@google.com Cycles curCycle(); 14014184Sgabeblack@google.com 14114184Sgabeblack@google.com // Internal functions 14214184Sgabeblack@google.com Entry getCacheEntry(Addr address), return_by_pointer="yes" { 14314184Sgabeblack@google.com Entry cache_entry := static_cast(Entry, "pointer", L1cache.lookup(address)); 14414184Sgabeblack@google.com return cache_entry; 14514184Sgabeblack@google.com } 14614184Sgabeblack@google.com 14714184Sgabeblack@google.com DataBlock getDataBlock(Addr addr), return_by_ref="yes" { 14814184Sgabeblack@google.com TBE tbe := TBEs.lookup(addr); 14914184Sgabeblack@google.com if(is_valid(tbe)) { 15014184Sgabeblack@google.com return tbe.DataBlk; 15114184Sgabeblack@google.com } else { 15214184Sgabeblack@google.com return getCacheEntry(addr).DataBlk; 15314184Sgabeblack@google.com } 15414184Sgabeblack@google.com } 15514184Sgabeblack@google.com 15614184Sgabeblack@google.com State getState(TBE tbe, Entry cache_entry, Addr addr) { 15714184Sgabeblack@google.com if(is_valid(tbe)) { 15814184Sgabeblack@google.com return tbe.TBEState; 15914184Sgabeblack@google.com } else if (is_valid(cache_entry)) { 16014184Sgabeblack@google.com return cache_entry.CacheState; 16114184Sgabeblack@google.com } 16214184Sgabeblack@google.com return State:I; 16314184Sgabeblack@google.com } 16414184Sgabeblack@google.com 16514184Sgabeblack@google.com void setState(TBE tbe, Entry cache_entry, Addr addr, State state) { 16614184Sgabeblack@google.com if (is_valid(tbe)) { 16714184Sgabeblack@google.com tbe.TBEState := state; 16814184Sgabeblack@google.com } 16914184Sgabeblack@google.com 17014184Sgabeblack@google.com if (is_valid(cache_entry)) { 17114184Sgabeblack@google.com cache_entry.CacheState := state; 17214184Sgabeblack@google.com } 17314184Sgabeblack@google.com } 17414184Sgabeblack@google.com 17514184Sgabeblack@google.com AccessPermission getAccessPermission(Addr addr) { 17614184Sgabeblack@google.com TBE tbe := TBEs.lookup(addr); 17714184Sgabeblack@google.com if(is_valid(tbe)) { 17814184Sgabeblack@google.com return TCP_State_to_permission(tbe.TBEState); 17914184Sgabeblack@google.com } 18014184Sgabeblack@google.com 18114184Sgabeblack@google.com Entry cache_entry := getCacheEntry(addr); 18214184Sgabeblack@google.com if(is_valid(cache_entry)) { 18314184Sgabeblack@google.com return TCP_State_to_permission(cache_entry.CacheState); 18414184Sgabeblack@google.com } 18514184Sgabeblack@google.com 18614184Sgabeblack@google.com return AccessPermission:NotPresent; 18714184Sgabeblack@google.com } 18814184Sgabeblack@google.com 18914184Sgabeblack@google.com bool isValid(Addr addr) { 19014184Sgabeblack@google.com AccessPermission perm := getAccessPermission(addr); 19114184Sgabeblack@google.com if (perm == AccessPermission:NotPresent || 19214184Sgabeblack@google.com perm == AccessPermission:Invalid || 19314184Sgabeblack@google.com perm == AccessPermission:Busy) { 19414184Sgabeblack@google.com return false; 19514184Sgabeblack@google.com } else { 19614184Sgabeblack@google.com return true; 19714184Sgabeblack@google.com } 19814184Sgabeblack@google.com } 19914184Sgabeblack@google.com 20014184Sgabeblack@google.com void setAccessPermission(Entry cache_entry, Addr addr, State state) { 20114184Sgabeblack@google.com if (is_valid(cache_entry)) { 20214184Sgabeblack@google.com cache_entry.changePermission(TCP_State_to_permission(state)); 20314184Sgabeblack@google.com } 20414184Sgabeblack@google.com } 20514184Sgabeblack@google.com 20614184Sgabeblack@google.com void functionalRead(Addr addr, Packet *pkt) { 20714184Sgabeblack@google.com TBE tbe := TBEs.lookup(addr); 20814184Sgabeblack@google.com if(is_valid(tbe)) { 20914184Sgabeblack@google.com testAndRead(addr, tbe.DataBlk, pkt); 21014184Sgabeblack@google.com } else { 21114184Sgabeblack@google.com functionalMemoryRead(pkt); 21214184Sgabeblack@google.com } 21314184Sgabeblack@google.com } 21414184Sgabeblack@google.com 21514184Sgabeblack@google.com int functionalWrite(Addr addr, Packet *pkt) { 21614184Sgabeblack@google.com int num_functional_writes := 0; 21714184Sgabeblack@google.com 21814184Sgabeblack@google.com TBE tbe := TBEs.lookup(addr); 21914184Sgabeblack@google.com if(is_valid(tbe)) { 22014184Sgabeblack@google.com num_functional_writes := num_functional_writes + 22114184Sgabeblack@google.com testAndWrite(addr, tbe.DataBlk, pkt); 22214184Sgabeblack@google.com } 22314184Sgabeblack@google.com 22414184Sgabeblack@google.com num_functional_writes := num_functional_writes + functionalMemoryWrite(pkt); 22514184Sgabeblack@google.com return num_functional_writes; 22614184Sgabeblack@google.com } 22714184Sgabeblack@google.com 22814184Sgabeblack@google.com void recordRequestType(RequestType request_type, Addr addr) { 22914184Sgabeblack@google.com if (request_type == RequestType:DataArrayRead) { 23014184Sgabeblack@google.com L1cache.recordRequestType(CacheRequestType:DataArrayRead, addr); 23114184Sgabeblack@google.com } else if (request_type == RequestType:DataArrayWrite) { 23214184Sgabeblack@google.com L1cache.recordRequestType(CacheRequestType:DataArrayWrite, addr); 23314184Sgabeblack@google.com } else if (request_type == RequestType:TagArrayRead) { 23414184Sgabeblack@google.com L1cache.recordRequestType(CacheRequestType:TagArrayRead, addr); 23514184Sgabeblack@google.com } else if (request_type == RequestType:TagArrayWrite) { 23614184Sgabeblack@google.com L1cache.recordRequestType(CacheRequestType:TagArrayWrite, addr); 23714184Sgabeblack@google.com } 23814184Sgabeblack@google.com } 23914184Sgabeblack@google.com 24014184Sgabeblack@google.com bool checkResourceAvailable(RequestType request_type, Addr addr) { 24114184Sgabeblack@google.com if (request_type == RequestType:DataArrayRead) { 24214184Sgabeblack@google.com return L1cache.checkResourceAvailable(CacheResourceType:DataArray, addr); 24314184Sgabeblack@google.com } else if (request_type == RequestType:DataArrayWrite) { 24414184Sgabeblack@google.com return L1cache.checkResourceAvailable(CacheResourceType:DataArray, addr); 24514184Sgabeblack@google.com } else if (request_type == RequestType:TagArrayRead) { 24614184Sgabeblack@google.com return L1cache.checkResourceAvailable(CacheResourceType:TagArray, addr); 24714184Sgabeblack@google.com } else if (request_type == RequestType:TagArrayWrite) { 24814184Sgabeblack@google.com return L1cache.checkResourceAvailable(CacheResourceType:TagArray, addr); 24914184Sgabeblack@google.com } else { 25014184Sgabeblack@google.com error("Invalid RequestType type in checkResourceAvailable"); 25114184Sgabeblack@google.com return true; 25214184Sgabeblack@google.com } 25314184Sgabeblack@google.com } 25414184Sgabeblack@google.com 25514184Sgabeblack@google.com MachineType getCoherenceType(MachineID myMachID, 25614184Sgabeblack@google.com MachineID senderMachID) { 25714184Sgabeblack@google.com if(myMachID == senderMachID) { 25814184Sgabeblack@google.com return MachineType:TCP; 25914184Sgabeblack@google.com } else if(machineIDToMachineType(senderMachID) == MachineType:TCP) { 26014184Sgabeblack@google.com return MachineType:L1Cache_wCC; 26114184Sgabeblack@google.com } else if(machineIDToMachineType(senderMachID) == MachineType:TCC) { 26214184Sgabeblack@google.com return MachineType:TCC; 26314184Sgabeblack@google.com } else { 26414184Sgabeblack@google.com return MachineType:TCCdir; 26514184Sgabeblack@google.com } 26614184Sgabeblack@google.com } 26714184Sgabeblack@google.com 26814184Sgabeblack@google.com // Out Ports 26914184Sgabeblack@google.com 27014184Sgabeblack@google.com out_port(requestNetwork_out, CPURequestMsg, requestFromTCP); 27114184Sgabeblack@google.com out_port(responseNetwork_out, ResponseMsg, responseFromTCP); 27214184Sgabeblack@google.com out_port(unblockNetwork_out, UnblockMsg, unblockFromCore); 27314184Sgabeblack@google.com 27414184Sgabeblack@google.com // In Ports 27514184Sgabeblack@google.com 27614184Sgabeblack@google.com in_port(probeNetwork_in, TDProbeRequestMsg, probeToTCP) { 27714184Sgabeblack@google.com if (probeNetwork_in.isReady(clockEdge())) { 27814184Sgabeblack@google.com peek(probeNetwork_in, TDProbeRequestMsg, block_on="addr") { 27914184Sgabeblack@google.com DPRINTF(RubySlicc, "%s\n", in_msg); 28014184Sgabeblack@google.com DPRINTF(RubySlicc, "machineID: %s\n", machineID); 28114184Sgabeblack@google.com Entry cache_entry := getCacheEntry(in_msg.addr); 28214184Sgabeblack@google.com TBE tbe := TBEs.lookup(in_msg.addr); 28314184Sgabeblack@google.com 28414184Sgabeblack@google.com if (in_msg.Type == ProbeRequestType:PrbInv) { 28514184Sgabeblack@google.com if (in_msg.ReturnData) { 28614184Sgabeblack@google.com trigger(Event:PrbInvData, in_msg.addr, cache_entry, tbe); 28714184Sgabeblack@google.com } else { 28814184Sgabeblack@google.com if(in_msg.localCtoD) { 28914184Sgabeblack@google.com trigger(Event:LocalPrbInv, in_msg.addr, cache_entry, tbe); 29014184Sgabeblack@google.com } else { 29114184Sgabeblack@google.com trigger(Event:PrbInv, in_msg.addr, cache_entry, tbe); 29214184Sgabeblack@google.com } 29314184Sgabeblack@google.com } 29414184Sgabeblack@google.com } else if (in_msg.Type == ProbeRequestType:PrbDowngrade) { 29514184Sgabeblack@google.com assert(in_msg.ReturnData); 29614184Sgabeblack@google.com trigger(Event:PrbShrData, in_msg.addr, cache_entry, tbe); 29714184Sgabeblack@google.com } 29814184Sgabeblack@google.com } 29914184Sgabeblack@google.com } 30014184Sgabeblack@google.com } 30114184Sgabeblack@google.com 30214184Sgabeblack@google.com in_port(responseToTCP_in, ResponseMsg, responseToTCP) { 30314184Sgabeblack@google.com if (responseToTCP_in.isReady(clockEdge())) { 30414184Sgabeblack@google.com peek(responseToTCP_in, ResponseMsg, block_on="addr") { 30514184Sgabeblack@google.com 30614184Sgabeblack@google.com Entry cache_entry := getCacheEntry(in_msg.addr); 30714184Sgabeblack@google.com TBE tbe := TBEs.lookup(in_msg.addr); 30814184Sgabeblack@google.com 30914184Sgabeblack@google.com if (in_msg.Type == CoherenceResponseType:TDSysResp) { 31014184Sgabeblack@google.com if (in_msg.State == CoherenceState:Modified) { 31114184Sgabeblack@google.com if (in_msg.CtoD) { 31214184Sgabeblack@google.com trigger(Event:TCC_AckCtoD, in_msg.addr, cache_entry, tbe); 31314184Sgabeblack@google.com } else { 31414184Sgabeblack@google.com trigger(Event:TCC_AckM, in_msg.addr, cache_entry, tbe); 31514184Sgabeblack@google.com } 31614184Sgabeblack@google.com } else if (in_msg.State == CoherenceState:Shared) { 31714184Sgabeblack@google.com trigger(Event:TCC_AckS, in_msg.addr, cache_entry, tbe); 31814184Sgabeblack@google.com } else if (in_msg.State == CoherenceState:Exclusive) { 31914184Sgabeblack@google.com trigger(Event:TCC_AckE, in_msg.addr, cache_entry, tbe); 32014184Sgabeblack@google.com } 32114184Sgabeblack@google.com } else if (in_msg.Type == CoherenceResponseType:TDSysWBAck) { 32214184Sgabeblack@google.com trigger(Event:TCC_AckWB, in_msg.addr, cache_entry, tbe); 32314184Sgabeblack@google.com } else if (in_msg.Type == CoherenceResponseType:TDSysWBNack) { 32414184Sgabeblack@google.com trigger(Event:TCC_NackWB, in_msg.addr, cache_entry, tbe); 32514184Sgabeblack@google.com } else { 32614184Sgabeblack@google.com error("Unexpected Response Message to Core"); 32714184Sgabeblack@google.com } 32814184Sgabeblack@google.com } 32914184Sgabeblack@google.com } 33014184Sgabeblack@google.com } 33114184Sgabeblack@google.com 33214184Sgabeblack@google.com in_port(mandatoryQueue_in, RubyRequest, mandatoryQueue, desc="...") { 33314184Sgabeblack@google.com if (mandatoryQueue_in.isReady(clockEdge())) { 33414184Sgabeblack@google.com peek(mandatoryQueue_in, RubyRequest, block_on="LineAddress") { 33514184Sgabeblack@google.com Entry cache_entry := getCacheEntry(in_msg.LineAddress); 33614184Sgabeblack@google.com TBE tbe := TBEs.lookup(in_msg.LineAddress); 33714184Sgabeblack@google.com DPRINTF(RubySlicc, "%s\n", in_msg); 33814184Sgabeblack@google.com if (in_msg.Type == RubyRequestType:LD) { 33914184Sgabeblack@google.com if (is_valid(cache_entry) || L1cache.cacheAvail(in_msg.LineAddress)) { 34014184Sgabeblack@google.com trigger(Event:Load, in_msg.LineAddress, cache_entry, tbe); 34114184Sgabeblack@google.com } else { 34214184Sgabeblack@google.com Addr victim := L1cache.cacheProbe(in_msg.LineAddress); 34314184Sgabeblack@google.com trigger(Event:Repl, victim, getCacheEntry(victim), TBEs.lookup(victim)); 34414184Sgabeblack@google.com } 34514184Sgabeblack@google.com } else { 34614184Sgabeblack@google.com if (is_valid(cache_entry) || L1cache.cacheAvail(in_msg.LineAddress)) { 34714184Sgabeblack@google.com trigger(Event:Store, in_msg.LineAddress, cache_entry, tbe); 34814184Sgabeblack@google.com } else { 34914184Sgabeblack@google.com Addr victim := L1cache.cacheProbe(in_msg.LineAddress); 35014184Sgabeblack@google.com trigger(Event:Repl, victim, getCacheEntry(victim), TBEs.lookup(victim)); 35114184Sgabeblack@google.com } 35214184Sgabeblack@google.com } 35314184Sgabeblack@google.com } 35414184Sgabeblack@google.com } 35514184Sgabeblack@google.com } 35614184Sgabeblack@google.com 35714184Sgabeblack@google.com // Actions 35814184Sgabeblack@google.com 35914184Sgabeblack@google.com action(ic_invCache, "ic", desc="invalidate cache") { 36014184Sgabeblack@google.com if(is_valid(cache_entry)) { 36114184Sgabeblack@google.com L1cache.deallocate(address); 36214184Sgabeblack@google.com } 36314184Sgabeblack@google.com unset_cache_entry(); 36414184Sgabeblack@google.com } 36514184Sgabeblack@google.com 36614184Sgabeblack@google.com action(n_issueRdBlk, "n", desc="Issue RdBlk") { 36714184Sgabeblack@google.com enqueue(requestNetwork_out, CPURequestMsg, issue_latency) { 36814184Sgabeblack@google.com out_msg.addr := address; 36914184Sgabeblack@google.com out_msg.Type := CoherenceRequestType:RdBlk; 37014184Sgabeblack@google.com out_msg.Requestor := machineID; 37114184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir, 37214184Sgabeblack@google.com TCC_select_low_bit, TCC_select_num_bits)); 37314184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Request_Control; 37414184Sgabeblack@google.com out_msg.InitialRequestTime := curCycle(); 37514184Sgabeblack@google.com } 37614184Sgabeblack@google.com } 37714184Sgabeblack@google.com 37814184Sgabeblack@google.com action(nM_issueRdBlkM, "nM", desc="Issue RdBlkM") { 37914184Sgabeblack@google.com enqueue(requestNetwork_out, CPURequestMsg, issue_latency) { 38014184Sgabeblack@google.com out_msg.addr := address; 38114184Sgabeblack@google.com out_msg.Type := CoherenceRequestType:RdBlkM; 38214184Sgabeblack@google.com out_msg.Requestor := machineID; 38314184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir, 38414184Sgabeblack@google.com TCC_select_low_bit, TCC_select_num_bits)); 38514184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Request_Control; 38614184Sgabeblack@google.com out_msg.InitialRequestTime := curCycle(); 38714184Sgabeblack@google.com } 38814184Sgabeblack@google.com } 38914184Sgabeblack@google.com 39014184Sgabeblack@google.com action(vd_victim, "vd", desc="Victimize M/O Data") { 39114184Sgabeblack@google.com enqueue(requestNetwork_out, CPURequestMsg, issue_latency) { 39214184Sgabeblack@google.com out_msg.addr := address; 39314184Sgabeblack@google.com out_msg.Requestor := machineID; 39414184Sgabeblack@google.com assert(is_valid(cache_entry)); 39514184Sgabeblack@google.com out_msg.DataBlk := cache_entry.DataBlk; 39614184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir, 39714184Sgabeblack@google.com TCC_select_low_bit, TCC_select_num_bits)); 39814184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Request_Control; 39914184Sgabeblack@google.com out_msg.Type := CoherenceRequestType:VicDirty; 40014184Sgabeblack@google.com out_msg.InitialRequestTime := curCycle(); 40114184Sgabeblack@google.com if (cache_entry.CacheState == State:O) { 40214184Sgabeblack@google.com out_msg.Shared := true; 40314184Sgabeblack@google.com } else { 40414184Sgabeblack@google.com out_msg.Shared := false; 40514184Sgabeblack@google.com } 40614184Sgabeblack@google.com out_msg.Dirty := cache_entry.Dirty; 40714184Sgabeblack@google.com } 40814184Sgabeblack@google.com } 40914184Sgabeblack@google.com 41014184Sgabeblack@google.com action(vc_victim, "vc", desc="Victimize E/S Data") { 41114184Sgabeblack@google.com enqueue(requestNetwork_out, CPURequestMsg, issue_latency) { 41214184Sgabeblack@google.com out_msg.addr := address; 41314184Sgabeblack@google.com out_msg.Requestor := machineID; 41414184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir, 41514184Sgabeblack@google.com TCC_select_low_bit, TCC_select_num_bits)); 41614184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Request_Control; 41714184Sgabeblack@google.com out_msg.Type := CoherenceRequestType:VicClean; 41814184Sgabeblack@google.com out_msg.InitialRequestTime := curCycle(); 41914184Sgabeblack@google.com if (cache_entry.CacheState == State:S) { 42014184Sgabeblack@google.com out_msg.Shared := true; 42114184Sgabeblack@google.com } else { 42214184Sgabeblack@google.com out_msg.Shared := false; 42314184Sgabeblack@google.com } 42414184Sgabeblack@google.com } 42514184Sgabeblack@google.com } 42614184Sgabeblack@google.com 42714184Sgabeblack@google.com action(a_allocate, "a", desc="allocate block") { 42814184Sgabeblack@google.com if (is_invalid(cache_entry)) { 42914184Sgabeblack@google.com set_cache_entry(L1cache.allocate(address, new Entry)); 43014184Sgabeblack@google.com } 43114184Sgabeblack@google.com } 43214184Sgabeblack@google.com 43314184Sgabeblack@google.com action(t_allocateTBE, "t", desc="allocate TBE Entry") { 43414184Sgabeblack@google.com check_allocate(TBEs); 43514184Sgabeblack@google.com assert(is_valid(cache_entry)); 43614184Sgabeblack@google.com TBEs.allocate(address); 43714184Sgabeblack@google.com set_tbe(TBEs.lookup(address)); 43814184Sgabeblack@google.com tbe.DataBlk := cache_entry.DataBlk; // Data only used for WBs 43914184Sgabeblack@google.com tbe.Dirty := cache_entry.Dirty; 44014184Sgabeblack@google.com tbe.Shared := false; 44114184Sgabeblack@google.com } 44214184Sgabeblack@google.com 44314184Sgabeblack@google.com action(d_deallocateTBE, "d", desc="Deallocate TBE") { 44414184Sgabeblack@google.com TBEs.deallocate(address); 44514184Sgabeblack@google.com unset_tbe(); 44614184Sgabeblack@google.com } 44714184Sgabeblack@google.com 44814184Sgabeblack@google.com action(p_popMandatoryQueue, "pm", desc="Pop Mandatory Queue") { 44914184Sgabeblack@google.com mandatoryQueue_in.dequeue(clockEdge()); 45014184Sgabeblack@google.com } 45114184Sgabeblack@google.com 45214184Sgabeblack@google.com action(pr_popResponseQueue, "pr", desc="Pop Response Queue") { 45314184Sgabeblack@google.com responseToTCP_in.dequeue(clockEdge()); 45414184Sgabeblack@google.com } 45514184Sgabeblack@google.com 45614184Sgabeblack@google.com action(pp_popProbeQueue, "pp", desc="pop probe queue") { 45714184Sgabeblack@google.com probeNetwork_in.dequeue(clockEdge()); 45814184Sgabeblack@google.com } 45914184Sgabeblack@google.com 46014184Sgabeblack@google.com action(l_loadDone, "l", desc="local load done") { 46114184Sgabeblack@google.com assert(is_valid(cache_entry)); 46214184Sgabeblack@google.com if (use_seq_not_coal) { 46314184Sgabeblack@google.com sequencer.readCallback(address, cache_entry.DataBlk, 46414184Sgabeblack@google.com false, MachineType:TCP); 46514184Sgabeblack@google.com } else { 46614184Sgabeblack@google.com coalescer.readCallback(address, MachineType:TCP, cache_entry.DataBlk); 46714184Sgabeblack@google.com } 46814184Sgabeblack@google.com } 46914184Sgabeblack@google.com 47014184Sgabeblack@google.com action(xl_loadDone, "xl", desc="remote load done") { 47114184Sgabeblack@google.com peek(responseToTCP_in, ResponseMsg) { 47214184Sgabeblack@google.com assert(is_valid(cache_entry)); 47314184Sgabeblack@google.com if (use_seq_not_coal) { 47414184Sgabeblack@google.com coalescer.recordCPReadCallBack(machineID, in_msg.Sender); 47514184Sgabeblack@google.com sequencer.readCallback(address, 47614184Sgabeblack@google.com cache_entry.DataBlk, 47714184Sgabeblack@google.com false, 47814184Sgabeblack@google.com machineIDToMachineType(in_msg.Sender), 47914184Sgabeblack@google.com in_msg.InitialRequestTime, 48014184Sgabeblack@google.com in_msg.ForwardRequestTime, 48114184Sgabeblack@google.com in_msg.ProbeRequestStartTime); 48214184Sgabeblack@google.com } else { 48314184Sgabeblack@google.com MachineType cc_mach_type := getCoherenceType(machineID, 48414184Sgabeblack@google.com in_msg.Sender); 48514184Sgabeblack@google.com coalescer.readCallback(address, 48614184Sgabeblack@google.com cc_mach_type, 48714184Sgabeblack@google.com cache_entry.DataBlk, 48814184Sgabeblack@google.com in_msg.InitialRequestTime, 48914184Sgabeblack@google.com in_msg.ForwardRequestTime, 49014184Sgabeblack@google.com in_msg.ProbeRequestStartTime); 49114184Sgabeblack@google.com } 49214184Sgabeblack@google.com } 49314184Sgabeblack@google.com } 49414184Sgabeblack@google.com 49514184Sgabeblack@google.com action(s_storeDone, "s", desc="local store done") { 49614184Sgabeblack@google.com assert(is_valid(cache_entry)); 49714184Sgabeblack@google.com if (use_seq_not_coal) { 49814184Sgabeblack@google.com coalescer.recordCPWriteCallBack(machineID, machineID); 49914184Sgabeblack@google.com sequencer.writeCallback(address, cache_entry.DataBlk, 50014184Sgabeblack@google.com false, MachineType:TCP); 50114184Sgabeblack@google.com } else { 50214184Sgabeblack@google.com coalescer.writeCallback(address, MachineType:TCP, cache_entry.DataBlk); 50314184Sgabeblack@google.com } 50414184Sgabeblack@google.com cache_entry.Dirty := true; 50514184Sgabeblack@google.com } 50614184Sgabeblack@google.com 50714184Sgabeblack@google.com action(xs_storeDone, "xs", desc="remote store done") { 50814184Sgabeblack@google.com peek(responseToTCP_in, ResponseMsg) { 50914184Sgabeblack@google.com assert(is_valid(cache_entry)); 51014184Sgabeblack@google.com if (use_seq_not_coal) { 51114184Sgabeblack@google.com coalescer.recordCPWriteCallBack(machineID, in_msg.Sender); 51214184Sgabeblack@google.com sequencer.writeCallback(address, 51314184Sgabeblack@google.com cache_entry.DataBlk, 51414184Sgabeblack@google.com false, 51514184Sgabeblack@google.com machineIDToMachineType(in_msg.Sender), 51614184Sgabeblack@google.com in_msg.InitialRequestTime, 51714184Sgabeblack@google.com in_msg.ForwardRequestTime, 51814184Sgabeblack@google.com in_msg.ProbeRequestStartTime); 51914184Sgabeblack@google.com } else { 52014184Sgabeblack@google.com MachineType cc_mach_type := getCoherenceType(machineID, 52114184Sgabeblack@google.com in_msg.Sender); 52214184Sgabeblack@google.com coalescer.writeCallback(address, 52314184Sgabeblack@google.com cc_mach_type, 52414184Sgabeblack@google.com cache_entry.DataBlk, 52514184Sgabeblack@google.com in_msg.InitialRequestTime, 52614184Sgabeblack@google.com in_msg.ForwardRequestTime, 52714184Sgabeblack@google.com in_msg.ProbeRequestStartTime); 52814184Sgabeblack@google.com } 52914184Sgabeblack@google.com cache_entry.Dirty := true; 53014184Sgabeblack@google.com } 53114184Sgabeblack@google.com } 53214184Sgabeblack@google.com 53314184Sgabeblack@google.com action(w_writeCache, "w", desc="write data to cache") { 53414184Sgabeblack@google.com peek(responseToTCP_in, ResponseMsg) { 53514184Sgabeblack@google.com assert(is_valid(cache_entry)); 53614184Sgabeblack@google.com cache_entry.DataBlk := in_msg.DataBlk; 53714184Sgabeblack@google.com cache_entry.Dirty := in_msg.Dirty; 53814184Sgabeblack@google.com } 53914184Sgabeblack@google.com } 54014184Sgabeblack@google.com 54114184Sgabeblack@google.com action(ss_sendStaleNotification, "ss", desc="stale data; nothing to writeback") { 54214184Sgabeblack@google.com peek(responseToTCP_in, ResponseMsg) { 54314184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, issue_latency) { 54414184Sgabeblack@google.com out_msg.addr := address; 54514184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:StaleNotif; 54614184Sgabeblack@google.com out_msg.Sender := machineID; 54714184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address,MachineType:TCC, 54814184Sgabeblack@google.com TCC_select_low_bit, TCC_select_num_bits)); 54914184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Control; 55014184Sgabeblack@google.com DPRINTF(RubySlicc, "%s\n", out_msg); 55114184Sgabeblack@google.com } 55214184Sgabeblack@google.com } 55314184Sgabeblack@google.com } 55414184Sgabeblack@google.com 55514184Sgabeblack@google.com action(wb_data, "wb", desc="write back data") { 55614184Sgabeblack@google.com peek(responseToTCP_in, ResponseMsg) { 55714184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, issue_latency) { 55814184Sgabeblack@google.com out_msg.addr := address; 55914184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:CPUData; 56014184Sgabeblack@google.com out_msg.Sender := machineID; 56114184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address,MachineType:TCC, 56214184Sgabeblack@google.com TCC_select_low_bit, TCC_select_num_bits)); 56314184Sgabeblack@google.com out_msg.DataBlk := tbe.DataBlk; 56414184Sgabeblack@google.com out_msg.Dirty := tbe.Dirty; 56514184Sgabeblack@google.com if (tbe.Shared) { 56614184Sgabeblack@google.com out_msg.NbReqShared := true; 56714184Sgabeblack@google.com } else { 56814184Sgabeblack@google.com out_msg.NbReqShared := false; 56914184Sgabeblack@google.com } 57014184Sgabeblack@google.com out_msg.State := CoherenceState:Shared; // faux info 57114184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Writeback_Data; 57214184Sgabeblack@google.com DPRINTF(RubySlicc, "%s\n", out_msg); 57314184Sgabeblack@google.com } 57414184Sgabeblack@google.com } 57514184Sgabeblack@google.com } 57614184Sgabeblack@google.com 57714184Sgabeblack@google.com action(piu_sendProbeResponseInvUntransferredOwnership, "piu", desc="send probe ack inv, no data, retain ownership") { 57814184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, issue_latency) { 57914184Sgabeblack@google.com out_msg.addr := address; 58014184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:CPUPrbResp; // TCC, L3 respond in same way to probes 58114184Sgabeblack@google.com out_msg.Sender := machineID; 58214184Sgabeblack@google.com // will this always be ok? probably not for multisocket 58314184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir, 58414184Sgabeblack@google.com TCC_select_low_bit, TCC_select_num_bits)); 58514184Sgabeblack@google.com out_msg.Dirty := false; 58614184Sgabeblack@google.com out_msg.Hit := false; 58714184Sgabeblack@google.com out_msg.Ntsl := true; 58814184Sgabeblack@google.com out_msg.State := CoherenceState:NA; 58914184Sgabeblack@google.com out_msg.UntransferredOwner :=true; 59014184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Control; 59114184Sgabeblack@google.com } 59214184Sgabeblack@google.com } 59314184Sgabeblack@google.com 59414184Sgabeblack@google.com action(pi_sendProbeResponseInv, "pi", desc="send probe ack inv, no data") { 59514184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, issue_latency) { 59614184Sgabeblack@google.com out_msg.addr := address; 59714184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:CPUPrbResp; // TCC, L3 respond in same way to probes 59814184Sgabeblack@google.com out_msg.Sender := machineID; 59914184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir, 60014184Sgabeblack@google.com TCC_select_low_bit, TCC_select_num_bits)); 60114184Sgabeblack@google.com out_msg.Dirty := false; 60214184Sgabeblack@google.com out_msg.Hit := false; 60314184Sgabeblack@google.com out_msg.Ntsl := true; 60414184Sgabeblack@google.com out_msg.State := CoherenceState:NA; 60514184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Control; 60614184Sgabeblack@google.com out_msg.isValid := isValid(address); 60714184Sgabeblack@google.com } 60814184Sgabeblack@google.com } 60914184Sgabeblack@google.com 61014184Sgabeblack@google.com action(pim_sendProbeResponseInvMs, "pim", desc="send probe ack inv, no data") { 61114184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, issue_latency) { 61214184Sgabeblack@google.com out_msg.addr := address; 61314184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:CPUPrbResp; // L3 and TCC respond in same way to probes 61414184Sgabeblack@google.com out_msg.Sender := machineID; 61514184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir, 61614184Sgabeblack@google.com TCC_select_low_bit, TCC_select_num_bits)); 61714184Sgabeblack@google.com out_msg.Dirty := false; 61814184Sgabeblack@google.com out_msg.Ntsl := true; 61914184Sgabeblack@google.com out_msg.Hit := false; 62014184Sgabeblack@google.com out_msg.State := CoherenceState:NA; 62114184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Control; 62214184Sgabeblack@google.com out_msg.isValid := isValid(address); 62314184Sgabeblack@google.com } 62414184Sgabeblack@google.com } 62514184Sgabeblack@google.com 62614184Sgabeblack@google.com action(prm_sendProbeResponseMiss, "prm", desc="send probe ack PrbShrData, no data") { 62714184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, issue_latency) { 62814184Sgabeblack@google.com out_msg.addr := address; 62914184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:CPUPrbResp; // L3 and TCC respond in same way to probes 63014184Sgabeblack@google.com out_msg.Sender := machineID; 63114184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir, 63214184Sgabeblack@google.com TCC_select_low_bit, TCC_select_num_bits)); 63314184Sgabeblack@google.com out_msg.Dirty := false; // only true if sending back data i think 63414184Sgabeblack@google.com out_msg.Hit := false; 63514184Sgabeblack@google.com out_msg.Ntsl := false; 63614184Sgabeblack@google.com out_msg.State := CoherenceState:NA; 63714184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Control; 63814184Sgabeblack@google.com out_msg.isValid := isValid(address); 63914184Sgabeblack@google.com } 64014184Sgabeblack@google.com } 64114184Sgabeblack@google.com 64214184Sgabeblack@google.com action(pd_sendProbeResponseData, "pd", desc="send probe ack, with data") { 64314184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, issue_latency) { 64414184Sgabeblack@google.com assert(is_valid(cache_entry) || is_valid(tbe)); 64514184Sgabeblack@google.com out_msg.addr := address; 64614184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:CPUPrbResp; 64714184Sgabeblack@google.com out_msg.Sender := machineID; 64814184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir, 64914184Sgabeblack@google.com TCC_select_low_bit, TCC_select_num_bits)); 65014184Sgabeblack@google.com out_msg.DataBlk := getDataBlock(address); 65114184Sgabeblack@google.com if (is_valid(tbe)) { 65214184Sgabeblack@google.com out_msg.Dirty := tbe.Dirty; 65314184Sgabeblack@google.com } else { 65414184Sgabeblack@google.com out_msg.Dirty := cache_entry.Dirty; 65514184Sgabeblack@google.com } 65614184Sgabeblack@google.com out_msg.Hit := true; 65714184Sgabeblack@google.com out_msg.State := CoherenceState:NA; 65814184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 65914184Sgabeblack@google.com out_msg.isValid := isValid(address); 66014184Sgabeblack@google.com APPEND_TRANSITION_COMMENT("Sending ack with dirty "); 66114184Sgabeblack@google.com APPEND_TRANSITION_COMMENT(out_msg.Dirty); 66214184Sgabeblack@google.com } 66314184Sgabeblack@google.com } 66414184Sgabeblack@google.com 66514184Sgabeblack@google.com action(pdm_sendProbeResponseDataMs, "pdm", desc="send probe ack, with data") { 66614184Sgabeblack@google.com enqueue(responseNetwork_out, ResponseMsg, issue_latency) { 66714184Sgabeblack@google.com assert(is_valid(cache_entry) || is_valid(tbe)); 66814184Sgabeblack@google.com assert(is_valid(cache_entry)); 66914184Sgabeblack@google.com out_msg.addr := address; 67014184Sgabeblack@google.com out_msg.Type := CoherenceResponseType:CPUPrbResp; 67114184Sgabeblack@google.com out_msg.Sender := machineID; 67214184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir, 67314184Sgabeblack@google.com TCC_select_low_bit, TCC_select_num_bits)); 67414184Sgabeblack@google.com out_msg.DataBlk := getDataBlock(address); 67514184Sgabeblack@google.com if (is_valid(tbe)) { 67614184Sgabeblack@google.com out_msg.Dirty := tbe.Dirty; 67714184Sgabeblack@google.com } else { 67814184Sgabeblack@google.com out_msg.Dirty := cache_entry.Dirty; 67914184Sgabeblack@google.com } 68014184Sgabeblack@google.com out_msg.Hit := true; 68114184Sgabeblack@google.com out_msg.State := CoherenceState:NA; 68214184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Response_Data; 68314184Sgabeblack@google.com out_msg.isValid := isValid(address); 68414184Sgabeblack@google.com APPEND_TRANSITION_COMMENT("Sending ack with dirty "); 68514184Sgabeblack@google.com APPEND_TRANSITION_COMMENT(out_msg.Dirty); 68614184Sgabeblack@google.com DPRINTF(RubySlicc, "Data is %s\n", out_msg.DataBlk); 68714184Sgabeblack@google.com } 68814184Sgabeblack@google.com } 68914184Sgabeblack@google.com 69014184Sgabeblack@google.com action(sf_setSharedFlip, "sf", desc="hit by shared probe, status may be different") { 69114184Sgabeblack@google.com assert(is_valid(tbe)); 69214184Sgabeblack@google.com tbe.Shared := true; 69314184Sgabeblack@google.com } 69414184Sgabeblack@google.com 69514184Sgabeblack@google.com action(mru_updateMRU, "mru", desc="Touch block for replacement policy") { 69614184Sgabeblack@google.com L1cache.setMRU(address); 69714184Sgabeblack@google.com } 69814184Sgabeblack@google.com 69914184Sgabeblack@google.com action(uu_sendUnblock, "uu", desc="state changed, unblock") { 70014184Sgabeblack@google.com enqueue(unblockNetwork_out, UnblockMsg, issue_latency) { 70114184Sgabeblack@google.com out_msg.addr := address; 70214184Sgabeblack@google.com out_msg.Sender := machineID; 70314184Sgabeblack@google.com out_msg.Destination.add(mapAddressToRange(address,MachineType:TCCdir, 70414184Sgabeblack@google.com TCC_select_low_bit, TCC_select_num_bits)); 70514184Sgabeblack@google.com out_msg.MessageSize := MessageSizeType:Unblock_Control; 70614184Sgabeblack@google.com out_msg.wasValid := isValid(address); 70714184Sgabeblack@google.com DPRINTF(RubySlicc, "%s\n", out_msg); 70814184Sgabeblack@google.com } 70914184Sgabeblack@google.com } 71014184Sgabeblack@google.com 71114184Sgabeblack@google.com action(yy_recycleProbeQueue, "yy", desc="recycle probe queue") { 71214184Sgabeblack@google.com probeNetwork_in.recycle(clockEdge(), cyclesToTicks(recycle_latency)); 71314184Sgabeblack@google.com } 71414184Sgabeblack@google.com 71514184Sgabeblack@google.com action(zz_recycleMandatoryQueue, "\z", desc="recycle mandatory queue") { 71614184Sgabeblack@google.com mandatoryQueue_in.recycle(clockEdge(), cyclesToTicks(recycle_latency)); 71714184Sgabeblack@google.com } 71814184Sgabeblack@google.com 71914184Sgabeblack@google.com // Transitions 72014184Sgabeblack@google.com 72114184Sgabeblack@google.com // transitions from base 72214184Sgabeblack@google.com transition(I, Load, I_ES) {TagArrayRead} { 72314184Sgabeblack@google.com a_allocate; 72414184Sgabeblack@google.com n_issueRdBlk; 72514184Sgabeblack@google.com p_popMandatoryQueue; 72614184Sgabeblack@google.com } 72714184Sgabeblack@google.com 72814184Sgabeblack@google.com transition(I, Store, I_M) {TagArrayRead, TagArrayWrite} { 72914184Sgabeblack@google.com a_allocate; 73014184Sgabeblack@google.com nM_issueRdBlkM; 73114184Sgabeblack@google.com p_popMandatoryQueue; 73214184Sgabeblack@google.com } 73314184Sgabeblack@google.com 73414184Sgabeblack@google.com transition(S, Store, S_M) {TagArrayRead} { 73514184Sgabeblack@google.com mru_updateMRU; 73614184Sgabeblack@google.com nM_issueRdBlkM; 73714184Sgabeblack@google.com p_popMandatoryQueue; 73814184Sgabeblack@google.com } 73914184Sgabeblack@google.com 74014184Sgabeblack@google.com transition(E, Store, M) {TagArrayRead, TagArrayWrite, DataArrayWrite} { 74114184Sgabeblack@google.com mru_updateMRU; 74214184Sgabeblack@google.com s_storeDone; 74314184Sgabeblack@google.com p_popMandatoryQueue; 74414184Sgabeblack@google.com } 74514184Sgabeblack@google.com 74614184Sgabeblack@google.com transition(O, Store, O_M) {TagArrayRead, DataArrayWrite} { 74714184Sgabeblack@google.com mru_updateMRU; 74814184Sgabeblack@google.com nM_issueRdBlkM; 74914184Sgabeblack@google.com p_popMandatoryQueue; 75014184Sgabeblack@google.com } 75114184Sgabeblack@google.com 75214184Sgabeblack@google.com transition(M, Store) {TagArrayRead, DataArrayWrite} { 75314184Sgabeblack@google.com mru_updateMRU; 75414184Sgabeblack@google.com s_storeDone; 75514184Sgabeblack@google.com p_popMandatoryQueue; 75614184Sgabeblack@google.com } 75714184Sgabeblack@google.com 75814184Sgabeblack@google.com // simple hit transitions 75914184Sgabeblack@google.com transition({S, E, O, M}, Load) {TagArrayRead, DataArrayRead} { 76014184Sgabeblack@google.com l_loadDone; 76114184Sgabeblack@google.com mru_updateMRU; 76214184Sgabeblack@google.com p_popMandatoryQueue; 76314184Sgabeblack@google.com } 76414184Sgabeblack@google.com 76514184Sgabeblack@google.com // recycles from transients 76614184Sgabeblack@google.com transition({I_M, I_ES, ES_I, MO_I, S_M, O_M, MO_PI, I_C}, {Load, Store, Repl}) {} { 76714184Sgabeblack@google.com zz_recycleMandatoryQueue; 76814184Sgabeblack@google.com } 76914184Sgabeblack@google.com 77014184Sgabeblack@google.com transition({S, E}, Repl, ES_I) {TagArrayRead} { 77114184Sgabeblack@google.com t_allocateTBE; 77214184Sgabeblack@google.com vc_victim; 77314184Sgabeblack@google.com ic_invCache; 77414184Sgabeblack@google.com } 77514184Sgabeblack@google.com 77614184Sgabeblack@google.com transition({O, M}, Repl, MO_I) {TagArrayRead, DataArrayRead} { 77714184Sgabeblack@google.com t_allocateTBE; 77814184Sgabeblack@google.com vd_victim; 77914184Sgabeblack@google.com ic_invCache; 78014184Sgabeblack@google.com } 78114184Sgabeblack@google.com 78214184Sgabeblack@google.com // TD event transitions 78314184Sgabeblack@google.com transition(I_M, {TCC_AckM, TCC_AckCtoD}, M) {TagArrayRead, TagArrayWrite, DataArrayWrite} { 78414184Sgabeblack@google.com w_writeCache; 78514184Sgabeblack@google.com xs_storeDone; 78614184Sgabeblack@google.com uu_sendUnblock; 78714184Sgabeblack@google.com pr_popResponseQueue; 78814184Sgabeblack@google.com } 78914184Sgabeblack@google.com 79014184Sgabeblack@google.com transition(I_ES, TCC_AckS, S) {TagArrayWrite, DataArrayWrite} { 79114184Sgabeblack@google.com w_writeCache; 79214184Sgabeblack@google.com xl_loadDone; 79314184Sgabeblack@google.com uu_sendUnblock; 79414184Sgabeblack@google.com pr_popResponseQueue; 79514184Sgabeblack@google.com } 79614184Sgabeblack@google.com 79714184Sgabeblack@google.com transition(I_ES, TCC_AckE, E) {TagArrayWrite, DataArrayWrite} { 79814184Sgabeblack@google.com w_writeCache; 79914184Sgabeblack@google.com xl_loadDone; 80014184Sgabeblack@google.com uu_sendUnblock; 80114184Sgabeblack@google.com pr_popResponseQueue; 80214184Sgabeblack@google.com } 80314184Sgabeblack@google.com 80414184Sgabeblack@google.com transition({S_M, O_M}, TCC_AckM, M) {TagArrayWrite, DataArrayWrite} { 80514184Sgabeblack@google.com xs_storeDone; 80614184Sgabeblack@google.com uu_sendUnblock; 80714184Sgabeblack@google.com pr_popResponseQueue; 80814184Sgabeblack@google.com } 80914184Sgabeblack@google.com 81014184Sgabeblack@google.com transition({MO_I, ES_I}, TCC_NackWB, I){TagArrayWrite} { 81114184Sgabeblack@google.com d_deallocateTBE; 81214184Sgabeblack@google.com pr_popResponseQueue; 81314184Sgabeblack@google.com } 81414184Sgabeblack@google.com 81514184Sgabeblack@google.com transition({MO_I, ES_I}, TCC_AckWB, I) {TagArrayWrite, DataArrayRead} { 81614184Sgabeblack@google.com wb_data; 81714184Sgabeblack@google.com d_deallocateTBE; 81814184Sgabeblack@google.com pr_popResponseQueue; 81914184Sgabeblack@google.com } 82014184Sgabeblack@google.com 82114184Sgabeblack@google.com transition(I_C, TCC_AckWB, I) {TagArrayWrite} { 82214184Sgabeblack@google.com ss_sendStaleNotification; 82314184Sgabeblack@google.com d_deallocateTBE; 82414184Sgabeblack@google.com pr_popResponseQueue; 82514184Sgabeblack@google.com } 82614184Sgabeblack@google.com 82714184Sgabeblack@google.com transition(I_C, TCC_NackWB, I) {TagArrayWrite} { 82814184Sgabeblack@google.com d_deallocateTBE; 82914184Sgabeblack@google.com pr_popResponseQueue; 83014184Sgabeblack@google.com } 83114184Sgabeblack@google.com 83214184Sgabeblack@google.com // Probe transitions 83314184Sgabeblack@google.com transition({M, O}, PrbInvData, I) {TagArrayRead, TagArrayWrite} { 83414184Sgabeblack@google.com pd_sendProbeResponseData; 83514184Sgabeblack@google.com ic_invCache; 83614184Sgabeblack@google.com pp_popProbeQueue; 83714184Sgabeblack@google.com } 83814184Sgabeblack@google.com 83914184Sgabeblack@google.com transition(I, PrbInvData) {TagArrayRead, TagArrayWrite} { 84014184Sgabeblack@google.com prm_sendProbeResponseMiss; 84114184Sgabeblack@google.com pp_popProbeQueue; 84214184Sgabeblack@google.com } 84314184Sgabeblack@google.com 84414184Sgabeblack@google.com transition({E, S}, PrbInvData, I) {TagArrayRead, TagArrayWrite} { 84514184Sgabeblack@google.com pd_sendProbeResponseData; 84614184Sgabeblack@google.com ic_invCache; 84714184Sgabeblack@google.com pp_popProbeQueue; 84814184Sgabeblack@google.com } 84914184Sgabeblack@google.com 85014184Sgabeblack@google.com transition(I_C, PrbInvData, I_C) {} { 85114184Sgabeblack@google.com pi_sendProbeResponseInv; 85214184Sgabeblack@google.com ic_invCache; 85314184Sgabeblack@google.com pp_popProbeQueue; 85414184Sgabeblack@google.com } 85514184Sgabeblack@google.com 85614184Sgabeblack@google.com // Needed for TCC-based protocols. Must hold on to ownership till transfer complete 85714184Sgabeblack@google.com transition({M, O}, LocalPrbInv, MO_PI){TagArrayRead, TagArrayWrite} { 85814184Sgabeblack@google.com piu_sendProbeResponseInvUntransferredOwnership; 85914184Sgabeblack@google.com pp_popProbeQueue; 86014184Sgabeblack@google.com } 86114184Sgabeblack@google.com 86214184Sgabeblack@google.com // If there is a race and we see a probe invalidate, handle normally. 86314184Sgabeblack@google.com transition(MO_PI, PrbInvData, I){TagArrayWrite} { 86414184Sgabeblack@google.com pd_sendProbeResponseData; 86514184Sgabeblack@google.com ic_invCache; 86614184Sgabeblack@google.com pp_popProbeQueue; 86714184Sgabeblack@google.com } 86814184Sgabeblack@google.com 86914184Sgabeblack@google.com transition(MO_PI, PrbInv, I){TagArrayWrite} { 87014184Sgabeblack@google.com pi_sendProbeResponseInv; 87114184Sgabeblack@google.com ic_invCache; 87214184Sgabeblack@google.com pp_popProbeQueue; 87314184Sgabeblack@google.com } 87414184Sgabeblack@google.com 87514184Sgabeblack@google.com // normal exit when ownership is successfully transferred 87614184Sgabeblack@google.com transition(MO_PI, TCC_AckCtoD, I) {TagArrayWrite} { 87714184Sgabeblack@google.com ic_invCache; 87814184Sgabeblack@google.com pr_popResponseQueue; 87914184Sgabeblack@google.com } 88014184Sgabeblack@google.com 88114184Sgabeblack@google.com transition({M, O, E, S, I}, PrbInv, I) {TagArrayRead, TagArrayWrite} { 88214184Sgabeblack@google.com pi_sendProbeResponseInv; 88314184Sgabeblack@google.com ic_invCache; 88414184Sgabeblack@google.com pp_popProbeQueue; 88514184Sgabeblack@google.com } 88614184Sgabeblack@google.com 88714184Sgabeblack@google.com transition({E, S, I}, LocalPrbInv, I){TagArrayRead, TagArrayWrite} { 88814184Sgabeblack@google.com pi_sendProbeResponseInv; 88914184Sgabeblack@google.com ic_invCache; 89014184Sgabeblack@google.com pp_popProbeQueue; 89114184Sgabeblack@google.com } 89214184Sgabeblack@google.com 89314184Sgabeblack@google.com 89414184Sgabeblack@google.com transition({M, E, O}, PrbShrData, O) {TagArrayRead, TagArrayWrite, DataArrayRead} { 89514184Sgabeblack@google.com pd_sendProbeResponseData; 89614184Sgabeblack@google.com pp_popProbeQueue; 89714184Sgabeblack@google.com } 89814184Sgabeblack@google.com 89914184Sgabeblack@google.com transition(MO_PI, PrbShrData) {DataArrayRead} { 90014184Sgabeblack@google.com pd_sendProbeResponseData; 90114184Sgabeblack@google.com pp_popProbeQueue; 90214184Sgabeblack@google.com } 90314184Sgabeblack@google.com 90414184Sgabeblack@google.com 90514184Sgabeblack@google.com transition(S, PrbShrData, S) {TagArrayRead, DataArrayRead} { 90614184Sgabeblack@google.com pd_sendProbeResponseData; 90714184Sgabeblack@google.com pp_popProbeQueue; 90814184Sgabeblack@google.com } 90914184Sgabeblack@google.com 91014184Sgabeblack@google.com transition({I, I_C}, PrbShrData) {TagArrayRead} { 91114184Sgabeblack@google.com prm_sendProbeResponseMiss; 91214184Sgabeblack@google.com pp_popProbeQueue; 91314184Sgabeblack@google.com } 91414184Sgabeblack@google.com 91514184Sgabeblack@google.com transition(I_C, PrbInv, I_C) {} { 91614184Sgabeblack@google.com pi_sendProbeResponseInv; 91714184Sgabeblack@google.com ic_invCache; 91814184Sgabeblack@google.com pp_popProbeQueue; 91914184Sgabeblack@google.com } 92014184Sgabeblack@google.com 92114184Sgabeblack@google.com transition({I_M, I_ES}, {PrbInv, PrbInvData}){TagArrayRead} { 92214184Sgabeblack@google.com pi_sendProbeResponseInv; 92314184Sgabeblack@google.com ic_invCache; 92414184Sgabeblack@google.com a_allocate; // but make sure there is room for incoming data when it arrives 92514184Sgabeblack@google.com pp_popProbeQueue; 92614184Sgabeblack@google.com } 92714184Sgabeblack@google.com 92814184Sgabeblack@google.com transition({I_M, I_ES}, PrbShrData) {} { 92914184Sgabeblack@google.com prm_sendProbeResponseMiss; 93014184Sgabeblack@google.com pp_popProbeQueue; 93114184Sgabeblack@google.com } 93214184Sgabeblack@google.com 93314184Sgabeblack@google.com transition(S_M, PrbInvData, I_M) {TagArrayRead} { 93414184Sgabeblack@google.com pim_sendProbeResponseInvMs; 93514184Sgabeblack@google.com ic_invCache; 93614184Sgabeblack@google.com a_allocate; 93714184Sgabeblack@google.com pp_popProbeQueue; 93814184Sgabeblack@google.com } 93914184Sgabeblack@google.com 94014184Sgabeblack@google.com transition(O_M, PrbInvData, I_M) {TagArrayRead,DataArrayRead} { 94114184Sgabeblack@google.com pdm_sendProbeResponseDataMs; 94214184Sgabeblack@google.com ic_invCache; 94314184Sgabeblack@google.com a_allocate; 94414184Sgabeblack@google.com pp_popProbeQueue; 94514184Sgabeblack@google.com } 94614184Sgabeblack@google.com 94714184Sgabeblack@google.com transition({S_M, O_M}, {PrbInv}, I_M) {TagArrayRead} { 94814184Sgabeblack@google.com pim_sendProbeResponseInvMs; 94914184Sgabeblack@google.com ic_invCache; 95014184Sgabeblack@google.com a_allocate; 95114184Sgabeblack@google.com pp_popProbeQueue; 95214184Sgabeblack@google.com } 95314184Sgabeblack@google.com 95414184Sgabeblack@google.com transition(S_M, {LocalPrbInv}, I_M) {TagArrayRead} { 95514184Sgabeblack@google.com pim_sendProbeResponseInvMs; 95614184Sgabeblack@google.com ic_invCache; 95714184Sgabeblack@google.com a_allocate; 95814184Sgabeblack@google.com pp_popProbeQueue; 95914184Sgabeblack@google.com } 96014184Sgabeblack@google.com 96114184Sgabeblack@google.com transition(O_M, LocalPrbInv, I_M) {TagArrayRead} { 96214184Sgabeblack@google.com piu_sendProbeResponseInvUntransferredOwnership; 96314184Sgabeblack@google.com ic_invCache; 96414184Sgabeblack@google.com a_allocate; 96514184Sgabeblack@google.com pp_popProbeQueue; 96614184Sgabeblack@google.com } 96714184Sgabeblack@google.com 96814184Sgabeblack@google.com transition({S_M, O_M}, PrbShrData) {DataArrayRead} { 96914184Sgabeblack@google.com pd_sendProbeResponseData; 97014184Sgabeblack@google.com pp_popProbeQueue; 97114184Sgabeblack@google.com } 97214184Sgabeblack@google.com 97314184Sgabeblack@google.com transition(ES_I, PrbInvData, I_C){ 97414184Sgabeblack@google.com pd_sendProbeResponseData; 97514184Sgabeblack@google.com ic_invCache; 97614184Sgabeblack@google.com pp_popProbeQueue; 97714184Sgabeblack@google.com } 97814184Sgabeblack@google.com 97914184Sgabeblack@google.com transition(MO_I, PrbInvData, I_C) {DataArrayRead} { 98014184Sgabeblack@google.com pd_sendProbeResponseData; 98114184Sgabeblack@google.com ic_invCache; 98214184Sgabeblack@google.com pp_popProbeQueue; 98314184Sgabeblack@google.com } 98414184Sgabeblack@google.com 98514184Sgabeblack@google.com transition(MO_I, PrbInv, I_C) { 98614184Sgabeblack@google.com pi_sendProbeResponseInv; 98714184Sgabeblack@google.com ic_invCache; 98814184Sgabeblack@google.com pp_popProbeQueue; 98914184Sgabeblack@google.com } 99014184Sgabeblack@google.com 99114184Sgabeblack@google.com transition(ES_I, PrbInv, I_C) { 99214184Sgabeblack@google.com pi_sendProbeResponseInv; 99314184Sgabeblack@google.com ic_invCache; 99414184Sgabeblack@google.com pp_popProbeQueue; 99514184Sgabeblack@google.com } 99614184Sgabeblack@google.com 99714184Sgabeblack@google.com transition(ES_I, PrbShrData, ES_I) {DataArrayRead} { 99814184Sgabeblack@google.com pd_sendProbeResponseData; 99914184Sgabeblack@google.com sf_setSharedFlip; 100014184Sgabeblack@google.com pp_popProbeQueue; 100114184Sgabeblack@google.com } 100214184Sgabeblack@google.com 100314184Sgabeblack@google.com transition(MO_I, PrbShrData, MO_I) {DataArrayRead} { 100414184Sgabeblack@google.com pd_sendProbeResponseData; 100514184Sgabeblack@google.com sf_setSharedFlip; 100614184Sgabeblack@google.com pp_popProbeQueue; 100714184Sgabeblack@google.com } 100814184Sgabeblack@google.com 100914184Sgabeblack@google.com} 1010