3 * Copyright (c) 1999-2005 Mark D. Hill and David A. Wood
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer;
10 * redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution;
13 * neither the name of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * $Id: MOESI_CMP_token-L1cache.sm 1.22 05/01/19 15:55:39-06:00 beckmann@s0-28.cs.wisc.edu $
35 machine(L1Cache, "Token protocol")
36 : Sequencer * sequencer,
37 CacheMemory * L1IcacheMemory,
38 CacheMemory * L1DcacheMemory,
39 int l2_select_num_bits,
41 int l1_request_latency = 2,
42 int l1_response_latency = 2,
43 int retry_threshold = 1,
44 int fixed_timeout_latency = 100,
45 bool dynamic_timeout_enabled = true,
46 bool no_mig_atomic = true
49 // From this node's L1 cache TO the network
51 // a local L1 -> this L2 bank
52 MessageBuffer responseFromL1Cache, network="To", virtual_network="4", ordered="false";
53 MessageBuffer persistentFromL1Cache, network="To", virtual_network="3", ordered="true";
54 // a local L1 -> this L2 bank, currently ordered with directory forwarded requests
55 MessageBuffer requestFromL1Cache, network="To", virtual_network="1", ordered="false";
58 // To this node's L1 cache FROM the network
59 // a L2 bank -> this L1
60 MessageBuffer responseToL1Cache, network="From", virtual_network="4", ordered="false";
61 MessageBuffer persistentToL1Cache, network="From", virtual_network="3", ordered="true";
62 // a L2 bank -> this L1
63 MessageBuffer requestToL1Cache, network="From", virtual_network="1", ordered="false";
66 enumeration(State, desc="Cache states", default="L1Cache_State_I") {
68 NP, "NP", desc="Not Present";
70 S, "S", desc="Shared";
72 M, "M", desc="Modified (dirty)";
73 MM, "MM", desc="Modified (dirty and locally modified)";
74 M_W, "M^W", desc="Modified (dirty), waiting";
75 MM_W, "MM^W", desc="Modified (dirty and locally modified), waiting";
78 IM, "IM", desc="Issued GetX";
79 SM, "SM", desc="Issued GetX, we still have an old copy of the line";
80 OM, "OM", desc="Issued GetX, received data";
81 IS, "IS", desc="Issued GetS";
84 I_L, "I^L", desc="Invalid, Locked";
85 S_L, "S^L", desc="Shared, Locked";
86 IM_L, "IM^L", desc="Invalid, Locked, trying to go to Modified";
87 SM_L, "SM^L", desc="Shared, Locked, trying to go to Modified";
88 IS_L, "IS^L", desc="Invalid, Locked, trying to go to Shared";
92 enumeration(Event, desc="Cache events") {
93 Load, desc="Load request from the processor";
94 Ifetch, desc="I-fetch request from the processor";
95 Store, desc="Store request from the processor";
96 Atomic, desc="Atomic request from the processor";
97 L1_Replacement, desc="L1 Replacement";
100 Data_Shared, desc="Received a data message, we are now a sharer";
101 Data_Owner, desc="Received a data message, we are now the owner";
102 Data_All_Tokens, desc="Received a data message, we are now the owner, we now have all the tokens";
103 Ack, desc="Received an ack message";
104 Ack_All_Tokens, desc="Received an ack message, we now have all the tokens";
107 Transient_GETX, desc="A GetX from another processor";
108 Transient_Local_GETX, desc="A GetX from another processor";
109 Transient_GETS, desc="A GetS from another processor";
110 Transient_Local_GETS, desc="A GetS from another processor";
111 Transient_GETS_Last_Token, desc="A GetS from another processor";
112 Transient_Local_GETS_Last_Token, desc="A GetS from another processor";
114 // Lock/Unlock for distributed
115 Persistent_GETX, desc="Another processor has priority to read/write";
116 Persistent_GETS, desc="Another processor has priority to read";
117 Persistent_GETS_Last_Token, desc="Another processor has priority to read, no more tokens";
118 Own_Lock_or_Unlock, desc="This processor now has priority";
121 Request_Timeout, desc="Timeout";
122 Use_TimeoutStarverX, desc="Timeout";
123 Use_TimeoutStarverS, desc="Timeout";
124 Use_TimeoutNoStarvers, desc="Timeout";
125 Use_TimeoutNoStarvers_NoMig, desc="Timeout Don't Migrate";
131 structure(Entry, desc="...", interface="AbstractCacheEntry") {
132 State CacheState, desc="cache state";
133 bool Dirty, desc="Is the data dirty (different than memory)?";
134 int Tokens, desc="The number of tokens we're holding for the line";
135 DataBlock DataBlk, desc="data for the block";
140 structure(TBE, desc="...") {
141 Address Address, desc="Physical address for this TBE";
142 State TBEState, desc="Transient state";
143 int IssueCount, default="0", desc="The number of times we've issued a request for this line.";
144 Address PC, desc="Program counter of request";
146 bool WentPersistent, default="false", desc="Request went persistent";
147 bool ExternalResponse, default="false", desc="Response came from an external controller";
148 bool IsAtomic, default="false", desc="Request was an atomic request";
150 AccessType AccessType, desc="Type of request (used for profiling)";
151 Time IssueTime, desc="Time the request was issued";
152 AccessModeType AccessMode, desc="user/supervisor access type";
153 PrefetchBit Prefetch, desc="Is this a prefetch request";
156 external_type(TBETable) {
158 void allocate(Address);
159 void deallocate(Address);
160 bool isPresent(Address);
163 external_type(PersistentTable) {
164 void persistentRequestLock(Address, MachineID, AccessType);
165 void persistentRequestUnlock(Address, MachineID);
166 bool okToIssueStarving(Address, MachineID);
167 MachineID findSmallest(Address);
168 AccessType typeOfSmallest(Address);
169 void markEntries(Address);
170 bool isLocked(Address);
171 int countStarvingForAddress(Address);
172 int countReadStarvingForAddress(Address);
175 void set_cache_entry(AbstractCacheEntry b);
176 void unset_cache_entry();
180 TBETable L1_TBEs, template_hack="<L1Cache_TBE>";
182 MessageBuffer mandatoryQueue, ordered="false", abstract_chip_ptr="true";
184 bool starving, default="false";
185 int l2_select_low_bit, default="RubySystem::getBlockSizeBits()";
187 PersistentTable persistentTable;
188 TimerTable useTimerTable;
189 TimerTable reissueTimerTable;
191 int outstandingRequests, default="0";
192 int outstandingPersistentRequests, default="0";
194 int averageLatencyHysteresis, default="(8)"; // Constant that provides hysteresis for calculated the estimated average
195 int averageLatencyCounter, default="(500 << (*m_L1Cache_averageLatencyHysteresis_ptr))";
197 int averageLatencyEstimate() {
198 DPRINTF(RubySlicc, "%d\n",
199 (averageLatencyCounter >> averageLatencyHysteresis));
200 //profile_average_latency_estimate( (averageLatencyCounter >> averageLatencyHysteresis) );
201 return averageLatencyCounter >> averageLatencyHysteresis;
204 void updateAverageLatencyEstimate(int latency) {
205 DPRINTF(RubySlicc, "%d\n", latency);
206 assert(latency >= 0);
208 // By subtracting the current average and then adding the most
209 // recent sample, we calculate an estimate of the recent average.
210 // If we simply used a running sum and divided by the total number
211 // of entries, the estimate of the average would adapt very slowly
212 // after the execution has run for a long time.
213 // averageLatencyCounter := averageLatencyCounter - averageLatencyEstimate() + latency;
215 averageLatencyCounter := averageLatencyCounter - averageLatencyEstimate() + latency;
218 Entry getCacheEntry(Address addr), return_by_pointer="yes" {
219 Entry L1Dcache_entry := static_cast(Entry, "pointer", L1DcacheMemory.lookup(addr));
220 if(is_valid(L1Dcache_entry)) {
221 return L1Dcache_entry;
224 Entry L1Icache_entry := static_cast(Entry, "pointer", L1IcacheMemory.lookup(addr));
225 return L1Icache_entry;
228 Entry getL1DCacheEntry(Address addr), return_by_pointer="yes" {
229 Entry L1Dcache_entry := static_cast(Entry, "pointer", L1DcacheMemory.lookup(addr));
230 return L1Dcache_entry;
233 Entry getL1ICacheEntry(Address addr), return_by_pointer="yes" {
234 Entry L1Icache_entry := static_cast(Entry, "pointer", L1IcacheMemory.lookup(addr));
235 return L1Icache_entry;
238 int getTokens(Entry cache_entry) {
239 if (is_valid(cache_entry)) {
240 return cache_entry.Tokens;
245 State getState(TBE tbe, Entry cache_entry, Address addr) {
249 } else if (is_valid(cache_entry)) {
250 return cache_entry.CacheState;
252 if ((persistentTable.isLocked(addr) == true) && (persistentTable.findSmallest(addr) != machineID)) {
253 // Not in cache, in persistent table, but this processor isn't highest priority
261 void setState(TBE tbe, Entry cache_entry, Address addr, State state) {
262 assert((L1DcacheMemory.isTagPresent(addr) && L1IcacheMemory.isTagPresent(addr)) == false);
265 assert(state != State:I);
266 assert(state != State:S);
267 assert(state != State:O);
268 assert(state != State:MM);
269 assert(state != State:M);
270 tbe.TBEState := state;
273 if (is_valid(cache_entry)) {
274 // Make sure the token count is in range
275 assert(cache_entry.Tokens >= 0);
276 assert(cache_entry.Tokens <= max_tokens());
277 assert(cache_entry.Tokens != (max_tokens() / 2));
279 if ((state == State:I_L) ||
280 (state == State:IM_L) ||
281 (state == State:IS_L)) {
282 // Make sure we have no tokens in the "Invalid, locked" states
283 assert(cache_entry.Tokens == 0);
285 // Make sure the line is locked
286 // assert(persistentTable.isLocked(addr));
288 // But we shouldn't have highest priority for it
289 // assert(persistentTable.findSmallest(addr) != id);
291 } else if ((state == State:S_L) ||
292 (state == State:SM_L)) {
293 assert(cache_entry.Tokens >= 1);
294 assert(cache_entry.Tokens < (max_tokens() / 2));
296 // Make sure the line is locked...
297 // assert(persistentTable.isLocked(addr));
299 // ...But we shouldn't have highest priority for it...
300 // assert(persistentTable.findSmallest(addr) != id);
302 // ...And it must be a GETS request
303 // assert(persistentTable.typeOfSmallest(addr) == AccessType:Read);
307 // If there is an entry in the persistent table of this block,
308 // this processor needs to have an entry in the table for this
309 // block, and that entry better be the smallest (highest
310 // priority). Otherwise, the state should have been one of
313 //if (persistentTable.isLocked(addr)) {
314 // assert(persistentTable.findSmallest(addr) == id);
318 // in M and E you have all the tokens
319 if (state == State:MM || state == State:M || state == State:MM_W || state == State:M_W) {
320 assert(cache_entry.Tokens == max_tokens());
323 // in NP you have no tokens
324 if (state == State:NP) {
325 assert(cache_entry.Tokens == 0);
328 // You have at least one token in S-like states
329 if (state == State:S || state == State:SM) {
330 assert(cache_entry.Tokens > 0);
333 // You have at least half the token in O-like states
334 if (state == State:O && state == State:OM) {
335 assert(cache_entry.Tokens > (max_tokens() / 2));
338 cache_entry.CacheState := state;
341 if (state == State:MM ||
342 state == State:MM_W) {
343 cache_entry.changePermission(AccessPermission:Read_Write);
344 } else if ((state == State:S) ||
345 (state == State:O) ||
346 (state == State:M) ||
347 (state == State:M_W) ||
348 (state == State:SM) ||
349 (state == State:S_L) ||
350 (state == State:SM_L) ||
351 (state == State:OM)) {
352 cache_entry.changePermission(AccessPermission:Read_Only);
354 cache_entry.changePermission(AccessPermission:Invalid);
359 Event mandatory_request_type_to_event(CacheRequestType type) {
360 if (type == CacheRequestType:LD) {
362 } else if (type == CacheRequestType:IFETCH) {
364 } else if (type == CacheRequestType:ST) {
366 } else if (type == CacheRequestType:ATOMIC) {
373 error("Invalid CacheRequestType");
377 AccessType cache_request_type_to_access_type(CacheRequestType type) {
378 if ((type == CacheRequestType:LD) || (type == CacheRequestType:IFETCH)) {
379 return AccessType:Read;
380 } else if ((type == CacheRequestType:ST) || (type == CacheRequestType:ATOMIC)) {
381 return AccessType:Write;
383 error("Invalid CacheRequestType");
387 GenericMachineType getNondirectHitMachType(Address addr, MachineID sender) {
388 if (machineIDToMachineType(sender) == MachineType:L1Cache) {
390 // NOTE direct local hits should not call this
392 return GenericMachineType:L1Cache_wCC;
393 } else if (machineIDToMachineType(sender) == MachineType:L2Cache) {
395 if (sender == (mapAddressToRange(addr,
398 l2_select_num_bits))) {
400 return GenericMachineType:L2Cache;
402 return GenericMachineType:L2Cache_wCC;
405 return ConvertMachToGenericMach(machineIDToMachineType(sender));
409 bool okToIssueStarving(Address addr, MachineID machinID) {
410 return persistentTable.okToIssueStarving(addr, machineID);
413 void markPersistentEntries(Address addr) {
414 persistentTable.markEntries(addr);
417 void setExternalResponse(TBE tbe) {
418 assert(is_valid(tbe));
419 tbe.ExternalResponse := true;
422 bool IsAtomic(TBE tbe) {
423 assert(is_valid(tbe));
428 out_port(persistentNetwork_out, PersistentMsg, persistentFromL1Cache);
429 out_port(requestNetwork_out, RequestMsg, requestFromL1Cache);
430 out_port(responseNetwork_out, ResponseMsg, responseFromL1Cache);
431 out_port(requestRecycle_out, RequestMsg, requestToL1Cache);
436 in_port(useTimerTable_in, Address, useTimerTable, rank=5) {
437 if (useTimerTable_in.isReady()) {
438 TBE tbe := L1_TBEs[useTimerTable.readyAddress()];
440 if (persistentTable.isLocked(useTimerTable.readyAddress()) &&
441 (persistentTable.findSmallest(useTimerTable.readyAddress()) != machineID)) {
442 if (persistentTable.typeOfSmallest(useTimerTable.readyAddress()) == AccessType:Write) {
443 trigger(Event:Use_TimeoutStarverX, useTimerTable.readyAddress(),
444 getCacheEntry(useTimerTable.readyAddress()), tbe);
446 trigger(Event:Use_TimeoutStarverS, useTimerTable.readyAddress(),
447 getCacheEntry(useTimerTable.readyAddress()), tbe);
450 if (no_mig_atomic && IsAtomic(tbe)) {
451 trigger(Event:Use_TimeoutNoStarvers_NoMig, useTimerTable.readyAddress(),
452 getCacheEntry(useTimerTable.readyAddress()), tbe);
454 trigger(Event:Use_TimeoutNoStarvers, useTimerTable.readyAddress(),
455 getCacheEntry(useTimerTable.readyAddress()), tbe);
462 in_port(reissueTimerTable_in, Address, reissueTimerTable, rank=4) {
463 if (reissueTimerTable_in.isReady()) {
464 trigger(Event:Request_Timeout, reissueTimerTable.readyAddress(),
465 getCacheEntry(reissueTimerTable.readyAddress()),
466 L1_TBEs[reissueTimerTable.readyAddress()]);
470 // Persistent Network
471 in_port(persistentNetwork_in, PersistentMsg, persistentToL1Cache, rank=3) {
472 if (persistentNetwork_in.isReady()) {
473 peek(persistentNetwork_in, PersistentMsg, block_on="Address") {
474 assert(in_msg.Destination.isElement(machineID));
476 // Apply the lockdown or unlockdown message to the table
477 if (in_msg.Type == PersistentRequestType:GETX_PERSISTENT) {
478 persistentTable.persistentRequestLock(in_msg.Address, in_msg.Requestor, AccessType:Write);
479 } else if (in_msg.Type == PersistentRequestType:GETS_PERSISTENT) {
480 persistentTable.persistentRequestLock(in_msg.Address, in_msg.Requestor, AccessType:Read);
481 } else if (in_msg.Type == PersistentRequestType:DEACTIVATE_PERSISTENT) {
482 persistentTable.persistentRequestUnlock(in_msg.Address, in_msg.Requestor);
484 error("Unexpected message");
487 // React to the message based on the current state of the table
488 Entry cache_entry := getCacheEntry(in_msg.Address);
489 TBE tbe := L1_TBEs[in_msg.Address];
491 if (persistentTable.isLocked(in_msg.Address)) {
492 if (persistentTable.findSmallest(in_msg.Address) == machineID) {
493 // Our Own Lock - this processor is highest priority
494 trigger(Event:Own_Lock_or_Unlock, in_msg.Address,
497 if (persistentTable.typeOfSmallest(in_msg.Address) == AccessType:Read) {
498 if (getTokens(cache_entry) == 1 ||
499 getTokens(cache_entry) == (max_tokens() / 2) + 1) {
500 trigger(Event:Persistent_GETS_Last_Token, in_msg.Address,
503 trigger(Event:Persistent_GETS, in_msg.Address,
507 trigger(Event:Persistent_GETX, in_msg.Address,
512 // Unlock case - no entries in the table
513 trigger(Event:Own_Lock_or_Unlock, in_msg.Address,
521 in_port(responseNetwork_in, ResponseMsg, responseToL1Cache, rank=2) {
522 if (responseNetwork_in.isReady()) {
523 peek(responseNetwork_in, ResponseMsg, block_on="Address") {
524 assert(in_msg.Destination.isElement(machineID));
526 Entry cache_entry := getCacheEntry(in_msg.Address);
527 TBE tbe := L1_TBEs[in_msg.Address];
529 // Mark TBE flag if response received off-chip. Use this to update average latency estimate
530 if ( machineIDToMachineType(in_msg.Sender) == MachineType:L2Cache ) {
532 if (in_msg.Sender == mapAddressToRange(in_msg.Address,
535 l2_select_num_bits)) {
537 // came from an off-chip L2 cache
539 // L1_TBEs[in_msg.Address].ExternalResponse := true;
540 // profile_offchipL2_response(in_msg.Address);
544 // profile_onchipL2_response(in_msg.Address );
546 } else if ( machineIDToMachineType(in_msg.Sender) == MachineType:Directory ) {
548 setExternalResponse(tbe);
549 // profile_memory_response( in_msg.Address);
551 } else if ( machineIDToMachineType(in_msg.Sender) == MachineType:L1Cache) {
552 //if (isLocalProcessor(machineID, in_msg.Sender) == false) {
553 //if (is_valid(tbe)) {
554 // tbe.ExternalResponse := true;
555 // profile_offchipL1_response(in_msg.Address );
559 // profile_onchipL1_response(in_msg.Address );
562 error("unexpected SenderMachine");
566 if (getTokens(cache_entry) + in_msg.Tokens != max_tokens()) {
567 if (in_msg.Type == CoherenceResponseType:ACK) {
568 assert(in_msg.Tokens < (max_tokens() / 2));
569 trigger(Event:Ack, in_msg.Address, cache_entry, tbe);
570 } else if (in_msg.Type == CoherenceResponseType:DATA_OWNER) {
571 trigger(Event:Data_Owner, in_msg.Address, cache_entry, tbe);
572 } else if (in_msg.Type == CoherenceResponseType:DATA_SHARED) {
573 assert(in_msg.Tokens < (max_tokens() / 2));
574 trigger(Event:Data_Shared, in_msg.Address, cache_entry, tbe);
576 error("Unexpected message");
579 if (in_msg.Type == CoherenceResponseType:ACK) {
580 assert(in_msg.Tokens < (max_tokens() / 2));
581 trigger(Event:Ack_All_Tokens, in_msg.Address, cache_entry, tbe);
582 } else if (in_msg.Type == CoherenceResponseType:DATA_OWNER || in_msg.Type == CoherenceResponseType:DATA_SHARED) {
583 trigger(Event:Data_All_Tokens, in_msg.Address, cache_entry, tbe);
585 error("Unexpected message");
593 in_port(requestNetwork_in, RequestMsg, requestToL1Cache) {
594 if (requestNetwork_in.isReady()) {
595 peek(requestNetwork_in, RequestMsg, block_on="Address") {
596 assert(in_msg.Destination.isElement(machineID));
598 Entry cache_entry := getCacheEntry(in_msg.Address);
599 TBE tbe := L1_TBEs[in_msg.Address];
601 if (in_msg.Type == CoherenceRequestType:GETX) {
602 if (in_msg.isLocal) {
603 trigger(Event:Transient_Local_GETX, in_msg.Address,
607 trigger(Event:Transient_GETX, in_msg.Address,
610 } else if (in_msg.Type == CoherenceRequestType:GETS) {
611 if (getTokens(cache_entry) == 1 ||
612 getTokens(cache_entry) == (max_tokens() / 2) + 1) {
613 if (in_msg.isLocal) {
614 trigger(Event:Transient_Local_GETS_Last_Token, in_msg.Address,
618 trigger(Event:Transient_GETS_Last_Token, in_msg.Address,
623 if (in_msg.isLocal) {
624 trigger(Event:Transient_Local_GETS, in_msg.Address,
628 trigger(Event:Transient_GETS, in_msg.Address,
633 error("Unexpected message");
640 in_port(mandatoryQueue_in, CacheMsg, mandatoryQueue, desc="...", rank=0) {
641 if (mandatoryQueue_in.isReady()) {
642 peek(mandatoryQueue_in, CacheMsg, block_on="LineAddress") {
643 // Check for data access to blocks in I-cache and ifetchs to blocks in D-cache
645 TBE tbe := L1_TBEs[in_msg.LineAddress];
647 if (in_msg.Type == CacheRequestType:IFETCH) {
648 // ** INSTRUCTION ACCESS ***
650 Entry L1Icache_entry := getL1ICacheEntry(in_msg.LineAddress);
651 if (is_valid(L1Icache_entry)) {
652 // The tag matches for the L1, so the L1 fetches the line. We know it can't be in the L2 due to exclusion
653 trigger(mandatory_request_type_to_event(in_msg.Type),
654 in_msg.LineAddress, L1Icache_entry, tbe);
657 // Check to see if it is in the OTHER L1
658 Entry L1Dcache_entry := getL1DCacheEntry(in_msg.LineAddress);
659 if (is_valid(L1Dcache_entry)) {
660 // The block is in the wrong L1, try to write it to the L2
661 trigger(Event:L1_Replacement, in_msg.LineAddress,
662 L1Dcache_entry, tbe);
665 if (L1IcacheMemory.cacheAvail(in_msg.LineAddress)) {
666 // L1 does't have the line, but we have space for it in the L1
667 trigger(mandatory_request_type_to_event(in_msg.Type),
668 in_msg.LineAddress, L1Icache_entry, tbe);
670 // No room in the L1, so we need to make room
671 trigger(Event:L1_Replacement,
672 L1IcacheMemory.cacheProbe(in_msg.LineAddress),
673 getL1ICacheEntry(L1IcacheMemory.cacheProbe(in_msg.LineAddress)),
674 L1_TBEs[L1IcacheMemory.cacheProbe(in_msg.LineAddress)]);
678 // *** DATA ACCESS ***
680 Entry L1Dcache_entry := getL1DCacheEntry(in_msg.LineAddress);
681 if (is_valid(L1Dcache_entry)) {
682 // The tag matches for the L1, so the L1 fetches the line. We know it can't be in the L2 due to exclusion
683 trigger(mandatory_request_type_to_event(in_msg.Type),
684 in_msg.LineAddress, L1Dcache_entry, tbe);
687 // Check to see if it is in the OTHER L1
688 Entry L1Icache_entry := getL1ICacheEntry(in_msg.LineAddress);
689 if (is_valid(L1Icache_entry)) {
690 // The block is in the wrong L1, try to write it to the L2
691 trigger(Event:L1_Replacement, in_msg.LineAddress,
692 L1Icache_entry, tbe);
695 if (L1DcacheMemory.cacheAvail(in_msg.LineAddress)) {
696 // L1 does't have the line, but we have space for it in the L1
697 trigger(mandatory_request_type_to_event(in_msg.Type),
698 in_msg.LineAddress, L1Dcache_entry, tbe);
700 // No room in the L1, so we need to make room
701 trigger(Event:L1_Replacement,
702 L1DcacheMemory.cacheProbe(in_msg.LineAddress),
703 getL1DCacheEntry(L1DcacheMemory.cacheProbe(in_msg.LineAddress)),
704 L1_TBEs[L1DcacheMemory.cacheProbe(in_msg.LineAddress)]);
714 action(a_issueReadRequest, "a", desc="Issue GETS") {
715 assert(is_valid(tbe));
716 if (tbe.IssueCount == 0) {
717 // Update outstanding requests
718 //profile_outstanding_request(outstandingRequests);
719 outstandingRequests := outstandingRequests + 1;
722 if (tbe.IssueCount >= retry_threshold) {
723 // Issue a persistent request if possible
724 if (okToIssueStarving(address, machineID) && (starving == false)) {
725 enqueue(persistentNetwork_out, PersistentMsg, latency = l1_request_latency) {
726 out_msg.Address := address;
727 out_msg.Type := PersistentRequestType:GETS_PERSISTENT;
728 out_msg.Requestor := machineID;
729 out_msg.Destination.broadcast(MachineType:L1Cache);
732 // Currently the configuration system limits the system to only one
733 // chip. Therefore, if we assume one shared L2 cache, then only one
734 // pertinent L2 cache exist.
736 //out_msg.Destination.addNetDest(getAllPertinentL2Banks(address));
738 out_msg.Destination.add(mapAddressToRange(address,
741 l2_select_num_bits));
743 out_msg.Destination.add(map_Address_to_Directory(address));
744 out_msg.MessageSize := MessageSizeType:Persistent_Control;
745 out_msg.Prefetch := tbe.Prefetch;
746 out_msg.AccessMode := tbe.AccessMode;
748 markPersistentEntries(address);
751 if (tbe.IssueCount == 0) {
752 //profile_persistent_prediction(address, tbe.AccessType);
755 // Update outstanding requests
756 //profile_outstanding_persistent_request(outstandingPersistentRequests);
757 outstandingPersistentRequests := outstandingPersistentRequests + 1;
759 // Increment IssueCount
760 tbe.IssueCount := tbe.IssueCount + 1;
762 tbe.WentPersistent := true;
764 // Do not schedule a wakeup, a persistent requests will always complete
768 // We'd like to issue a persistent request, but are not allowed
769 // to issue a P.R. right now. This, we do not increment the
772 // Set a wakeup timer
773 reissueTimerTable.set(address, 10);
777 // Make a normal request
778 enqueue(requestNetwork_out, RequestMsg, latency = l1_request_latency) {
779 out_msg.Address := address;
780 out_msg.Type := CoherenceRequestType:GETS;
781 out_msg.Requestor := machineID;
782 out_msg.Destination.add(mapAddressToRange(address,
785 l2_select_num_bits));
787 out_msg.RetryNum := tbe.IssueCount;
788 if (tbe.IssueCount == 0) {
789 out_msg.MessageSize := MessageSizeType:Request_Control;
791 out_msg.MessageSize := MessageSizeType:Reissue_Control;
793 out_msg.Prefetch := tbe.Prefetch;
794 out_msg.AccessMode := tbe.AccessMode;
797 // send to other local L1s, with local bit set
798 enqueue(requestNetwork_out, RequestMsg, latency = l1_request_latency) {
799 out_msg.Address := address;
800 out_msg.Type := CoherenceRequestType:GETS;
801 out_msg.Requestor := machineID;
803 // Since only one chip, assuming all L1 caches are local
805 //out_msg.Destination := getOtherLocalL1IDs(machineID);
806 out_msg.Destination.broadcast(MachineType:L1Cache);
807 out_msg.Destination.remove(machineID);
809 out_msg.RetryNum := tbe.IssueCount;
810 out_msg.isLocal := true;
811 if (tbe.IssueCount == 0) {
812 out_msg.MessageSize := MessageSizeType:Broadcast_Control;
814 out_msg.MessageSize := MessageSizeType:Broadcast_Control;
816 out_msg.Prefetch := tbe.Prefetch;
817 out_msg.AccessMode := tbe.AccessMode;
820 // Increment IssueCount
821 tbe.IssueCount := tbe.IssueCount + 1;
823 // Set a wakeup timer
825 if (dynamic_timeout_enabled) {
826 reissueTimerTable.set(address, 1.25 * averageLatencyEstimate());
828 reissueTimerTable.set(address, fixed_timeout_latency);
834 action(b_issueWriteRequest, "b", desc="Issue GETX") {
836 assert(is_valid(tbe));
837 if (tbe.IssueCount == 0) {
838 // Update outstanding requests
839 //profile_outstanding_request(outstandingRequests);
840 outstandingRequests := outstandingRequests + 1;
843 if (tbe.IssueCount >= retry_threshold) {
844 // Issue a persistent request if possible
845 if ( okToIssueStarving(address, machineID) && (starving == false)) {
846 enqueue(persistentNetwork_out, PersistentMsg, latency = l1_request_latency) {
847 out_msg.Address := address;
848 out_msg.Type := PersistentRequestType:GETX_PERSISTENT;
849 out_msg.Requestor := machineID;
850 out_msg.Destination.broadcast(MachineType:L1Cache);
853 // Currently the configuration system limits the system to only one
854 // chip. Therefore, if we assume one shared L2 cache, then only one
855 // pertinent L2 cache exist.
857 //out_msg.Destination.addNetDest(getAllPertinentL2Banks(address));
859 out_msg.Destination.add(mapAddressToRange(address,
862 l2_select_num_bits));
864 out_msg.Destination.add(map_Address_to_Directory(address));
865 out_msg.MessageSize := MessageSizeType:Persistent_Control;
866 out_msg.Prefetch := tbe.Prefetch;
867 out_msg.AccessMode := tbe.AccessMode;
869 markPersistentEntries(address);
872 // Update outstanding requests
873 //profile_outstanding_persistent_request(outstandingPersistentRequests);
874 outstandingPersistentRequests := outstandingPersistentRequests + 1;
876 if (tbe.IssueCount == 0) {
877 //profile_persistent_prediction(address, tbe.AccessType);
880 // Increment IssueCount
881 tbe.IssueCount := tbe.IssueCount + 1;
883 tbe.WentPersistent := true;
885 // Do not schedule a wakeup, a persistent requests will always complete
889 // We'd like to issue a persistent request, but are not allowed
890 // to issue a P.R. right now. This, we do not increment the
893 // Set a wakeup timer
894 reissueTimerTable.set(address, 10);
899 // Make a normal request
900 enqueue(requestNetwork_out, RequestMsg, latency = l1_request_latency) {
901 out_msg.Address := address;
902 out_msg.Type := CoherenceRequestType:GETX;
903 out_msg.Requestor := machineID;
905 out_msg.Destination.add(mapAddressToRange(address,
908 l2_select_num_bits));
910 out_msg.RetryNum := tbe.IssueCount;
912 if (tbe.IssueCount == 0) {
913 out_msg.MessageSize := MessageSizeType:Request_Control;
915 out_msg.MessageSize := MessageSizeType:Reissue_Control;
917 out_msg.Prefetch := tbe.Prefetch;
918 out_msg.AccessMode := tbe.AccessMode;
921 // send to other local L1s too
922 enqueue(requestNetwork_out, RequestMsg, latency = l1_request_latency) {
923 out_msg.Address := address;
924 out_msg.Type := CoherenceRequestType:GETX;
925 out_msg.Requestor := machineID;
926 out_msg.isLocal := true;
929 // Since only one chip, assuming all L1 caches are local
931 //out_msg.Destination := getOtherLocalL1IDs(machineID);
932 out_msg.Destination.broadcast(MachineType:L1Cache);
933 out_msg.Destination.remove(machineID);
935 out_msg.RetryNum := tbe.IssueCount;
936 if (tbe.IssueCount == 0) {
937 out_msg.MessageSize := MessageSizeType:Broadcast_Control;
939 out_msg.MessageSize := MessageSizeType:Broadcast_Control;
941 out_msg.Prefetch := tbe.Prefetch;
942 out_msg.AccessMode := tbe.AccessMode;
945 // Increment IssueCount
946 tbe.IssueCount := tbe.IssueCount + 1;
948 DPRINTF(RubySlicc, "incremented issue count to %d\n",
951 // Set a wakeup timer
952 if (dynamic_timeout_enabled) {
953 reissueTimerTable.set(address, 1.25 * averageLatencyEstimate());
955 reissueTimerTable.set(address, fixed_timeout_latency);
960 action(bb_bounceResponse, "\b", desc="Bounce tokens and data to memory") {
961 peek(responseNetwork_in, ResponseMsg) {
962 // FIXME, should use a 3rd vnet
963 enqueue(responseNetwork_out, ResponseMsg, latency="1") {
964 out_msg.Address := address;
965 out_msg.Type := in_msg.Type;
966 out_msg.Sender := machineID;
967 out_msg.Destination.add(map_Address_to_Directory(address));
968 out_msg.Tokens := in_msg.Tokens;
969 out_msg.MessageSize := in_msg.MessageSize;
970 out_msg.DataBlk := in_msg.DataBlk;
971 out_msg.Dirty := in_msg.Dirty;
976 action(c_ownedReplacement, "c", desc="Issue writeback") {
977 assert(is_valid(cache_entry));
978 enqueue(responseNetwork_out, ResponseMsg, latency = l1_response_latency) {
979 out_msg.Address := address;
980 out_msg.Sender := machineID;
982 out_msg.Destination.add(mapAddressToRange(address,
985 l2_select_num_bits));
987 out_msg.Tokens := cache_entry.Tokens;
988 out_msg.DataBlk := cache_entry.DataBlk;
989 out_msg.Dirty := cache_entry.Dirty;
990 out_msg.Type := CoherenceResponseType:WB_OWNED;
992 // always send the data?
993 out_msg.MessageSize := MessageSizeType:Writeback_Data;
995 cache_entry.Tokens := 0;
998 action(cc_sharedReplacement, "\c", desc="Issue shared writeback") {
1000 // don't send writeback if replacing block with no tokens
1001 assert(is_valid(cache_entry));
1002 assert (cache_entry.Tokens > 0);
1003 enqueue(responseNetwork_out, ResponseMsg, latency = l1_response_latency) {
1004 out_msg.Address := address;
1005 out_msg.Sender := machineID;
1007 out_msg.Destination.add(mapAddressToRange(address,
1008 MachineType:L2Cache,
1010 l2_select_num_bits));
1012 out_msg.Tokens := cache_entry.Tokens;
1013 out_msg.DataBlk := cache_entry.DataBlk;
1014 // assert(cache_entry.Dirty == false);
1015 out_msg.Dirty := false;
1017 out_msg.MessageSize := MessageSizeType:Writeback_Data;
1018 out_msg.Type := CoherenceResponseType:WB_SHARED_DATA;
1020 cache_entry.Tokens := 0;
1023 action(tr_tokenReplacement, "tr", desc="Issue token writeback") {
1024 assert(is_valid(cache_entry));
1025 if (cache_entry.Tokens > 0) {
1026 enqueue(responseNetwork_out, ResponseMsg, latency = l1_response_latency) {
1027 out_msg.Address := address;
1028 out_msg.Sender := machineID;
1030 out_msg.Destination.add(mapAddressToRange(address,
1031 MachineType:L2Cache,
1033 l2_select_num_bits));
1035 out_msg.Tokens := cache_entry.Tokens;
1036 out_msg.DataBlk := cache_entry.DataBlk;
1037 // assert(cache_entry.Dirty == false);
1038 out_msg.Dirty := false;
1040 // always send the data?
1041 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1042 out_msg.Type := CoherenceResponseType:WB_TOKENS;
1045 cache_entry.Tokens := 0;
1049 action(d_sendDataWithToken, "d", desc="Send data and a token from cache to requestor") {
1050 assert(is_valid(cache_entry));
1051 peek(requestNetwork_in, RequestMsg) {
1052 enqueue(responseNetwork_out, ResponseMsg, latency = l1_response_latency) {
1053 out_msg.Address := address;
1054 out_msg.Type := CoherenceResponseType:DATA_SHARED;
1055 out_msg.Sender := machineID;
1056 out_msg.Destination.add(in_msg.Requestor);
1057 out_msg.Tokens := 1;
1058 out_msg.DataBlk := cache_entry.DataBlk;
1059 // out_msg.Dirty := cache_entry.Dirty;
1060 out_msg.Dirty := false;
1061 if (in_msg.isLocal) {
1062 out_msg.MessageSize := MessageSizeType:ResponseLocal_Data;
1064 out_msg.MessageSize := MessageSizeType:Response_Data;
1068 cache_entry.Tokens := cache_entry.Tokens - 1;
1069 assert(cache_entry.Tokens >= 1);
1072 action(d_sendDataWithNTokenIfAvail, "\dd", desc="Send data and a token from cache to requestor") {
1073 assert(is_valid(cache_entry));
1074 peek(requestNetwork_in, RequestMsg) {
1075 if (cache_entry.Tokens > (N_tokens + (max_tokens() / 2))) {
1076 enqueue(responseNetwork_out, ResponseMsg, latency = l1_response_latency) {
1077 out_msg.Address := address;
1078 out_msg.Type := CoherenceResponseType:DATA_SHARED;
1079 out_msg.Sender := machineID;
1080 out_msg.Destination.add(in_msg.Requestor);
1081 out_msg.Tokens := N_tokens;
1082 out_msg.DataBlk := cache_entry.DataBlk;
1083 // out_msg.Dirty := cache_entry.Dirty;
1084 out_msg.Dirty := false;
1085 if (in_msg.isLocal) {
1086 out_msg.MessageSize := MessageSizeType:ResponseLocal_Data;
1088 out_msg.MessageSize := MessageSizeType:Response_Data;
1091 cache_entry.Tokens := cache_entry.Tokens - N_tokens;
1093 else if (cache_entry.Tokens > 1) {
1094 enqueue(responseNetwork_out, ResponseMsg, latency = l1_response_latency) {
1095 out_msg.Address := address;
1096 out_msg.Type := CoherenceResponseType:DATA_SHARED;
1097 out_msg.Sender := machineID;
1098 out_msg.Destination.add(in_msg.Requestor);
1099 out_msg.Tokens := 1;
1100 out_msg.DataBlk := cache_entry.DataBlk;
1101 // out_msg.Dirty := cache_entry.Dirty;
1102 out_msg.Dirty := false;
1103 if (in_msg.isLocal) {
1104 out_msg.MessageSize := MessageSizeType:ResponseLocal_Data;
1106 out_msg.MessageSize := MessageSizeType:Response_Data;
1109 cache_entry.Tokens := cache_entry.Tokens - 1;
1112 // assert(cache_entry.Tokens >= 1);
1115 action(dd_sendDataWithAllTokens, "\d", desc="Send data and all tokens from cache to requestor") {
1116 peek(requestNetwork_in, RequestMsg) {
1117 assert(is_valid(cache_entry));
1118 enqueue(responseNetwork_out, ResponseMsg, latency = l1_response_latency) {
1119 out_msg.Address := address;
1120 out_msg.Type := CoherenceResponseType:DATA_OWNER;
1121 out_msg.Sender := machineID;
1122 out_msg.Destination.add(in_msg.Requestor);
1123 assert(cache_entry.Tokens > (max_tokens() / 2));
1124 out_msg.Tokens := cache_entry.Tokens;
1125 out_msg.DataBlk := cache_entry.DataBlk;
1126 out_msg.Dirty := cache_entry.Dirty;
1127 if (in_msg.isLocal) {
1128 out_msg.MessageSize := MessageSizeType:ResponseLocal_Data;
1130 out_msg.MessageSize := MessageSizeType:Response_Data;
1134 cache_entry.Tokens := 0;
1137 action(e_sendAckWithCollectedTokens, "e", desc="Send ack with the tokens we've collected thus far.") {
1138 // assert(persistentTable.findSmallest(address) != id); // Make sure we never bounce tokens to ourself
1139 assert(is_valid(cache_entry));
1140 if (cache_entry.Tokens > 0) {
1141 enqueue(responseNetwork_out, ResponseMsg, latency = l1_response_latency) {
1142 out_msg.Address := address;
1143 if (cache_entry.Tokens > (max_tokens() / 2)) {
1144 out_msg.Type := CoherenceResponseType:DATA_OWNER;
1146 out_msg.Type := CoherenceResponseType:ACK;
1148 out_msg.Sender := machineID;
1149 out_msg.Destination.add(persistentTable.findSmallest(address));
1150 assert(cache_entry.Tokens >= 1);
1151 out_msg.Tokens := cache_entry.Tokens;
1152 out_msg.DataBlk := cache_entry.DataBlk;
1153 out_msg.MessageSize := MessageSizeType:Response_Control;
1156 cache_entry.Tokens := 0;
1159 action(ee_sendDataWithAllTokens, "\e", desc="Send data and all tokens from cache to starver") {
1160 //assert(persistentTable.findSmallest(address) != id); // Make sure we never bounce tokens to ourself
1161 assert(is_valid(cache_entry));
1162 assert(cache_entry.Tokens > 0);
1163 enqueue(responseNetwork_out, ResponseMsg, latency = l1_response_latency) {
1164 out_msg.Address := address;
1165 out_msg.Type := CoherenceResponseType:DATA_OWNER;
1166 out_msg.Sender := machineID;
1167 out_msg.Destination.add(persistentTable.findSmallest(address));
1168 assert(cache_entry.Tokens > (max_tokens() / 2));
1169 out_msg.Tokens := cache_entry.Tokens;
1170 out_msg.DataBlk := cache_entry.DataBlk;
1171 out_msg.Dirty := cache_entry.Dirty;
1172 out_msg.MessageSize := MessageSizeType:Response_Data;
1174 cache_entry.Tokens := 0;
1177 action(f_sendAckWithAllButNorOneTokens, "f", desc="Send ack with all our tokens but one to starver.") {
1178 //assert(persistentTable.findSmallest(address) != id); // Make sure we never bounce tokens to ourself
1179 assert(is_valid(cache_entry));
1180 assert(cache_entry.Tokens > 0);
1181 if (cache_entry.Tokens > 1) {
1182 enqueue(responseNetwork_out, ResponseMsg, latency = l1_response_latency) {
1183 out_msg.Address := address;
1184 if (cache_entry.Tokens > (max_tokens() / 2)) {
1185 out_msg.Type := CoherenceResponseType:DATA_OWNER;
1187 out_msg.Type := CoherenceResponseType:ACK;
1189 out_msg.Sender := machineID;
1190 out_msg.Destination.add(persistentTable.findSmallest(address));
1191 assert(cache_entry.Tokens >= 1);
1192 if (cache_entry.Tokens > N_tokens) {
1193 out_msg.Tokens := cache_entry.Tokens - N_tokens;
1195 out_msg.Tokens := cache_entry.Tokens - 1;
1197 out_msg.DataBlk := cache_entry.DataBlk;
1198 out_msg.MessageSize := MessageSizeType:Response_Control;
1201 if (cache_entry.Tokens > N_tokens) {
1202 cache_entry.Tokens := N_tokens;
1204 cache_entry.Tokens := 1;
1208 action(ff_sendDataWithAllButNorOneTokens, "\f", desc="Send data and out tokens but one to starver") {
1209 //assert(persistentTable.findSmallest(address) != id); // Make sure we never bounce tokens to ourself
1210 assert(is_valid(cache_entry));
1211 assert(cache_entry.Tokens > ((max_tokens() / 2) + 1));
1212 enqueue(responseNetwork_out, ResponseMsg, latency = l1_response_latency) {
1213 out_msg.Address := address;
1214 out_msg.Type := CoherenceResponseType:DATA_OWNER;
1215 out_msg.Sender := machineID;
1216 out_msg.Destination.add(persistentTable.findSmallest(address));
1217 if (cache_entry.Tokens > (N_tokens + (max_tokens() / 2))) {
1218 out_msg.Tokens := cache_entry.Tokens - N_tokens;
1220 out_msg.Tokens := cache_entry.Tokens - 1;
1222 assert(out_msg.Tokens > (max_tokens() / 2));
1223 out_msg.DataBlk := cache_entry.DataBlk;
1224 out_msg.Dirty := cache_entry.Dirty;
1225 out_msg.MessageSize := MessageSizeType:Response_Data;
1227 if (cache_entry.Tokens > (N_tokens + (max_tokens() / 2))) {
1228 cache_entry.Tokens := N_tokens;
1230 cache_entry.Tokens := 1;
1234 action(fo_sendDataWithOwnerToken, "fo", desc="Send data and owner tokens") {
1235 assert(is_valid(cache_entry));
1236 assert(cache_entry.Tokens == ((max_tokens() / 2) + 1));
1237 enqueue(responseNetwork_out, ResponseMsg, latency = l1_response_latency) {
1238 out_msg.Address := address;
1239 out_msg.Type := CoherenceResponseType:DATA_OWNER;
1240 out_msg.Sender := machineID;
1241 out_msg.Destination.add(persistentTable.findSmallest(address));
1242 out_msg.Tokens := cache_entry.Tokens;
1243 assert(out_msg.Tokens > (max_tokens() / 2));
1244 out_msg.DataBlk := cache_entry.DataBlk;
1245 out_msg.Dirty := cache_entry.Dirty;
1246 out_msg.MessageSize := MessageSizeType:Response_Data;
1248 cache_entry.Tokens := 0;
1251 action(g_bounceResponseToStarver, "g", desc="Redirect response to starving processor") {
1252 // assert(persistentTable.isLocked(address));
1254 peek(responseNetwork_in, ResponseMsg) {
1255 // assert(persistentTable.findSmallest(address) != id); // Make sure we never bounce tokens to ourself
1256 // FIXME, should use a 3rd vnet in some cases
1257 enqueue(responseNetwork_out, ResponseMsg, latency="1") {
1258 out_msg.Address := address;
1259 out_msg.Type := in_msg.Type;
1260 out_msg.Sender := machineID;
1261 out_msg.Destination.add(persistentTable.findSmallest(address));
1262 out_msg.Tokens := in_msg.Tokens;
1263 out_msg.DataBlk := in_msg.DataBlk;
1264 out_msg.Dirty := in_msg.Dirty;
1265 out_msg.MessageSize := in_msg.MessageSize;
1271 action(h_load_hit, "h", desc="Notify sequencer the load completed.") {
1272 assert(is_valid(cache_entry));
1273 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
1274 address, cache_entry.DataBlk);
1276 sequencer.readCallback(address,
1277 GenericMachineType:L1Cache,
1278 cache_entry.DataBlk);
1282 action(x_external_load_hit, "x", desc="Notify sequencer the load completed.") {
1283 assert(is_valid(cache_entry));
1284 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
1285 address, cache_entry.DataBlk);
1286 peek(responseNetwork_in, ResponseMsg) {
1288 sequencer.readCallback(address,
1289 getNondirectHitMachType(address, in_msg.Sender),
1290 cache_entry.DataBlk);
1295 action(hh_store_hit, "\h", desc="Notify sequencer that store completed.") {
1296 assert(is_valid(cache_entry));
1297 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
1298 address, cache_entry.DataBlk);
1300 sequencer.writeCallback(address,
1301 GenericMachineType:L1Cache,
1302 cache_entry.DataBlk);
1304 cache_entry.Dirty := true;
1305 DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
1308 action(xx_external_store_hit, "\x", desc="Notify sequencer that store completed.") {
1309 assert(is_valid(cache_entry));
1310 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
1311 address, cache_entry.DataBlk);
1312 peek(responseNetwork_in, ResponseMsg) {
1314 sequencer.writeCallback(address,
1315 getNondirectHitMachType(address, in_msg.Sender),
1316 cache_entry.DataBlk);
1319 cache_entry.Dirty := true;
1320 DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
1323 action(i_allocateTBE, "i", desc="Allocate TBE") {
1324 check_allocate(L1_TBEs);
1325 L1_TBEs.allocate(address);
1326 set_tbe(L1_TBEs[address]);
1327 tbe.IssueCount := 0;
1328 peek(mandatoryQueue_in, CacheMsg) {
1329 tbe.PC := in_msg.ProgramCounter;
1330 tbe.AccessType := cache_request_type_to_access_type(in_msg.Type);
1331 if (in_msg.Type == CacheRequestType:ATOMIC) {
1332 tbe.IsAtomic := true;
1334 tbe.Prefetch := in_msg.Prefetch;
1335 tbe.AccessMode := in_msg.AccessMode;
1337 tbe.IssueTime := get_time();
1340 action(ta_traceStalledAddress, "ta", desc="Trace Stalled Address") {
1341 peek(mandatoryQueue_in, CacheMsg) {
1342 APPEND_TRANSITION_COMMENT(in_msg.LineAddress);
1346 action(j_unsetReissueTimer, "j", desc="Unset reissue timer.") {
1347 if (reissueTimerTable.isSet(address)) {
1348 reissueTimerTable.unset(address);
1352 action(jj_unsetUseTimer, "\j", desc="Unset use timer.") {
1353 useTimerTable.unset(address);
1356 action(k_popMandatoryQueue, "k", desc="Pop mandatory queue.") {
1357 mandatoryQueue_in.dequeue();
1360 action(l_popPersistentQueue, "l", desc="Pop persistent queue.") {
1361 persistentNetwork_in.dequeue();
1364 action(m_popRequestQueue, "m", desc="Pop request queue.") {
1365 requestNetwork_in.dequeue();
1368 action(n_popResponseQueue, "n", desc="Pop response queue") {
1369 responseNetwork_in.dequeue();
1372 action(o_scheduleUseTimeout, "o", desc="Schedule a use timeout.") {
1373 useTimerTable.set(address, 50);
1376 action(p_informL2AboutTokenLoss, "p", desc="Inform L2 about loss of all tokens") {
1377 enqueue(responseNetwork_out, ResponseMsg, latency = l1_response_latency) {
1378 out_msg.Address := address;
1379 out_msg.Type := CoherenceResponseType:INV;
1380 out_msg.Tokens := 0;
1381 out_msg.Sender := machineID;
1383 out_msg.Destination.add(mapAddressToRange(address,
1384 MachineType:L2Cache,
1386 l2_select_num_bits));
1388 out_msg.MessageSize := MessageSizeType:Response_Control;
1393 action(q_updateTokensFromResponse, "q", desc="Update the token count based on the incoming response message") {
1394 peek(responseNetwork_in, ResponseMsg) {
1395 assert(is_valid(cache_entry));
1396 assert(in_msg.Tokens != 0);
1397 DPRINTF(RubySlicc, "L1 received tokens for address: %s, tokens: %d\n",
1398 in_msg.Address, in_msg.Tokens);
1399 cache_entry.Tokens := cache_entry.Tokens + in_msg.Tokens;
1400 DPRINTF(RubySlicc, "%d\n", cache_entry.Tokens);
1402 if (cache_entry.Dirty == false && in_msg.Dirty) {
1403 cache_entry.Dirty := true;
1408 action(s_deallocateTBE, "s", desc="Deallocate TBE") {
1410 assert(is_valid(tbe));
1411 if (tbe.WentPersistent) {
1412 // assert(starving == true);
1413 outstandingRequests := outstandingRequests - 1;
1414 enqueue(persistentNetwork_out, PersistentMsg, latency = l1_request_latency) {
1415 out_msg.Address := address;
1416 out_msg.Type := PersistentRequestType:DEACTIVATE_PERSISTENT;
1417 out_msg.Requestor := machineID;
1418 out_msg.Destination.broadcast(MachineType:L1Cache);
1421 // Currently the configuration system limits the system to only one
1422 // chip. Therefore, if we assume one shared L2 cache, then only one
1423 // pertinent L2 cache exist.
1425 //out_msg.Destination.addNetDest(getAllPertinentL2Banks(address));
1427 out_msg.Destination.add(mapAddressToRange(address,
1428 MachineType:L2Cache,
1430 l2_select_num_bits));
1432 out_msg.Destination.add(map_Address_to_Directory(address));
1433 out_msg.MessageSize := MessageSizeType:Persistent_Control;
1438 // Update average latency
1439 if (tbe.IssueCount <= 1) {
1440 if (tbe.ExternalResponse == true) {
1441 updateAverageLatencyEstimate(time_to_int(get_time()) - time_to_int(tbe.IssueTime));
1446 //if (tbe.WentPersistent) {
1447 // profile_token_retry(address, tbe.AccessType, 2);
1450 // profile_token_retry(address, tbe.AccessType, 1);
1453 //profile_token_retry(address, tbe.AccessType, tbe.IssueCount);
1454 L1_TBEs.deallocate(address);
1458 action(t_sendAckWithCollectedTokens, "t", desc="Send ack with the tokens we've collected thus far.") {
1459 assert(is_valid(cache_entry));
1460 if (cache_entry.Tokens > 0) {
1461 peek(requestNetwork_in, RequestMsg) {
1462 enqueue(responseNetwork_out, ResponseMsg, latency = l1_response_latency) {
1463 out_msg.Address := address;
1464 if (cache_entry.Tokens > (max_tokens() / 2)) {
1465 out_msg.Type := CoherenceResponseType:DATA_OWNER;
1467 out_msg.Type := CoherenceResponseType:ACK;
1469 out_msg.Sender := machineID;
1470 out_msg.Destination.add(in_msg.Requestor);
1471 assert(cache_entry.Tokens >= 1);
1472 out_msg.Tokens := cache_entry.Tokens;
1473 out_msg.DataBlk := cache_entry.DataBlk;
1474 out_msg.MessageSize := MessageSizeType:Response_Control;
1478 cache_entry.Tokens := 0;
1481 action(u_writeDataToCache, "u", desc="Write data to cache") {
1482 peek(responseNetwork_in, ResponseMsg) {
1483 assert(is_valid(cache_entry));
1484 cache_entry.DataBlk := in_msg.DataBlk;
1485 if (cache_entry.Dirty == false && in_msg.Dirty) {
1486 cache_entry.Dirty := in_msg.Dirty;
1492 action(gg_deallocateL1CacheBlock, "\g", desc="Deallocate cache block. Sets the cache to invalid, allowing a replacement in parallel with a fetch.") {
1493 assert(getTokens(cache_entry) == 0);
1494 if (L1DcacheMemory.isTagPresent(address)) {
1495 L1DcacheMemory.deallocate(address);
1497 L1IcacheMemory.deallocate(address);
1499 unset_cache_entry();
1502 action(ii_allocateL1DCacheBlock, "\i", desc="Set L1 D-cache tag equal to tag of block B.") {
1503 if (is_valid(cache_entry)) {
1505 set_cache_entry(L1DcacheMemory.allocate(address, new Entry));
1509 action(pp_allocateL1ICacheBlock, "\p", desc="Set L1 I-cache tag equal to tag of block B.") {
1510 if (is_valid(cache_entry)) {
1512 set_cache_entry(L1IcacheMemory.allocate(address, new Entry));
1516 action(uu_profileMiss, "\u", desc="Profile the demand miss") {
1517 peek(mandatoryQueue_in, CacheMsg) {
1518 if (L1DcacheMemory.isTagPresent(address)) {
1519 L1DcacheMemory.profileMiss(in_msg);
1521 L1IcacheMemory.profileMiss(in_msg);
1526 action(w_assertIncomingDataAndCacheDataMatch, "w", desc="Assert that the incoming data and the data in the cache match") {
1527 peek(responseNetwork_in, ResponseMsg) {
1528 assert(is_valid(cache_entry));
1529 assert(cache_entry.DataBlk == in_msg.DataBlk);
1533 action(zz_stallAndWaitMandatoryQueue, "\z", desc="Send the head of the mandatory queue to the back of the queue.") {
1534 peek(mandatoryQueue_in, CacheMsg) {
1535 APPEND_TRANSITION_COMMENT(in_msg.LineAddress);
1537 stall_and_wait(mandatoryQueue_in, address);
1540 action(kd_wakeUpDependents, "kd", desc="wake-up dependents") {
1541 wake_up_dependents(address);
1544 action(ka_wakeUpAllDependents, "ka", desc="wake-up all dependents") {
1545 wake_up_all_dependents();
1548 //*****************************************************
1550 //*****************************************************
1552 // Transitions for Load/Store/L2_Replacement from transient states
1553 transition({IM, SM, OM, IS, IM_L, IS_L, I_L, S_L, SM_L, M_W, MM_W}, L1_Replacement) {
1554 ta_traceStalledAddress;
1555 zz_stallAndWaitMandatoryQueue;
1558 transition({IM, SM, OM, IS, IM_L, IS_L, SM_L}, {Store, Atomic}) {
1559 zz_stallAndWaitMandatoryQueue;
1562 transition({IM, IS, IM_L, IS_L}, {Load, Ifetch}) {
1563 zz_stallAndWaitMandatoryQueue;
1568 transition({NP, I, S, O, M, MM, M_W, MM_W, IM, SM, OM, IS}, Own_Lock_or_Unlock) {
1569 l_popPersistentQueue;
1572 // Transitions from NP
1573 transition(NP, Load, IS) {
1574 ii_allocateL1DCacheBlock;
1578 k_popMandatoryQueue;
1581 transition(NP, Ifetch, IS) {
1582 pp_allocateL1ICacheBlock;
1586 k_popMandatoryQueue;
1589 transition(NP, {Store, Atomic}, IM) {
1590 ii_allocateL1DCacheBlock;
1592 b_issueWriteRequest;
1594 k_popMandatoryQueue;
1597 transition(NP, {Ack, Data_Shared, Data_Owner, Data_All_Tokens}) {
1602 transition(NP, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_Local_GETS}) {
1606 transition(NP, {Persistent_GETX, Persistent_GETS, Persistent_GETS_Last_Token}, I_L) {
1607 l_popPersistentQueue;
1610 // Transitions from Idle
1611 transition(I, Load, IS) {
1615 k_popMandatoryQueue;
1618 transition(I, Ifetch, IS) {
1622 k_popMandatoryQueue;
1625 transition(I, {Store, Atomic}, IM) {
1627 b_issueWriteRequest;
1629 k_popMandatoryQueue;
1632 transition(I, L1_Replacement) {
1633 ta_traceStalledAddress;
1634 tr_tokenReplacement;
1635 gg_deallocateL1CacheBlock;
1636 ka_wakeUpAllDependents;
1639 transition(I, {Transient_GETX, Transient_Local_GETX}) {
1640 t_sendAckWithCollectedTokens;
1644 transition(I, {Transient_GETS, Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token, Transient_Local_GETS}) {
1648 transition(I, {Persistent_GETX, Persistent_GETS, Persistent_GETS_Last_Token}, I_L) {
1649 e_sendAckWithCollectedTokens;
1650 l_popPersistentQueue;
1653 transition(I_L, {Persistent_GETX, Persistent_GETS, Persistent_GETS_Last_Token}) {
1654 l_popPersistentQueue;
1657 transition(I, Ack) {
1658 q_updateTokensFromResponse;
1662 transition(I, Data_Shared, S) {
1664 q_updateTokensFromResponse;
1668 transition(I, Data_Owner, O) {
1670 q_updateTokensFromResponse;
1674 transition(I, Data_All_Tokens, M) {
1676 q_updateTokensFromResponse;
1680 // Transitions from Shared
1681 transition({S, SM, S_L, SM_L}, {Load, Ifetch}) {
1683 k_popMandatoryQueue;
1686 transition(S, {Store, Atomic}, SM) {
1688 b_issueWriteRequest;
1690 k_popMandatoryQueue;
1693 transition(S, L1_Replacement, I) {
1694 ta_traceStalledAddress;
1695 cc_sharedReplacement; // Only needed in some cases
1696 gg_deallocateL1CacheBlock;
1697 ka_wakeUpAllDependents;
1700 transition(S, {Transient_GETX, Transient_Local_GETX}, I) {
1701 t_sendAckWithCollectedTokens;
1702 p_informL2AboutTokenLoss;
1706 // only owner responds to non-local requests
1707 transition(S, Transient_GETS) {
1711 transition(S, Transient_Local_GETS) {
1712 d_sendDataWithToken;
1716 transition(S, {Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token}) {
1720 transition({S, S_L}, Persistent_GETX, I_L) {
1721 e_sendAckWithCollectedTokens;
1722 p_informL2AboutTokenLoss;
1723 l_popPersistentQueue;
1726 transition(S, {Persistent_GETS, Persistent_GETS_Last_Token}, S_L) {
1727 f_sendAckWithAllButNorOneTokens;
1728 l_popPersistentQueue;
1731 transition(S_L, {Persistent_GETS, Persistent_GETS_Last_Token}) {
1732 l_popPersistentQueue;
1735 transition(S, Ack) {
1736 q_updateTokensFromResponse;
1740 transition(S, Data_Shared) {
1741 w_assertIncomingDataAndCacheDataMatch;
1742 q_updateTokensFromResponse;
1746 transition(S, Data_Owner, O) {
1747 w_assertIncomingDataAndCacheDataMatch;
1748 q_updateTokensFromResponse;
1752 transition(S, Data_All_Tokens, M) {
1753 w_assertIncomingDataAndCacheDataMatch;
1754 q_updateTokensFromResponse;
1758 // Transitions from Owned
1759 transition({O, OM}, {Load, Ifetch}) {
1761 k_popMandatoryQueue;
1764 transition(O, {Store, Atomic}, OM) {
1766 b_issueWriteRequest;
1768 k_popMandatoryQueue;
1771 transition(O, L1_Replacement, I) {
1772 ta_traceStalledAddress;
1774 gg_deallocateL1CacheBlock;
1775 ka_wakeUpAllDependents;
1778 transition(O, {Transient_GETX, Transient_Local_GETX}, I) {
1779 dd_sendDataWithAllTokens;
1780 p_informL2AboutTokenLoss;
1784 transition(O, Persistent_GETX, I_L) {
1785 ee_sendDataWithAllTokens;
1786 p_informL2AboutTokenLoss;
1787 l_popPersistentQueue;
1790 transition(O, Persistent_GETS, S_L) {
1791 ff_sendDataWithAllButNorOneTokens;
1792 l_popPersistentQueue;
1795 transition(O, Persistent_GETS_Last_Token, I_L) {
1796 fo_sendDataWithOwnerToken;
1797 l_popPersistentQueue;
1800 transition(O, Transient_GETS) {
1801 d_sendDataWithToken;
1805 transition(O, Transient_Local_GETS) {
1806 d_sendDataWithToken;
1810 // ran out of tokens, wait for it to go persistent
1811 transition(O, {Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token}) {
1815 transition(O, Ack) {
1816 q_updateTokensFromResponse;
1820 transition(O, Ack_All_Tokens, M) {
1821 q_updateTokensFromResponse;
1825 transition(O, Data_Shared) {
1826 w_assertIncomingDataAndCacheDataMatch;
1827 q_updateTokensFromResponse;
1831 transition(O, Data_All_Tokens, M) {
1832 w_assertIncomingDataAndCacheDataMatch;
1833 q_updateTokensFromResponse;
1837 // Transitions from Modified
1838 transition({MM, MM_W}, {Load, Ifetch}) {
1840 k_popMandatoryQueue;
1843 transition({MM_W}, {Store, Atomic}) {
1845 k_popMandatoryQueue;
1848 transition(MM, Store) {
1850 k_popMandatoryQueue;
1853 transition(MM, Atomic, M) {
1855 k_popMandatoryQueue;
1858 transition(MM, L1_Replacement, I) {
1859 ta_traceStalledAddress;
1861 gg_deallocateL1CacheBlock;
1862 ka_wakeUpAllDependents;
1865 transition(MM, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_Local_GETS}, I) {
1866 dd_sendDataWithAllTokens;
1867 p_informL2AboutTokenLoss;
1871 transition({MM_W}, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_Local_GETS}) { // Ignore the request
1875 // Implement the migratory sharing optimization, even for persistent requests
1876 transition(MM, {Persistent_GETX, Persistent_GETS}, I_L) {
1877 ee_sendDataWithAllTokens;
1878 p_informL2AboutTokenLoss;
1879 l_popPersistentQueue;
1882 // ignore persistent requests in lockout period
1883 transition(MM_W, {Persistent_GETX, Persistent_GETS}) {
1884 l_popPersistentQueue;
1887 transition(MM_W, Use_TimeoutNoStarvers, MM) {
1890 kd_wakeUpDependents;
1893 transition(MM_W, Use_TimeoutNoStarvers_NoMig, M) {
1896 kd_wakeUpDependents;
1899 // Transitions from Dirty Exclusive
1900 transition({M, M_W}, {Load, Ifetch}) {
1902 k_popMandatoryQueue;
1905 transition(M, Store, MM) {
1907 k_popMandatoryQueue;
1910 transition(M, Atomic) {
1912 k_popMandatoryQueue;
1915 transition(M_W, Store, MM_W) {
1917 k_popMandatoryQueue;
1920 transition(M_W, Atomic) {
1922 k_popMandatoryQueue;
1925 transition(M, L1_Replacement, I) {
1926 ta_traceStalledAddress;
1928 gg_deallocateL1CacheBlock;
1929 ka_wakeUpAllDependents;
1932 transition(M, {Transient_GETX, Transient_Local_GETX}, I) {
1933 dd_sendDataWithAllTokens;
1934 p_informL2AboutTokenLoss;
1938 transition(M, Transient_Local_GETS, O) {
1939 d_sendDataWithToken;
1943 transition(M, Transient_GETS, O) {
1944 d_sendDataWithNTokenIfAvail;
1948 transition(M_W, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_Local_GETS}) { // Ignore the request
1952 transition(M, Persistent_GETX, I_L) {
1953 ee_sendDataWithAllTokens;
1954 p_informL2AboutTokenLoss;
1955 l_popPersistentQueue;
1958 transition(M, Persistent_GETS, S_L) {
1959 ff_sendDataWithAllButNorOneTokens;
1960 l_popPersistentQueue;
1963 // ignore persistent requests in lockout period
1964 transition(M_W, {Persistent_GETX, Persistent_GETS}) {
1965 l_popPersistentQueue;
1968 transition(M_W, Use_TimeoutStarverS, S_L) {
1970 ff_sendDataWithAllButNorOneTokens;
1974 // someone unlocked during timeout
1975 transition(M_W, {Use_TimeoutNoStarvers, Use_TimeoutNoStarvers_NoMig}, M) {
1978 kd_wakeUpDependents;
1981 transition(M_W, Use_TimeoutStarverX, I_L) {
1983 ee_sendDataWithAllTokens;
1984 p_informL2AboutTokenLoss;
1991 transition(MM_W, {Use_TimeoutStarverX, Use_TimeoutStarverS}, I_L) {
1993 ee_sendDataWithAllTokens;
1994 p_informL2AboutTokenLoss;
2000 // Transient_GETX and Transient_GETS in transient states
2001 transition(OM, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token, Transient_Local_GETS}) {
2002 m_popRequestQueue; // Even if we have the data, we can pretend we don't have it yet.
2005 transition(IS, {Transient_GETX, Transient_Local_GETX}) {
2006 t_sendAckWithCollectedTokens;
2010 transition(IS, {Transient_GETS, Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token, Transient_Local_GETS}) {
2014 transition(IS, {Persistent_GETX, Persistent_GETS, Persistent_GETS_Last_Token}, IS_L) {
2015 e_sendAckWithCollectedTokens;
2016 l_popPersistentQueue;
2019 transition(IS_L, {Persistent_GETX, Persistent_GETS}) {
2020 l_popPersistentQueue;
2023 transition(IM, {Persistent_GETX, Persistent_GETS, Persistent_GETS_Last_Token}, IM_L) {
2024 e_sendAckWithCollectedTokens;
2025 l_popPersistentQueue;
2028 transition(IM_L, {Persistent_GETX, Persistent_GETS}) {
2029 l_popPersistentQueue;
2032 transition({SM, SM_L}, Persistent_GETX, IM_L) {
2033 e_sendAckWithCollectedTokens;
2034 l_popPersistentQueue;
2037 transition(SM, {Persistent_GETS, Persistent_GETS_Last_Token}, SM_L) {
2038 f_sendAckWithAllButNorOneTokens;
2039 l_popPersistentQueue;
2042 transition(SM_L, {Persistent_GETS, Persistent_GETS_Last_Token}) {
2043 l_popPersistentQueue;
2046 transition(OM, Persistent_GETX, IM_L) {
2047 ee_sendDataWithAllTokens;
2048 l_popPersistentQueue;
2051 transition(OM, Persistent_GETS, SM_L) {
2052 ff_sendDataWithAllButNorOneTokens;
2053 l_popPersistentQueue;
2056 transition(OM, Persistent_GETS_Last_Token, IM_L) {
2057 fo_sendDataWithOwnerToken;
2058 l_popPersistentQueue;
2061 // Transitions from IM/SM
2063 transition({IM, SM}, Ack) {
2064 q_updateTokensFromResponse;
2068 transition(IM, Data_Shared, SM) {
2070 q_updateTokensFromResponse;
2074 transition(IM, Data_Owner, OM) {
2076 q_updateTokensFromResponse;
2080 transition(IM, Data_All_Tokens, MM_W) {
2082 q_updateTokensFromResponse;
2083 xx_external_store_hit;
2084 o_scheduleUseTimeout;
2085 j_unsetReissueTimer;
2087 kd_wakeUpDependents;
2090 transition(SM, Data_Shared) {
2091 w_assertIncomingDataAndCacheDataMatch;
2092 q_updateTokensFromResponse;
2096 transition(SM, Data_Owner, OM) {
2097 w_assertIncomingDataAndCacheDataMatch;
2098 q_updateTokensFromResponse;
2102 transition(SM, Data_All_Tokens, MM_W) {
2103 w_assertIncomingDataAndCacheDataMatch;
2104 q_updateTokensFromResponse;
2105 xx_external_store_hit;
2106 o_scheduleUseTimeout;
2107 j_unsetReissueTimer;
2109 kd_wakeUpDependents;
2112 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
2113 t_sendAckWithCollectedTokens;
2117 transition({IM, SM}, {Transient_GETS, Transient_GETS_Last_Token, Transient_Local_GETS_Last_Token, Transient_Local_GETS}) {
2121 transition({IM, SM}, Request_Timeout) {
2122 j_unsetReissueTimer;
2123 b_issueWriteRequest;
2126 // Transitions from OM
2128 transition(OM, Ack) {
2129 q_updateTokensFromResponse;
2133 transition(OM, Ack_All_Tokens, MM_W) {
2134 q_updateTokensFromResponse;
2135 xx_external_store_hit;
2136 o_scheduleUseTimeout;
2137 j_unsetReissueTimer;
2139 kd_wakeUpDependents;
2142 transition(OM, Data_Shared) {
2143 w_assertIncomingDataAndCacheDataMatch;
2144 q_updateTokensFromResponse;
2148 transition(OM, Data_All_Tokens, MM_W) {
2149 w_assertIncomingDataAndCacheDataMatch;
2150 q_updateTokensFromResponse;
2151 xx_external_store_hit;
2152 o_scheduleUseTimeout;
2153 j_unsetReissueTimer;
2155 kd_wakeUpDependents;
2158 transition(OM, Request_Timeout) {
2159 j_unsetReissueTimer;
2160 b_issueWriteRequest;
2163 // Transitions from IS
2165 transition(IS, Ack) {
2166 q_updateTokensFromResponse;
2170 transition(IS, Data_Shared, S) {
2172 q_updateTokensFromResponse;
2173 x_external_load_hit;
2175 j_unsetReissueTimer;
2177 kd_wakeUpDependents;
2180 transition(IS, Data_Owner, O) {
2182 q_updateTokensFromResponse;
2183 x_external_load_hit;
2185 j_unsetReissueTimer;
2187 kd_wakeUpDependents;
2190 transition(IS, Data_All_Tokens, M_W) {
2192 q_updateTokensFromResponse;
2193 x_external_load_hit;
2194 o_scheduleUseTimeout;
2195 j_unsetReissueTimer;
2197 kd_wakeUpDependents;
2200 transition(IS, Request_Timeout) {
2201 j_unsetReissueTimer;
2205 // Transitions from I_L
2207 transition(I_L, Load, IS_L) {
2208 ii_allocateL1DCacheBlock;
2212 k_popMandatoryQueue;
2215 transition(I_L, Ifetch, IS_L) {
2216 pp_allocateL1ICacheBlock;
2220 k_popMandatoryQueue;
2223 transition(I_L, {Store, Atomic}, IM_L) {
2224 ii_allocateL1DCacheBlock;
2226 b_issueWriteRequest;
2228 k_popMandatoryQueue;
2232 // Transitions from S_L
2234 transition(S_L, {Store, Atomic}, SM_L) {
2236 b_issueWriteRequest;
2238 k_popMandatoryQueue;
2241 // Other transitions from *_L states
2243 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}) {
2247 transition({I_L, IM_L, IS_L, S_L, SM_L}, Ack) {
2248 g_bounceResponseToStarver;
2252 transition({I_L, IM_L, S_L, SM_L}, {Data_Shared, Data_Owner}) {
2253 g_bounceResponseToStarver;
2257 transition({I_L, S_L}, Data_All_Tokens) {
2258 g_bounceResponseToStarver;
2262 transition(IS_L, Request_Timeout) {
2263 j_unsetReissueTimer;
2267 transition({IM_L, SM_L}, Request_Timeout) {
2268 j_unsetReissueTimer;
2269 b_issueWriteRequest;
2272 // Opportunisticly Complete the memory operation in the following
2273 // cases. Note: these transitions could just use
2274 // g_bounceResponseToStarver, but if we have the data and tokens, we
2275 // might as well complete the memory request while we have the
2276 // chance (and then immediately forward on the data)
2278 transition(IM_L, Data_All_Tokens, MM_W) {
2280 q_updateTokensFromResponse;
2281 xx_external_store_hit;
2282 j_unsetReissueTimer;
2283 o_scheduleUseTimeout;
2285 kd_wakeUpDependents;
2288 transition(SM_L, Data_All_Tokens, S_L) {
2290 q_updateTokensFromResponse;
2291 xx_external_store_hit;
2292 ff_sendDataWithAllButNorOneTokens;
2294 j_unsetReissueTimer;
2298 transition(IS_L, Data_Shared, I_L) {
2300 q_updateTokensFromResponse;
2301 x_external_load_hit;
2303 e_sendAckWithCollectedTokens;
2304 p_informL2AboutTokenLoss;
2305 j_unsetReissueTimer;
2309 transition(IS_L, Data_Owner, I_L) {
2311 q_updateTokensFromResponse;
2312 x_external_load_hit;
2313 ee_sendDataWithAllTokens;
2315 p_informL2AboutTokenLoss;
2316 j_unsetReissueTimer;
2320 transition(IS_L, Data_All_Tokens, M_W) {
2322 q_updateTokensFromResponse;
2323 x_external_load_hit;
2324 j_unsetReissueTimer;
2325 o_scheduleUseTimeout;
2327 kd_wakeUpDependents;
2331 // Own_Lock_or_Unlock
2333 transition(I_L, Own_Lock_or_Unlock, I) {
2334 l_popPersistentQueue;
2335 kd_wakeUpDependents;
2338 transition(S_L, Own_Lock_or_Unlock, S) {
2339 l_popPersistentQueue;
2340 kd_wakeUpDependents;
2343 transition(IM_L, Own_Lock_or_Unlock, IM) {
2344 l_popPersistentQueue;
2345 kd_wakeUpDependents;
2348 transition(IS_L, Own_Lock_or_Unlock, IS) {
2349 l_popPersistentQueue;
2350 kd_wakeUpDependents;
2353 transition(SM_L, Own_Lock_or_Unlock, SM) {
2354 l_popPersistentQueue;
2355 kd_wakeUpDependents;