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"; // this L2 bank -> a local L1
44 MessageBuffer GlobalRequestFromL2Cache, network="To", virtual_network="1", ordered="false"; // this L2 bank -> mod-directory
45 MessageBuffer responseFromL2Cache, network="To", virtual_network="2", ordered="false"; // 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"; // a local L1 -> this L2 bank, Lets try this???
49 MessageBuffer GlobalRequestToL2Cache, network="From", virtual_network="1", ordered="false"; // mod-directory -> this L2 bank
50 MessageBuffer responseToL2Cache, network="From", virtual_network="2", ordered="false"; // a local L1 || mod-directory -> this L2 bank
51 // MessageBuffer L1WritebackToL2Cache, network="From", virtual_network="3", ordered="false";
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:Busy, desc="Idle/NP, but local sharers exist";
60 ILX, AccessPermission:Busy, desc="Idle/NP, but local exclusive exists";
61 ILO, AccessPermission:Busy, desc="Idle/NP, but local owner exists";
62 ILOX, AccessPermission:Busy, desc="Idle/NP, but local owner exists and chip is exclusive";
63 ILOS, AccessPermission:Busy, desc="Idle/NP, but local owner exists and local sharers as well";
64 ILOSX, AccessPermission:Busy, 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";
131 enumeration(Event, desc="Cache events") {
134 L1_GETS, desc="local L1 GETS request";
135 L1_GETX, desc="local L1 GETX request";
136 L1_PUTO, desc="local owner wants to writeback";
137 L1_PUTX, desc="local exclusive wants to writeback";
138 L1_PUTS_only, desc="only local sharer wants to writeback";
139 L1_PUTS, desc="local sharer wants to writeback";
140 Fwd_GETX, desc="A GetX from another processor";
141 Fwd_GETS, desc="A GetS from another processor";
142 Fwd_DMA, desc="A request from DMA";
143 Own_GETX, desc="A GetX from this node";
144 Inv, desc="Invalidations from the directory";
147 IntAck, desc="Received an ack message";
148 ExtAck, desc="Received an ack message";
149 All_Acks, desc="Received all ack messages";
150 Data, desc="Received a data message, responder has a shared copy";
151 Data_Exclusive, desc="Received a data message";
152 L1_WBCLEANDATA, desc="Writeback from L1, with data";
153 L1_WBDIRTYDATA, desc="Writeback from L1, with data";
155 Writeback_Ack, desc="Writeback O.K. from directory";
156 Writeback_Nack, desc="Writeback not O.K. from directory";
158 Unblock, desc="Local L1 is telling L2 dir to unblock";
159 Exclusive_Unblock, desc="Local L1 is telling L2 dir to unblock";
162 // events initiated by this L2
163 L2_Replacement, desc="L2 Replacement", format="!r";
170 structure(Entry, desc="...", interface="AbstractCacheEntry") {
171 State CacheState, desc="cache state";
172 NetDest Sharers, desc="Set of the internal processors that want the block in shared state";
173 MachineID Owner, desc="ID of the L1 cache to forward the block to once we get a response";
174 bool OwnerValid, default="false", desc="true if Owner means something";
175 bool Dirty, desc="Is the data dirty (different than memory)?";
176 DataBlock DataBlk, desc="data for the block";
180 structure(DirEntry, desc="...") {
181 NetDest Sharers, desc="Set of the internal processors that want the block in shared state";
182 MachineID Owner, desc="ID of the L1 cache to forward the block to once we get a response";
183 bool OwnerValid, default="false", desc="true if Owner means something";
184 State DirState, desc="directory state";
188 structure(TBE, desc="...") {
189 Address Address, desc="Physical address for this TBE";
190 State TBEState, desc="Transient state";
191 Address PC, desc="Program counter of request";
192 DataBlock DataBlk, desc="Buffer for the data block";
193 bool Dirty, desc="Is the data dirty (different than memory)?";
195 int NumExtPendingAcks, default="0", desc="Number of global acks/data messages waiting for";
196 int NumIntPendingAcks, default="0", desc="Number of global acks/data messages waiting for";
197 int Fwd_GETX_ExtAcks, default="0", desc="Number of acks that requestor will need";
198 int Local_GETX_IntAcks, default="0", desc="Number of acks that requestor will need";
200 NetDest L1_GetS_IDs, desc="Set of the internal processors that want the block in shared state";
201 MachineID L1_GetX_ID, desc="ID of the L1 cache to forward the block to once we get a response";
202 NetDest Fwd_GetS_IDs, desc="Set of the internal processors that want the block in shared state";
203 MachineID Fwd_GetX_ID, desc="ID of the L1 cache to forward the block to once we get a response";
206 structure(TBETable, external = "yes") {
208 void allocate(Address);
209 void deallocate(Address);
210 bool isPresent(Address);
213 structure(PerfectCacheMemory, external = "yes") {
214 void allocate(Address);
215 void deallocate(Address);
216 DirEntry lookup(Address);
217 bool isTagPresent(Address);
221 TBETable TBEs, template_hack="<L2Cache_TBE>";
222 PerfectCacheMemory localDirectory, template_hack="<L2Cache_DirEntry>";
224 void set_cache_entry(AbstractCacheEntry b);
225 void unset_cache_entry();
229 Entry getCacheEntry(Address address), return_by_pointer="yes" {
230 return static_cast(Entry, "pointer", L2cacheMemory[address]);
233 bool isDirTagPresent(Address addr) {
234 return (localDirectory.isTagPresent(addr) );
237 bool isOnlySharer(Entry cache_entry, Address addr, MachineID shar_id) {
238 if (is_valid(cache_entry)) {
239 assert (localDirectory.isTagPresent(addr) == false);
240 if (cache_entry.Sharers.count() > 1) {
243 else if (cache_entry.Sharers.count() == 1) {
244 if (cache_entry.Sharers.isElement(shar_id)) {
248 return false; // something happened which should cause this PUTS to be nacked
256 else if (localDirectory.isTagPresent(addr)){
257 if (localDirectory[addr].Sharers.count() > 1) {
260 else if (localDirectory[addr].Sharers.count() == 1) {
261 if (localDirectory[addr].Sharers.isElement(shar_id)) {
265 return false; // something happened which should cause this PUTS to be nacked
273 // shouldn't happen unless L1 issues PUTS before unblock received
278 void copyCacheStateToDir(Entry cache_entry, Address addr) {
279 assert(localDirectory.isTagPresent(addr) == false);
280 assert(is_valid(cache_entry));
281 localDirectory.allocate(addr);
282 localDirectory[addr].DirState := cache_entry.CacheState;
283 localDirectory[addr].Sharers := cache_entry.Sharers;
284 localDirectory[addr].Owner := cache_entry.Owner;
285 localDirectory[addr].OwnerValid := cache_entry.OwnerValid;
289 void copyDirToCache(Entry cache_entry, Address addr) {
290 assert(is_valid(cache_entry));
291 cache_entry.Sharers := localDirectory[addr].Sharers;
292 cache_entry.Owner := localDirectory[addr].Owner;
293 cache_entry.OwnerValid := localDirectory[addr].OwnerValid;
297 void recordLocalSharerInDir(Entry cache_entry, Address addr, MachineID shar_id) {
298 if (is_valid(cache_entry)) {
299 assert (localDirectory.isTagPresent(addr) == false);
300 cache_entry.Sharers.add(shar_id);
303 if (localDirectory.isTagPresent(addr) == false) {
304 localDirectory.allocate(addr);
305 localDirectory[addr].Sharers.clear();
306 localDirectory[addr].OwnerValid := false;
308 localDirectory[addr].Sharers.add(shar_id);
312 void recordNewLocalExclusiveInDir(Entry cache_entry, Address addr, MachineID exc_id) {
314 if (is_valid(cache_entry)) {
315 assert (localDirectory.isTagPresent(addr) == false);
316 cache_entry.Sharers.clear();
317 cache_entry.OwnerValid := true;
318 cache_entry.Owner := exc_id;
321 if (localDirectory.isTagPresent(addr) == false) {
322 localDirectory.allocate(addr);
324 localDirectory[addr].Sharers.clear();
325 localDirectory[addr].OwnerValid := true;
326 localDirectory[addr].Owner := exc_id;
330 void removeAllLocalSharersFromDir(Entry cache_entry, Address addr) {
331 if (is_valid(cache_entry)) {
332 assert (localDirectory.isTagPresent(addr) == false);
333 cache_entry.Sharers.clear();
334 cache_entry.OwnerValid := false;
337 localDirectory[addr].Sharers.clear();
338 localDirectory[addr].OwnerValid := false;
342 void removeSharerFromDir(Entry cache_entry, Address addr, MachineID sender) {
343 if (is_valid(cache_entry)) {
344 assert (localDirectory.isTagPresent(addr) == false);
345 cache_entry.Sharers.remove(sender);
348 localDirectory[addr].Sharers.remove(sender);
352 void removeOwnerFromDir(Entry cache_entry, Address addr, MachineID sender) {
353 if (is_valid(cache_entry)) {
354 assert (localDirectory.isTagPresent(addr) == false);
355 cache_entry.OwnerValid := false;
358 localDirectory[addr].OwnerValid := false;
362 bool isLocalSharer(Entry cache_entry, Address addr, MachineID shar_id) {
363 if (is_valid(cache_entry)) {
364 assert (localDirectory.isTagPresent(addr) == false);
365 return cache_entry.Sharers.isElement(shar_id);
368 return localDirectory[addr].Sharers.isElement(shar_id);
372 NetDest getLocalSharers(Entry cache_entry, Address addr) {
373 if (is_valid(cache_entry)) {
374 assert (localDirectory.isTagPresent(addr) == false);
375 return cache_entry.Sharers;
378 return localDirectory[addr].Sharers;
382 MachineID getLocalOwner(Entry cache_entry, Address addr) {
383 if (is_valid(cache_entry)) {
384 assert (localDirectory.isTagPresent(addr) == false);
385 return cache_entry.Owner;
388 return localDirectory[addr].Owner;
392 int countLocalSharers(Entry cache_entry, Address addr) {
393 if (is_valid(cache_entry)) {
394 assert (localDirectory.isTagPresent(addr) == false);
395 return cache_entry.Sharers.count();
398 return localDirectory[addr].Sharers.count();
402 bool isLocalOwnerValid(Entry cache_entry, Address addr) {
403 if (is_valid(cache_entry)) {
404 assert (localDirectory.isTagPresent(addr) == false);
405 return cache_entry.OwnerValid;
408 return localDirectory[addr].OwnerValid;
412 int countLocalSharersExceptRequestor(Entry cache_entry, Address addr, MachineID requestor) {
413 if (is_valid(cache_entry)) {
414 assert (localDirectory.isTagPresent(addr) == false);
415 if (cache_entry.Sharers.isElement(requestor)) {
416 return ( cache_entry.Sharers.count() - 1 );
419 return cache_entry.Sharers.count();
423 if (localDirectory[addr].Sharers.isElement(requestor)) {
424 return ( localDirectory[addr].Sharers.count() - 1 );
427 return localDirectory[addr].Sharers.count();
432 State getState(TBE tbe, Entry cache_entry, Address addr) {
436 } else if (is_valid(cache_entry)) {
437 return cache_entry.CacheState;
438 } else if (isDirTagPresent(addr)) {
439 return localDirectory[addr].DirState;
445 std::string getCoherenceRequestTypeStr(CoherenceRequestType type) {
446 return CoherenceRequestType_to_string(type);
449 void setState(TBE tbe, Entry cache_entry, Address addr, State state) {
450 assert((localDirectory.isTagPresent(addr) && L2cacheMemory.isTagPresent(addr)) == false);
453 tbe.TBEState := state;
457 (state == State:M) ||
458 (state == State:O) ||
459 (state == State:S) ||
460 (state == State:OLS) ||
461 (state == State:SLS) ||
462 (state == State:OLSX) ||
465 assert(is_valid(cache_entry));
468 (state == State:ILS) ||
469 (state == State:ILX) ||
470 (state == State:ILO) ||
471 (state == State:ILOX) ||
472 (state == State:ILOS) ||
473 (state == State:ILOSX)
475 // assert(isCacheTagPresent(addr) == false);
478 if (is_valid(cache_entry)) {
479 if ( ((cache_entry.CacheState != State:M) && (state == State:M)) ||
480 ((cache_entry.CacheState != State:S) && (state == State:S)) ||
481 ((cache_entry.CacheState != State:O) && (state == State:O)) ) {
482 cache_entry.CacheState := state;
483 // disable Coherence Checker for now
484 // sequencer.checkCoherence(addr);
487 cache_entry.CacheState := state;
490 else if (localDirectory.isTagPresent(addr)) {
491 localDirectory[addr].DirState := state;
495 MessageBuffer triggerQueue, ordered="true";
497 out_port(globalRequestNetwork_out, RequestMsg, GlobalRequestFromL2Cache);
498 out_port(localRequestNetwork_out, RequestMsg, L1RequestFromL2Cache);
499 out_port(responseNetwork_out, ResponseMsg, responseFromL2Cache);
501 out_port(triggerQueue_out, TriggerMsg, triggerQueue);
507 in_port(triggerQueue_in, TriggerMsg, triggerQueue) {
508 if (triggerQueue_in.isReady()) {
509 peek(triggerQueue_in, TriggerMsg) {
510 if (in_msg.Type == TriggerType:ALL_ACKS) {
511 trigger(Event:All_Acks, in_msg.Address,
512 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
514 error("Unexpected message");
522 in_port(requestNetwork_in, RequestMsg, GlobalRequestToL2Cache) {
523 if (requestNetwork_in.isReady()) {
524 peek(requestNetwork_in, RequestMsg) {
525 if (in_msg.Type == CoherenceRequestType:GETX || in_msg.Type == CoherenceRequestType:DMA_WRITE) {
526 if (in_msg.Requestor == machineID) {
527 trigger(Event:Own_GETX, in_msg.Address,
528 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
530 trigger(Event:Fwd_GETX, in_msg.Address,
531 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
533 } else if (in_msg.Type == CoherenceRequestType:GETS) {
534 trigger(Event:Fwd_GETS, in_msg.Address,
535 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
536 } else if(in_msg.Type == CoherenceRequestType:DMA_READ) {
537 trigger(Event:Fwd_DMA, in_msg.Address,
538 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
539 } else if (in_msg.Type == CoherenceRequestType:INV) {
540 trigger(Event:Inv, in_msg.Address,
541 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
542 } else if (in_msg.Type == CoherenceRequestType:WB_ACK) {
543 trigger(Event:Writeback_Ack, in_msg.Address,
544 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
545 } else if (in_msg.Type == CoherenceRequestType:WB_NACK) {
546 trigger(Event:Writeback_Nack, in_msg.Address,
547 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
549 error("Unexpected message");
555 in_port(L1requestNetwork_in, RequestMsg, L1RequestToL2Cache) {
556 if (L1requestNetwork_in.isReady()) {
557 peek(L1requestNetwork_in, RequestMsg) {
558 assert(in_msg.Destination.isElement(machineID));
559 if (in_msg.Type == CoherenceRequestType:GETX) {
560 trigger(Event:L1_GETX, in_msg.Address,
561 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
562 } else if (in_msg.Type == CoherenceRequestType:GETS) {
563 trigger(Event:L1_GETS, in_msg.Address,
564 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
565 } else if (in_msg.Type == CoherenceRequestType:PUTO) {
566 trigger(Event:L1_PUTO, in_msg.Address,
567 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
568 } else if (in_msg.Type == CoherenceRequestType:PUTX) {
569 trigger(Event:L1_PUTX, in_msg.Address,
570 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
571 } else if (in_msg.Type == CoherenceRequestType:PUTS) {
572 Entry cache_entry := getCacheEntry(in_msg.Address);
573 if (isOnlySharer(cache_entry, in_msg.Address, in_msg.Requestor)) {
574 trigger(Event:L1_PUTS_only, in_msg.Address,
575 cache_entry, TBEs[in_msg.Address]);
578 trigger(Event:L1_PUTS, in_msg.Address,
579 cache_entry, TBEs[in_msg.Address]);
582 error("Unexpected message");
590 in_port(responseNetwork_in, ResponseMsg, responseToL2Cache) {
591 if (responseNetwork_in.isReady()) {
592 peek(responseNetwork_in, ResponseMsg) {
593 assert(in_msg.Destination.isElement(machineID));
594 if (in_msg.Type == CoherenceResponseType:ACK) {
595 if (in_msg.SenderMachine == MachineType:L2Cache) {
596 trigger(Event:ExtAck, in_msg.Address,
597 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
600 trigger(Event:IntAck, in_msg.Address,
601 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
603 } else if (in_msg.Type == CoherenceResponseType:DATA) {
604 trigger(Event:Data, in_msg.Address,
605 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
606 } else if (in_msg.Type == CoherenceResponseType:DATA_EXCLUSIVE) {
607 trigger(Event:Data_Exclusive, in_msg.Address,
608 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
609 } else if (in_msg.Type == CoherenceResponseType:UNBLOCK) {
610 trigger(Event:Unblock, in_msg.Address,
611 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
612 } else if (in_msg.Type == CoherenceResponseType:UNBLOCK_EXCLUSIVE) {
613 trigger(Event:Exclusive_Unblock, in_msg.Address,
614 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
615 } else if (in_msg.Type == CoherenceResponseType:WRITEBACK_DIRTY_DATA) {
616 Entry cache_entry := getCacheEntry(in_msg.Address);
617 if (is_invalid(cache_entry) &&
618 L2cacheMemory.cacheAvail(in_msg.Address) == false) {
619 trigger(Event:L2_Replacement, L2cacheMemory.cacheProbe(in_msg.Address),
620 getCacheEntry(L2cacheMemory.cacheProbe(in_msg.Address)),
621 TBEs[L2cacheMemory.cacheProbe(in_msg.Address)]);
624 trigger(Event:L1_WBDIRTYDATA, in_msg.Address,
625 cache_entry, TBEs[in_msg.Address]);
627 } else if (in_msg.Type == CoherenceResponseType:WRITEBACK_CLEAN_DATA) {
628 Entry cache_entry := getCacheEntry(in_msg.Address);
629 if (is_invalid(cache_entry) &&
630 L2cacheMemory.cacheAvail(in_msg.Address) == false) {
631 trigger(Event:L2_Replacement, L2cacheMemory.cacheProbe(in_msg.Address),
632 getCacheEntry(L2cacheMemory.cacheProbe(in_msg.Address)),
633 TBEs[L2cacheMemory.cacheProbe(in_msg.Address)]);
636 trigger(Event:L1_WBCLEANDATA, in_msg.Address,
637 cache_entry, TBEs[in_msg.Address]);
640 error("Unexpected message");
649 action(a_issueGETS, "a", desc="issue local request globally") {
650 peek(L1requestNetwork_in, RequestMsg) {
651 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
652 out_msg.Address := address;
653 out_msg.Type := CoherenceRequestType:GETS;
654 out_msg.RequestorMachine := MachineType:L2Cache;
655 out_msg.Requestor := machineID;
656 out_msg.Destination.add(map_Address_to_Directory(address));
657 out_msg.MessageSize := MessageSizeType:Request_Control;
662 action(a_issueGETX, "\a", desc="issue local request globally") {
663 peek(L1requestNetwork_in, RequestMsg) {
664 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
665 out_msg.Address := address;
666 out_msg.Type := CoherenceRequestType:GETX;
667 out_msg.RequestorMachine := MachineType:L2Cache;
668 out_msg.Requestor := machineID;
669 out_msg.Destination.add(map_Address_to_Directory(address));
670 out_msg.MessageSize := MessageSizeType:Request_Control;
675 action(b_issuePUTX, "b", desc="Issue PUTX") {
676 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
677 out_msg.Address := address;
678 out_msg.Type := CoherenceRequestType:PUTX;
679 out_msg.RequestorMachine := MachineType:L2Cache;
680 out_msg.Requestor := machineID;
681 out_msg.Destination.add(map_Address_to_Directory(address));
682 out_msg.MessageSize := MessageSizeType:Writeback_Control;
686 action(b_issuePUTO, "\b", desc="Issue PUTO") {
687 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
688 out_msg.Address := address;
689 out_msg.Type := CoherenceRequestType:PUTO;
690 out_msg.Requestor := machineID;
691 out_msg.RequestorMachine := MachineType:L2Cache;
692 out_msg.Destination.add(map_Address_to_Directory(address));
693 out_msg.MessageSize := MessageSizeType:Writeback_Control;
697 /* PUTO, but local sharers exist */
698 action(b_issuePUTO_ls, "\bb", desc="Issue PUTO") {
699 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
700 out_msg.Address := address;
701 out_msg.Type := CoherenceRequestType:PUTO_SHARERS;
702 out_msg.Requestor := machineID;
703 out_msg.RequestorMachine := MachineType:L2Cache;
704 out_msg.Destination.add(map_Address_to_Directory(address));
705 out_msg.MessageSize := MessageSizeType:Writeback_Control;
709 action(c_sendDataFromTBEToL1GETS, "c", desc="Send data from TBE to L1 requestors in TBE") {
710 assert(is_valid(tbe));
711 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
712 out_msg.Address := address;
713 out_msg.Type := CoherenceResponseType:DATA;
714 out_msg.Sender := machineID;
715 out_msg.Destination.addNetDest(tbe.L1_GetS_IDs);
716 out_msg.DataBlk := tbe.DataBlk;
717 // out_msg.Dirty := tbe.Dirty;
718 // shared data should be clean
719 out_msg.Dirty := false;
720 out_msg.MessageSize := MessageSizeType:Response_Data;
722 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
723 address, tbe.DataBlk);
726 action(c_sendDataFromTBEToL1GETX, "\c", desc="Send data from TBE to L1 requestors in TBE") {
727 assert(is_valid(tbe));
728 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
729 out_msg.Address := address;
730 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
731 out_msg.Sender := machineID;
732 out_msg.SenderMachine := MachineType:L2Cache;
733 out_msg.Destination.add(tbe.L1_GetX_ID);
734 out_msg.DataBlk := tbe.DataBlk;
735 out_msg.Dirty := tbe.Dirty;
736 out_msg.Acks := tbe.Local_GETX_IntAcks;
737 out_msg.MessageSize := MessageSizeType:Response_Data;
739 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
740 address, tbe.DataBlk);
743 action(c_sendExclusiveDataFromTBEToL1GETS, "\cc", desc="Send data from TBE to L1 requestors in TBE") {
744 assert(is_valid(tbe));
745 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
746 out_msg.Address := address;
747 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
748 out_msg.Sender := machineID;
749 out_msg.SenderMachine := MachineType:L2Cache;
750 out_msg.Destination.addNetDest(tbe.L1_GetS_IDs);
751 out_msg.DataBlk := tbe.DataBlk;
752 out_msg.Dirty := tbe.Dirty;
753 out_msg.MessageSize := MessageSizeType:Response_Data;
757 action(c_sendDataFromTBEToFwdGETX, "cc", desc="Send data from TBE to external GETX") {
758 assert(is_valid(tbe));
759 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
760 out_msg.Address := address;
761 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
762 out_msg.Sender := machineID;
763 out_msg.SenderMachine := MachineType:L2Cache;
764 out_msg.Destination.add(tbe.Fwd_GetX_ID);
765 out_msg.DataBlk := tbe.DataBlk;
766 out_msg.Dirty := tbe.Dirty;
767 out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
768 out_msg.MessageSize := MessageSizeType:Response_Data;
772 action(c_sendDataFromTBEToFwdGETS, "ccc", desc="Send data from TBE to external GETX") {
773 assert(is_valid(tbe));
774 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
775 out_msg.Address := address;
776 out_msg.Type := CoherenceResponseType:DATA;
777 out_msg.Sender := machineID;
778 out_msg.Destination.addNetDest(tbe.Fwd_GetS_IDs);
779 out_msg.DataBlk := tbe.DataBlk;
780 // out_msg.Dirty := tbe.Dirty;
781 // shared data should be clean
782 out_msg.Dirty := false;
783 out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
784 out_msg.MessageSize := MessageSizeType:Response_Data;
786 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
787 address, tbe.DataBlk);
790 action(c_sendExclusiveDataFromTBEToFwdGETS, "\ccc", desc="Send data from TBE to external GETX") {
791 assert(is_valid(tbe));
792 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
793 out_msg.Address := address;
794 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
795 out_msg.Sender := machineID;
796 out_msg.SenderMachine := MachineType:L2Cache;
797 out_msg.Destination.addNetDest(tbe.Fwd_GetS_IDs);
798 out_msg.DataBlk := tbe.DataBlk;
799 out_msg.Dirty := tbe.Dirty;
800 out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
801 out_msg.MessageSize := MessageSizeType:Response_Data;
803 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
804 address, tbe.DataBlk);
807 action(d_sendDataToL1GETS, "d", desc="Send data directly to L1 requestor") {
808 assert(is_valid(cache_entry));
809 peek(L1requestNetwork_in, RequestMsg) {
810 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
811 out_msg.Address := address;
812 out_msg.Type := CoherenceResponseType:DATA;
813 out_msg.Sender := machineID;
814 out_msg.Destination.add(in_msg.Requestor);
815 out_msg.DataBlk := cache_entry.DataBlk;
816 // out_msg.Dirty := cache_entry.Dirty;
817 // shared data should be clean
818 out_msg.Dirty := false;
819 out_msg.MessageSize := MessageSizeType:ResponseL2hit_Data;
822 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
823 address, cache_entry.DataBlk);
826 action(d_sendDataToL1GETX, "\d", desc="Send data and a token from TBE to L1 requestor") {
827 assert(is_valid(cache_entry));
828 peek(L1requestNetwork_in, RequestMsg) {
829 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
830 assert(is_valid(tbe));
831 out_msg.Address := address;
832 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
833 out_msg.Sender := machineID;
834 out_msg.SenderMachine := MachineType:L2Cache;
835 out_msg.Destination.add(in_msg.Requestor);
836 out_msg.DataBlk := cache_entry.DataBlk;
837 out_msg.Dirty := cache_entry.Dirty;
838 out_msg.MessageSize := MessageSizeType:ResponseL2hit_Data;
839 out_msg.Acks := tbe.Local_GETX_IntAcks;
842 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
843 address, cache_entry.DataBlk);
846 action(dd_sendDataToFwdGETX, "dd", desc="send data") {
847 assert(is_valid(cache_entry));
848 peek(requestNetwork_in, RequestMsg) {
849 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
850 out_msg.Address := address;
851 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
852 out_msg.Sender := machineID;
853 out_msg.SenderMachine := MachineType:L2Cache;
854 out_msg.Destination.add(in_msg.Requestor);
855 out_msg.DataBlk := cache_entry.DataBlk;
856 out_msg.Dirty := cache_entry.Dirty;
857 out_msg.MessageSize := MessageSizeType:Response_Data;
858 out_msg.Acks := in_msg.Acks;
861 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
862 address, cache_entry.DataBlk);
866 action(dd_sendDataToFwdGETS, "\dd", desc="send data") {
867 assert(is_valid(cache_entry));
868 peek(requestNetwork_in, RequestMsg) {
869 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
870 out_msg.Address := address;
871 out_msg.Type := CoherenceResponseType:DATA;
872 out_msg.Sender := machineID;
873 out_msg.Destination.add(in_msg.Requestor);
874 out_msg.DataBlk := cache_entry.DataBlk;
875 // out_msg.Dirty := cache_entry.Dirty;
876 // shared data should be clean
877 out_msg.Dirty := false;
878 out_msg.MessageSize := MessageSizeType:Response_Data;
881 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
882 address, cache_entry.DataBlk);
885 action(dd_sendExclusiveDataToFwdGETS, "\d\d", desc="send data") {
886 assert(is_valid(cache_entry));
887 peek(requestNetwork_in, RequestMsg) {
888 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
889 out_msg.Address := address;
890 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
891 out_msg.Sender := machineID;
892 out_msg.Destination.add(in_msg.Requestor);
893 out_msg.DataBlk := cache_entry.DataBlk;
894 out_msg.Dirty := cache_entry.Dirty;
895 out_msg.MessageSize := MessageSizeType:Response_Data;
900 action(e_sendAck, "e", desc="Send ack with the tokens we've collected thus far.") {
901 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
902 assert(is_valid(tbe));
903 out_msg.Address := address;
904 out_msg.Type := CoherenceResponseType:ACK;
905 out_msg.Sender := machineID;
906 out_msg.SenderMachine := MachineType:L2Cache;
908 out_msg.Destination.add( tbe.Fwd_GetX_ID);
909 out_msg.Acks := 0 - 1;
910 out_msg.MessageSize := MessageSizeType:Response_Control;
914 action(e_sendAckToL1Requestor, "\e", desc="Send ack with the tokens we've collected thus far.") {
915 peek(L1requestNetwork_in, RequestMsg) {
916 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
917 out_msg.Address := address;
918 out_msg.Type := CoherenceResponseType:ACK;
919 out_msg.Sender := machineID;
920 out_msg.SenderMachine := MachineType:L2Cache;
921 out_msg.Destination.add(in_msg.Requestor);
922 out_msg.Acks := 0 - 1;
923 out_msg.MessageSize := MessageSizeType:Response_Control;
928 action(e_sendAckToL1RequestorFromTBE, "eee", desc="Send ack with the tokens we've collected thus far.") {
929 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
930 assert(is_valid(tbe));
931 out_msg.Address := address;
932 out_msg.Type := CoherenceResponseType:ACK;
933 out_msg.Sender := machineID;
934 out_msg.SenderMachine := MachineType:L2Cache;
935 out_msg.Destination.add(tbe.L1_GetX_ID);
936 out_msg.Acks := 0 - 1;
937 out_msg.MessageSize := MessageSizeType:Response_Control;
941 action(ee_sendLocalInv, "\ee", desc="Send local invalidates") {
942 assert(is_valid(tbe));
943 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
944 DPRINTF(RubySlicc, "Address: %s, Local Sharers: %s, Pending Acks: %d\n",
945 address, getLocalSharers(cache_entry, address),
946 tbe.NumIntPendingAcks);
947 if (isLocalOwnerValid(cache_entry, address)) {
948 tbe.NumIntPendingAcks := tbe.NumIntPendingAcks + 1;
949 DPRINTF(RubySlicc, "%s\n", getLocalOwner(cache_entry, address));
952 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
953 out_msg.Address := address;
954 out_msg.Type := CoherenceRequestType:INV;
955 out_msg.Requestor := machineID;
956 out_msg.RequestorMachine := MachineType:L2Cache;
957 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
958 if (isLocalOwnerValid(cache_entry, address))
960 out_msg.Destination.add(getLocalOwner(cache_entry, address));
962 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
966 action(ee_sendLocalInvSharersOnly, "\eee", desc="Send local invalidates to sharers if they exist") {
968 // assert(countLocalSharers(address) > 0);
969 assert(is_valid(tbe));
970 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
972 if (countLocalSharers(cache_entry, address) > 0) {
973 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
974 out_msg.Address := address;
975 out_msg.Type := CoherenceRequestType:INV;
976 out_msg.Requestor := machineID;
977 out_msg.RequestorMachine := MachineType:L2Cache;
978 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
979 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
984 action(ee_addLocalIntAck, "e\ee", desc="add a local ack to wait for") {
985 assert(is_valid(tbe));
986 tbe.NumIntPendingAcks := tbe.NumIntPendingAcks + 1;
989 action(ee_issueLocalInvExceptL1Requestor, "\eeee", desc="Send local invalidates to sharers if they exist") {
990 peek(L1requestNetwork_in, RequestMsg) {
992 // assert(countLocalSharers(address) > 0);
993 if (countLocalSharers(cache_entry, address) == 0) {
994 tbe.NumIntPendingAcks := 0;
998 if (isLocalSharer(cache_entry, address, in_msg.Requestor)) {
999 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address) - 1;
1002 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
1005 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1006 out_msg.Address := address;
1007 out_msg.Type := CoherenceRequestType:INV;
1008 out_msg.Requestor := in_msg.Requestor;
1009 out_msg.RequestorMachine := MachineType:L1Cache;
1010 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
1011 out_msg.Destination.remove(in_msg.Requestor);
1012 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
1018 action(ee_issueLocalInvExceptL1RequestorInTBE, "\eeeeee", desc="Send local invalidates to sharers if they exist") {
1019 assert(is_valid(tbe));
1020 if (countLocalSharers(cache_entry, address) == 0) {
1021 tbe.NumIntPendingAcks := 0;
1024 if (isLocalSharer(cache_entry, address, tbe.L1_GetX_ID)) {
1025 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address) - 1;
1028 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
1031 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1032 out_msg.Address := address;
1033 out_msg.Type := CoherenceRequestType:INV;
1034 out_msg.Requestor := tbe.L1_GetX_ID;
1035 out_msg.RequestorMachine := MachineType:L1Cache;
1036 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
1037 out_msg.Destination.remove(tbe.L1_GetX_ID);
1038 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
1043 action(f_sendUnblock, "f", desc="Send unblock to global directory") {
1044 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
1045 out_msg.Address := address;
1046 out_msg.Type := CoherenceResponseType:UNBLOCK;
1047 out_msg.Destination.add(map_Address_to_Directory(address));
1048 out_msg.Sender := machineID;
1049 out_msg.SenderMachine := MachineType:L2Cache;
1050 out_msg.MessageSize := MessageSizeType:Unblock_Control;
1055 action(f_sendExclusiveUnblock, "\f", desc="Send unblock to global directory") {
1056 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
1057 out_msg.Address := address;
1058 out_msg.Type := CoherenceResponseType:UNBLOCK_EXCLUSIVE;
1059 out_msg.Destination.add(map_Address_to_Directory(address));
1060 out_msg.Sender := machineID;
1061 out_msg.SenderMachine := MachineType:L2Cache;
1062 out_msg.MessageSize := MessageSizeType:Unblock_Control;
1067 action(g_recordLocalSharer, "g", desc="Record new local sharer from unblock message") {
1068 peek(responseNetwork_in, ResponseMsg) {
1069 recordLocalSharerInDir(cache_entry, in_msg.Address, in_msg.Sender);
1073 action(g_recordLocalExclusive, "\g", desc="Record new local exclusive sharer from unblock message") {
1074 peek(responseNetwork_in, ResponseMsg) {
1075 recordNewLocalExclusiveInDir(cache_entry, address, in_msg.Sender);
1079 action(gg_clearLocalSharers, "gg", desc="Clear local sharers") {
1080 removeAllLocalSharersFromDir(cache_entry, address);
1083 action(gg_clearSharerFromL1Response, "\gg", desc="Clear sharer from L1 response queue") {
1084 peek(responseNetwork_in, ResponseMsg) {
1085 removeSharerFromDir(cache_entry, in_msg.Address, in_msg.Sender);
1089 action(gg_clearOwnerFromL1Response, "g\g", desc="Clear sharer from L1 response queue") {
1090 peek(responseNetwork_in, ResponseMsg) {
1091 removeOwnerFromDir(cache_entry, in_msg.Address, in_msg.Sender);
1095 action(h_countLocalSharersExceptRequestor, "h", desc="counts number of acks needed for L1 GETX") {
1096 peek(L1requestNetwork_in, RequestMsg) {
1097 assert(is_valid(tbe));
1098 tbe.Local_GETX_IntAcks := countLocalSharersExceptRequestor(cache_entry, address, in_msg.Requestor);
1102 action(h_clearIntAcks, "\h", desc="clear IntAcks") {
1103 assert(is_valid(tbe));
1104 tbe.Local_GETX_IntAcks := 0;
1107 action(hh_countLocalSharersExceptL1GETXRequestorInTBE, "hh", desc="counts number of acks needed for L1 GETX") {
1108 assert(is_valid(tbe));
1109 tbe.Local_GETX_IntAcks := countLocalSharersExceptRequestor(cache_entry, address, tbe.L1_GetX_ID);
1112 action(i_copyDataToTBE, "\i", desc="Copy data from response queue to TBE") {
1113 peek(responseNetwork_in, ResponseMsg) {
1114 assert(is_valid(tbe));
1115 tbe.DataBlk := in_msg.DataBlk;
1116 tbe.Dirty := in_msg.Dirty;
1120 action(i_allocateTBE, "i", desc="Allocate TBE for internal/external request(isPrefetch=0, number of invalidates=0)") {
1121 check_allocate(TBEs);
1122 TBEs.allocate(address);
1123 set_tbe(TBEs[address]);
1124 if(is_valid(cache_entry)) {
1125 tbe.DataBlk := cache_entry.DataBlk;
1126 tbe.Dirty := cache_entry.Dirty;
1128 tbe.NumIntPendingAcks := 0; // default value
1129 tbe.NumExtPendingAcks := 0; // default value
1130 tbe.Fwd_GetS_IDs.clear();
1131 tbe.L1_GetS_IDs.clear();
1136 action(j_forwardGlobalRequestToLocalOwner, "j", desc="Forward external request to local owner") {
1137 peek(requestNetwork_in, RequestMsg) {
1138 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1139 out_msg.Address := in_msg.Address;
1140 out_msg.Type := in_msg.Type;
1141 out_msg.Requestor := machineID;
1142 out_msg.RequestorMachine := MachineType:L2Cache;
1143 out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.Address));
1144 out_msg.Type := in_msg.Type;
1145 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1146 out_msg.Acks := 0 - 1;
1152 action(k_forwardLocalGETSToLocalSharer, "k", desc="Forward local request to local sharer/owner") {
1153 peek(L1requestNetwork_in, RequestMsg) {
1154 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1155 out_msg.Address := in_msg.Address;
1156 out_msg.Type := CoherenceRequestType:GETS;
1157 out_msg.Requestor := in_msg.Requestor;
1158 out_msg.RequestorMachine := MachineType:L1Cache;
1159 // should randomize this so one node doesn't get abused more than others
1160 out_msg.Destination.add(localDirectory[in_msg.Address].Sharers.smallestElement(MachineType:L1Cache));
1161 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1166 action(k_forwardLocalGETXToLocalOwner, "\k", desc="Forward local request to local owner") {
1167 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1168 assert(is_valid(tbe));
1169 out_msg.Address := address;
1170 out_msg.Type := CoherenceRequestType:GETX;
1171 out_msg.Requestor := tbe.L1_GetX_ID;
1172 out_msg.RequestorMachine := MachineType:L1Cache;
1173 out_msg.Destination.add(localDirectory[address].Owner);
1174 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1175 out_msg.Acks := 1 + tbe.Local_GETX_IntAcks;
1179 // same as previous except that it assumes to TBE is present to get number of acks
1180 action(kk_forwardLocalGETXToLocalExclusive, "kk", desc="Forward local request to local owner") {
1181 peek(L1requestNetwork_in, RequestMsg) {
1182 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1183 out_msg.Address := in_msg.Address;
1184 out_msg.Type := CoherenceRequestType:GETX;
1185 out_msg.Requestor := in_msg.Requestor;
1186 out_msg.RequestorMachine := MachineType:L1Cache;
1187 out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.Address));
1188 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1194 action(kk_forwardLocalGETSToLocalOwner, "\kk", desc="Forward local request to local owner") {
1195 peek(L1requestNetwork_in, RequestMsg) {
1196 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1197 out_msg.Address := in_msg.Address;
1198 out_msg.Type := CoherenceRequestType:GETS;
1199 out_msg.Requestor := in_msg.Requestor;
1200 out_msg.RequestorMachine := MachineType:L1Cache;
1201 out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.Address));
1202 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1208 action(l_writebackAckNeedData, "l", desc="Send writeback ack to L1 requesting data") {
1209 peek(L1requestNetwork_in, RequestMsg) {
1210 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1211 out_msg.Address := in_msg.Address;
1212 // out_msg.Type := CoherenceResponseType:WRITEBACK_SEND_DATA;
1213 out_msg.Type := CoherenceRequestType:WB_ACK_DATA;
1214 out_msg.Requestor := machineID;
1215 out_msg.RequestorMachine := MachineType:L2Cache;
1216 out_msg.Destination.add(in_msg.Requestor);
1217 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1222 action(l_writebackAckDropData, "\l", desc="Send writeback ack to L1 indicating to drop data") {
1223 peek(L1requestNetwork_in, RequestMsg) {
1224 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1225 out_msg.Address := in_msg.Address;
1226 // out_msg.Type := CoherenceResponseType:WRITEBACK_ACK;
1227 out_msg.Type := CoherenceRequestType:WB_ACK;
1228 out_msg.Requestor := machineID;
1229 out_msg.RequestorMachine := MachineType:L2Cache;
1230 out_msg.Destination.add(in_msg.Requestor);
1231 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1236 action(ll_writebackNack, "\ll", desc="Send writeback nack to L1") {
1237 peek(L1requestNetwork_in, RequestMsg) {
1238 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1239 out_msg.Address := in_msg.Address;
1240 out_msg.Type := CoherenceRequestType:WB_NACK;
1241 out_msg.Requestor := machineID;
1242 out_msg.RequestorMachine := MachineType:L2Cache;
1243 out_msg.Destination.add(in_msg.Requestor);
1244 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1249 action(m_popRequestQueue, "m", desc="Pop request queue.") {
1250 requestNetwork_in.dequeue();
1253 action(m_decrementNumberOfMessagesInt, "\m", desc="Decrement the number of messages for which we're waiting") {
1254 peek(responseNetwork_in, ResponseMsg) {
1255 assert(is_valid(tbe));
1256 tbe.NumIntPendingAcks := tbe.NumIntPendingAcks + in_msg.Acks;
1260 action(m_decrementNumberOfMessagesExt, "\mmm", desc="Decrement the number of messages for which we're waiting") {
1261 peek(responseNetwork_in, ResponseMsg) {
1262 assert(is_valid(tbe));
1263 tbe.NumExtPendingAcks := tbe.NumExtPendingAcks - in_msg.Acks;
1267 action(mm_decrementNumberOfMessagesExt, "\mm", desc="Decrement the number of messages for which we're waiting") {
1268 peek(requestNetwork_in, RequestMsg) {
1269 assert(is_valid(tbe));
1270 tbe.NumExtPendingAcks := tbe.NumExtPendingAcks - in_msg.Acks;
1274 action(n_popResponseQueue, "n", desc="Pop response queue") {
1275 responseNetwork_in.dequeue();
1278 action(n_popTriggerQueue, "\n", desc="Pop trigger queue.") {
1279 triggerQueue_in.dequeue();
1282 action(o_popL1RequestQueue, "o", desc="Pop L1 request queue.") {
1283 L1requestNetwork_in.dequeue();
1287 action(o_checkForIntCompletion, "\o", desc="Check if we have received all the messages required for completion") {
1288 assert(is_valid(tbe));
1289 if (tbe.NumIntPendingAcks == 0) {
1290 enqueue(triggerQueue_out, TriggerMsg) {
1291 out_msg.Address := address;
1292 out_msg.Type := TriggerType:ALL_ACKS;
1297 action(o_checkForExtCompletion, "\oo", desc="Check if we have received all the messages required for completion") {
1298 assert(is_valid(tbe));
1299 if (tbe.NumExtPendingAcks == 0) {
1300 enqueue(triggerQueue_out, TriggerMsg) {
1301 out_msg.Address := address;
1302 out_msg.Type := TriggerType:ALL_ACKS;
1308 action( qq_sendDataFromTBEToMemory, "qq", desc="Send data from TBE to directory") {
1309 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
1310 assert(is_valid(tbe));
1311 out_msg.Address := address;
1312 out_msg.Sender := machineID;
1313 out_msg.SenderMachine := MachineType:L2Cache;
1314 out_msg.Destination.add(map_Address_to_Directory(address));
1315 out_msg.Dirty := tbe.Dirty;
1317 out_msg.Type := CoherenceResponseType:WRITEBACK_DIRTY_DATA;
1318 out_msg.DataBlk := tbe.DataBlk;
1319 out_msg.MessageSize := MessageSizeType:Writeback_Data;
1321 out_msg.Type := CoherenceResponseType:WRITEBACK_CLEAN_ACK;
1322 // NOTE: in a real system this would not send data. We send
1323 // data here only so we can check it at the memory
1324 out_msg.DataBlk := tbe.DataBlk;
1325 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1330 action( r_setMRU, "\rrr", desc="manually set the MRU bit for cache line" ) {
1331 if(is_valid(cache_entry)) {
1332 L2cacheMemory.setMRU(address);
1336 action( s_recordGetXL1ID, "ss", desc="record local GETX requestor") {
1337 peek(L1requestNetwork_in, RequestMsg) {
1338 assert(is_valid(tbe));
1339 tbe.L1_GetX_ID := in_msg.Requestor;
1343 action(s_deallocateTBE, "s", desc="Deallocate external TBE") {
1344 TBEs.deallocate(address);
1348 action( s_recordGetSL1ID, "\ss", desc="record local GETS requestor") {
1349 peek(L1requestNetwork_in, RequestMsg) {
1350 assert(is_valid(tbe));
1351 tbe.L1_GetS_IDs.add(in_msg.Requestor);
1355 action(t_recordFwdXID, "t", desc="record global GETX requestor") {
1356 peek(requestNetwork_in, RequestMsg) {
1357 assert(is_valid(tbe));
1358 tbe.Fwd_GetX_ID := in_msg.Requestor;
1359 tbe.Fwd_GETX_ExtAcks := in_msg.Acks;
1363 action(t_recordFwdSID, "\t", desc="record global GETS requestor") {
1364 peek(requestNetwork_in, RequestMsg) {
1365 assert(is_valid(tbe));
1366 tbe.Fwd_GetS_IDs.clear();
1367 tbe.Fwd_GetS_IDs.add(in_msg.Requestor);
1372 action(u_writeDataToCache, "u", desc="Write data to cache") {
1373 peek(responseNetwork_in, ResponseMsg) {
1374 assert(is_valid(cache_entry));
1375 cache_entry.DataBlk := in_msg.DataBlk;
1376 if ((cache_entry.Dirty == false) && in_msg.Dirty) {
1377 cache_entry.Dirty := in_msg.Dirty;
1382 action(vv_allocateL2CacheBlock, "\v", desc="Set L2 cache tag equal to tag of block B.") {
1383 set_cache_entry(L2cacheMemory.allocate(address, new Entry));
1386 action(rr_deallocateL2CacheBlock, "\r", desc="Deallocate L2 cache block. Sets the cache to not present, allowing a replacement in parallel with a fetch.") {
1387 L2cacheMemory.deallocate(address);
1388 unset_cache_entry();
1392 action(w_assertIncomingDataAndCacheDataMatch, "w", desc="Assert that the incoming data and the data in the cache match") {
1393 peek(responseNetwork_in, ResponseMsg) {
1394 assert(is_valid(cache_entry));
1395 assert(cache_entry.DataBlk == in_msg.DataBlk);
1399 action(uu_profileMiss, "\u", desc="Profile the demand miss") {
1400 peek(L1requestNetwork_in, RequestMsg) {
1401 // AccessModeType not implemented
1402 // profile_L2Cache_miss(convertToGenericType(in_msg.Type), in_msg.AccessMode, MessageSizeTypeToInt(in_msg.MessageSize), in_msg.Prefetch, machineIDToNodeID(in_msg.Requestor));
1406 action(y_copyCacheStateToDir, "y", desc="Copy cache state to directory state") {
1407 copyCacheStateToDir(cache_entry, address);
1410 action(y_copyDirToCacheAndRemove, "/y", desc="Copy dir state to cache and remove") {
1411 copyDirToCache(cache_entry, address);
1412 localDirectory.deallocate(address);
1415 action(z_stall, "z", desc="Stall") {
1418 action(zz_recycleL1RequestQueue, "zz", desc="Send the head of the mandatory queue to the back of the queue.") {
1419 peek(L1requestNetwork_in, RequestMsg) {
1420 APPEND_TRANSITION_COMMENT(in_msg.Requestor);
1422 L1requestNetwork_in.recycle();
1425 action(zz_recycleRequestQueue, "\zz", desc="Send the head of the mandatory queue to the back of the queue.") {
1426 peek(requestNetwork_in, RequestMsg) {
1427 APPEND_TRANSITION_COMMENT(in_msg.Requestor);
1429 requestNetwork_in.recycle();
1432 action(zz_recycleResponseQueue, "\z\z", desc="Send the head of the mandatory queue to the back of the queue.") {
1433 peek(responseNetwork_in, ResponseMsg) {
1434 APPEND_TRANSITION_COMMENT(in_msg.Sender);
1436 responseNetwork_in.recycle();
1441 //*****************************************************
1443 //*****************************************************
1445 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}, {L1_PUTO, L1_PUTS, L1_PUTS_only, L1_PUTX}) {
1446 zz_recycleL1RequestQueue;
1449 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}, {L1_GETX, L1_GETS}) {
1450 zz_recycleL1RequestQueue;
1453 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}, L2_Replacement) {
1454 zz_recycleResponseQueue;
1457 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}, {Fwd_GETX, Fwd_GETS, Fwd_DMA}) {
1458 zz_recycleRequestQueue;
1461 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}, {Inv}) {
1462 zz_recycleRequestQueue;
1465 transition({IGM, IGS}, {Own_GETX}) {
1466 zz_recycleRequestQueue;
1469 // must happened because we forwarded GETX to local exclusive trying to do wb
1470 transition({I, M, O, ILS, ILOX, OLS, OLSX, SLS, S}, L1_PUTX) {
1472 o_popL1RequestQueue;
1475 transition({M}, {L1_PUTS, L1_PUTO} ) {
1477 o_popL1RequestQueue;
1480 transition({ILS, OLSX}, L1_PUTO){
1482 o_popL1RequestQueue;
1485 // happened if we forwarded GETS to exclusive who tried to do writeback
1486 // ?? should we just Nack these instead? Could be a bugs here
1487 transition(ILO, L1_PUTX, ILOW) {
1488 l_writebackAckNeedData;
1489 o_popL1RequestQueue;
1492 // this can happen if we forwarded a L1_GETX to exclusiver after it issued a PUTX
1493 transition(ILOS, L1_PUTX, ILOSW) {
1494 l_writebackAckNeedData;
1495 o_popL1RequestQueue;
1498 transition(ILOSX, L1_PUTX, ILOSXW) {
1499 l_writebackAckNeedData;
1500 o_popL1RequestQueue;
1503 // must happened because we got Inv when L1 attempted PUTS
1504 transition(I, L1_PUTS) {
1506 o_popL1RequestQueue;
1509 transition(I, L1_PUTO) {
1511 o_popL1RequestQueue;
1514 // FORWARDED REQUESTS
1516 transition({ILO, ILX, ILOX}, Fwd_GETS, IFGS) {
1519 j_forwardGlobalRequestToLocalOwner;
1523 transition({ILOS, ILOSX}, Fwd_GETS, ISFGS) {
1526 j_forwardGlobalRequestToLocalOwner;
1530 transition({ILOS, ILOSX}, Fwd_DMA) {
1533 j_forwardGlobalRequestToLocalOwner;
1537 transition({ILO, ILX, ILOX}, Fwd_DMA) {
1540 j_forwardGlobalRequestToLocalOwner;
1544 transition({ILOS, ILOSX, ILO, ILX, ILOX, ILXW}, Data) {
1546 c_sendDataFromTBEToFwdGETS;
1551 transition(IFGS, Data, ILO) {
1553 c_sendDataFromTBEToFwdGETS;
1558 transition(ISFGS, Data, ILOS) {
1560 c_sendDataFromTBEToFwdGETS;
1565 transition(IFGS, Data_Exclusive, I) {
1567 c_sendExclusiveDataFromTBEToFwdGETS;
1568 gg_clearLocalSharers;
1574 transition({ILX, ILO, ILOX}, Fwd_GETX, IFGX) {
1577 j_forwardGlobalRequestToLocalOwner;
1581 transition(IFGX, {Data_Exclusive, Data}, I) {
1583 c_sendDataFromTBEToFwdGETX;
1584 gg_clearLocalSharers;
1589 transition({ILOSX, ILOS}, Fwd_GETX, IFGXX) {
1592 j_forwardGlobalRequestToLocalOwner;
1593 ee_sendLocalInvSharersOnly;
1599 transition(IFGXX, IntAck) {
1600 m_decrementNumberOfMessagesInt;
1601 o_checkForIntCompletion;
1605 transition(IFGXX, Data_Exclusive) {
1607 m_decrementNumberOfMessagesInt;
1608 o_checkForIntCompletion;
1612 transition(IFGXX, All_Acks, I) {
1613 c_sendDataFromTBEToFwdGETX;
1614 gg_clearLocalSharers;
1620 // transition({O, OX}, Fwd_GETX, I) {
1621 transition(O, Fwd_GETX, I) {
1622 dd_sendDataToFwdGETX;
1623 y_copyCacheStateToDir;
1624 rr_deallocateL2CacheBlock;
1628 transition({O, OLS}, {Fwd_GETS, Fwd_DMA}) {
1629 dd_sendDataToFwdGETS;
1633 // transition({OLSX, OX}, Fwd_GETS, O) {
1634 transition(OLSX, Fwd_GETS, OLS) {
1635 dd_sendDataToFwdGETS;
1639 transition(OLSX, Fwd_DMA) {
1640 dd_sendDataToFwdGETS;
1644 transition(M, Fwd_GETX, I) {
1645 dd_sendDataToFwdGETX;
1646 rr_deallocateL2CacheBlock;
1650 // MAKE THIS THE SAME POLICY FOR NOW
1652 // transition(M, Fwd_GETS, O) {
1653 // dd_sendDataToFwdGETS;
1654 // m_popRequestQueue;
1657 transition(M, Fwd_GETS, I) {
1658 dd_sendExclusiveDataToFwdGETS;
1659 rr_deallocateL2CacheBlock;
1663 transition(M, Fwd_DMA) {
1664 dd_sendExclusiveDataToFwdGETS;
1668 transition({OLS, OLSX}, Fwd_GETX, OLSF) {
1675 transition(OLSF, IntAck) {
1676 m_decrementNumberOfMessagesInt;
1677 o_checkForIntCompletion;
1681 transition(OLSF, All_Acks, I) {
1682 c_sendDataFromTBEToFwdGETX;
1683 gg_clearLocalSharers;
1685 rr_deallocateL2CacheBlock;
1691 // INVALIDATIONS FROM GLOBAL DIRECTORY
1693 transition({IGM, IGS}, Inv) {
1699 transition({I,NP}, Inv) {
1707 // NEED INV for S state
1709 transition({ILS, ILO, ILX}, Inv, II) {
1713 gg_clearLocalSharers;
1717 transition(SLS, Inv, II) {
1721 rr_deallocateL2CacheBlock;
1725 transition(II, IntAck) {
1726 m_decrementNumberOfMessagesInt;
1727 o_checkForIntCompletion;
1731 transition(II, All_Acks, I) {
1737 transition(S, Inv, I) {
1742 rr_deallocateL2CacheBlock;
1747 // LOCAL REQUESTS SATISFIED LOCALLY
1749 transition(OLSX, L1_GETX, IFLOX) {
1752 // count number of INVs needed that doesn't include requestor
1753 h_countLocalSharersExceptRequestor;
1754 // issue INVs to everyone except requestor
1755 ee_issueLocalInvExceptL1Requestor;
1757 y_copyCacheStateToDir;
1759 rr_deallocateL2CacheBlock;
1761 o_popL1RequestQueue;
1764 transition(IFLOX, Exclusive_Unblock, ILX) {
1765 g_recordLocalExclusive;
1770 transition(OLSX, L1_GETS, OLSXS) {
1773 o_popL1RequestQueue;
1776 transition(OLSXS, Unblock, OLSX) {
1777 g_recordLocalSharer;
1781 // after this, can't get Fwd_GETX
1782 transition(IGMO, Own_GETX) {
1783 mm_decrementNumberOfMessagesExt;
1784 o_checkForExtCompletion;
1790 transition(ILX, L1_GETS, IFLOXX) {
1791 kk_forwardLocalGETSToLocalOwner;
1793 o_popL1RequestQueue;
1796 transition(ILOSX, L1_GETS, IFLOSX) {
1797 kk_forwardLocalGETSToLocalOwner;
1799 o_popL1RequestQueue;
1802 transition({ILOS, ILO}, L1_GETS, IFLO) {
1803 kk_forwardLocalGETSToLocalOwner;
1805 o_popL1RequestQueue;
1808 transition(ILS, L1_GETS, IFLS) {
1809 k_forwardLocalGETSToLocalSharer;
1811 o_popL1RequestQueue;
1814 transition({ILX, ILOX}, L1_GETX, IFLOXX) {
1815 kk_forwardLocalGETXToLocalExclusive;
1816 e_sendAckToL1Requestor;
1818 o_popL1RequestQueue;
1821 transition(ILOX, L1_GETS, IFLOX) {
1822 kk_forwardLocalGETSToLocalOwner;
1824 o_popL1RequestQueue;
1827 transition(IFLOX, Unblock, ILOSX) {
1828 g_recordLocalSharer;
1832 transition(IFLS, Unblock, ILS) {
1833 g_recordLocalSharer;
1837 transition(IFLOXX, Unblock, ILOSX) {
1838 g_recordLocalSharer;
1842 transition(IFLOSX, Unblock, ILOSX) {
1843 g_recordLocalSharer;
1847 transition({IFLOSX, IFLOXX}, Exclusive_Unblock, ILX) {
1848 g_recordLocalExclusive;
1852 transition(IFLO, Unblock, ILOS) {
1853 g_recordLocalSharer;
1858 transition(ILOSX, L1_GETX, IFLXO) {
1861 h_countLocalSharersExceptRequestor;
1862 ee_issueLocalInvExceptL1Requestor;
1863 k_forwardLocalGETXToLocalOwner;
1864 e_sendAckToL1RequestorFromTBE;
1866 o_popL1RequestQueue;
1869 transition(IFLXO, Exclusive_Unblock, ILX) {
1870 g_recordLocalExclusive;
1875 // LOCAL REQUESTS THAT MUST ISSUE
1877 transition(NP, {L1_PUTS, L1_PUTX, L1_PUTO}) {
1879 o_popL1RequestQueue;
1882 transition({NP, I}, L1_GETS, IGS) {
1887 o_popL1RequestQueue;
1890 transition({NP, I}, L1_GETX, IGM) {
1895 o_popL1RequestQueue;
1898 transition(S, L1_GETX, IGM) {
1902 y_copyCacheStateToDir;
1904 rr_deallocateL2CacheBlock;
1906 o_popL1RequestQueue;
1909 transition(ILS, L1_GETX, IGMLS) {
1913 // count number of INVs (just sharers?) needed that doesn't include requestor
1914 h_countLocalSharersExceptRequestor;
1916 o_popL1RequestQueue;
1919 transition(IGMLS, Inv) {
1925 transition(IGMLS, IntAck) {
1926 m_decrementNumberOfMessagesInt;
1927 o_checkForIntCompletion;
1931 transition(IGMLS, All_Acks, IGM) {
1932 gg_clearLocalSharers;
1938 // transition(IGMLS, ExtAck, IGMO) {
1939 transition(IGMLS, ExtAck) {
1940 m_decrementNumberOfMessagesExt;
1941 o_checkForExtCompletion;
1945 transition(IGMLS, {Data, Data_Exclusive}, IGMO) {
1946 ee_issueLocalInvExceptL1RequestorInTBE;
1948 m_decrementNumberOfMessagesExt;
1949 o_checkForExtCompletion;
1954 transition(ILOS, L1_GETX, IGMIO) {
1959 o_popL1RequestQueue;
1962 // new exclusive happened while sharer attempted writeback
1963 transition(ILX, {L1_PUTS, L1_PUTS_only, L1_PUTO}) {
1965 o_popL1RequestQueue;
1968 transition(S, L1_PUTS) {
1970 o_popL1RequestQueue;
1973 transition(OLS, L1_GETX, OGMIO) {
1977 h_countLocalSharersExceptRequestor;
1978 // COPY DATA FROM CACHE TO TBE (happens during i_allocateTBE)
1979 y_copyCacheStateToDir;
1980 rr_deallocateL2CacheBlock;
1982 o_popL1RequestQueue;
1985 transition(OGMIO, {Fwd_GETS, Fwd_DMA}) {
1987 c_sendDataFromTBEToFwdGETS;
1991 transition(ILO, L1_GETX, IGMIO) {
1995 // the following, of course, returns 0 sharers but do anyways for consistency
1996 h_countLocalSharersExceptRequestor;
1998 o_popL1RequestQueue;
2001 transition({ILO, ILOX}, L1_PUTS) {
2003 o_popL1RequestQueue;
2006 transition(IGMIO, Fwd_GETX, IGMIOF) {
2008 j_forwardGlobalRequestToLocalOwner;
2009 ee_sendLocalInvSharersOnly;
2014 transition(IGMIO, Fwd_GETS, IGMIOFS) {
2016 j_forwardGlobalRequestToLocalOwner;
2020 transition(IGMIO, Fwd_DMA) {
2022 j_forwardGlobalRequestToLocalOwner;
2026 transition(IGMIOFS, Data, IGMIO) {
2028 c_sendDataFromTBEToFwdGETS;
2032 transition(OGMIO, Fwd_GETX, OGMIOF) {
2034 ee_sendLocalInvSharersOnly;
2038 transition(OGMIOF, IntAck) {
2039 m_decrementNumberOfMessagesInt;
2040 o_checkForIntCompletion;
2044 transition(OGMIOF, All_Acks, IGM) {
2045 gg_clearLocalSharers;
2046 hh_countLocalSharersExceptL1GETXRequestorInTBE;
2047 c_sendDataFromTBEToFwdGETX;
2051 transition(IGMIOF, IntAck) {
2052 m_decrementNumberOfMessagesInt;
2053 o_checkForIntCompletion;
2057 transition(IGMIOF, Data_Exclusive) {
2059 m_decrementNumberOfMessagesInt;
2060 o_checkForIntCompletion;
2064 transition(IGMIOF, All_Acks, IGM) {
2065 gg_clearLocalSharers;
2066 c_sendDataFromTBEToFwdGETX;
2070 transition(IGMIO, All_Acks, IGMO) {
2071 hh_countLocalSharersExceptL1GETXRequestorInTBE;
2072 ee_issueLocalInvExceptL1RequestorInTBE;
2073 k_forwardLocalGETXToLocalOwner;
2074 e_sendAckToL1RequestorFromTBE;
2078 transition(OGMIO, All_Acks, IGMO) {
2079 ee_issueLocalInvExceptL1RequestorInTBE;
2080 c_sendDataFromTBEToL1GETX;
2084 transition({IGMIO, OGMIO}, Own_GETX) {
2085 mm_decrementNumberOfMessagesExt;
2086 o_checkForExtCompletion;
2091 transition(IGM, {Data, Data_Exclusive}, IGMO) {
2093 m_decrementNumberOfMessagesExt;
2094 o_checkForExtCompletion;
2098 transition({IGM, IGMIO, OGMIO}, ExtAck) {
2099 m_decrementNumberOfMessagesExt;
2100 o_checkForExtCompletion;
2104 transition(IGMO, ExtAck) {
2105 m_decrementNumberOfMessagesExt;
2106 o_checkForExtCompletion;
2110 transition(IGS, Data) {
2112 m_decrementNumberOfMessagesExt;
2113 c_sendDataFromTBEToL1GETS;
2117 transition(IGS, Data_Exclusive) {
2119 m_decrementNumberOfMessagesExt;
2120 c_sendExclusiveDataFromTBEToL1GETS;
2124 transition(IGS, Unblock, ILS) {
2125 g_recordLocalSharer;
2131 transition(IGS, Exclusive_Unblock, ILX) {
2132 g_recordLocalExclusive;
2133 f_sendExclusiveUnblock;
2138 transition(IGMO, All_Acks) {
2139 c_sendDataFromTBEToL1GETX;
2143 transition(IGMO, Exclusive_Unblock, ILX) {
2144 g_recordLocalExclusive;
2145 f_sendExclusiveUnblock;
2151 transition(SLS, L1_GETX, IGMLS) {
2155 // count number of INVs needed that doesn't include requestor
2156 h_countLocalSharersExceptRequestor;
2157 // issue INVs to everyone except requestor
2158 y_copyCacheStateToDir;
2159 rr_deallocateL2CacheBlock;
2161 o_popL1RequestQueue;
2165 transition(SLS, L1_GETS, SLSS ) {
2168 o_popL1RequestQueue;
2171 transition(SLSS, Unblock, SLS) {
2172 g_recordLocalSharer;
2177 transition(O, L1_GETX, IGMO) {
2181 y_copyCacheStateToDir;
2182 rr_deallocateL2CacheBlock;
2184 o_popL1RequestQueue;
2187 transition(OLS, L1_GETS, OLSS) {
2190 o_popL1RequestQueue;
2193 transition(OLSS, Unblock, OLS) {
2194 g_recordLocalSharer;
2198 transition(IGMO, Fwd_GETX, IGM) {
2200 c_sendDataFromTBEToFwdGETX;
2205 transition(IGMO, {Fwd_GETS, Fwd_DMA}) {
2207 c_sendDataFromTBEToFwdGETS;
2212 // LOCAL REQUESTS SATISFIED DIRECTLY BY L2
2214 transition(M, L1_GETX, MM) {
2216 // should count 0 of course
2217 h_countLocalSharersExceptRequestor;
2219 y_copyCacheStateToDir;
2220 rr_deallocateL2CacheBlock;
2222 o_popL1RequestQueue;
2225 transition(MM, Exclusive_Unblock, ILX) {
2226 g_recordLocalExclusive;
2230 transition(M, L1_GETS, OO) {
2232 // should count 0 of course
2233 h_countLocalSharersExceptRequestor;
2237 o_popL1RequestQueue;
2240 transition(S, L1_GETS, SS) {
2243 o_popL1RequestQueue;
2246 transition(SS, Unblock, SLS) {
2247 g_recordLocalSharer;
2251 transition(O, L1_GETS, OO) {
2254 o_popL1RequestQueue;
2257 transition(OO, Unblock, OLS) {
2258 g_recordLocalSharer;
2262 transition(OO, Exclusive_Unblock, ILX) {
2263 g_recordLocalExclusive
2264 y_copyCacheStateToDir;
2265 rr_deallocateL2CacheBlock;
2271 transition(ILO, L1_PUTO, ILOW) {
2272 l_writebackAckNeedData;
2273 o_popL1RequestQueue;
2276 transition(ILOX, L1_PUTO, ILOXW) {
2277 l_writebackAckNeedData;
2278 o_popL1RequestQueue;
2282 transition(ILOS, L1_PUTO, ILOSW) {
2283 l_writebackAckNeedData;
2284 o_popL1RequestQueue;
2287 transition(ILOSX, L1_PUTO, ILOSXW) {
2288 l_writebackAckNeedData;
2289 o_popL1RequestQueue;
2293 // hmmm...keep data or drop. Just drop for now
2294 transition(ILOS, L1_PUTS_only, ILOW) {
2295 l_writebackAckDropData;
2296 o_popL1RequestQueue;
2299 transition(ILSW, Unblock, ILS) {
2300 gg_clearSharerFromL1Response;
2304 transition(ILOW, Unblock, ILO) {
2305 gg_clearSharerFromL1Response;
2309 transition(ILOSX, L1_PUTS_only, ILOXW) {
2310 l_writebackAckDropData;
2311 o_popL1RequestQueue;
2314 transition(ILOXW, Unblock, ILOX) {
2315 gg_clearSharerFromL1Response;
2319 // hmmm...keep data or drop. Just drop for now
2320 transition(ILOS, L1_PUTS, ILOSW) {
2321 l_writebackAckDropData;
2322 o_popL1RequestQueue;
2325 transition(ILOSX, L1_PUTS, ILOSXW) {
2326 l_writebackAckDropData;
2327 o_popL1RequestQueue;
2330 transition(ILOSW, Unblock, ILOS) {
2331 gg_clearSharerFromL1Response;
2335 transition(ILOSXW, Unblock, ILOSX) {
2336 gg_clearSharerFromL1Response;
2340 transition(SLS, L1_PUTS, SLSW) {
2341 l_writebackAckDropData;
2342 o_popL1RequestQueue;
2345 transition(SLS, L1_PUTS_only, SW) {
2346 l_writebackAckDropData;
2347 o_popL1RequestQueue;
2350 transition(SW, {Unblock}, S) {
2351 gg_clearSharerFromL1Response;
2355 transition(OLS, L1_PUTS, OLSW) {
2356 l_writebackAckDropData;
2357 o_popL1RequestQueue;
2360 transition(ILS, L1_PUTS, ILSW) {
2361 l_writebackAckNeedData;
2362 o_popL1RequestQueue;
2365 transition(ILS, L1_PUTS_only, IW) {
2366 l_writebackAckNeedData;
2367 o_popL1RequestQueue;
2370 transition(OLS, L1_PUTS_only, OW) {
2371 l_writebackAckDropData;
2372 o_popL1RequestQueue;
2375 transition(OLSX, L1_PUTS_only, OXW) {
2376 l_writebackAckDropData;
2377 o_popL1RequestQueue;
2380 transition(OLSX, L1_PUTS, OLSXW) {
2381 l_writebackAckDropData;
2382 o_popL1RequestQueue;
2385 transition(OLSXW, {Unblock}, OLSX) {
2386 gg_clearSharerFromL1Response;
2390 transition(OW, {Unblock}, O) {
2391 gg_clearSharerFromL1Response;
2395 transition(OXW, {Unblock}, M) {
2396 gg_clearSharerFromL1Response;
2400 transition(ILX, L1_PUTX, ILXW ) {
2401 l_writebackAckNeedData;
2402 o_popL1RequestQueue;
2405 transition(ILXW, L1_WBDIRTYDATA, M) {
2406 gg_clearLocalSharers;
2407 vv_allocateL2CacheBlock;
2408 y_copyDirToCacheAndRemove;
2414 transition(ILXW, L1_WBCLEANDATA, M) {
2415 gg_clearLocalSharers;
2416 vv_allocateL2CacheBlock;
2417 y_copyDirToCacheAndRemove;
2422 transition(ILXW, Unblock, ILX) {
2423 // writeback canceled because L1 invalidated
2427 transition(ILSW, L1_WBCLEANDATA, SLS) {
2428 vv_allocateL2CacheBlock;
2429 y_copyDirToCacheAndRemove;
2431 gg_clearSharerFromL1Response;
2435 transition(IW, L1_WBCLEANDATA, S) {
2436 vv_allocateL2CacheBlock;
2437 y_copyDirToCacheAndRemove;
2439 gg_clearSharerFromL1Response;
2444 // Owner can have dirty data
2445 transition(ILOW, {L1_WBCLEANDATA, L1_WBDIRTYDATA}, O) {
2446 vv_allocateL2CacheBlock;
2447 y_copyDirToCacheAndRemove;
2448 gg_clearOwnerFromL1Response;
2453 transition(ILOXW, L1_WBDIRTYDATA, M) {
2454 vv_allocateL2CacheBlock;
2455 y_copyDirToCacheAndRemove;
2456 gg_clearOwnerFromL1Response;
2461 transition(ILOXW, L1_WBCLEANDATA, M) {
2462 vv_allocateL2CacheBlock;
2463 y_copyDirToCacheAndRemove;
2464 gg_clearOwnerFromL1Response;
2469 transition(ILOSW, {L1_WBCLEANDATA, L1_WBDIRTYDATA}, OLS) {
2470 vv_allocateL2CacheBlock;
2471 y_copyDirToCacheAndRemove;
2472 gg_clearOwnerFromL1Response;
2477 transition(ILOSXW, {L1_WBCLEANDATA, L1_WBDIRTYDATA}, OLSX) {
2478 vv_allocateL2CacheBlock;
2479 y_copyDirToCacheAndRemove;
2480 gg_clearOwnerFromL1Response;
2486 transition(SLSW, {Unblock}, SLS) {
2487 gg_clearSharerFromL1Response;
2491 transition(OLSW, {Unblock}, OLS) {
2492 gg_clearSharerFromL1Response;
2498 transition({I, S}, L2_Replacement, I) {
2499 rr_deallocateL2CacheBlock;
2502 transition(ILS, L2_Replacement) {
2503 y_copyCacheStateToDir;
2504 rr_deallocateL2CacheBlock;
2507 transition(ILX, L2_Replacement ) {
2508 y_copyCacheStateToDir;
2509 rr_deallocateL2CacheBlock;
2512 transition({ILO, ILOS}, L2_Replacement ) {
2513 y_copyCacheStateToDir;
2514 rr_deallocateL2CacheBlock;
2517 transition(SLS, L2_Replacement, ILS) {
2518 y_copyCacheStateToDir;
2519 rr_deallocateL2CacheBlock;
2522 transition({OLS, OLSX}, L2_Replacement, OLSI) {
2523 y_copyCacheStateToDir;
2526 rr_deallocateL2CacheBlock;
2530 transition(O, L2_Replacement, OI) {
2533 rr_deallocateL2CacheBlock;
2536 transition(M, L2_Replacement, MI) {
2539 rr_deallocateL2CacheBlock;
2542 transition(OLSI, Fwd_GETX, ILSI) {
2548 transition(ILSI, IntAck) {
2549 m_decrementNumberOfMessagesInt;
2550 o_checkForIntCompletion;
2554 transition(ILSI, All_Acks, MII) {
2555 gg_clearLocalSharers;
2556 c_sendDataFromTBEToFwdGETX;
2560 transition(OLSI, {Fwd_GETS, Fwd_DMA}) {
2562 c_sendDataFromTBEToFwdGETS;
2566 transition({MI, OI}, {Fwd_GETS, Fwd_DMA}, OI) {
2568 c_sendDataFromTBEToFwdGETS;
2572 transition({MI, OI}, Fwd_GETX, MII) {
2574 c_sendDataFromTBEToFwdGETX;
2578 transition({MI, OI}, Writeback_Ack, I) {
2579 qq_sendDataFromTBEToMemory;
2584 transition(MII, Writeback_Nack, I) {
2589 transition(OI, Writeback_Nack) {
2594 transition(OLSI, Writeback_Ack, ILS) {
2595 qq_sendDataFromTBEToMemory;
2600 transition(MII, Writeback_Ack, I) {
2606 transition(ILSI, Writeback_Ack, ILS) {