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.
35 machine(L2Cache, "Token protocol")
36 : CacheMemory * L2cacheMemory,
37 int response_latency = 2,
38 int request_latency = 2
42 // From local bank of L2 cache TO the network
43 MessageBuffer L1RequestFromL2Cache, network="To", virtual_network="0", ordered="false", vnet_type="request"; // this L2 bank -> a local L1
44 MessageBuffer GlobalRequestFromL2Cache, network="To", virtual_network="1", ordered="false", vnet_type="request"; // this L2 bank -> mod-directory
45 MessageBuffer responseFromL2Cache, network="To", virtual_network="2", ordered="false", vnet_type="response"; // this L2 bank -> a local L1 || mod-directory
47 // FROM the network to this local bank of L2 cache
48 MessageBuffer L1RequestToL2Cache, network="From", virtual_network="0", ordered="false", vnet_type="request"; // a local L1 -> this L2 bank, Lets try this???
49 MessageBuffer GlobalRequestToL2Cache, network="From", virtual_network="1", ordered="false", vnet_type="request"; // mod-directory -> this L2 bank
50 MessageBuffer responseToL2Cache, network="From", virtual_network="2", ordered="false", vnet_type="response"; // a local L1 || mod-directory -> this L2 bank
51 // MessageBuffer L1WritebackToL2Cache, network="From", virtual_network="3", ordered="false", vnet_type="writeback";
54 state_declaration(State, desc="L2 Cache states", default="L2Cache_State_I") {
57 NP, AccessPermission:Invalid, desc="Not Present";
58 I, AccessPermission:Invalid, desc="Invalid";
59 ILS, AccessPermission:Invalid, desc="Idle/NP, but local sharers exist";
60 ILX, AccessPermission:Invalid, desc="Idle/NP, but local exclusive exists";
61 ILO, AccessPermission:Invalid, desc="Idle/NP, but local owner exists";
62 ILOX, AccessPermission:Invalid, desc="Idle/NP, but local owner exists and chip is exclusive";
63 ILOS, AccessPermission:Invalid, desc="Idle/NP, but local owner exists and local sharers as well";
64 ILOSX, AccessPermission:Invalid, desc="Idle/NP, but local owner exists, local sharers exist, chip is exclusive ";
65 S, AccessPermission:Read_Only, desc="Shared, no local sharers";
66 O, AccessPermission:Read_Only, desc="Owned, no local sharers";
67 OLS, AccessPermission:Read_Only, desc="Owned with local sharers";
68 OLSX, AccessPermission:Read_Only, desc="Owned with local sharers, chip is exclusive";
69 SLS, AccessPermission:Read_Only, desc="Shared with local sharers";
70 M, AccessPermission:Read_Write, desc="Modified";
74 IFGX, AccessPermission:Busy, desc="Blocked, forwarded global GETX to local owner/exclusive. No other on-chip invs needed";
75 IFGS, AccessPermission:Busy, desc="Blocked, forwarded global GETS to local owner";
76 ISFGS, AccessPermission:Busy, desc="Blocked, forwarded global GETS to local owner, local sharers exist";
78 IFGXX, AccessPermission:Busy, desc="Blocked, forwarded global GETX to local owner but may need acks from other sharers";
79 OFGX, AccessPermission:Busy, desc="Blocked, forwarded global GETX to owner and got data but may need acks";
81 OLSF, AccessPermission:Busy, desc="Blocked, got Fwd_GETX with local sharers, waiting for local inv acks";
84 ILOW, AccessPermission:Busy, desc="local WB request, was ILO";
85 ILOXW, AccessPermission:Busy, desc="local WB request, was ILOX";
86 ILOSW, AccessPermission:Busy, desc="local WB request, was ILOS";
87 ILOSXW, AccessPermission:Busy, desc="local WB request, was ILOSX";
88 SLSW, AccessPermission:Busy, desc="local WB request, was SLS";
89 OLSW, AccessPermission:Busy, desc="local WB request, was OLS";
90 ILSW, AccessPermission:Busy, desc="local WB request, was ILS";
91 IW, AccessPermission:Busy, desc="local WB request from only sharer, was ILS";
92 OW, AccessPermission:Busy, desc="local WB request from only sharer, was OLS";
93 SW, AccessPermission:Busy, desc="local WB request from only sharer, was SLS";
94 OXW, AccessPermission:Busy, desc="local WB request from only sharer, was OLSX";
95 OLSXW, AccessPermission:Busy, desc="local WB request from sharer, was OLSX";
96 ILXW, AccessPermission:Busy, desc="local WB request, was ILX";
98 IFLS, AccessPermission:Busy, desc="Blocked, forwarded local GETS to _some_ local sharer";
99 IFLO, AccessPermission:Busy, desc="Blocked, forwarded local GETS to local owner";
100 IFLOX, AccessPermission:Busy, desc="Blocked, forwarded local GETS to local owner but chip is exclusive";
101 IFLOXX, AccessPermission:Busy, desc="Blocked, forwarded local GETX to local owner/exclusive, chip is exclusive";
102 IFLOSX, AccessPermission:Busy, desc="Blocked, forwarded local GETS to local owner w/ other sharers, chip is exclusive";
103 IFLXO, AccessPermission:Busy, desc="Blocked, forwarded local GETX to local owner with other sharers, chip is exclusive";
105 IGS, AccessPermission:Busy, desc="Semi-blocked, issued local GETS to directory";
106 IGM, AccessPermission:Busy, desc="Blocked, issued local GETX to directory. Need global acks and data";
107 IGMLS, AccessPermission:Busy, desc="Blocked, issued local GETX to directory but may need to INV local sharers";
108 IGMO, AccessPermission:Busy, desc="Blocked, have data for local GETX but need all acks";
109 IGMIO, AccessPermission:Busy, desc="Blocked, issued local GETX, local owner with possible local sharer, may need to INV";
110 OGMIO, AccessPermission:Busy, desc="Blocked, issued local GETX, was owner, may need to INV";
111 IGMIOF, AccessPermission:Busy, desc="Blocked, issued local GETX, local owner, waiting for global acks, got Fwd_GETX";
112 IGMIOFS, AccessPermission:Busy, desc="Blocked, issued local GETX, local owner, waiting for global acks, got Fwd_GETS";
113 OGMIOF, AccessPermission:Busy, desc="Blocked, issued local GETX, was owner, waiting for global acks, got Fwd_GETX";
115 II, AccessPermission:Busy, desc="Blocked, handling invalidations";
116 MM, AccessPermission:Busy, desc="Blocked, was M satisfying local GETX";
117 SS, AccessPermission:Busy, desc="Blocked, was S satisfying local GETS";
118 OO, AccessPermission:Busy, desc="Blocked, was O satisfying local GETS";
119 OLSS, AccessPermission:Busy, desc="Blocked, satisfying local GETS";
120 OLSXS, AccessPermission:Busy, desc="Blocked, satisfying local GETS";
121 SLSS, AccessPermission:Busy, desc="Blocked, satisfying local GETS";
123 OI, AccessPermission:Busy, desc="Blocked, doing writeback, was O";
124 MI, AccessPermission:Busy, desc="Blocked, doing writeback, was M";
125 MII, AccessPermission:Busy, desc="Blocked, doing writeback, was M, got Fwd_GETX";
126 OLSI, AccessPermission:Busy, desc="Blocked, doing writeback, was OLS";
127 ILSI, AccessPermission:Busy, desc="Blocked, doing writeback, was OLS got Fwd_GETX";
129 // DMA blocking states
130 ILOSD, AccessPermission:Busy, desc="Blocked, waiting for DMA ack";
131 ILOSXD, AccessPermission:Busy, desc="Blocked, waiting for DMA ack";
132 ILOD, AccessPermission:Busy, desc="Blocked, waiting for DMA ack";
133 ILXD, AccessPermission:Busy, desc="Blocked, waiting for DMA ack";
134 ILOXD, AccessPermission:Busy, desc="Blocked, waiting for DMA ack";
138 enumeration(Event, desc="Cache events") {
141 L1_GETS, desc="local L1 GETS request";
142 L1_GETX, desc="local L1 GETX request";
143 L1_PUTO, desc="local owner wants to writeback";
144 L1_PUTX, desc="local exclusive wants to writeback";
145 L1_PUTS_only, desc="only local sharer wants to writeback";
146 L1_PUTS, desc="local sharer wants to writeback";
147 Fwd_GETX, desc="A GetX from another processor";
148 Fwd_GETS, desc="A GetS from another processor";
149 Fwd_DMA, desc="A request from DMA";
150 Own_GETX, desc="A GetX from this node";
151 Inv, desc="Invalidations from the directory";
154 IntAck, desc="Received an ack message";
155 ExtAck, desc="Received an ack message";
156 All_Acks, desc="Received all ack messages";
157 Data, desc="Received a data message, responder has a shared copy";
158 Data_Exclusive, desc="Received a data message";
159 L1_WBCLEANDATA, desc="Writeback from L1, with data";
160 L1_WBDIRTYDATA, desc="Writeback from L1, with data";
162 Writeback_Ack, desc="Writeback O.K. from directory";
163 Writeback_Nack, desc="Writeback not O.K. from directory";
165 Unblock, desc="Local L1 is telling L2 dir to unblock";
166 Exclusive_Unblock, desc="Local L1 is telling L2 dir to unblock";
168 DmaAck, desc="DMA ack from local L1";
169 // events initiated by this L2
170 L2_Replacement, desc="L2 Replacement", format="!r";
177 structure(Entry, desc="...", interface="AbstractCacheEntry") {
178 State CacheState, desc="cache state";
179 NetDest Sharers, desc="Set of the internal processors that want the block in shared state";
180 MachineID Owner, desc="ID of the L1 cache to forward the block to once we get a response";
181 bool OwnerValid, default="false", desc="true if Owner means something";
182 bool Dirty, desc="Is the data dirty (different than memory)?";
183 DataBlock DataBlk, desc="data for the block";
187 structure(DirEntry, desc="...") {
188 NetDest Sharers, desc="Set of the internal processors that want the block in shared state";
189 MachineID Owner, desc="ID of the L1 cache to forward the block to once we get a response";
190 bool OwnerValid, default="false", desc="true if Owner means something";
191 State DirState, desc="directory state";
195 structure(TBE, desc="...") {
196 Address address, desc="Physical address for this TBE";
197 State TBEState, desc="Transient state";
198 Address PC, desc="Program counter of request";
199 DataBlock DataBlk, desc="Buffer for the data block";
200 bool Dirty, desc="Is the data dirty (different than memory)?";
202 int NumExtPendingAcks, default="0", desc="Number of global acks/data messages waiting for";
203 int NumIntPendingAcks, default="0", desc="Number of global acks/data messages waiting for";
204 int Fwd_GETX_ExtAcks, default="0", desc="Number of acks that requestor will need";
205 int Local_GETX_IntAcks, default="0", desc="Number of acks that requestor will need";
207 NetDest L1_GetS_IDs, desc="Set of the internal processors that want the block in shared state";
208 MachineID L1_GetX_ID, desc="ID of the L1 cache to forward the block to once we get a response";
209 NetDest Fwd_GetS_IDs, desc="Set of the internal processors that want the block in shared state";
210 MachineID Fwd_GetX_ID, desc="ID of the L1 cache to forward the block to once we get a response";
213 structure(TBETable, external = "yes") {
215 void allocate(Address);
216 void deallocate(Address);
217 bool isPresent(Address);
220 structure(PerfectCacheMemory, external = "yes") {
221 void allocate(Address);
222 void deallocate(Address);
223 DirEntry lookup(Address);
224 bool isTagPresent(Address);
227 TBETable TBEs, template="<L2Cache_TBE>", constructor="m_number_of_TBEs";
228 PerfectCacheMemory localDirectory, template="<L2Cache_DirEntry>";
230 void set_cache_entry(AbstractCacheEntry b);
231 void unset_cache_entry();
235 Entry getCacheEntry(Address address), return_by_pointer="yes" {
236 return static_cast(Entry, "pointer", L2cacheMemory[address]);
239 bool isDirTagPresent(Address addr) {
240 return (localDirectory.isTagPresent(addr) );
243 bool isOnlySharer(Entry cache_entry, Address addr, MachineID shar_id) {
244 if (is_valid(cache_entry)) {
245 assert (localDirectory.isTagPresent(addr) == false);
246 if (cache_entry.Sharers.count() > 1) {
249 else if (cache_entry.Sharers.count() == 1) {
250 if (cache_entry.Sharers.isElement(shar_id)) {
254 return false; // something happened which should cause this PUTS to be nacked
262 else if (localDirectory.isTagPresent(addr)){
263 if (localDirectory[addr].Sharers.count() > 1) {
266 else if (localDirectory[addr].Sharers.count() == 1) {
267 if (localDirectory[addr].Sharers.isElement(shar_id)) {
271 return false; // something happened which should cause this PUTS to be nacked
279 // shouldn't happen unless L1 issues PUTS before unblock received
284 void copyCacheStateToDir(Entry cache_entry, Address addr) {
285 assert(localDirectory.isTagPresent(addr) == false);
286 assert(is_valid(cache_entry));
287 localDirectory.allocate(addr);
288 localDirectory[addr].DirState := cache_entry.CacheState;
289 localDirectory[addr].Sharers := cache_entry.Sharers;
290 localDirectory[addr].Owner := cache_entry.Owner;
291 localDirectory[addr].OwnerValid := cache_entry.OwnerValid;
295 void copyDirToCache(Entry cache_entry, Address addr) {
296 assert(is_valid(cache_entry));
297 cache_entry.Sharers := localDirectory[addr].Sharers;
298 cache_entry.Owner := localDirectory[addr].Owner;
299 cache_entry.OwnerValid := localDirectory[addr].OwnerValid;
303 void recordLocalSharerInDir(Entry cache_entry, Address addr, MachineID shar_id) {
304 if (is_valid(cache_entry)) {
305 assert (localDirectory.isTagPresent(addr) == false);
306 cache_entry.Sharers.add(shar_id);
309 if (localDirectory.isTagPresent(addr) == false) {
310 localDirectory.allocate(addr);
311 localDirectory[addr].Sharers.clear();
312 localDirectory[addr].OwnerValid := false;
314 localDirectory[addr].Sharers.add(shar_id);
318 void recordNewLocalExclusiveInDir(Entry cache_entry, Address addr, MachineID exc_id) {
320 if (is_valid(cache_entry)) {
321 assert (localDirectory.isTagPresent(addr) == false);
322 cache_entry.Sharers.clear();
323 cache_entry.OwnerValid := true;
324 cache_entry.Owner := exc_id;
327 if (localDirectory.isTagPresent(addr) == false) {
328 localDirectory.allocate(addr);
330 localDirectory[addr].Sharers.clear();
331 localDirectory[addr].OwnerValid := true;
332 localDirectory[addr].Owner := exc_id;
336 void removeAllLocalSharersFromDir(Entry cache_entry, Address addr) {
337 if (is_valid(cache_entry)) {
338 assert (localDirectory.isTagPresent(addr) == false);
339 cache_entry.Sharers.clear();
340 cache_entry.OwnerValid := false;
343 localDirectory[addr].Sharers.clear();
344 localDirectory[addr].OwnerValid := false;
348 void removeSharerFromDir(Entry cache_entry, Address addr, MachineID sender) {
349 if (is_valid(cache_entry)) {
350 assert (localDirectory.isTagPresent(addr) == false);
351 cache_entry.Sharers.remove(sender);
354 localDirectory[addr].Sharers.remove(sender);
358 void removeOwnerFromDir(Entry cache_entry, Address addr, MachineID sender) {
359 if (is_valid(cache_entry)) {
360 assert (localDirectory.isTagPresent(addr) == false);
361 cache_entry.OwnerValid := false;
364 localDirectory[addr].OwnerValid := false;
368 bool isLocalSharer(Entry cache_entry, Address addr, MachineID shar_id) {
369 if (is_valid(cache_entry)) {
370 assert (localDirectory.isTagPresent(addr) == false);
371 return cache_entry.Sharers.isElement(shar_id);
374 return localDirectory[addr].Sharers.isElement(shar_id);
378 NetDest getLocalSharers(Entry cache_entry, Address addr) {
379 if (is_valid(cache_entry)) {
380 assert (localDirectory.isTagPresent(addr) == false);
381 return cache_entry.Sharers;
384 return localDirectory[addr].Sharers;
388 MachineID getLocalOwner(Entry cache_entry, Address addr) {
389 if (is_valid(cache_entry)) {
390 assert (localDirectory.isTagPresent(addr) == false);
391 return cache_entry.Owner;
394 return localDirectory[addr].Owner;
398 int countLocalSharers(Entry cache_entry, Address addr) {
399 if (is_valid(cache_entry)) {
400 assert (localDirectory.isTagPresent(addr) == false);
401 return cache_entry.Sharers.count();
404 return localDirectory[addr].Sharers.count();
408 bool isLocalOwnerValid(Entry cache_entry, Address addr) {
409 if (is_valid(cache_entry)) {
410 assert (localDirectory.isTagPresent(addr) == false);
411 return cache_entry.OwnerValid;
414 return localDirectory[addr].OwnerValid;
418 int countLocalSharersExceptRequestor(Entry cache_entry, Address addr, MachineID requestor) {
419 if (is_valid(cache_entry)) {
420 assert (localDirectory.isTagPresent(addr) == false);
421 if (cache_entry.Sharers.isElement(requestor)) {
422 return ( cache_entry.Sharers.count() - 1 );
425 return cache_entry.Sharers.count();
429 if (localDirectory[addr].Sharers.isElement(requestor)) {
430 return ( localDirectory[addr].Sharers.count() - 1 );
433 return localDirectory[addr].Sharers.count();
438 State getState(TBE tbe, Entry cache_entry, Address addr) {
442 } else if (is_valid(cache_entry)) {
443 return cache_entry.CacheState;
444 } else if (isDirTagPresent(addr)) {
445 return localDirectory[addr].DirState;
451 std::string getCoherenceRequestTypeStr(CoherenceRequestType type) {
452 return CoherenceRequestType_to_string(type);
455 void setState(TBE tbe, Entry cache_entry, Address addr, State state) {
456 assert((localDirectory.isTagPresent(addr) && L2cacheMemory.isTagPresent(addr)) == false);
459 tbe.TBEState := state;
463 (state == State:M) ||
464 (state == State:O) ||
465 (state == State:S) ||
466 (state == State:OLS) ||
467 (state == State:SLS) ||
468 (state == State:OLSX) ||
471 assert(is_valid(cache_entry));
474 (state == State:ILS) ||
475 (state == State:ILX) ||
476 (state == State:ILO) ||
477 (state == State:ILOX) ||
478 (state == State:ILOS) ||
479 (state == State:ILOSX)
481 // assert(isCacheTagPresent(addr) == false);
484 if (is_valid(cache_entry)) {
485 if ( ((cache_entry.CacheState != State:M) && (state == State:M)) ||
486 ((cache_entry.CacheState != State:S) && (state == State:S)) ||
487 ((cache_entry.CacheState != State:O) && (state == State:O)) ) {
488 cache_entry.CacheState := state;
489 // disable Coherence Checker for now
490 // sequencer.checkCoherence(addr);
493 cache_entry.CacheState := state;
496 else if (localDirectory.isTagPresent(addr)) {
497 localDirectory[addr].DirState := state;
501 AccessPermission getAccessPermission(Address addr) {
502 TBE tbe := TBEs[addr];
504 DPRINTF(RubySlicc, "%s\n", L2Cache_State_to_permission(tbe.TBEState));
505 return L2Cache_State_to_permission(tbe.TBEState);
508 Entry cache_entry := getCacheEntry(addr);
509 if(is_valid(cache_entry)) {
510 DPRINTF(RubySlicc, "%s\n", L2Cache_State_to_permission(cache_entry.CacheState));
511 return L2Cache_State_to_permission(cache_entry.CacheState);
514 DPRINTF(RubySlicc, "AccessPermission_NotPresent\n");
515 return AccessPermission:NotPresent;
518 void setAccessPermission(Entry cache_entry, Address addr, State state) {
519 if (is_valid(cache_entry)) {
520 cache_entry.changePermission(L2Cache_State_to_permission(state));
524 DataBlock getDataBlock(Address addr), return_by_ref="yes" {
525 TBE tbe := TBEs[addr];
530 return getCacheEntry(addr).DataBlk;
533 MessageBuffer triggerQueue, ordered="true";
535 out_port(globalRequestNetwork_out, RequestMsg, GlobalRequestFromL2Cache);
536 out_port(localRequestNetwork_out, RequestMsg, L1RequestFromL2Cache);
537 out_port(responseNetwork_out, ResponseMsg, responseFromL2Cache);
539 out_port(triggerQueue_out, TriggerMsg, triggerQueue);
545 in_port(triggerQueue_in, TriggerMsg, triggerQueue) {
546 if (triggerQueue_in.isReady()) {
547 peek(triggerQueue_in, TriggerMsg) {
548 if (in_msg.Type == TriggerType:ALL_ACKS) {
549 trigger(Event:All_Acks, in_msg.Address,
550 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
552 error("Unexpected message");
560 in_port(requestNetwork_in, RequestMsg, GlobalRequestToL2Cache) {
561 if (requestNetwork_in.isReady()) {
562 peek(requestNetwork_in, RequestMsg) {
563 if (in_msg.Type == CoherenceRequestType:GETX || in_msg.Type == CoherenceRequestType:DMA_WRITE) {
564 if (in_msg.Requestor == machineID) {
565 trigger(Event:Own_GETX, in_msg.Address,
566 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
568 trigger(Event:Fwd_GETX, in_msg.Address,
569 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
571 } else if (in_msg.Type == CoherenceRequestType:GETS) {
572 trigger(Event:Fwd_GETS, in_msg.Address,
573 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
574 } else if(in_msg.Type == CoherenceRequestType:DMA_READ) {
575 trigger(Event:Fwd_DMA, in_msg.Address,
576 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
577 } else if (in_msg.Type == CoherenceRequestType:INV) {
578 trigger(Event:Inv, in_msg.Address,
579 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
580 } else if (in_msg.Type == CoherenceRequestType:WB_ACK) {
581 trigger(Event:Writeback_Ack, in_msg.Address,
582 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
583 } else if (in_msg.Type == CoherenceRequestType:WB_NACK) {
584 trigger(Event:Writeback_Nack, in_msg.Address,
585 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
587 error("Unexpected message");
593 in_port(L1requestNetwork_in, RequestMsg, L1RequestToL2Cache) {
594 if (L1requestNetwork_in.isReady()) {
595 peek(L1requestNetwork_in, RequestMsg) {
596 assert(in_msg.Destination.isElement(machineID));
597 if (in_msg.Type == CoherenceRequestType:GETX) {
598 trigger(Event:L1_GETX, in_msg.Address,
599 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
600 } else if (in_msg.Type == CoherenceRequestType:GETS) {
601 trigger(Event:L1_GETS, in_msg.Address,
602 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
603 } else if (in_msg.Type == CoherenceRequestType:PUTO) {
604 trigger(Event:L1_PUTO, in_msg.Address,
605 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
606 } else if (in_msg.Type == CoherenceRequestType:PUTX) {
607 trigger(Event:L1_PUTX, in_msg.Address,
608 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
609 } else if (in_msg.Type == CoherenceRequestType:PUTS) {
610 Entry cache_entry := getCacheEntry(in_msg.Address);
611 if (isOnlySharer(cache_entry, in_msg.Address, in_msg.Requestor)) {
612 trigger(Event:L1_PUTS_only, in_msg.Address,
613 cache_entry, TBEs[in_msg.Address]);
616 trigger(Event:L1_PUTS, in_msg.Address,
617 cache_entry, TBEs[in_msg.Address]);
620 error("Unexpected message");
628 in_port(responseNetwork_in, ResponseMsg, responseToL2Cache) {
629 if (responseNetwork_in.isReady()) {
630 peek(responseNetwork_in, ResponseMsg) {
631 assert(in_msg.Destination.isElement(machineID));
632 if (in_msg.Type == CoherenceResponseType:ACK) {
633 if (in_msg.SenderMachine == MachineType:L2Cache) {
634 trigger(Event:ExtAck, in_msg.Address,
635 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
638 trigger(Event:IntAck, in_msg.Address,
639 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
641 } else if (in_msg.Type == CoherenceResponseType:DATA) {
642 trigger(Event:Data, in_msg.Address,
643 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
644 } else if (in_msg.Type == CoherenceResponseType:DATA_EXCLUSIVE) {
645 trigger(Event:Data_Exclusive, in_msg.Address,
646 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
647 } else if (in_msg.Type == CoherenceResponseType:UNBLOCK) {
648 trigger(Event:Unblock, in_msg.Address,
649 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
650 } else if (in_msg.Type == CoherenceResponseType:UNBLOCK_EXCLUSIVE) {
651 trigger(Event:Exclusive_Unblock, in_msg.Address,
652 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
653 } else if (in_msg.Type == CoherenceResponseType:WRITEBACK_DIRTY_DATA) {
654 Entry cache_entry := getCacheEntry(in_msg.Address);
655 if (is_invalid(cache_entry) &&
656 L2cacheMemory.cacheAvail(in_msg.Address) == false) {
657 trigger(Event:L2_Replacement, L2cacheMemory.cacheProbe(in_msg.Address),
658 getCacheEntry(L2cacheMemory.cacheProbe(in_msg.Address)),
659 TBEs[L2cacheMemory.cacheProbe(in_msg.Address)]);
662 trigger(Event:L1_WBDIRTYDATA, in_msg.Address,
663 cache_entry, TBEs[in_msg.Address]);
665 } else if (in_msg.Type == CoherenceResponseType:WRITEBACK_CLEAN_DATA) {
666 Entry cache_entry := getCacheEntry(in_msg.Address);
667 if (is_invalid(cache_entry) &&
668 L2cacheMemory.cacheAvail(in_msg.Address) == false) {
669 trigger(Event:L2_Replacement, L2cacheMemory.cacheProbe(in_msg.Address),
670 getCacheEntry(L2cacheMemory.cacheProbe(in_msg.Address)),
671 TBEs[L2cacheMemory.cacheProbe(in_msg.Address)]);
674 trigger(Event:L1_WBCLEANDATA, in_msg.Address,
675 cache_entry, TBEs[in_msg.Address]);
677 } else if (in_msg.Type == CoherenceResponseType:DMA_ACK) {
678 trigger(Event:DmaAck, in_msg.Address,
679 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
681 error("Unexpected message");
690 action(a_issueGETS, "a", desc="issue local request globally") {
691 peek(L1requestNetwork_in, RequestMsg) {
692 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
693 out_msg.Address := address;
694 out_msg.Type := CoherenceRequestType:GETS;
695 out_msg.RequestorMachine := MachineType:L2Cache;
696 out_msg.Requestor := machineID;
697 out_msg.Destination.add(map_Address_to_Directory(address));
698 out_msg.MessageSize := MessageSizeType:Request_Control;
703 action(a_issueGETX, "\a", desc="issue local request globally") {
704 peek(L1requestNetwork_in, RequestMsg) {
705 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
706 out_msg.Address := address;
707 out_msg.Type := CoherenceRequestType:GETX;
708 out_msg.RequestorMachine := MachineType:L2Cache;
709 out_msg.Requestor := machineID;
710 out_msg.Destination.add(map_Address_to_Directory(address));
711 out_msg.MessageSize := MessageSizeType:Request_Control;
716 action(b_issuePUTX, "b", desc="Issue PUTX") {
717 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
718 out_msg.Address := address;
719 out_msg.Type := CoherenceRequestType:PUTX;
720 out_msg.RequestorMachine := MachineType:L2Cache;
721 out_msg.Requestor := machineID;
722 out_msg.Destination.add(map_Address_to_Directory(address));
723 out_msg.MessageSize := MessageSizeType:Writeback_Control;
727 action(b_issuePUTO, "\b", desc="Issue PUTO") {
728 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
729 out_msg.Address := address;
730 out_msg.Type := CoherenceRequestType:PUTO;
731 out_msg.Requestor := machineID;
732 out_msg.RequestorMachine := MachineType:L2Cache;
733 out_msg.Destination.add(map_Address_to_Directory(address));
734 out_msg.MessageSize := MessageSizeType:Writeback_Control;
738 /* PUTO, but local sharers exist */
739 action(b_issuePUTO_ls, "\bb", desc="Issue PUTO") {
740 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
741 out_msg.Address := address;
742 out_msg.Type := CoherenceRequestType:PUTO_SHARERS;
743 out_msg.Requestor := machineID;
744 out_msg.RequestorMachine := MachineType:L2Cache;
745 out_msg.Destination.add(map_Address_to_Directory(address));
746 out_msg.MessageSize := MessageSizeType:Writeback_Control;
750 action(c_sendDataFromTBEToL1GETS, "c", desc="Send data from TBE to L1 requestors in TBE") {
751 assert(is_valid(tbe));
752 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
753 out_msg.Address := address;
754 out_msg.Type := CoherenceResponseType:DATA;
755 out_msg.Sender := machineID;
756 out_msg.Destination.addNetDest(tbe.L1_GetS_IDs);
757 out_msg.DataBlk := tbe.DataBlk;
758 // out_msg.Dirty := tbe.Dirty;
759 // shared data should be clean
760 out_msg.Dirty := false;
761 out_msg.MessageSize := MessageSizeType:Response_Data;
763 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
764 address, tbe.DataBlk);
767 action(c_sendDataFromTBEToL1GETX, "\c", desc="Send data from TBE to L1 requestors in TBE") {
768 assert(is_valid(tbe));
769 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
770 out_msg.Address := address;
771 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
772 out_msg.Sender := machineID;
773 out_msg.SenderMachine := MachineType:L2Cache;
774 out_msg.Destination.add(tbe.L1_GetX_ID);
775 out_msg.DataBlk := tbe.DataBlk;
776 out_msg.Dirty := tbe.Dirty;
777 out_msg.Acks := tbe.Local_GETX_IntAcks;
778 out_msg.MessageSize := MessageSizeType:Response_Data;
780 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
781 address, tbe.DataBlk);
784 action(c_sendExclusiveDataFromTBEToL1GETS, "\cc", desc="Send data from TBE to L1 requestors in TBE") {
785 assert(is_valid(tbe));
786 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
787 out_msg.Address := address;
788 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
789 out_msg.Sender := machineID;
790 out_msg.SenderMachine := MachineType:L2Cache;
791 out_msg.Destination.addNetDest(tbe.L1_GetS_IDs);
792 out_msg.DataBlk := tbe.DataBlk;
793 out_msg.Dirty := tbe.Dirty;
794 out_msg.MessageSize := MessageSizeType:Response_Data;
798 action(c_sendDataFromTBEToFwdGETX, "cc", desc="Send data from TBE to external GETX") {
799 assert(is_valid(tbe));
800 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
801 out_msg.Address := address;
802 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
803 out_msg.Sender := machineID;
804 out_msg.SenderMachine := MachineType:L2Cache;
805 out_msg.Destination.add(tbe.Fwd_GetX_ID);
806 out_msg.DataBlk := tbe.DataBlk;
807 out_msg.Dirty := tbe.Dirty;
808 out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
809 out_msg.MessageSize := MessageSizeType:Response_Data;
813 action(cd_sendDataFromTBEToFwdDma, "cd", desc="Send data from TBE to external GETX") {
814 assert(is_valid(tbe));
815 peek(requestNetwork_in, RequestMsg) {
816 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
817 out_msg.Address := address;
818 out_msg.Type := CoherenceResponseType:DATA;
819 out_msg.Sender := machineID;
820 out_msg.Destination.add(in_msg.Requestor);
821 out_msg.DataBlk := tbe.DataBlk;
822 // out_msg.Dirty := tbe.Dirty;
823 // shared data should be clean
824 out_msg.Dirty := false;
825 out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
826 out_msg.MessageSize := MessageSizeType:Response_Data;
829 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
830 address, tbe.DataBlk);
833 action(c_sendDataFromTBEToFwdGETS, "ccc", desc="Send data from TBE to external GETX") {
834 assert(is_valid(tbe));
835 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
836 out_msg.Address := address;
837 out_msg.Type := CoherenceResponseType:DATA;
838 out_msg.Sender := machineID;
839 out_msg.Destination.addNetDest(tbe.Fwd_GetS_IDs);
840 out_msg.DataBlk := tbe.DataBlk;
841 // out_msg.Dirty := tbe.Dirty;
842 // shared data should be clean
843 out_msg.Dirty := false;
844 out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
845 out_msg.MessageSize := MessageSizeType:Response_Data;
847 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
848 address, tbe.DataBlk);
851 action(c_sendExclusiveDataFromTBEToFwdGETS, "\ccc", desc="Send data from TBE to external GETX") {
852 assert(is_valid(tbe));
853 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
854 out_msg.Address := address;
855 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
856 out_msg.Sender := machineID;
857 out_msg.SenderMachine := MachineType:L2Cache;
858 out_msg.Destination.addNetDest(tbe.Fwd_GetS_IDs);
859 out_msg.DataBlk := tbe.DataBlk;
860 out_msg.Dirty := tbe.Dirty;
861 out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
862 out_msg.MessageSize := MessageSizeType:Response_Data;
864 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
865 address, tbe.DataBlk);
868 action(d_sendDataToL1GETS, "d", desc="Send data directly to L1 requestor") {
869 assert(is_valid(cache_entry));
870 peek(L1requestNetwork_in, RequestMsg) {
871 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
872 out_msg.Address := address;
873 out_msg.Type := CoherenceResponseType:DATA;
874 out_msg.Sender := machineID;
875 out_msg.Destination.add(in_msg.Requestor);
876 out_msg.DataBlk := cache_entry.DataBlk;
877 // out_msg.Dirty := cache_entry.Dirty;
878 // shared data should be clean
879 out_msg.Dirty := false;
880 out_msg.MessageSize := MessageSizeType:ResponseL2hit_Data;
883 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
884 address, cache_entry.DataBlk);
887 action(d_sendDataToL1GETX, "\d", desc="Send data and a token from TBE to L1 requestor") {
888 assert(is_valid(cache_entry));
889 peek(L1requestNetwork_in, RequestMsg) {
890 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
891 assert(is_valid(tbe));
892 out_msg.Address := address;
893 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
894 out_msg.Sender := machineID;
895 out_msg.SenderMachine := MachineType:L2Cache;
896 out_msg.Destination.add(in_msg.Requestor);
897 out_msg.DataBlk := cache_entry.DataBlk;
898 out_msg.Dirty := cache_entry.Dirty;
899 out_msg.MessageSize := MessageSizeType:ResponseL2hit_Data;
900 out_msg.Acks := tbe.Local_GETX_IntAcks;
903 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
904 address, cache_entry.DataBlk);
907 action(dd_sendDataToFwdGETX, "dd", desc="send data") {
908 assert(is_valid(cache_entry));
909 peek(requestNetwork_in, RequestMsg) {
910 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
911 out_msg.Address := address;
912 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
913 out_msg.Sender := machineID;
914 out_msg.SenderMachine := MachineType:L2Cache;
915 out_msg.Destination.add(in_msg.Requestor);
916 out_msg.DataBlk := cache_entry.DataBlk;
917 out_msg.Dirty := cache_entry.Dirty;
918 out_msg.MessageSize := MessageSizeType:Response_Data;
919 out_msg.Acks := in_msg.Acks;
922 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
923 address, cache_entry.DataBlk);
927 action(dd_sendDataToFwdGETS, "\dd", desc="send data") {
928 assert(is_valid(cache_entry));
929 peek(requestNetwork_in, RequestMsg) {
930 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
931 out_msg.Address := address;
932 out_msg.Type := CoherenceResponseType:DATA;
933 out_msg.Sender := machineID;
934 out_msg.Destination.add(in_msg.Requestor);
935 out_msg.DataBlk := cache_entry.DataBlk;
936 // out_msg.Dirty := cache_entry.Dirty;
937 // shared data should be clean
938 out_msg.Dirty := false;
939 out_msg.MessageSize := MessageSizeType:Response_Data;
942 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
943 address, cache_entry.DataBlk);
946 action(dd_sendExclusiveDataToFwdGETS, "\d\d", desc="send data") {
947 assert(is_valid(cache_entry));
948 peek(requestNetwork_in, RequestMsg) {
949 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
950 out_msg.Address := address;
951 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
952 out_msg.Sender := machineID;
953 out_msg.Destination.add(in_msg.Requestor);
954 out_msg.DataBlk := cache_entry.DataBlk;
955 out_msg.Dirty := cache_entry.Dirty;
956 out_msg.MessageSize := MessageSizeType:Response_Data;
961 action(e_sendAck, "e", desc="Send ack with the tokens we've collected thus far.") {
962 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
963 assert(is_valid(tbe));
964 out_msg.Address := address;
965 out_msg.Type := CoherenceResponseType:ACK;
966 out_msg.Sender := machineID;
967 out_msg.SenderMachine := MachineType:L2Cache;
969 out_msg.Destination.add( tbe.Fwd_GetX_ID);
970 out_msg.Acks := 0 - 1;
971 out_msg.MessageSize := MessageSizeType:Response_Control;
975 action(e_sendAckToL1Requestor, "\e", desc="Send ack with the tokens we've collected thus far.") {
976 peek(L1requestNetwork_in, RequestMsg) {
977 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
978 out_msg.Address := address;
979 out_msg.Type := CoherenceResponseType:ACK;
980 out_msg.Sender := machineID;
981 out_msg.SenderMachine := MachineType:L2Cache;
982 out_msg.Destination.add(in_msg.Requestor);
983 out_msg.Acks := 0 - 1;
984 out_msg.MessageSize := MessageSizeType:Response_Control;
989 action(e_sendAckToL1RequestorFromTBE, "eee", desc="Send ack with the tokens we've collected thus far.") {
990 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
991 assert(is_valid(tbe));
992 out_msg.Address := address;
993 out_msg.Type := CoherenceResponseType:ACK;
994 out_msg.Sender := machineID;
995 out_msg.SenderMachine := MachineType:L2Cache;
996 out_msg.Destination.add(tbe.L1_GetX_ID);
997 out_msg.Acks := 0 - 1;
998 out_msg.MessageSize := MessageSizeType:Response_Control;
1002 action(ee_sendLocalInv, "\ee", desc="Send local invalidates") {
1003 assert(is_valid(tbe));
1004 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
1005 DPRINTF(RubySlicc, "Address: %s, Local Sharers: %s, Pending Acks: %d\n",
1006 address, getLocalSharers(cache_entry, address),
1007 tbe.NumIntPendingAcks);
1008 if (isLocalOwnerValid(cache_entry, address)) {
1009 tbe.NumIntPendingAcks := tbe.NumIntPendingAcks + 1;
1010 DPRINTF(RubySlicc, "%s\n", getLocalOwner(cache_entry, address));
1013 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1014 out_msg.Address := address;
1015 out_msg.Type := CoherenceRequestType:INV;
1016 out_msg.Requestor := machineID;
1017 out_msg.RequestorMachine := MachineType:L2Cache;
1018 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
1019 if (isLocalOwnerValid(cache_entry, address))
1021 out_msg.Destination.add(getLocalOwner(cache_entry, address));
1023 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
1027 action(ee_sendLocalInvSharersOnly, "\eee", desc="Send local invalidates to sharers if they exist") {
1029 // assert(countLocalSharers(address) > 0);
1030 assert(is_valid(tbe));
1031 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
1033 if (countLocalSharers(cache_entry, address) > 0) {
1034 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1035 out_msg.Address := address;
1036 out_msg.Type := CoherenceRequestType:INV;
1037 out_msg.Requestor := machineID;
1038 out_msg.RequestorMachine := MachineType:L2Cache;
1039 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
1040 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
1045 action(ee_addLocalIntAck, "e\ee", desc="add a local ack to wait for") {
1046 assert(is_valid(tbe));
1047 tbe.NumIntPendingAcks := tbe.NumIntPendingAcks + 1;
1050 action(ee_issueLocalInvExceptL1Requestor, "\eeee", desc="Send local invalidates to sharers if they exist") {
1051 peek(L1requestNetwork_in, RequestMsg) {
1053 // assert(countLocalSharers(address) > 0);
1054 if (countLocalSharers(cache_entry, address) == 0) {
1055 tbe.NumIntPendingAcks := 0;
1059 if (isLocalSharer(cache_entry, address, in_msg.Requestor)) {
1060 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address) - 1;
1063 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
1066 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1067 out_msg.Address := address;
1068 out_msg.Type := CoherenceRequestType:INV;
1069 out_msg.Requestor := in_msg.Requestor;
1070 out_msg.RequestorMachine := MachineType:L1Cache;
1071 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
1072 out_msg.Destination.remove(in_msg.Requestor);
1073 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
1079 action(ee_issueLocalInvExceptL1RequestorInTBE, "\eeeeee", desc="Send local invalidates to sharers if they exist") {
1080 assert(is_valid(tbe));
1081 if (countLocalSharers(cache_entry, address) == 0) {
1082 tbe.NumIntPendingAcks := 0;
1085 if (isLocalSharer(cache_entry, address, tbe.L1_GetX_ID)) {
1086 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address) - 1;
1089 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
1092 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1093 out_msg.Address := address;
1094 out_msg.Type := CoherenceRequestType:INV;
1095 out_msg.Requestor := tbe.L1_GetX_ID;
1096 out_msg.RequestorMachine := MachineType:L1Cache;
1097 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
1098 out_msg.Destination.remove(tbe.L1_GetX_ID);
1099 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
1104 action(f_sendUnblock, "f", desc="Send unblock to global directory") {
1105 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
1106 out_msg.Address := address;
1107 out_msg.Type := CoherenceResponseType:UNBLOCK;
1108 out_msg.Destination.add(map_Address_to_Directory(address));
1109 out_msg.Sender := machineID;
1110 out_msg.SenderMachine := MachineType:L2Cache;
1111 out_msg.MessageSize := MessageSizeType:Unblock_Control;
1116 action(f_sendExclusiveUnblock, "\f", desc="Send unblock to global directory") {
1117 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
1118 out_msg.Address := address;
1119 out_msg.Type := CoherenceResponseType:UNBLOCK_EXCLUSIVE;
1120 out_msg.Destination.add(map_Address_to_Directory(address));
1121 out_msg.Sender := machineID;
1122 out_msg.SenderMachine := MachineType:L2Cache;
1123 out_msg.MessageSize := MessageSizeType:Unblock_Control;
1128 action(g_recordLocalSharer, "g", desc="Record new local sharer from unblock message") {
1129 peek(responseNetwork_in, ResponseMsg) {
1130 recordLocalSharerInDir(cache_entry, in_msg.Address, in_msg.Sender);
1134 action(g_recordLocalExclusive, "\g", desc="Record new local exclusive sharer from unblock message") {
1135 peek(responseNetwork_in, ResponseMsg) {
1136 recordNewLocalExclusiveInDir(cache_entry, address, in_msg.Sender);
1140 action(gg_clearLocalSharers, "gg", desc="Clear local sharers") {
1141 removeAllLocalSharersFromDir(cache_entry, address);
1144 action(gg_clearSharerFromL1Response, "\gg", desc="Clear sharer from L1 response queue") {
1145 peek(responseNetwork_in, ResponseMsg) {
1146 removeSharerFromDir(cache_entry, in_msg.Address, in_msg.Sender);
1150 action(gg_clearOwnerFromL1Response, "g\g", desc="Clear sharer from L1 response queue") {
1151 peek(responseNetwork_in, ResponseMsg) {
1152 removeOwnerFromDir(cache_entry, in_msg.Address, in_msg.Sender);
1156 action(h_countLocalSharersExceptRequestor, "h", desc="counts number of acks needed for L1 GETX") {
1157 peek(L1requestNetwork_in, RequestMsg) {
1158 assert(is_valid(tbe));
1159 tbe.Local_GETX_IntAcks := countLocalSharersExceptRequestor(cache_entry, address, in_msg.Requestor);
1163 action(h_clearIntAcks, "\h", desc="clear IntAcks") {
1164 assert(is_valid(tbe));
1165 tbe.Local_GETX_IntAcks := 0;
1168 action(hh_countLocalSharersExceptL1GETXRequestorInTBE, "hh", desc="counts number of acks needed for L1 GETX") {
1169 assert(is_valid(tbe));
1170 tbe.Local_GETX_IntAcks := countLocalSharersExceptRequestor(cache_entry, address, tbe.L1_GetX_ID);
1173 action(i_copyDataToTBE, "\i", desc="Copy data from response queue to TBE") {
1174 peek(responseNetwork_in, ResponseMsg) {
1175 assert(is_valid(tbe));
1176 tbe.DataBlk := in_msg.DataBlk;
1177 tbe.Dirty := in_msg.Dirty;
1178 APPEND_TRANSITION_COMMENT(in_msg.Sender);
1182 action(i_allocateTBE, "i", desc="Allocate TBE for internal/external request(isPrefetch=0, number of invalidates=0)") {
1183 check_allocate(TBEs);
1184 TBEs.allocate(address);
1185 set_tbe(TBEs[address]);
1186 if(is_valid(cache_entry)) {
1187 tbe.DataBlk := cache_entry.DataBlk;
1188 tbe.Dirty := cache_entry.Dirty;
1190 tbe.NumIntPendingAcks := 0; // default value
1191 tbe.NumExtPendingAcks := 0; // default value
1192 tbe.Fwd_GetS_IDs.clear();
1193 tbe.L1_GetS_IDs.clear();
1198 action(j_forwardGlobalRequestToLocalOwner, "j", desc="Forward external request to local owner") {
1199 peek(requestNetwork_in, RequestMsg) {
1200 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1201 out_msg.Address := in_msg.Address;
1202 out_msg.Type := in_msg.Type;
1203 out_msg.Requestor := machineID;
1204 out_msg.RequestorMachine := MachineType:L2Cache;
1205 out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.Address));
1206 out_msg.Type := in_msg.Type;
1207 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1208 out_msg.Acks := 0 - 1;
1213 action(jd_forwardDmaRequestToLocalOwner, "jd", desc="Forward dma request to local owner") {
1214 peek(requestNetwork_in, RequestMsg) {
1215 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1216 out_msg.Address := in_msg.Address;
1217 out_msg.Type := in_msg.Type;
1218 out_msg.Requestor := in_msg.Requestor;
1219 out_msg.RequestorMachine := in_msg.RequestorMachine;
1220 out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.Address));
1221 out_msg.Type := in_msg.Type;
1222 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1223 out_msg.Acks := 0 - 1;
1229 action(k_forwardLocalGETSToLocalSharer, "k", desc="Forward local request to local sharer/owner") {
1230 peek(L1requestNetwork_in, RequestMsg) {
1231 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1232 out_msg.Address := in_msg.Address;
1233 out_msg.Type := CoherenceRequestType:GETS;
1234 out_msg.Requestor := in_msg.Requestor;
1235 out_msg.RequestorMachine := MachineType:L1Cache;
1236 // should randomize this so one node doesn't get abused more than others
1237 out_msg.Destination.add(localDirectory[in_msg.Address].Sharers.smallestElement(MachineType:L1Cache));
1238 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1243 action(k_forwardLocalGETXToLocalOwner, "\k", desc="Forward local request to local owner") {
1244 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1245 assert(is_valid(tbe));
1246 out_msg.Address := address;
1247 out_msg.Type := CoherenceRequestType:GETX;
1248 out_msg.Requestor := tbe.L1_GetX_ID;
1249 out_msg.RequestorMachine := MachineType:L1Cache;
1250 out_msg.Destination.add(localDirectory[address].Owner);
1251 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1252 out_msg.Acks := 1 + tbe.Local_GETX_IntAcks;
1256 // same as previous except that it assumes to TBE is present to get number of acks
1257 action(kk_forwardLocalGETXToLocalExclusive, "kk", desc="Forward local request to local owner") {
1258 peek(L1requestNetwork_in, RequestMsg) {
1259 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1260 out_msg.Address := in_msg.Address;
1261 out_msg.Type := CoherenceRequestType:GETX;
1262 out_msg.Requestor := in_msg.Requestor;
1263 out_msg.RequestorMachine := MachineType:L1Cache;
1264 out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.Address));
1265 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1271 action(kk_forwardLocalGETSToLocalOwner, "\kk", desc="Forward local request to local owner") {
1272 peek(L1requestNetwork_in, RequestMsg) {
1273 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1274 out_msg.Address := in_msg.Address;
1275 out_msg.Type := CoherenceRequestType:GETS;
1276 out_msg.Requestor := in_msg.Requestor;
1277 out_msg.RequestorMachine := MachineType:L1Cache;
1278 out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.Address));
1279 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1285 action(l_writebackAckNeedData, "l", desc="Send writeback ack to L1 requesting data") {
1286 peek(L1requestNetwork_in, RequestMsg) {
1287 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1288 out_msg.Address := in_msg.Address;
1289 // out_msg.Type := CoherenceResponseType:WRITEBACK_SEND_DATA;
1290 out_msg.Type := CoherenceRequestType:WB_ACK_DATA;
1291 out_msg.Requestor := machineID;
1292 out_msg.RequestorMachine := MachineType:L2Cache;
1293 out_msg.Destination.add(in_msg.Requestor);
1294 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1299 action(l_writebackAckDropData, "\l", desc="Send writeback ack to L1 indicating to drop data") {
1300 peek(L1requestNetwork_in, RequestMsg) {
1301 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1302 out_msg.Address := in_msg.Address;
1303 // out_msg.Type := CoherenceResponseType:WRITEBACK_ACK;
1304 out_msg.Type := CoherenceRequestType:WB_ACK;
1305 out_msg.Requestor := machineID;
1306 out_msg.RequestorMachine := MachineType:L2Cache;
1307 out_msg.Destination.add(in_msg.Requestor);
1308 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1313 action(ll_writebackNack, "\ll", desc="Send writeback nack to L1") {
1314 peek(L1requestNetwork_in, RequestMsg) {
1315 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1316 out_msg.Address := in_msg.Address;
1317 out_msg.Type := CoherenceRequestType:WB_NACK;
1318 out_msg.Requestor := machineID;
1319 out_msg.RequestorMachine := MachineType:L2Cache;
1320 out_msg.Destination.add(in_msg.Requestor);
1321 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1326 action(m_popRequestQueue, "m", desc="Pop request queue.") {
1327 requestNetwork_in.dequeue();
1330 action(m_decrementNumberOfMessagesInt, "\m", desc="Decrement the number of messages for which we're waiting") {
1331 peek(responseNetwork_in, ResponseMsg) {
1332 assert(is_valid(tbe));
1333 tbe.NumIntPendingAcks := tbe.NumIntPendingAcks + in_msg.Acks;
1337 action(m_decrementNumberOfMessagesExt, "\mmm", desc="Decrement the number of messages for which we're waiting") {
1338 peek(responseNetwork_in, ResponseMsg) {
1339 assert(is_valid(tbe));
1340 tbe.NumExtPendingAcks := tbe.NumExtPendingAcks - in_msg.Acks;
1344 action(mm_decrementNumberOfMessagesExt, "\mm", desc="Decrement the number of messages for which we're waiting") {
1345 peek(requestNetwork_in, RequestMsg) {
1346 assert(is_valid(tbe));
1347 tbe.NumExtPendingAcks := tbe.NumExtPendingAcks - in_msg.Acks;
1351 action(n_popResponseQueue, "n", desc="Pop response queue") {
1352 responseNetwork_in.dequeue();
1355 action(n_popTriggerQueue, "\n", desc="Pop trigger queue.") {
1356 triggerQueue_in.dequeue();
1359 action(o_popL1RequestQueue, "o", desc="Pop L1 request queue.") {
1360 L1requestNetwork_in.dequeue();
1364 action(o_checkForIntCompletion, "\o", desc="Check if we have received all the messages required for completion") {
1365 assert(is_valid(tbe));
1366 if (tbe.NumIntPendingAcks == 0) {
1367 enqueue(triggerQueue_out, TriggerMsg) {
1368 out_msg.Address := address;
1369 out_msg.Type := TriggerType:ALL_ACKS;
1374 action(o_checkForExtCompletion, "\oo", desc="Check if we have received all the messages required for completion") {
1375 assert(is_valid(tbe));
1376 if (tbe.NumExtPendingAcks == 0) {
1377 enqueue(triggerQueue_out, TriggerMsg) {
1378 out_msg.Address := address;
1379 out_msg.Type := TriggerType:ALL_ACKS;
1385 action( qq_sendDataFromTBEToMemory, "qq", desc="Send data from TBE to directory") {
1386 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
1387 assert(is_valid(tbe));
1388 out_msg.Address := address;
1389 out_msg.Sender := machineID;
1390 out_msg.SenderMachine := MachineType:L2Cache;
1391 out_msg.Destination.add(map_Address_to_Directory(address));
1392 out_msg.Dirty := tbe.Dirty;
1394 out_msg.Type := CoherenceResponseType:WRITEBACK_DIRTY_DATA;
1395 out_msg.DataBlk := tbe.DataBlk;
1396 out_msg.MessageSize := MessageSizeType:Writeback_Data;
1398 out_msg.Type := CoherenceResponseType:WRITEBACK_CLEAN_ACK;
1399 // NOTE: in a real system this would not send data. We send
1400 // data here only so we can check it at the memory
1401 out_msg.DataBlk := tbe.DataBlk;
1402 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1407 action( r_setMRU, "\rrr", desc="manually set the MRU bit for cache line" ) {
1408 if(is_valid(cache_entry)) {
1409 L2cacheMemory.setMRU(address);
1413 action( s_recordGetXL1ID, "ss", desc="record local GETX requestor") {
1414 peek(L1requestNetwork_in, RequestMsg) {
1415 assert(is_valid(tbe));
1416 tbe.L1_GetX_ID := in_msg.Requestor;
1420 action(s_deallocateTBE, "s", desc="Deallocate external TBE") {
1421 TBEs.deallocate(address);
1425 action( s_recordGetSL1ID, "\ss", desc="record local GETS requestor") {
1426 peek(L1requestNetwork_in, RequestMsg) {
1427 assert(is_valid(tbe));
1428 tbe.L1_GetS_IDs.add(in_msg.Requestor);
1432 action(t_recordFwdXID, "t", desc="record global GETX requestor") {
1433 peek(requestNetwork_in, RequestMsg) {
1434 assert(is_valid(tbe));
1435 tbe.Fwd_GetX_ID := in_msg.Requestor;
1436 tbe.Fwd_GETX_ExtAcks := in_msg.Acks;
1440 action(t_recordFwdSID, "\t", desc="record global GETS requestor") {
1441 peek(requestNetwork_in, RequestMsg) {
1442 assert(is_valid(tbe));
1443 tbe.Fwd_GetS_IDs.clear();
1444 tbe.Fwd_GetS_IDs.add(in_msg.Requestor);
1449 action(u_writeDataToCache, "u", desc="Write data to cache") {
1450 peek(responseNetwork_in, ResponseMsg) {
1451 assert(is_valid(cache_entry));
1452 cache_entry.DataBlk := in_msg.DataBlk;
1453 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
1454 address, cache_entry.DataBlk);
1455 if ((cache_entry.Dirty == false) && in_msg.Dirty) {
1456 cache_entry.Dirty := in_msg.Dirty;
1461 action(vv_allocateL2CacheBlock, "\v", desc="Set L2 cache tag equal to tag of block B.") {
1462 set_cache_entry(L2cacheMemory.allocate(address, new Entry));
1465 action(rr_deallocateL2CacheBlock, "\r", desc="Deallocate L2 cache block. Sets the cache to not present, allowing a replacement in parallel with a fetch.") {
1466 L2cacheMemory.deallocate(address);
1467 unset_cache_entry();
1471 action(w_assertIncomingDataAndCacheDataMatch, "w", desc="Assert that the incoming data and the data in the cache match") {
1472 peek(responseNetwork_in, ResponseMsg) {
1473 assert(is_valid(cache_entry));
1474 assert(cache_entry.DataBlk == in_msg.DataBlk);
1478 action(uu_profileMiss, "\u", desc="Profile the demand miss") {
1479 peek(L1requestNetwork_in, RequestMsg) {
1480 // AccessModeType not implemented
1481 // profile_L2Cache_miss(convertToGenericType(in_msg.Type), in_msg.AccessMode, MessageSizeTypeToInt(in_msg.MessageSize), in_msg.Prefetch, machineIDToNodeID(in_msg.Requestor));
1485 action(y_copyCacheStateToDir, "y", desc="Copy cache state to directory state") {
1486 copyCacheStateToDir(cache_entry, address);
1489 action(y_copyDirToCacheAndRemove, "/y", desc="Copy dir state to cache and remove") {
1490 copyDirToCache(cache_entry, address);
1491 localDirectory.deallocate(address);
1494 action(z_stall, "z", desc="Stall") {
1497 action(zz_recycleL1RequestQueue, "zz", desc="Send the head of the mandatory queue to the back of the queue.") {
1498 peek(L1requestNetwork_in, RequestMsg) {
1499 APPEND_TRANSITION_COMMENT(in_msg.Requestor);
1501 L1requestNetwork_in.recycle();
1504 action(zz_recycleRequestQueue, "\zz", desc="Send the head of the mandatory queue to the back of the queue.") {
1505 peek(requestNetwork_in, RequestMsg) {
1506 APPEND_TRANSITION_COMMENT(in_msg.Requestor);
1508 requestNetwork_in.recycle();
1511 action(zz_recycleResponseQueue, "\z\z", desc="Send the head of the mandatory queue to the back of the queue.") {
1512 peek(responseNetwork_in, ResponseMsg) {
1513 APPEND_TRANSITION_COMMENT(in_msg.Sender);
1515 responseNetwork_in.recycle();
1518 action(da_sendDmaAckUnblock, "da", desc="Send dma ack to global directory") {
1519 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
1520 out_msg.Address := address;
1521 out_msg.Type := CoherenceResponseType:DMA_ACK;
1522 out_msg.Destination.add(map_Address_to_Directory(address));
1523 out_msg.Sender := machineID;
1524 out_msg.SenderMachine := MachineType:L2Cache;
1525 out_msg.MessageSize := MessageSizeType:Unblock_Control;
1531 //*****************************************************
1533 //*****************************************************
1535 transition({II, IFGX, IFGS, ISFGS, IFGXX, IFLXO, OFGX, ILOW, ILOXW, ILOSW, ILOSXW, SLSW, OLSW, ILSW, IW, OW, SW, OXW, OLSXW, ILXW, IFLS, IFLO, IFLOX, IFLOXX, IFLOSX, OLSXS, IGS, IGM, IGMLS, IGMO, IGMIO, OGMIO, IGMIOF, OGMIOF, MM, SS, OO, OI, MI, MII, OLSI, ILSI, SLSS, OLSS, OLSF, IGMIOFS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {L1_PUTO, L1_PUTS, L1_PUTS_only, L1_PUTX}) {
1536 zz_recycleL1RequestQueue;
1539 transition({II, IFGX, IFGS, ISFGS, IFGXX, IFLXO, OFGX, ILOW, ILOXW, ILOSW, ILOSXW, SLSW, OLSW, ILSW, IW, OW, SW, OXW, OLSXW, ILXW, IFLS, IFLO, IFLOX, IFLOXX, IFLOSX, OLSXS, IGS, IGM, IGMLS, IGMO, IGMIO, OGMIO, IGMIOF, OGMIOF, MM, SS, OO, OI, MI, MII, OLSI, ILSI, SLSS, OLSS, OLSF, IGMIOFS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {L1_GETX, L1_GETS}) {
1540 zz_recycleL1RequestQueue;
1543 transition({IFGX, IFGS, ISFGS, IFGXX, IFLXO, OFGX, ILOW, ILOXW, ILOSW, ILOSXW, SLSW, OLSW, ILSW, IW, ILXW, OW, SW, OXW, OLSXW, IFLS, IFLO, IFLOX, IFLOXX, IFLOSX,OLSXS, IGS, IGM, IGMLS, IGMO, MM, SS, OO, OI, MI, MII, OLSI, ILSI, SLSS, OLSS, OLSF, IGMIOFS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, L2_Replacement) {
1544 zz_recycleResponseQueue;
1547 transition({IFGX, IFGS, ISFGS, IFGXX, IFLXO, OFGX, ILOW, ILOXW, ILOSW, ILOSXW, SLSW, OLSW, ILSW, IW, OW, SW, OXW, OLSXW, ILXW, IFLS, IFLO, IFLOX, IFLOXX, IFLOSX,OLSXS, IGS, IGM, MM, SS, OO, SLSS, OLSS, OLSF, IGMIOFS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {Fwd_GETX, Fwd_GETS, Fwd_DMA}) {
1548 zz_recycleRequestQueue;
1551 transition({OGMIO, IGMIO, IGMO}, Fwd_DMA) {
1552 zz_recycleRequestQueue;
1555 transition({IFGX, IFGS, ISFGS, IFGXX, IFLXO, OFGX, ILOW, ILOXW, ILOSW, ILOSXW, SLSW, OLSW, ILSW, IW, OW, SW, OXW, OLSXW, ILXW, IFLS, IFLO, IFLOX, IFLOXX, IFLOSX,OLSXS, MM, SS, OO, SLSS, OLSS, OLSF, IGMIOFS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {Inv}) {
1556 zz_recycleRequestQueue;
1559 transition({IGM, IGS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {Own_GETX}) {
1560 zz_recycleRequestQueue;
1563 // must happened because we forwarded GETX to local exclusive trying to do wb
1564 transition({I, M, O, ILS, ILOX, OLS, OLSX, SLS, S}, L1_PUTX) {
1566 o_popL1RequestQueue;
1569 transition({M}, {L1_PUTS, L1_PUTO} ) {
1571 o_popL1RequestQueue;
1574 transition({ILS, OLSX}, L1_PUTO){
1576 o_popL1RequestQueue;
1579 // happened if we forwarded GETS to exclusive who tried to do writeback
1580 // ?? should we just Nack these instead? Could be a bugs here
1581 transition(ILO, L1_PUTX, ILOW) {
1582 l_writebackAckNeedData;
1583 o_popL1RequestQueue;
1586 // this can happen if we forwarded a L1_GETX to exclusiver after it issued a PUTX
1587 transition(ILOS, L1_PUTX, ILOSW) {
1588 l_writebackAckNeedData;
1589 o_popL1RequestQueue;
1592 transition(ILOSX, L1_PUTX, ILOSXW) {
1593 l_writebackAckNeedData;
1594 o_popL1RequestQueue;
1597 // must happened because we got Inv when L1 attempted PUTS
1598 transition(I, L1_PUTS) {
1600 o_popL1RequestQueue;
1603 transition(I, L1_PUTO) {
1605 o_popL1RequestQueue;
1608 // FORWARDED REQUESTS
1610 transition({ILO, ILX, ILOX}, Fwd_GETS, IFGS) {
1613 j_forwardGlobalRequestToLocalOwner;
1617 transition({ILOS, ILOSX}, Fwd_GETS, ISFGS) {
1620 j_forwardGlobalRequestToLocalOwner;
1624 transition(ILOS, Fwd_DMA, ILOSD) {
1626 jd_forwardDmaRequestToLocalOwner;
1630 transition(ILOSD, DmaAck, ILOS) {
1632 da_sendDmaAckUnblock;
1636 transition(ILOSX, Fwd_DMA, ILOSXD) {
1639 jd_forwardDmaRequestToLocalOwner;
1643 transition(ILOSXD, DmaAck, ILOSX) {
1645 da_sendDmaAckUnblock;
1649 transition(ILO, Fwd_DMA, ILOD) {
1652 jd_forwardDmaRequestToLocalOwner;
1656 transition(ILOD, DmaAck, ILO) {
1658 da_sendDmaAckUnblock;
1662 transition(ILX, Fwd_DMA, ILXD) {
1665 jd_forwardDmaRequestToLocalOwner;
1669 transition(ILXD, DmaAck, ILX) {
1671 da_sendDmaAckUnblock;
1675 transition(ILOX, Fwd_DMA, ILOXD) {
1678 jd_forwardDmaRequestToLocalOwner;
1682 transition(ILOXD, DmaAck, ILOX) {
1684 da_sendDmaAckUnblock;
1688 transition({ILOS, ILOSX, ILO, ILX, ILOX, ILXW}, Data) {
1690 c_sendDataFromTBEToFwdGETS;
1695 transition(IFGS, Data, ILO) {
1697 c_sendDataFromTBEToFwdGETS;
1702 transition(ISFGS, Data, ILOS) {
1704 c_sendDataFromTBEToFwdGETS;
1709 transition(IFGS, Data_Exclusive, I) {
1711 c_sendExclusiveDataFromTBEToFwdGETS;
1712 gg_clearLocalSharers;
1718 transition({ILX, ILO, ILOX}, Fwd_GETX, IFGX) {
1721 j_forwardGlobalRequestToLocalOwner;
1725 transition(IFGX, {Data_Exclusive, Data}, I) {
1727 c_sendDataFromTBEToFwdGETX;
1728 gg_clearLocalSharers;
1733 transition({ILOSX, ILOS}, Fwd_GETX, IFGXX) {
1736 j_forwardGlobalRequestToLocalOwner;
1737 ee_sendLocalInvSharersOnly;
1743 transition(IFGXX, IntAck) {
1744 m_decrementNumberOfMessagesInt;
1745 o_checkForIntCompletion;
1749 transition(IFGXX, Data_Exclusive) {
1751 m_decrementNumberOfMessagesInt;
1752 o_checkForIntCompletion;
1756 transition(IFGXX, All_Acks, I) {
1757 c_sendDataFromTBEToFwdGETX;
1758 gg_clearLocalSharers;
1764 // transition({O, OX}, Fwd_GETX, I) {
1765 transition(O, Fwd_GETX, I) {
1766 dd_sendDataToFwdGETX;
1767 y_copyCacheStateToDir;
1768 rr_deallocateL2CacheBlock;
1772 transition({O, OLS}, Fwd_GETS) {
1773 dd_sendDataToFwdGETS;
1777 transition({O, OLS}, Fwd_DMA) {
1778 dd_sendDataToFwdGETS;
1779 da_sendDmaAckUnblock;
1783 // transition({OLSX, OX}, Fwd_GETS, O) {
1784 transition(OLSX, Fwd_GETS, OLS) {
1785 dd_sendDataToFwdGETS;
1789 transition(OLSX, Fwd_DMA) {
1790 dd_sendDataToFwdGETS;
1791 da_sendDmaAckUnblock;
1795 transition(M, Fwd_GETX, I) {
1796 dd_sendDataToFwdGETX;
1797 rr_deallocateL2CacheBlock;
1801 // MAKE THIS THE SAME POLICY FOR NOW
1803 // transition(M, Fwd_GETS, O) {
1804 // dd_sendDataToFwdGETS;
1805 // m_popRequestQueue;
1808 transition(M, Fwd_GETS, I) {
1809 dd_sendExclusiveDataToFwdGETS;
1810 rr_deallocateL2CacheBlock;
1814 transition(M, Fwd_DMA) {
1815 dd_sendExclusiveDataToFwdGETS;
1816 da_sendDmaAckUnblock;
1820 transition({OLS, OLSX}, Fwd_GETX, OLSF) {
1827 transition(OLSF, IntAck) {
1828 m_decrementNumberOfMessagesInt;
1829 o_checkForIntCompletion;
1833 transition(OLSF, All_Acks, I) {
1834 c_sendDataFromTBEToFwdGETX;
1835 gg_clearLocalSharers;
1837 rr_deallocateL2CacheBlock;
1843 // INVALIDATIONS FROM GLOBAL DIRECTORY
1845 transition({IGM, IGS}, Inv) {
1851 transition({I,NP}, Inv) {
1859 // NEED INV for S state
1861 transition({ILS, ILO, ILX}, Inv, II) {
1865 gg_clearLocalSharers;
1869 transition(SLS, Inv, II) {
1873 rr_deallocateL2CacheBlock;
1877 transition(II, IntAck) {
1878 m_decrementNumberOfMessagesInt;
1879 o_checkForIntCompletion;
1883 transition(II, All_Acks, I) {
1889 transition(S, Inv, I) {
1894 rr_deallocateL2CacheBlock;
1899 // LOCAL REQUESTS SATISFIED LOCALLY
1901 transition(OLSX, L1_GETX, IFLOX) {
1904 // count number of INVs needed that doesn't include requestor
1905 h_countLocalSharersExceptRequestor;
1906 // issue INVs to everyone except requestor
1907 ee_issueLocalInvExceptL1Requestor;
1909 y_copyCacheStateToDir;
1911 rr_deallocateL2CacheBlock;
1913 o_popL1RequestQueue;
1916 transition(IFLOX, Exclusive_Unblock, ILX) {
1917 g_recordLocalExclusive;
1922 transition(OLSX, L1_GETS, OLSXS) {
1925 o_popL1RequestQueue;
1928 transition(OLSXS, Unblock, OLSX) {
1929 g_recordLocalSharer;
1933 // after this, can't get Fwd_GETX
1934 transition(IGMO, Own_GETX) {
1935 mm_decrementNumberOfMessagesExt;
1936 o_checkForExtCompletion;
1942 transition(ILX, L1_GETS, IFLOXX) {
1943 kk_forwardLocalGETSToLocalOwner;
1945 o_popL1RequestQueue;
1948 transition(ILOSX, L1_GETS, IFLOSX) {
1949 kk_forwardLocalGETSToLocalOwner;
1951 o_popL1RequestQueue;
1954 transition({ILOS, ILO}, L1_GETS, IFLO) {
1955 kk_forwardLocalGETSToLocalOwner;
1957 o_popL1RequestQueue;
1960 transition(ILS, L1_GETS, IFLS) {
1961 k_forwardLocalGETSToLocalSharer;
1963 o_popL1RequestQueue;
1966 transition({ILX, ILOX}, L1_GETX, IFLOXX) {
1967 kk_forwardLocalGETXToLocalExclusive;
1968 e_sendAckToL1Requestor;
1970 o_popL1RequestQueue;
1973 transition(ILOX, L1_GETS, IFLOX) {
1974 kk_forwardLocalGETSToLocalOwner;
1976 o_popL1RequestQueue;
1979 transition(IFLOX, Unblock, ILOSX) {
1980 g_recordLocalSharer;
1984 transition(IFLS, Unblock, ILS) {
1985 g_recordLocalSharer;
1989 transition(IFLOXX, Unblock, ILOSX) {
1990 g_recordLocalSharer;
1994 transition(IFLOSX, Unblock, ILOSX) {
1995 g_recordLocalSharer;
1999 transition({IFLOSX, IFLOXX}, Exclusive_Unblock, ILX) {
2000 g_recordLocalExclusive;
2004 transition(IFLO, Unblock, ILOS) {
2005 g_recordLocalSharer;
2010 transition(ILOSX, L1_GETX, IFLXO) {
2013 h_countLocalSharersExceptRequestor;
2014 ee_issueLocalInvExceptL1Requestor;
2015 k_forwardLocalGETXToLocalOwner;
2016 e_sendAckToL1RequestorFromTBE;
2018 o_popL1RequestQueue;
2021 transition(IFLXO, Exclusive_Unblock, ILX) {
2022 g_recordLocalExclusive;
2027 // LOCAL REQUESTS THAT MUST ISSUE
2029 transition(NP, {L1_PUTS, L1_PUTX, L1_PUTO}) {
2031 o_popL1RequestQueue;
2034 transition({NP, I}, L1_GETS, IGS) {
2039 o_popL1RequestQueue;
2042 transition({NP, I}, L1_GETX, IGM) {
2047 o_popL1RequestQueue;
2050 transition(S, L1_GETX, IGM) {
2054 y_copyCacheStateToDir;
2056 rr_deallocateL2CacheBlock;
2058 o_popL1RequestQueue;
2061 transition(ILS, L1_GETX, IGMLS) {
2065 // count number of INVs (just sharers?) needed that doesn't include requestor
2066 h_countLocalSharersExceptRequestor;
2068 o_popL1RequestQueue;
2071 transition(IGMLS, Inv) {
2077 transition(IGMLS, IntAck) {
2078 m_decrementNumberOfMessagesInt;
2079 o_checkForIntCompletion;
2083 transition(IGMLS, All_Acks, IGM) {
2084 gg_clearLocalSharers;
2090 // transition(IGMLS, ExtAck, IGMO) {
2091 transition(IGMLS, ExtAck) {
2092 m_decrementNumberOfMessagesExt;
2093 o_checkForExtCompletion;
2097 transition(IGMLS, {Data, Data_Exclusive}, IGMO) {
2098 ee_issueLocalInvExceptL1RequestorInTBE;
2100 m_decrementNumberOfMessagesExt;
2101 o_checkForExtCompletion;
2106 transition(ILOS, L1_GETX, IGMIO) {
2111 o_popL1RequestQueue;
2114 // new exclusive happened while sharer attempted writeback
2115 transition(ILX, {L1_PUTS, L1_PUTS_only, L1_PUTO}) {
2117 o_popL1RequestQueue;
2120 transition(S, L1_PUTS) {
2122 o_popL1RequestQueue;
2125 transition(OLS, L1_GETX, OGMIO) {
2129 h_countLocalSharersExceptRequestor;
2130 // COPY DATA FROM CACHE TO TBE (happens during i_allocateTBE)
2131 y_copyCacheStateToDir;
2132 rr_deallocateL2CacheBlock;
2134 o_popL1RequestQueue;
2137 transition(OGMIO, Fwd_GETS) {
2139 c_sendDataFromTBEToFwdGETS;
2143 transition(ILO, L1_GETX, IGMIO) {
2147 // the following, of course, returns 0 sharers but do anyways for consistency
2148 h_countLocalSharersExceptRequestor;
2150 o_popL1RequestQueue;
2153 transition({ILO, ILOX}, L1_PUTS) {
2155 o_popL1RequestQueue;
2158 transition(IGMIO, Fwd_GETX, IGMIOF) {
2160 j_forwardGlobalRequestToLocalOwner;
2161 ee_sendLocalInvSharersOnly;
2166 transition(IGMIO, Fwd_GETS, IGMIOFS) {
2168 j_forwardGlobalRequestToLocalOwner;
2172 transition(IGMIOFS, Data, IGMIO) {
2174 c_sendDataFromTBEToFwdGETS;
2178 transition(OGMIO, Fwd_GETX, OGMIOF) {
2180 ee_sendLocalInvSharersOnly;
2184 transition(OGMIOF, IntAck) {
2185 m_decrementNumberOfMessagesInt;
2186 o_checkForIntCompletion;
2190 transition(OGMIOF, All_Acks, IGM) {
2191 gg_clearLocalSharers;
2192 hh_countLocalSharersExceptL1GETXRequestorInTBE;
2193 c_sendDataFromTBEToFwdGETX;
2197 transition(IGMIOF, IntAck) {
2198 m_decrementNumberOfMessagesInt;
2199 o_checkForIntCompletion;
2203 transition(IGMIOF, Data_Exclusive) {
2205 m_decrementNumberOfMessagesInt;
2206 o_checkForIntCompletion;
2210 transition(IGMIOF, All_Acks, IGM) {
2211 gg_clearLocalSharers;
2212 c_sendDataFromTBEToFwdGETX;
2216 transition(IGMIO, All_Acks, IGMO) {
2217 hh_countLocalSharersExceptL1GETXRequestorInTBE;
2218 ee_issueLocalInvExceptL1RequestorInTBE;
2219 k_forwardLocalGETXToLocalOwner;
2220 e_sendAckToL1RequestorFromTBE;
2224 transition(OGMIO, All_Acks, IGMO) {
2225 ee_issueLocalInvExceptL1RequestorInTBE;
2226 c_sendDataFromTBEToL1GETX;
2230 transition({IGMIO, OGMIO}, Own_GETX) {
2231 mm_decrementNumberOfMessagesExt;
2232 o_checkForExtCompletion;
2237 transition(IGM, {Data, Data_Exclusive}, IGMO) {
2239 m_decrementNumberOfMessagesExt;
2240 o_checkForExtCompletion;
2244 transition({IGM, IGMIO, OGMIO}, ExtAck) {
2245 m_decrementNumberOfMessagesExt;
2246 o_checkForExtCompletion;
2250 transition(IGMO, ExtAck) {
2251 m_decrementNumberOfMessagesExt;
2252 o_checkForExtCompletion;
2256 transition(IGS, Data) {
2258 m_decrementNumberOfMessagesExt;
2259 c_sendDataFromTBEToL1GETS;
2263 transition(IGS, Data_Exclusive) {
2265 m_decrementNumberOfMessagesExt;
2266 c_sendExclusiveDataFromTBEToL1GETS;
2270 transition(IGS, Unblock, ILS) {
2271 g_recordLocalSharer;
2277 transition(IGS, Exclusive_Unblock, ILX) {
2278 g_recordLocalExclusive;
2279 f_sendExclusiveUnblock;
2284 transition(IGMO, All_Acks) {
2285 c_sendDataFromTBEToL1GETX;
2289 transition(IGMO, Exclusive_Unblock, ILX) {
2290 g_recordLocalExclusive;
2291 f_sendExclusiveUnblock;
2297 transition(SLS, L1_GETX, IGMLS) {
2301 // count number of INVs needed that doesn't include requestor
2302 h_countLocalSharersExceptRequestor;
2303 // issue INVs to everyone except requestor
2304 y_copyCacheStateToDir;
2305 rr_deallocateL2CacheBlock;
2307 o_popL1RequestQueue;
2311 transition(SLS, L1_GETS, SLSS ) {
2314 o_popL1RequestQueue;
2317 transition(SLSS, Unblock, SLS) {
2318 g_recordLocalSharer;
2323 transition(O, L1_GETX, IGMO) {
2327 y_copyCacheStateToDir;
2328 rr_deallocateL2CacheBlock;
2330 o_popL1RequestQueue;
2333 transition(OLS, L1_GETS, OLSS) {
2336 o_popL1RequestQueue;
2339 transition(OLSS, Unblock, OLS) {
2340 g_recordLocalSharer;
2344 transition(IGMO, Fwd_GETX, IGM) {
2346 c_sendDataFromTBEToFwdGETX;
2351 transition(IGMO, Fwd_GETS) {
2353 c_sendDataFromTBEToFwdGETS;
2358 // LOCAL REQUESTS SATISFIED DIRECTLY BY L2
2360 transition(M, L1_GETX, MM) {
2362 // should count 0 of course
2363 h_countLocalSharersExceptRequestor;
2365 y_copyCacheStateToDir;
2366 rr_deallocateL2CacheBlock;
2368 o_popL1RequestQueue;
2371 transition(MM, Exclusive_Unblock, ILX) {
2372 g_recordLocalExclusive;
2376 transition(M, L1_GETS, OO) {
2378 // should count 0 of course
2379 h_countLocalSharersExceptRequestor;
2383 o_popL1RequestQueue;
2386 transition(S, L1_GETS, SS) {
2389 o_popL1RequestQueue;
2392 transition(SS, Unblock, SLS) {
2393 g_recordLocalSharer;
2397 transition(O, L1_GETS, OO) {
2400 o_popL1RequestQueue;
2403 transition(OO, Unblock, OLS) {
2404 g_recordLocalSharer;
2408 transition(OO, Exclusive_Unblock, ILX) {
2409 g_recordLocalExclusive
2410 y_copyCacheStateToDir;
2411 rr_deallocateL2CacheBlock;
2417 transition(ILO, L1_PUTO, ILOW) {
2418 l_writebackAckNeedData;
2419 o_popL1RequestQueue;
2422 transition(ILOX, L1_PUTO, ILOXW) {
2423 l_writebackAckNeedData;
2424 o_popL1RequestQueue;
2428 transition(ILOS, L1_PUTO, ILOSW) {
2429 l_writebackAckNeedData;
2430 o_popL1RequestQueue;
2433 transition(ILOSX, L1_PUTO, ILOSXW) {
2434 l_writebackAckNeedData;
2435 o_popL1RequestQueue;
2439 // hmmm...keep data or drop. Just drop for now
2440 transition(ILOS, L1_PUTS_only, ILOW) {
2441 l_writebackAckDropData;
2442 o_popL1RequestQueue;
2445 transition(ILSW, Unblock, ILS) {
2446 gg_clearSharerFromL1Response;
2450 transition(ILOW, Unblock, ILO) {
2451 gg_clearSharerFromL1Response;
2455 transition(ILOSX, L1_PUTS_only, ILOXW) {
2456 l_writebackAckDropData;
2457 o_popL1RequestQueue;
2460 transition(ILOXW, Unblock, ILOX) {
2461 gg_clearSharerFromL1Response;
2465 // hmmm...keep data or drop. Just drop for now
2466 transition(ILOS, L1_PUTS, ILOSW) {
2467 l_writebackAckDropData;
2468 o_popL1RequestQueue;
2471 transition(ILOSX, L1_PUTS, ILOSXW) {
2472 l_writebackAckDropData;
2473 o_popL1RequestQueue;
2476 transition(ILOSW, Unblock, ILOS) {
2477 gg_clearSharerFromL1Response;
2481 transition(ILOSXW, Unblock, ILOSX) {
2482 gg_clearSharerFromL1Response;
2486 transition(SLS, L1_PUTS, SLSW) {
2487 l_writebackAckDropData;
2488 o_popL1RequestQueue;
2491 transition(SLS, L1_PUTS_only, SW) {
2492 l_writebackAckDropData;
2493 o_popL1RequestQueue;
2496 transition(SW, {Unblock}, S) {
2497 gg_clearSharerFromL1Response;
2501 transition(OLS, L1_PUTS, OLSW) {
2502 l_writebackAckDropData;
2503 o_popL1RequestQueue;
2506 transition(ILS, L1_PUTS, ILSW) {
2507 l_writebackAckNeedData;
2508 o_popL1RequestQueue;
2511 transition(ILS, L1_PUTS_only, IW) {
2512 l_writebackAckNeedData;
2513 o_popL1RequestQueue;
2516 transition(OLS, L1_PUTS_only, OW) {
2517 l_writebackAckDropData;
2518 o_popL1RequestQueue;
2521 transition(OLSX, L1_PUTS_only, OXW) {
2522 l_writebackAckDropData;
2523 o_popL1RequestQueue;
2526 transition(OLSX, L1_PUTS, OLSXW) {
2527 l_writebackAckDropData;
2528 o_popL1RequestQueue;
2531 transition(OLSXW, {Unblock}, OLSX) {
2532 gg_clearSharerFromL1Response;
2536 transition(OW, {Unblock}, O) {
2537 gg_clearSharerFromL1Response;
2541 transition(OXW, {Unblock}, M) {
2542 gg_clearSharerFromL1Response;
2546 transition(ILX, L1_PUTX, ILXW ) {
2547 l_writebackAckNeedData;
2548 o_popL1RequestQueue;
2551 transition(ILXW, L1_WBDIRTYDATA, M) {
2552 gg_clearLocalSharers;
2553 vv_allocateL2CacheBlock;
2554 y_copyDirToCacheAndRemove;
2560 transition(ILXW, L1_WBCLEANDATA, M) {
2561 gg_clearLocalSharers;
2562 vv_allocateL2CacheBlock;
2563 y_copyDirToCacheAndRemove;
2568 transition(ILXW, Unblock, ILX) {
2569 // writeback canceled because L1 invalidated
2573 transition(ILSW, L1_WBCLEANDATA, SLS) {
2574 vv_allocateL2CacheBlock;
2575 y_copyDirToCacheAndRemove;
2577 gg_clearSharerFromL1Response;
2581 transition(IW, L1_WBCLEANDATA, S) {
2582 vv_allocateL2CacheBlock;
2583 y_copyDirToCacheAndRemove;
2585 gg_clearSharerFromL1Response;
2590 // Owner can have dirty data
2591 transition(ILOW, {L1_WBCLEANDATA, L1_WBDIRTYDATA}, O) {
2592 vv_allocateL2CacheBlock;
2593 y_copyDirToCacheAndRemove;
2594 gg_clearOwnerFromL1Response;
2599 transition(ILOXW, L1_WBDIRTYDATA, M) {
2600 vv_allocateL2CacheBlock;
2601 y_copyDirToCacheAndRemove;
2602 gg_clearOwnerFromL1Response;
2607 transition(ILOXW, L1_WBCLEANDATA, M) {
2608 vv_allocateL2CacheBlock;
2609 y_copyDirToCacheAndRemove;
2610 gg_clearOwnerFromL1Response;
2615 transition(ILOSW, {L1_WBCLEANDATA, L1_WBDIRTYDATA}, OLS) {
2616 vv_allocateL2CacheBlock;
2617 y_copyDirToCacheAndRemove;
2618 gg_clearOwnerFromL1Response;
2623 transition(ILOSXW, {L1_WBCLEANDATA, L1_WBDIRTYDATA}, OLSX) {
2624 vv_allocateL2CacheBlock;
2625 y_copyDirToCacheAndRemove;
2626 gg_clearOwnerFromL1Response;
2632 transition(SLSW, {Unblock}, SLS) {
2633 gg_clearSharerFromL1Response;
2637 transition(OLSW, {Unblock}, OLS) {
2638 gg_clearSharerFromL1Response;
2644 transition({I, S}, L2_Replacement, I) {
2645 rr_deallocateL2CacheBlock;
2648 transition(ILS, L2_Replacement) {
2649 y_copyCacheStateToDir;
2650 rr_deallocateL2CacheBlock;
2653 transition(ILX, L2_Replacement ) {
2654 y_copyCacheStateToDir;
2655 rr_deallocateL2CacheBlock;
2658 transition({ILO, ILOS}, L2_Replacement ) {
2659 y_copyCacheStateToDir;
2660 rr_deallocateL2CacheBlock;
2663 transition(SLS, L2_Replacement, ILS) {
2664 y_copyCacheStateToDir;
2665 rr_deallocateL2CacheBlock;
2668 transition({OLS, OLSX}, L2_Replacement, OLSI) {
2669 y_copyCacheStateToDir;
2672 rr_deallocateL2CacheBlock;
2676 transition(O, L2_Replacement, OI) {
2679 rr_deallocateL2CacheBlock;
2682 transition(M, L2_Replacement, MI) {
2685 rr_deallocateL2CacheBlock;
2688 transition(OLSI, Fwd_GETX, ILSI) {
2694 transition(ILSI, IntAck) {
2695 m_decrementNumberOfMessagesInt;
2696 o_checkForIntCompletion;
2700 transition(ILSI, All_Acks, MII) {
2701 gg_clearLocalSharers;
2702 c_sendDataFromTBEToFwdGETX;
2706 transition(OLSI, Fwd_GETS) {
2708 c_sendDataFromTBEToFwdGETS;
2712 transition({MI, OI}, Fwd_GETS, OI) {
2714 c_sendDataFromTBEToFwdGETS;
2718 transition({MI, OI}, Fwd_DMA, OI) {
2719 cd_sendDataFromTBEToFwdDma;
2720 da_sendDmaAckUnblock;
2724 transition(OLSI, Fwd_DMA) {
2725 cd_sendDataFromTBEToFwdDma;
2726 da_sendDmaAckUnblock;
2730 transition({MI, OI}, Fwd_GETX, MII) {
2732 c_sendDataFromTBEToFwdGETX;
2736 transition({MI, OI}, Writeback_Ack, I) {
2737 qq_sendDataFromTBEToMemory;
2742 transition(MII, Writeback_Nack, I) {
2747 transition(OI, Writeback_Nack) {
2752 transition(OLSI, Writeback_Ack, ILS) {
2753 qq_sendDataFromTBEToMemory;
2758 transition(MII, Writeback_Ack, I) {
2764 transition(ILSI, Writeback_Ack, ILS) {