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";
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);
228 TBETable TBEs, template_hack="<L2Cache_TBE>";
229 PerfectCacheMemory localDirectory, template_hack="<L2Cache_DirEntry>";
231 void set_cache_entry(AbstractCacheEntry b);
232 void unset_cache_entry();
236 Entry getCacheEntry(Address address), return_by_pointer="yes" {
237 return static_cast(Entry, "pointer", L2cacheMemory[address]);
240 bool isDirTagPresent(Address addr) {
241 return (localDirectory.isTagPresent(addr) );
244 bool isOnlySharer(Entry cache_entry, Address addr, MachineID shar_id) {
245 if (is_valid(cache_entry)) {
246 assert (localDirectory.isTagPresent(addr) == false);
247 if (cache_entry.Sharers.count() > 1) {
250 else if (cache_entry.Sharers.count() == 1) {
251 if (cache_entry.Sharers.isElement(shar_id)) {
255 return false; // something happened which should cause this PUTS to be nacked
263 else if (localDirectory.isTagPresent(addr)){
264 if (localDirectory[addr].Sharers.count() > 1) {
267 else if (localDirectory[addr].Sharers.count() == 1) {
268 if (localDirectory[addr].Sharers.isElement(shar_id)) {
272 return false; // something happened which should cause this PUTS to be nacked
280 // shouldn't happen unless L1 issues PUTS before unblock received
285 void copyCacheStateToDir(Entry cache_entry, Address addr) {
286 assert(localDirectory.isTagPresent(addr) == false);
287 assert(is_valid(cache_entry));
288 localDirectory.allocate(addr);
289 localDirectory[addr].DirState := cache_entry.CacheState;
290 localDirectory[addr].Sharers := cache_entry.Sharers;
291 localDirectory[addr].Owner := cache_entry.Owner;
292 localDirectory[addr].OwnerValid := cache_entry.OwnerValid;
296 void copyDirToCache(Entry cache_entry, Address addr) {
297 assert(is_valid(cache_entry));
298 cache_entry.Sharers := localDirectory[addr].Sharers;
299 cache_entry.Owner := localDirectory[addr].Owner;
300 cache_entry.OwnerValid := localDirectory[addr].OwnerValid;
304 void recordLocalSharerInDir(Entry cache_entry, Address addr, MachineID shar_id) {
305 if (is_valid(cache_entry)) {
306 assert (localDirectory.isTagPresent(addr) == false);
307 cache_entry.Sharers.add(shar_id);
310 if (localDirectory.isTagPresent(addr) == false) {
311 localDirectory.allocate(addr);
312 localDirectory[addr].Sharers.clear();
313 localDirectory[addr].OwnerValid := false;
315 localDirectory[addr].Sharers.add(shar_id);
319 void recordNewLocalExclusiveInDir(Entry cache_entry, Address addr, MachineID exc_id) {
321 if (is_valid(cache_entry)) {
322 assert (localDirectory.isTagPresent(addr) == false);
323 cache_entry.Sharers.clear();
324 cache_entry.OwnerValid := true;
325 cache_entry.Owner := exc_id;
328 if (localDirectory.isTagPresent(addr) == false) {
329 localDirectory.allocate(addr);
331 localDirectory[addr].Sharers.clear();
332 localDirectory[addr].OwnerValid := true;
333 localDirectory[addr].Owner := exc_id;
337 void removeAllLocalSharersFromDir(Entry cache_entry, Address addr) {
338 if (is_valid(cache_entry)) {
339 assert (localDirectory.isTagPresent(addr) == false);
340 cache_entry.Sharers.clear();
341 cache_entry.OwnerValid := false;
344 localDirectory[addr].Sharers.clear();
345 localDirectory[addr].OwnerValid := false;
349 void removeSharerFromDir(Entry cache_entry, Address addr, MachineID sender) {
350 if (is_valid(cache_entry)) {
351 assert (localDirectory.isTagPresent(addr) == false);
352 cache_entry.Sharers.remove(sender);
355 localDirectory[addr].Sharers.remove(sender);
359 void removeOwnerFromDir(Entry cache_entry, Address addr, MachineID sender) {
360 if (is_valid(cache_entry)) {
361 assert (localDirectory.isTagPresent(addr) == false);
362 cache_entry.OwnerValid := false;
365 localDirectory[addr].OwnerValid := false;
369 bool isLocalSharer(Entry cache_entry, Address addr, MachineID shar_id) {
370 if (is_valid(cache_entry)) {
371 assert (localDirectory.isTagPresent(addr) == false);
372 return cache_entry.Sharers.isElement(shar_id);
375 return localDirectory[addr].Sharers.isElement(shar_id);
379 NetDest getLocalSharers(Entry cache_entry, Address addr) {
380 if (is_valid(cache_entry)) {
381 assert (localDirectory.isTagPresent(addr) == false);
382 return cache_entry.Sharers;
385 return localDirectory[addr].Sharers;
389 MachineID getLocalOwner(Entry cache_entry, Address addr) {
390 if (is_valid(cache_entry)) {
391 assert (localDirectory.isTagPresent(addr) == false);
392 return cache_entry.Owner;
395 return localDirectory[addr].Owner;
399 int countLocalSharers(Entry cache_entry, Address addr) {
400 if (is_valid(cache_entry)) {
401 assert (localDirectory.isTagPresent(addr) == false);
402 return cache_entry.Sharers.count();
405 return localDirectory[addr].Sharers.count();
409 bool isLocalOwnerValid(Entry cache_entry, Address addr) {
410 if (is_valid(cache_entry)) {
411 assert (localDirectory.isTagPresent(addr) == false);
412 return cache_entry.OwnerValid;
415 return localDirectory[addr].OwnerValid;
419 int countLocalSharersExceptRequestor(Entry cache_entry, Address addr, MachineID requestor) {
420 if (is_valid(cache_entry)) {
421 assert (localDirectory.isTagPresent(addr) == false);
422 if (cache_entry.Sharers.isElement(requestor)) {
423 return ( cache_entry.Sharers.count() - 1 );
426 return cache_entry.Sharers.count();
430 if (localDirectory[addr].Sharers.isElement(requestor)) {
431 return ( localDirectory[addr].Sharers.count() - 1 );
434 return localDirectory[addr].Sharers.count();
439 State getState(TBE tbe, Entry cache_entry, Address addr) {
443 } else if (is_valid(cache_entry)) {
444 return cache_entry.CacheState;
445 } else if (isDirTagPresent(addr)) {
446 return localDirectory[addr].DirState;
452 std::string getCoherenceRequestTypeStr(CoherenceRequestType type) {
453 return CoherenceRequestType_to_string(type);
456 void setState(TBE tbe, Entry cache_entry, Address addr, State state) {
457 assert((localDirectory.isTagPresent(addr) && L2cacheMemory.isTagPresent(addr)) == false);
460 tbe.TBEState := state;
464 (state == State:M) ||
465 (state == State:O) ||
466 (state == State:S) ||
467 (state == State:OLS) ||
468 (state == State:SLS) ||
469 (state == State:OLSX) ||
472 assert(is_valid(cache_entry));
475 (state == State:ILS) ||
476 (state == State:ILX) ||
477 (state == State:ILO) ||
478 (state == State:ILOX) ||
479 (state == State:ILOS) ||
480 (state == State:ILOSX)
482 // assert(isCacheTagPresent(addr) == false);
485 if (is_valid(cache_entry)) {
486 if ( ((cache_entry.CacheState != State:M) && (state == State:M)) ||
487 ((cache_entry.CacheState != State:S) && (state == State:S)) ||
488 ((cache_entry.CacheState != State:O) && (state == State:O)) ) {
489 cache_entry.CacheState := state;
490 // disable Coherence Checker for now
491 // sequencer.checkCoherence(addr);
494 cache_entry.CacheState := state;
497 else if (localDirectory.isTagPresent(addr)) {
498 localDirectory[addr].DirState := state;
502 MessageBuffer triggerQueue, ordered="true";
504 out_port(globalRequestNetwork_out, RequestMsg, GlobalRequestFromL2Cache);
505 out_port(localRequestNetwork_out, RequestMsg, L1RequestFromL2Cache);
506 out_port(responseNetwork_out, ResponseMsg, responseFromL2Cache);
508 out_port(triggerQueue_out, TriggerMsg, triggerQueue);
514 in_port(triggerQueue_in, TriggerMsg, triggerQueue) {
515 if (triggerQueue_in.isReady()) {
516 peek(triggerQueue_in, TriggerMsg) {
517 if (in_msg.Type == TriggerType:ALL_ACKS) {
518 trigger(Event:All_Acks, in_msg.Address,
519 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
521 error("Unexpected message");
529 in_port(requestNetwork_in, RequestMsg, GlobalRequestToL2Cache) {
530 if (requestNetwork_in.isReady()) {
531 peek(requestNetwork_in, RequestMsg) {
532 if (in_msg.Type == CoherenceRequestType:GETX || in_msg.Type == CoherenceRequestType:DMA_WRITE) {
533 if (in_msg.Requestor == machineID) {
534 trigger(Event:Own_GETX, in_msg.Address,
535 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
537 trigger(Event:Fwd_GETX, in_msg.Address,
538 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
540 } else if (in_msg.Type == CoherenceRequestType:GETS) {
541 trigger(Event:Fwd_GETS, in_msg.Address,
542 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
543 } else if(in_msg.Type == CoherenceRequestType:DMA_READ) {
544 trigger(Event:Fwd_DMA, in_msg.Address,
545 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
546 } else if (in_msg.Type == CoherenceRequestType:INV) {
547 trigger(Event:Inv, in_msg.Address,
548 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
549 } else if (in_msg.Type == CoherenceRequestType:WB_ACK) {
550 trigger(Event:Writeback_Ack, in_msg.Address,
551 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
552 } else if (in_msg.Type == CoherenceRequestType:WB_NACK) {
553 trigger(Event:Writeback_Nack, in_msg.Address,
554 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
556 error("Unexpected message");
562 in_port(L1requestNetwork_in, RequestMsg, L1RequestToL2Cache) {
563 if (L1requestNetwork_in.isReady()) {
564 peek(L1requestNetwork_in, RequestMsg) {
565 assert(in_msg.Destination.isElement(machineID));
566 if (in_msg.Type == CoherenceRequestType:GETX) {
567 trigger(Event:L1_GETX, in_msg.Address,
568 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
569 } else if (in_msg.Type == CoherenceRequestType:GETS) {
570 trigger(Event:L1_GETS, in_msg.Address,
571 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
572 } else if (in_msg.Type == CoherenceRequestType:PUTO) {
573 trigger(Event:L1_PUTO, in_msg.Address,
574 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
575 } else if (in_msg.Type == CoherenceRequestType:PUTX) {
576 trigger(Event:L1_PUTX, in_msg.Address,
577 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
578 } else if (in_msg.Type == CoherenceRequestType:PUTS) {
579 Entry cache_entry := getCacheEntry(in_msg.Address);
580 if (isOnlySharer(cache_entry, in_msg.Address, in_msg.Requestor)) {
581 trigger(Event:L1_PUTS_only, in_msg.Address,
582 cache_entry, TBEs[in_msg.Address]);
585 trigger(Event:L1_PUTS, in_msg.Address,
586 cache_entry, TBEs[in_msg.Address]);
589 error("Unexpected message");
597 in_port(responseNetwork_in, ResponseMsg, responseToL2Cache) {
598 if (responseNetwork_in.isReady()) {
599 peek(responseNetwork_in, ResponseMsg) {
600 assert(in_msg.Destination.isElement(machineID));
601 if (in_msg.Type == CoherenceResponseType:ACK) {
602 if (in_msg.SenderMachine == MachineType:L2Cache) {
603 trigger(Event:ExtAck, in_msg.Address,
604 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
607 trigger(Event:IntAck, in_msg.Address,
608 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
610 } else if (in_msg.Type == CoherenceResponseType:DATA) {
611 trigger(Event:Data, in_msg.Address,
612 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
613 } else if (in_msg.Type == CoherenceResponseType:DATA_EXCLUSIVE) {
614 trigger(Event:Data_Exclusive, in_msg.Address,
615 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
616 } else if (in_msg.Type == CoherenceResponseType:UNBLOCK) {
617 trigger(Event:Unblock, in_msg.Address,
618 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
619 } else if (in_msg.Type == CoherenceResponseType:UNBLOCK_EXCLUSIVE) {
620 trigger(Event:Exclusive_Unblock, in_msg.Address,
621 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
622 } else if (in_msg.Type == CoherenceResponseType:WRITEBACK_DIRTY_DATA) {
623 Entry cache_entry := getCacheEntry(in_msg.Address);
624 if (is_invalid(cache_entry) &&
625 L2cacheMemory.cacheAvail(in_msg.Address) == false) {
626 trigger(Event:L2_Replacement, L2cacheMemory.cacheProbe(in_msg.Address),
627 getCacheEntry(L2cacheMemory.cacheProbe(in_msg.Address)),
628 TBEs[L2cacheMemory.cacheProbe(in_msg.Address)]);
631 trigger(Event:L1_WBDIRTYDATA, in_msg.Address,
632 cache_entry, TBEs[in_msg.Address]);
634 } else if (in_msg.Type == CoherenceResponseType:WRITEBACK_CLEAN_DATA) {
635 Entry cache_entry := getCacheEntry(in_msg.Address);
636 if (is_invalid(cache_entry) &&
637 L2cacheMemory.cacheAvail(in_msg.Address) == false) {
638 trigger(Event:L2_Replacement, L2cacheMemory.cacheProbe(in_msg.Address),
639 getCacheEntry(L2cacheMemory.cacheProbe(in_msg.Address)),
640 TBEs[L2cacheMemory.cacheProbe(in_msg.Address)]);
643 trigger(Event:L1_WBCLEANDATA, in_msg.Address,
644 cache_entry, TBEs[in_msg.Address]);
646 } else if (in_msg.Type == CoherenceResponseType:DMA_ACK) {
647 trigger(Event:DmaAck, in_msg.Address,
648 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
650 error("Unexpected message");
659 action(a_issueGETS, "a", desc="issue local request globally") {
660 peek(L1requestNetwork_in, RequestMsg) {
661 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
662 out_msg.Address := address;
663 out_msg.Type := CoherenceRequestType:GETS;
664 out_msg.RequestorMachine := MachineType:L2Cache;
665 out_msg.Requestor := machineID;
666 out_msg.Destination.add(map_Address_to_Directory(address));
667 out_msg.MessageSize := MessageSizeType:Request_Control;
672 action(a_issueGETX, "\a", desc="issue local request globally") {
673 peek(L1requestNetwork_in, RequestMsg) {
674 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
675 out_msg.Address := address;
676 out_msg.Type := CoherenceRequestType:GETX;
677 out_msg.RequestorMachine := MachineType:L2Cache;
678 out_msg.Requestor := machineID;
679 out_msg.Destination.add(map_Address_to_Directory(address));
680 out_msg.MessageSize := MessageSizeType:Request_Control;
685 action(b_issuePUTX, "b", desc="Issue PUTX") {
686 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
687 out_msg.Address := address;
688 out_msg.Type := CoherenceRequestType:PUTX;
689 out_msg.RequestorMachine := MachineType:L2Cache;
690 out_msg.Requestor := machineID;
691 out_msg.Destination.add(map_Address_to_Directory(address));
692 out_msg.MessageSize := MessageSizeType:Writeback_Control;
696 action(b_issuePUTO, "\b", desc="Issue PUTO") {
697 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
698 out_msg.Address := address;
699 out_msg.Type := CoherenceRequestType:PUTO;
700 out_msg.Requestor := machineID;
701 out_msg.RequestorMachine := MachineType:L2Cache;
702 out_msg.Destination.add(map_Address_to_Directory(address));
703 out_msg.MessageSize := MessageSizeType:Writeback_Control;
707 /* PUTO, but local sharers exist */
708 action(b_issuePUTO_ls, "\bb", desc="Issue PUTO") {
709 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
710 out_msg.Address := address;
711 out_msg.Type := CoherenceRequestType:PUTO_SHARERS;
712 out_msg.Requestor := machineID;
713 out_msg.RequestorMachine := MachineType:L2Cache;
714 out_msg.Destination.add(map_Address_to_Directory(address));
715 out_msg.MessageSize := MessageSizeType:Writeback_Control;
719 action(c_sendDataFromTBEToL1GETS, "c", desc="Send data from TBE to L1 requestors in TBE") {
720 assert(is_valid(tbe));
721 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
722 out_msg.Address := address;
723 out_msg.Type := CoherenceResponseType:DATA;
724 out_msg.Sender := machineID;
725 out_msg.Destination.addNetDest(tbe.L1_GetS_IDs);
726 out_msg.DataBlk := tbe.DataBlk;
727 // out_msg.Dirty := tbe.Dirty;
728 // shared data should be clean
729 out_msg.Dirty := false;
730 out_msg.MessageSize := MessageSizeType:Response_Data;
732 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
733 address, tbe.DataBlk);
736 action(c_sendDataFromTBEToL1GETX, "\c", desc="Send data from TBE to L1 requestors in TBE") {
737 assert(is_valid(tbe));
738 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
739 out_msg.Address := address;
740 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
741 out_msg.Sender := machineID;
742 out_msg.SenderMachine := MachineType:L2Cache;
743 out_msg.Destination.add(tbe.L1_GetX_ID);
744 out_msg.DataBlk := tbe.DataBlk;
745 out_msg.Dirty := tbe.Dirty;
746 out_msg.Acks := tbe.Local_GETX_IntAcks;
747 out_msg.MessageSize := MessageSizeType:Response_Data;
749 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
750 address, tbe.DataBlk);
753 action(c_sendExclusiveDataFromTBEToL1GETS, "\cc", desc="Send data from TBE to L1 requestors in TBE") {
754 assert(is_valid(tbe));
755 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
756 out_msg.Address := address;
757 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
758 out_msg.Sender := machineID;
759 out_msg.SenderMachine := MachineType:L2Cache;
760 out_msg.Destination.addNetDest(tbe.L1_GetS_IDs);
761 out_msg.DataBlk := tbe.DataBlk;
762 out_msg.Dirty := tbe.Dirty;
763 out_msg.MessageSize := MessageSizeType:Response_Data;
767 action(c_sendDataFromTBEToFwdGETX, "cc", desc="Send data from TBE to external GETX") {
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.Fwd_GetX_ID);
775 out_msg.DataBlk := tbe.DataBlk;
776 out_msg.Dirty := tbe.Dirty;
777 out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
778 out_msg.MessageSize := MessageSizeType:Response_Data;
782 action(cd_sendDataFromTBEToFwdDma, "cd", desc="Send data from TBE to external GETX") {
783 assert(is_valid(tbe));
784 peek(requestNetwork_in, RequestMsg) {
785 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
786 out_msg.Address := address;
787 out_msg.Type := CoherenceResponseType:DATA;
788 out_msg.Sender := machineID;
789 out_msg.Destination.add(in_msg.Requestor);
790 out_msg.DataBlk := tbe.DataBlk;
791 // out_msg.Dirty := tbe.Dirty;
792 // shared data should be clean
793 out_msg.Dirty := false;
794 out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
795 out_msg.MessageSize := MessageSizeType:Response_Data;
798 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
799 address, tbe.DataBlk);
802 action(c_sendDataFromTBEToFwdGETS, "ccc", desc="Send data from TBE to external GETX") {
803 assert(is_valid(tbe));
804 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
805 out_msg.Address := address;
806 out_msg.Type := CoherenceResponseType:DATA;
807 out_msg.Sender := machineID;
808 out_msg.Destination.addNetDest(tbe.Fwd_GetS_IDs);
809 out_msg.DataBlk := tbe.DataBlk;
810 // out_msg.Dirty := tbe.Dirty;
811 // shared data should be clean
812 out_msg.Dirty := false;
813 out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
814 out_msg.MessageSize := MessageSizeType:Response_Data;
816 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
817 address, tbe.DataBlk);
820 action(c_sendExclusiveDataFromTBEToFwdGETS, "\ccc", desc="Send data from TBE to external GETX") {
821 assert(is_valid(tbe));
822 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
823 out_msg.Address := address;
824 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
825 out_msg.Sender := machineID;
826 out_msg.SenderMachine := MachineType:L2Cache;
827 out_msg.Destination.addNetDest(tbe.Fwd_GetS_IDs);
828 out_msg.DataBlk := tbe.DataBlk;
829 out_msg.Dirty := tbe.Dirty;
830 out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
831 out_msg.MessageSize := MessageSizeType:Response_Data;
833 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
834 address, tbe.DataBlk);
837 action(d_sendDataToL1GETS, "d", desc="Send data directly to L1 requestor") {
838 assert(is_valid(cache_entry));
839 peek(L1requestNetwork_in, RequestMsg) {
840 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
841 out_msg.Address := address;
842 out_msg.Type := CoherenceResponseType:DATA;
843 out_msg.Sender := machineID;
844 out_msg.Destination.add(in_msg.Requestor);
845 out_msg.DataBlk := cache_entry.DataBlk;
846 // out_msg.Dirty := cache_entry.Dirty;
847 // shared data should be clean
848 out_msg.Dirty := false;
849 out_msg.MessageSize := MessageSizeType:ResponseL2hit_Data;
852 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
853 address, cache_entry.DataBlk);
856 action(d_sendDataToL1GETX, "\d", desc="Send data and a token from TBE to L1 requestor") {
857 assert(is_valid(cache_entry));
858 peek(L1requestNetwork_in, RequestMsg) {
859 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
860 assert(is_valid(tbe));
861 out_msg.Address := address;
862 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
863 out_msg.Sender := machineID;
864 out_msg.SenderMachine := MachineType:L2Cache;
865 out_msg.Destination.add(in_msg.Requestor);
866 out_msg.DataBlk := cache_entry.DataBlk;
867 out_msg.Dirty := cache_entry.Dirty;
868 out_msg.MessageSize := MessageSizeType:ResponseL2hit_Data;
869 out_msg.Acks := tbe.Local_GETX_IntAcks;
872 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
873 address, cache_entry.DataBlk);
876 action(dd_sendDataToFwdGETX, "dd", desc="send data") {
877 assert(is_valid(cache_entry));
878 peek(requestNetwork_in, RequestMsg) {
879 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
880 out_msg.Address := address;
881 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
882 out_msg.Sender := machineID;
883 out_msg.SenderMachine := MachineType:L2Cache;
884 out_msg.Destination.add(in_msg.Requestor);
885 out_msg.DataBlk := cache_entry.DataBlk;
886 out_msg.Dirty := cache_entry.Dirty;
887 out_msg.MessageSize := MessageSizeType:Response_Data;
888 out_msg.Acks := in_msg.Acks;
891 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
892 address, cache_entry.DataBlk);
896 action(dd_sendDataToFwdGETS, "\dd", desc="send data") {
897 assert(is_valid(cache_entry));
898 peek(requestNetwork_in, RequestMsg) {
899 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
900 out_msg.Address := address;
901 out_msg.Type := CoherenceResponseType:DATA;
902 out_msg.Sender := machineID;
903 out_msg.Destination.add(in_msg.Requestor);
904 out_msg.DataBlk := cache_entry.DataBlk;
905 // out_msg.Dirty := cache_entry.Dirty;
906 // shared data should be clean
907 out_msg.Dirty := false;
908 out_msg.MessageSize := MessageSizeType:Response_Data;
911 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
912 address, cache_entry.DataBlk);
915 action(dd_sendExclusiveDataToFwdGETS, "\d\d", desc="send data") {
916 assert(is_valid(cache_entry));
917 peek(requestNetwork_in, RequestMsg) {
918 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
919 out_msg.Address := address;
920 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
921 out_msg.Sender := machineID;
922 out_msg.Destination.add(in_msg.Requestor);
923 out_msg.DataBlk := cache_entry.DataBlk;
924 out_msg.Dirty := cache_entry.Dirty;
925 out_msg.MessageSize := MessageSizeType:Response_Data;
930 action(e_sendAck, "e", desc="Send ack with the tokens we've collected thus far.") {
931 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
932 assert(is_valid(tbe));
933 out_msg.Address := address;
934 out_msg.Type := CoherenceResponseType:ACK;
935 out_msg.Sender := machineID;
936 out_msg.SenderMachine := MachineType:L2Cache;
938 out_msg.Destination.add( tbe.Fwd_GetX_ID);
939 out_msg.Acks := 0 - 1;
940 out_msg.MessageSize := MessageSizeType:Response_Control;
944 action(e_sendAckToL1Requestor, "\e", desc="Send ack with the tokens we've collected thus far.") {
945 peek(L1requestNetwork_in, RequestMsg) {
946 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
947 out_msg.Address := address;
948 out_msg.Type := CoherenceResponseType:ACK;
949 out_msg.Sender := machineID;
950 out_msg.SenderMachine := MachineType:L2Cache;
951 out_msg.Destination.add(in_msg.Requestor);
952 out_msg.Acks := 0 - 1;
953 out_msg.MessageSize := MessageSizeType:Response_Control;
958 action(e_sendAckToL1RequestorFromTBE, "eee", desc="Send ack with the tokens we've collected thus far.") {
959 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
960 assert(is_valid(tbe));
961 out_msg.Address := address;
962 out_msg.Type := CoherenceResponseType:ACK;
963 out_msg.Sender := machineID;
964 out_msg.SenderMachine := MachineType:L2Cache;
965 out_msg.Destination.add(tbe.L1_GetX_ID);
966 out_msg.Acks := 0 - 1;
967 out_msg.MessageSize := MessageSizeType:Response_Control;
971 action(ee_sendLocalInv, "\ee", desc="Send local invalidates") {
972 assert(is_valid(tbe));
973 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
974 DPRINTF(RubySlicc, "Address: %s, Local Sharers: %s, Pending Acks: %d\n",
975 address, getLocalSharers(cache_entry, address),
976 tbe.NumIntPendingAcks);
977 if (isLocalOwnerValid(cache_entry, address)) {
978 tbe.NumIntPendingAcks := tbe.NumIntPendingAcks + 1;
979 DPRINTF(RubySlicc, "%s\n", getLocalOwner(cache_entry, address));
982 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
983 out_msg.Address := address;
984 out_msg.Type := CoherenceRequestType:INV;
985 out_msg.Requestor := machineID;
986 out_msg.RequestorMachine := MachineType:L2Cache;
987 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
988 if (isLocalOwnerValid(cache_entry, address))
990 out_msg.Destination.add(getLocalOwner(cache_entry, address));
992 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
996 action(ee_sendLocalInvSharersOnly, "\eee", desc="Send local invalidates to sharers if they exist") {
998 // assert(countLocalSharers(address) > 0);
999 assert(is_valid(tbe));
1000 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
1002 if (countLocalSharers(cache_entry, address) > 0) {
1003 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1004 out_msg.Address := address;
1005 out_msg.Type := CoherenceRequestType:INV;
1006 out_msg.Requestor := machineID;
1007 out_msg.RequestorMachine := MachineType:L2Cache;
1008 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
1009 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
1014 action(ee_addLocalIntAck, "e\ee", desc="add a local ack to wait for") {
1015 assert(is_valid(tbe));
1016 tbe.NumIntPendingAcks := tbe.NumIntPendingAcks + 1;
1019 action(ee_issueLocalInvExceptL1Requestor, "\eeee", desc="Send local invalidates to sharers if they exist") {
1020 peek(L1requestNetwork_in, RequestMsg) {
1022 // assert(countLocalSharers(address) > 0);
1023 if (countLocalSharers(cache_entry, address) == 0) {
1024 tbe.NumIntPendingAcks := 0;
1028 if (isLocalSharer(cache_entry, address, in_msg.Requestor)) {
1029 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address) - 1;
1032 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
1035 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1036 out_msg.Address := address;
1037 out_msg.Type := CoherenceRequestType:INV;
1038 out_msg.Requestor := in_msg.Requestor;
1039 out_msg.RequestorMachine := MachineType:L1Cache;
1040 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
1041 out_msg.Destination.remove(in_msg.Requestor);
1042 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
1048 action(ee_issueLocalInvExceptL1RequestorInTBE, "\eeeeee", desc="Send local invalidates to sharers if they exist") {
1049 assert(is_valid(tbe));
1050 if (countLocalSharers(cache_entry, address) == 0) {
1051 tbe.NumIntPendingAcks := 0;
1054 if (isLocalSharer(cache_entry, address, tbe.L1_GetX_ID)) {
1055 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address) - 1;
1058 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
1061 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1062 out_msg.Address := address;
1063 out_msg.Type := CoherenceRequestType:INV;
1064 out_msg.Requestor := tbe.L1_GetX_ID;
1065 out_msg.RequestorMachine := MachineType:L1Cache;
1066 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
1067 out_msg.Destination.remove(tbe.L1_GetX_ID);
1068 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
1073 action(f_sendUnblock, "f", desc="Send unblock to global directory") {
1074 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
1075 out_msg.Address := address;
1076 out_msg.Type := CoherenceResponseType:UNBLOCK;
1077 out_msg.Destination.add(map_Address_to_Directory(address));
1078 out_msg.Sender := machineID;
1079 out_msg.SenderMachine := MachineType:L2Cache;
1080 out_msg.MessageSize := MessageSizeType:Unblock_Control;
1085 action(f_sendExclusiveUnblock, "\f", desc="Send unblock to global directory") {
1086 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
1087 out_msg.Address := address;
1088 out_msg.Type := CoherenceResponseType:UNBLOCK_EXCLUSIVE;
1089 out_msg.Destination.add(map_Address_to_Directory(address));
1090 out_msg.Sender := machineID;
1091 out_msg.SenderMachine := MachineType:L2Cache;
1092 out_msg.MessageSize := MessageSizeType:Unblock_Control;
1097 action(g_recordLocalSharer, "g", desc="Record new local sharer from unblock message") {
1098 peek(responseNetwork_in, ResponseMsg) {
1099 recordLocalSharerInDir(cache_entry, in_msg.Address, in_msg.Sender);
1103 action(g_recordLocalExclusive, "\g", desc="Record new local exclusive sharer from unblock message") {
1104 peek(responseNetwork_in, ResponseMsg) {
1105 recordNewLocalExclusiveInDir(cache_entry, address, in_msg.Sender);
1109 action(gg_clearLocalSharers, "gg", desc="Clear local sharers") {
1110 removeAllLocalSharersFromDir(cache_entry, address);
1113 action(gg_clearSharerFromL1Response, "\gg", desc="Clear sharer from L1 response queue") {
1114 peek(responseNetwork_in, ResponseMsg) {
1115 removeSharerFromDir(cache_entry, in_msg.Address, in_msg.Sender);
1119 action(gg_clearOwnerFromL1Response, "g\g", desc="Clear sharer from L1 response queue") {
1120 peek(responseNetwork_in, ResponseMsg) {
1121 removeOwnerFromDir(cache_entry, in_msg.Address, in_msg.Sender);
1125 action(h_countLocalSharersExceptRequestor, "h", desc="counts number of acks needed for L1 GETX") {
1126 peek(L1requestNetwork_in, RequestMsg) {
1127 assert(is_valid(tbe));
1128 tbe.Local_GETX_IntAcks := countLocalSharersExceptRequestor(cache_entry, address, in_msg.Requestor);
1132 action(h_clearIntAcks, "\h", desc="clear IntAcks") {
1133 assert(is_valid(tbe));
1134 tbe.Local_GETX_IntAcks := 0;
1137 action(hh_countLocalSharersExceptL1GETXRequestorInTBE, "hh", desc="counts number of acks needed for L1 GETX") {
1138 assert(is_valid(tbe));
1139 tbe.Local_GETX_IntAcks := countLocalSharersExceptRequestor(cache_entry, address, tbe.L1_GetX_ID);
1142 action(i_copyDataToTBE, "\i", desc="Copy data from response queue to TBE") {
1143 peek(responseNetwork_in, ResponseMsg) {
1144 assert(is_valid(tbe));
1145 tbe.DataBlk := in_msg.DataBlk;
1146 tbe.Dirty := in_msg.Dirty;
1147 APPEND_TRANSITION_COMMENT(in_msg.Sender);
1151 action(i_allocateTBE, "i", desc="Allocate TBE for internal/external request(isPrefetch=0, number of invalidates=0)") {
1152 check_allocate(TBEs);
1153 TBEs.allocate(address);
1154 set_tbe(TBEs[address]);
1155 if(is_valid(cache_entry)) {
1156 tbe.DataBlk := cache_entry.DataBlk;
1157 tbe.Dirty := cache_entry.Dirty;
1159 tbe.NumIntPendingAcks := 0; // default value
1160 tbe.NumExtPendingAcks := 0; // default value
1161 tbe.Fwd_GetS_IDs.clear();
1162 tbe.L1_GetS_IDs.clear();
1167 action(j_forwardGlobalRequestToLocalOwner, "j", desc="Forward external request to local owner") {
1168 peek(requestNetwork_in, RequestMsg) {
1169 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1170 out_msg.Address := in_msg.Address;
1171 out_msg.Type := in_msg.Type;
1172 out_msg.Requestor := machineID;
1173 out_msg.RequestorMachine := MachineType:L2Cache;
1174 out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.Address));
1175 out_msg.Type := in_msg.Type;
1176 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1177 out_msg.Acks := 0 - 1;
1182 action(jd_forwardDmaRequestToLocalOwner, "jd", desc="Forward dma request to local owner") {
1183 peek(requestNetwork_in, RequestMsg) {
1184 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1185 out_msg.Address := in_msg.Address;
1186 out_msg.Type := in_msg.Type;
1187 out_msg.Requestor := in_msg.Requestor;
1188 out_msg.RequestorMachine := in_msg.RequestorMachine;
1189 out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.Address));
1190 out_msg.Type := in_msg.Type;
1191 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1192 out_msg.Acks := 0 - 1;
1198 action(k_forwardLocalGETSToLocalSharer, "k", desc="Forward local request to local sharer/owner") {
1199 peek(L1requestNetwork_in, RequestMsg) {
1200 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1201 out_msg.Address := in_msg.Address;
1202 out_msg.Type := CoherenceRequestType:GETS;
1203 out_msg.Requestor := in_msg.Requestor;
1204 out_msg.RequestorMachine := MachineType:L1Cache;
1205 // should randomize this so one node doesn't get abused more than others
1206 out_msg.Destination.add(localDirectory[in_msg.Address].Sharers.smallestElement(MachineType:L1Cache));
1207 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1212 action(k_forwardLocalGETXToLocalOwner, "\k", desc="Forward local request to local owner") {
1213 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1214 assert(is_valid(tbe));
1215 out_msg.Address := address;
1216 out_msg.Type := CoherenceRequestType:GETX;
1217 out_msg.Requestor := tbe.L1_GetX_ID;
1218 out_msg.RequestorMachine := MachineType:L1Cache;
1219 out_msg.Destination.add(localDirectory[address].Owner);
1220 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1221 out_msg.Acks := 1 + tbe.Local_GETX_IntAcks;
1225 // same as previous except that it assumes to TBE is present to get number of acks
1226 action(kk_forwardLocalGETXToLocalExclusive, "kk", desc="Forward local request to local owner") {
1227 peek(L1requestNetwork_in, RequestMsg) {
1228 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1229 out_msg.Address := in_msg.Address;
1230 out_msg.Type := CoherenceRequestType:GETX;
1231 out_msg.Requestor := in_msg.Requestor;
1232 out_msg.RequestorMachine := MachineType:L1Cache;
1233 out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.Address));
1234 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1240 action(kk_forwardLocalGETSToLocalOwner, "\kk", desc="Forward local request to local owner") {
1241 peek(L1requestNetwork_in, RequestMsg) {
1242 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1243 out_msg.Address := in_msg.Address;
1244 out_msg.Type := CoherenceRequestType:GETS;
1245 out_msg.Requestor := in_msg.Requestor;
1246 out_msg.RequestorMachine := MachineType:L1Cache;
1247 out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.Address));
1248 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1254 action(l_writebackAckNeedData, "l", desc="Send writeback ack to L1 requesting data") {
1255 peek(L1requestNetwork_in, RequestMsg) {
1256 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1257 out_msg.Address := in_msg.Address;
1258 // out_msg.Type := CoherenceResponseType:WRITEBACK_SEND_DATA;
1259 out_msg.Type := CoherenceRequestType:WB_ACK_DATA;
1260 out_msg.Requestor := machineID;
1261 out_msg.RequestorMachine := MachineType:L2Cache;
1262 out_msg.Destination.add(in_msg.Requestor);
1263 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1268 action(l_writebackAckDropData, "\l", desc="Send writeback ack to L1 indicating to drop data") {
1269 peek(L1requestNetwork_in, RequestMsg) {
1270 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1271 out_msg.Address := in_msg.Address;
1272 // out_msg.Type := CoherenceResponseType:WRITEBACK_ACK;
1273 out_msg.Type := CoherenceRequestType:WB_ACK;
1274 out_msg.Requestor := machineID;
1275 out_msg.RequestorMachine := MachineType:L2Cache;
1276 out_msg.Destination.add(in_msg.Requestor);
1277 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1282 action(ll_writebackNack, "\ll", desc="Send writeback nack to L1") {
1283 peek(L1requestNetwork_in, RequestMsg) {
1284 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1285 out_msg.Address := in_msg.Address;
1286 out_msg.Type := CoherenceRequestType:WB_NACK;
1287 out_msg.Requestor := machineID;
1288 out_msg.RequestorMachine := MachineType:L2Cache;
1289 out_msg.Destination.add(in_msg.Requestor);
1290 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1295 action(m_popRequestQueue, "m", desc="Pop request queue.") {
1296 requestNetwork_in.dequeue();
1299 action(m_decrementNumberOfMessagesInt, "\m", desc="Decrement the number of messages for which we're waiting") {
1300 peek(responseNetwork_in, ResponseMsg) {
1301 assert(is_valid(tbe));
1302 tbe.NumIntPendingAcks := tbe.NumIntPendingAcks + in_msg.Acks;
1306 action(m_decrementNumberOfMessagesExt, "\mmm", desc="Decrement the number of messages for which we're waiting") {
1307 peek(responseNetwork_in, ResponseMsg) {
1308 assert(is_valid(tbe));
1309 tbe.NumExtPendingAcks := tbe.NumExtPendingAcks - in_msg.Acks;
1313 action(mm_decrementNumberOfMessagesExt, "\mm", desc="Decrement the number of messages for which we're waiting") {
1314 peek(requestNetwork_in, RequestMsg) {
1315 assert(is_valid(tbe));
1316 tbe.NumExtPendingAcks := tbe.NumExtPendingAcks - in_msg.Acks;
1320 action(n_popResponseQueue, "n", desc="Pop response queue") {
1321 responseNetwork_in.dequeue();
1324 action(n_popTriggerQueue, "\n", desc="Pop trigger queue.") {
1325 triggerQueue_in.dequeue();
1328 action(o_popL1RequestQueue, "o", desc="Pop L1 request queue.") {
1329 L1requestNetwork_in.dequeue();
1333 action(o_checkForIntCompletion, "\o", desc="Check if we have received all the messages required for completion") {
1334 assert(is_valid(tbe));
1335 if (tbe.NumIntPendingAcks == 0) {
1336 enqueue(triggerQueue_out, TriggerMsg) {
1337 out_msg.Address := address;
1338 out_msg.Type := TriggerType:ALL_ACKS;
1343 action(o_checkForExtCompletion, "\oo", desc="Check if we have received all the messages required for completion") {
1344 assert(is_valid(tbe));
1345 if (tbe.NumExtPendingAcks == 0) {
1346 enqueue(triggerQueue_out, TriggerMsg) {
1347 out_msg.Address := address;
1348 out_msg.Type := TriggerType:ALL_ACKS;
1354 action( qq_sendDataFromTBEToMemory, "qq", desc="Send data from TBE to directory") {
1355 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
1356 assert(is_valid(tbe));
1357 out_msg.Address := address;
1358 out_msg.Sender := machineID;
1359 out_msg.SenderMachine := MachineType:L2Cache;
1360 out_msg.Destination.add(map_Address_to_Directory(address));
1361 out_msg.Dirty := tbe.Dirty;
1363 out_msg.Type := CoherenceResponseType:WRITEBACK_DIRTY_DATA;
1364 out_msg.DataBlk := tbe.DataBlk;
1365 out_msg.MessageSize := MessageSizeType:Writeback_Data;
1367 out_msg.Type := CoherenceResponseType:WRITEBACK_CLEAN_ACK;
1368 // NOTE: in a real system this would not send data. We send
1369 // data here only so we can check it at the memory
1370 out_msg.DataBlk := tbe.DataBlk;
1371 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1376 action( r_setMRU, "\rrr", desc="manually set the MRU bit for cache line" ) {
1377 if(is_valid(cache_entry)) {
1378 L2cacheMemory.setMRU(address);
1382 action( s_recordGetXL1ID, "ss", desc="record local GETX requestor") {
1383 peek(L1requestNetwork_in, RequestMsg) {
1384 assert(is_valid(tbe));
1385 tbe.L1_GetX_ID := in_msg.Requestor;
1389 action(s_deallocateTBE, "s", desc="Deallocate external TBE") {
1390 TBEs.deallocate(address);
1394 action( s_recordGetSL1ID, "\ss", desc="record local GETS requestor") {
1395 peek(L1requestNetwork_in, RequestMsg) {
1396 assert(is_valid(tbe));
1397 tbe.L1_GetS_IDs.add(in_msg.Requestor);
1401 action(t_recordFwdXID, "t", desc="record global GETX requestor") {
1402 peek(requestNetwork_in, RequestMsg) {
1403 assert(is_valid(tbe));
1404 tbe.Fwd_GetX_ID := in_msg.Requestor;
1405 tbe.Fwd_GETX_ExtAcks := in_msg.Acks;
1409 action(t_recordFwdSID, "\t", desc="record global GETS requestor") {
1410 peek(requestNetwork_in, RequestMsg) {
1411 assert(is_valid(tbe));
1412 tbe.Fwd_GetS_IDs.clear();
1413 tbe.Fwd_GetS_IDs.add(in_msg.Requestor);
1418 action(u_writeDataToCache, "u", desc="Write data to cache") {
1419 peek(responseNetwork_in, ResponseMsg) {
1420 assert(is_valid(cache_entry));
1421 cache_entry.DataBlk := in_msg.DataBlk;
1422 if ((cache_entry.Dirty == false) && in_msg.Dirty) {
1423 cache_entry.Dirty := in_msg.Dirty;
1428 action(vv_allocateL2CacheBlock, "\v", desc="Set L2 cache tag equal to tag of block B.") {
1429 set_cache_entry(L2cacheMemory.allocate(address, new Entry));
1432 action(rr_deallocateL2CacheBlock, "\r", desc="Deallocate L2 cache block. Sets the cache to not present, allowing a replacement in parallel with a fetch.") {
1433 L2cacheMemory.deallocate(address);
1434 unset_cache_entry();
1438 action(w_assertIncomingDataAndCacheDataMatch, "w", desc="Assert that the incoming data and the data in the cache match") {
1439 peek(responseNetwork_in, ResponseMsg) {
1440 assert(is_valid(cache_entry));
1441 assert(cache_entry.DataBlk == in_msg.DataBlk);
1445 action(uu_profileMiss, "\u", desc="Profile the demand miss") {
1446 peek(L1requestNetwork_in, RequestMsg) {
1447 // AccessModeType not implemented
1448 // profile_L2Cache_miss(convertToGenericType(in_msg.Type), in_msg.AccessMode, MessageSizeTypeToInt(in_msg.MessageSize), in_msg.Prefetch, machineIDToNodeID(in_msg.Requestor));
1452 action(y_copyCacheStateToDir, "y", desc="Copy cache state to directory state") {
1453 copyCacheStateToDir(cache_entry, address);
1456 action(y_copyDirToCacheAndRemove, "/y", desc="Copy dir state to cache and remove") {
1457 copyDirToCache(cache_entry, address);
1458 localDirectory.deallocate(address);
1461 action(z_stall, "z", desc="Stall") {
1464 action(zz_recycleL1RequestQueue, "zz", desc="Send the head of the mandatory queue to the back of the queue.") {
1465 peek(L1requestNetwork_in, RequestMsg) {
1466 APPEND_TRANSITION_COMMENT(in_msg.Requestor);
1468 L1requestNetwork_in.recycle();
1471 action(zz_recycleRequestQueue, "\zz", desc="Send the head of the mandatory queue to the back of the queue.") {
1472 peek(requestNetwork_in, RequestMsg) {
1473 APPEND_TRANSITION_COMMENT(in_msg.Requestor);
1475 requestNetwork_in.recycle();
1478 action(zz_recycleResponseQueue, "\z\z", desc="Send the head of the mandatory queue to the back of the queue.") {
1479 peek(responseNetwork_in, ResponseMsg) {
1480 APPEND_TRANSITION_COMMENT(in_msg.Sender);
1482 responseNetwork_in.recycle();
1485 action(da_sendDmaAckUnblock, "da", desc="Send dma ack to global directory") {
1486 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
1487 out_msg.Address := address;
1488 out_msg.Type := CoherenceResponseType:DMA_ACK;
1489 out_msg.Destination.add(map_Address_to_Directory(address));
1490 out_msg.Sender := machineID;
1491 out_msg.SenderMachine := MachineType:L2Cache;
1492 out_msg.MessageSize := MessageSizeType:Unblock_Control;
1498 //*****************************************************
1500 //*****************************************************
1502 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}) {
1503 zz_recycleL1RequestQueue;
1506 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}) {
1507 zz_recycleL1RequestQueue;
1510 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) {
1511 zz_recycleResponseQueue;
1514 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}) {
1515 zz_recycleRequestQueue;
1518 transition({OGMIO, IGMIO, IGMO}, Fwd_DMA) {
1519 zz_recycleRequestQueue;
1522 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}) {
1523 zz_recycleRequestQueue;
1526 transition({IGM, IGS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {Own_GETX}) {
1527 zz_recycleRequestQueue;
1530 // must happened because we forwarded GETX to local exclusive trying to do wb
1531 transition({I, M, O, ILS, ILOX, OLS, OLSX, SLS, S}, L1_PUTX) {
1533 o_popL1RequestQueue;
1536 transition({M}, {L1_PUTS, L1_PUTO} ) {
1538 o_popL1RequestQueue;
1541 transition({ILS, OLSX}, L1_PUTO){
1543 o_popL1RequestQueue;
1546 // happened if we forwarded GETS to exclusive who tried to do writeback
1547 // ?? should we just Nack these instead? Could be a bugs here
1548 transition(ILO, L1_PUTX, ILOW) {
1549 l_writebackAckNeedData;
1550 o_popL1RequestQueue;
1553 // this can happen if we forwarded a L1_GETX to exclusiver after it issued a PUTX
1554 transition(ILOS, L1_PUTX, ILOSW) {
1555 l_writebackAckNeedData;
1556 o_popL1RequestQueue;
1559 transition(ILOSX, L1_PUTX, ILOSXW) {
1560 l_writebackAckNeedData;
1561 o_popL1RequestQueue;
1564 // must happened because we got Inv when L1 attempted PUTS
1565 transition(I, L1_PUTS) {
1567 o_popL1RequestQueue;
1570 transition(I, L1_PUTO) {
1572 o_popL1RequestQueue;
1575 // FORWARDED REQUESTS
1577 transition({ILO, ILX, ILOX}, Fwd_GETS, IFGS) {
1580 j_forwardGlobalRequestToLocalOwner;
1584 transition({ILOS, ILOSX}, Fwd_GETS, ISFGS) {
1587 j_forwardGlobalRequestToLocalOwner;
1591 transition(ILOS, Fwd_DMA, ILOSD) {
1593 jd_forwardDmaRequestToLocalOwner;
1597 transition(ILOSD, DmaAck, ILOS) {
1599 da_sendDmaAckUnblock;
1603 transition(ILOSX, Fwd_DMA, ILOSXD) {
1606 jd_forwardDmaRequestToLocalOwner;
1610 transition(ILOSXD, DmaAck, ILOSX) {
1612 da_sendDmaAckUnblock;
1616 transition(ILO, Fwd_DMA, ILOD) {
1619 jd_forwardDmaRequestToLocalOwner;
1623 transition(ILOD, DmaAck, ILO) {
1625 da_sendDmaAckUnblock;
1629 transition(ILX, Fwd_DMA, ILXD) {
1632 jd_forwardDmaRequestToLocalOwner;
1636 transition(ILXD, DmaAck, ILX) {
1638 da_sendDmaAckUnblock;
1642 transition(ILOX, Fwd_DMA, ILOXD) {
1645 jd_forwardDmaRequestToLocalOwner;
1649 transition(ILOXD, DmaAck, ILOX) {
1651 da_sendDmaAckUnblock;
1655 transition({ILOS, ILOSX, ILO, ILX, ILOX, ILXW}, Data) {
1657 c_sendDataFromTBEToFwdGETS;
1662 transition(IFGS, Data, ILO) {
1664 c_sendDataFromTBEToFwdGETS;
1669 transition(ISFGS, Data, ILOS) {
1671 c_sendDataFromTBEToFwdGETS;
1676 transition(IFGS, Data_Exclusive, I) {
1678 c_sendExclusiveDataFromTBEToFwdGETS;
1679 gg_clearLocalSharers;
1685 transition({ILX, ILO, ILOX}, Fwd_GETX, IFGX) {
1688 j_forwardGlobalRequestToLocalOwner;
1692 transition(IFGX, {Data_Exclusive, Data}, I) {
1694 c_sendDataFromTBEToFwdGETX;
1695 gg_clearLocalSharers;
1700 transition({ILOSX, ILOS}, Fwd_GETX, IFGXX) {
1703 j_forwardGlobalRequestToLocalOwner;
1704 ee_sendLocalInvSharersOnly;
1710 transition(IFGXX, IntAck) {
1711 m_decrementNumberOfMessagesInt;
1712 o_checkForIntCompletion;
1716 transition(IFGXX, Data_Exclusive) {
1718 m_decrementNumberOfMessagesInt;
1719 o_checkForIntCompletion;
1723 transition(IFGXX, All_Acks, I) {
1724 c_sendDataFromTBEToFwdGETX;
1725 gg_clearLocalSharers;
1731 // transition({O, OX}, Fwd_GETX, I) {
1732 transition(O, Fwd_GETX, I) {
1733 dd_sendDataToFwdGETX;
1734 y_copyCacheStateToDir;
1735 rr_deallocateL2CacheBlock;
1739 transition({O, OLS}, Fwd_GETS) {
1740 dd_sendDataToFwdGETS;
1744 transition({O, OLS}, Fwd_DMA) {
1745 dd_sendDataToFwdGETS;
1746 da_sendDmaAckUnblock;
1750 // transition({OLSX, OX}, Fwd_GETS, O) {
1751 transition(OLSX, Fwd_GETS, OLS) {
1752 dd_sendDataToFwdGETS;
1756 transition(OLSX, Fwd_DMA) {
1757 dd_sendDataToFwdGETS;
1758 da_sendDmaAckUnblock;
1762 transition(M, Fwd_GETX, I) {
1763 dd_sendDataToFwdGETX;
1764 rr_deallocateL2CacheBlock;
1768 // MAKE THIS THE SAME POLICY FOR NOW
1770 // transition(M, Fwd_GETS, O) {
1771 // dd_sendDataToFwdGETS;
1772 // m_popRequestQueue;
1775 transition(M, Fwd_GETS, I) {
1776 dd_sendExclusiveDataToFwdGETS;
1777 rr_deallocateL2CacheBlock;
1781 transition(M, Fwd_DMA) {
1782 dd_sendExclusiveDataToFwdGETS;
1783 da_sendDmaAckUnblock;
1787 transition({OLS, OLSX}, Fwd_GETX, OLSF) {
1794 transition(OLSF, IntAck) {
1795 m_decrementNumberOfMessagesInt;
1796 o_checkForIntCompletion;
1800 transition(OLSF, All_Acks, I) {
1801 c_sendDataFromTBEToFwdGETX;
1802 gg_clearLocalSharers;
1804 rr_deallocateL2CacheBlock;
1810 // INVALIDATIONS FROM GLOBAL DIRECTORY
1812 transition({IGM, IGS}, Inv) {
1818 transition({I,NP}, Inv) {
1826 // NEED INV for S state
1828 transition({ILS, ILO, ILX}, Inv, II) {
1832 gg_clearLocalSharers;
1836 transition(SLS, Inv, II) {
1840 rr_deallocateL2CacheBlock;
1844 transition(II, IntAck) {
1845 m_decrementNumberOfMessagesInt;
1846 o_checkForIntCompletion;
1850 transition(II, All_Acks, I) {
1856 transition(S, Inv, I) {
1861 rr_deallocateL2CacheBlock;
1866 // LOCAL REQUESTS SATISFIED LOCALLY
1868 transition(OLSX, L1_GETX, IFLOX) {
1871 // count number of INVs needed that doesn't include requestor
1872 h_countLocalSharersExceptRequestor;
1873 // issue INVs to everyone except requestor
1874 ee_issueLocalInvExceptL1Requestor;
1876 y_copyCacheStateToDir;
1878 rr_deallocateL2CacheBlock;
1880 o_popL1RequestQueue;
1883 transition(IFLOX, Exclusive_Unblock, ILX) {
1884 g_recordLocalExclusive;
1889 transition(OLSX, L1_GETS, OLSXS) {
1892 o_popL1RequestQueue;
1895 transition(OLSXS, Unblock, OLSX) {
1896 g_recordLocalSharer;
1900 // after this, can't get Fwd_GETX
1901 transition(IGMO, Own_GETX) {
1902 mm_decrementNumberOfMessagesExt;
1903 o_checkForExtCompletion;
1909 transition(ILX, L1_GETS, IFLOXX) {
1910 kk_forwardLocalGETSToLocalOwner;
1912 o_popL1RequestQueue;
1915 transition(ILOSX, L1_GETS, IFLOSX) {
1916 kk_forwardLocalGETSToLocalOwner;
1918 o_popL1RequestQueue;
1921 transition({ILOS, ILO}, L1_GETS, IFLO) {
1922 kk_forwardLocalGETSToLocalOwner;
1924 o_popL1RequestQueue;
1927 transition(ILS, L1_GETS, IFLS) {
1928 k_forwardLocalGETSToLocalSharer;
1930 o_popL1RequestQueue;
1933 transition({ILX, ILOX}, L1_GETX, IFLOXX) {
1934 kk_forwardLocalGETXToLocalExclusive;
1935 e_sendAckToL1Requestor;
1937 o_popL1RequestQueue;
1940 transition(ILOX, L1_GETS, IFLOX) {
1941 kk_forwardLocalGETSToLocalOwner;
1943 o_popL1RequestQueue;
1946 transition(IFLOX, Unblock, ILOSX) {
1947 g_recordLocalSharer;
1951 transition(IFLS, Unblock, ILS) {
1952 g_recordLocalSharer;
1956 transition(IFLOXX, Unblock, ILOSX) {
1957 g_recordLocalSharer;
1961 transition(IFLOSX, Unblock, ILOSX) {
1962 g_recordLocalSharer;
1966 transition({IFLOSX, IFLOXX}, Exclusive_Unblock, ILX) {
1967 g_recordLocalExclusive;
1971 transition(IFLO, Unblock, ILOS) {
1972 g_recordLocalSharer;
1977 transition(ILOSX, L1_GETX, IFLXO) {
1980 h_countLocalSharersExceptRequestor;
1981 ee_issueLocalInvExceptL1Requestor;
1982 k_forwardLocalGETXToLocalOwner;
1983 e_sendAckToL1RequestorFromTBE;
1985 o_popL1RequestQueue;
1988 transition(IFLXO, Exclusive_Unblock, ILX) {
1989 g_recordLocalExclusive;
1994 // LOCAL REQUESTS THAT MUST ISSUE
1996 transition(NP, {L1_PUTS, L1_PUTX, L1_PUTO}) {
1998 o_popL1RequestQueue;
2001 transition({NP, I}, L1_GETS, IGS) {
2006 o_popL1RequestQueue;
2009 transition({NP, I}, L1_GETX, IGM) {
2014 o_popL1RequestQueue;
2017 transition(S, L1_GETX, IGM) {
2021 y_copyCacheStateToDir;
2023 rr_deallocateL2CacheBlock;
2025 o_popL1RequestQueue;
2028 transition(ILS, L1_GETX, IGMLS) {
2032 // count number of INVs (just sharers?) needed that doesn't include requestor
2033 h_countLocalSharersExceptRequestor;
2035 o_popL1RequestQueue;
2038 transition(IGMLS, Inv) {
2044 transition(IGMLS, IntAck) {
2045 m_decrementNumberOfMessagesInt;
2046 o_checkForIntCompletion;
2050 transition(IGMLS, All_Acks, IGM) {
2051 gg_clearLocalSharers;
2057 // transition(IGMLS, ExtAck, IGMO) {
2058 transition(IGMLS, ExtAck) {
2059 m_decrementNumberOfMessagesExt;
2060 o_checkForExtCompletion;
2064 transition(IGMLS, {Data, Data_Exclusive}, IGMO) {
2065 ee_issueLocalInvExceptL1RequestorInTBE;
2067 m_decrementNumberOfMessagesExt;
2068 o_checkForExtCompletion;
2073 transition(ILOS, L1_GETX, IGMIO) {
2078 o_popL1RequestQueue;
2081 // new exclusive happened while sharer attempted writeback
2082 transition(ILX, {L1_PUTS, L1_PUTS_only, L1_PUTO}) {
2084 o_popL1RequestQueue;
2087 transition(S, L1_PUTS) {
2089 o_popL1RequestQueue;
2092 transition(OLS, L1_GETX, OGMIO) {
2096 h_countLocalSharersExceptRequestor;
2097 // COPY DATA FROM CACHE TO TBE (happens during i_allocateTBE)
2098 y_copyCacheStateToDir;
2099 rr_deallocateL2CacheBlock;
2101 o_popL1RequestQueue;
2104 transition(OGMIO, Fwd_GETS) {
2106 c_sendDataFromTBEToFwdGETS;
2110 transition(ILO, L1_GETX, IGMIO) {
2114 // the following, of course, returns 0 sharers but do anyways for consistency
2115 h_countLocalSharersExceptRequestor;
2117 o_popL1RequestQueue;
2120 transition({ILO, ILOX}, L1_PUTS) {
2122 o_popL1RequestQueue;
2125 transition(IGMIO, Fwd_GETX, IGMIOF) {
2127 j_forwardGlobalRequestToLocalOwner;
2128 ee_sendLocalInvSharersOnly;
2133 transition(IGMIO, Fwd_GETS, IGMIOFS) {
2135 j_forwardGlobalRequestToLocalOwner;
2139 transition(IGMIOFS, Data, IGMIO) {
2141 c_sendDataFromTBEToFwdGETS;
2145 transition(OGMIO, Fwd_GETX, OGMIOF) {
2147 ee_sendLocalInvSharersOnly;
2151 transition(OGMIOF, IntAck) {
2152 m_decrementNumberOfMessagesInt;
2153 o_checkForIntCompletion;
2157 transition(OGMIOF, All_Acks, IGM) {
2158 gg_clearLocalSharers;
2159 hh_countLocalSharersExceptL1GETXRequestorInTBE;
2160 c_sendDataFromTBEToFwdGETX;
2164 transition(IGMIOF, IntAck) {
2165 m_decrementNumberOfMessagesInt;
2166 o_checkForIntCompletion;
2170 transition(IGMIOF, Data_Exclusive) {
2172 m_decrementNumberOfMessagesInt;
2173 o_checkForIntCompletion;
2177 transition(IGMIOF, All_Acks, IGM) {
2178 gg_clearLocalSharers;
2179 c_sendDataFromTBEToFwdGETX;
2183 transition(IGMIO, All_Acks, IGMO) {
2184 hh_countLocalSharersExceptL1GETXRequestorInTBE;
2185 ee_issueLocalInvExceptL1RequestorInTBE;
2186 k_forwardLocalGETXToLocalOwner;
2187 e_sendAckToL1RequestorFromTBE;
2191 transition(OGMIO, All_Acks, IGMO) {
2192 ee_issueLocalInvExceptL1RequestorInTBE;
2193 c_sendDataFromTBEToL1GETX;
2197 transition({IGMIO, OGMIO}, Own_GETX) {
2198 mm_decrementNumberOfMessagesExt;
2199 o_checkForExtCompletion;
2204 transition(IGM, {Data, Data_Exclusive}, IGMO) {
2206 m_decrementNumberOfMessagesExt;
2207 o_checkForExtCompletion;
2211 transition({IGM, IGMIO, OGMIO}, ExtAck) {
2212 m_decrementNumberOfMessagesExt;
2213 o_checkForExtCompletion;
2217 transition(IGMO, ExtAck) {
2218 m_decrementNumberOfMessagesExt;
2219 o_checkForExtCompletion;
2223 transition(IGS, Data) {
2225 m_decrementNumberOfMessagesExt;
2226 c_sendDataFromTBEToL1GETS;
2230 transition(IGS, Data_Exclusive) {
2232 m_decrementNumberOfMessagesExt;
2233 c_sendExclusiveDataFromTBEToL1GETS;
2237 transition(IGS, Unblock, ILS) {
2238 g_recordLocalSharer;
2244 transition(IGS, Exclusive_Unblock, ILX) {
2245 g_recordLocalExclusive;
2246 f_sendExclusiveUnblock;
2251 transition(IGMO, All_Acks) {
2252 c_sendDataFromTBEToL1GETX;
2256 transition(IGMO, Exclusive_Unblock, ILX) {
2257 g_recordLocalExclusive;
2258 f_sendExclusiveUnblock;
2264 transition(SLS, L1_GETX, IGMLS) {
2268 // count number of INVs needed that doesn't include requestor
2269 h_countLocalSharersExceptRequestor;
2270 // issue INVs to everyone except requestor
2271 y_copyCacheStateToDir;
2272 rr_deallocateL2CacheBlock;
2274 o_popL1RequestQueue;
2278 transition(SLS, L1_GETS, SLSS ) {
2281 o_popL1RequestQueue;
2284 transition(SLSS, Unblock, SLS) {
2285 g_recordLocalSharer;
2290 transition(O, L1_GETX, IGMO) {
2294 y_copyCacheStateToDir;
2295 rr_deallocateL2CacheBlock;
2297 o_popL1RequestQueue;
2300 transition(OLS, L1_GETS, OLSS) {
2303 o_popL1RequestQueue;
2306 transition(OLSS, Unblock, OLS) {
2307 g_recordLocalSharer;
2311 transition(IGMO, Fwd_GETX, IGM) {
2313 c_sendDataFromTBEToFwdGETX;
2318 transition(IGMO, Fwd_GETS) {
2320 c_sendDataFromTBEToFwdGETS;
2325 // LOCAL REQUESTS SATISFIED DIRECTLY BY L2
2327 transition(M, L1_GETX, MM) {
2329 // should count 0 of course
2330 h_countLocalSharersExceptRequestor;
2332 y_copyCacheStateToDir;
2333 rr_deallocateL2CacheBlock;
2335 o_popL1RequestQueue;
2338 transition(MM, Exclusive_Unblock, ILX) {
2339 g_recordLocalExclusive;
2343 transition(M, L1_GETS, OO) {
2345 // should count 0 of course
2346 h_countLocalSharersExceptRequestor;
2350 o_popL1RequestQueue;
2353 transition(S, L1_GETS, SS) {
2356 o_popL1RequestQueue;
2359 transition(SS, Unblock, SLS) {
2360 g_recordLocalSharer;
2364 transition(O, L1_GETS, OO) {
2367 o_popL1RequestQueue;
2370 transition(OO, Unblock, OLS) {
2371 g_recordLocalSharer;
2375 transition(OO, Exclusive_Unblock, ILX) {
2376 g_recordLocalExclusive
2377 y_copyCacheStateToDir;
2378 rr_deallocateL2CacheBlock;
2384 transition(ILO, L1_PUTO, ILOW) {
2385 l_writebackAckNeedData;
2386 o_popL1RequestQueue;
2389 transition(ILOX, L1_PUTO, ILOXW) {
2390 l_writebackAckNeedData;
2391 o_popL1RequestQueue;
2395 transition(ILOS, L1_PUTO, ILOSW) {
2396 l_writebackAckNeedData;
2397 o_popL1RequestQueue;
2400 transition(ILOSX, L1_PUTO, ILOSXW) {
2401 l_writebackAckNeedData;
2402 o_popL1RequestQueue;
2406 // hmmm...keep data or drop. Just drop for now
2407 transition(ILOS, L1_PUTS_only, ILOW) {
2408 l_writebackAckDropData;
2409 o_popL1RequestQueue;
2412 transition(ILSW, Unblock, ILS) {
2413 gg_clearSharerFromL1Response;
2417 transition(ILOW, Unblock, ILO) {
2418 gg_clearSharerFromL1Response;
2422 transition(ILOSX, L1_PUTS_only, ILOXW) {
2423 l_writebackAckDropData;
2424 o_popL1RequestQueue;
2427 transition(ILOXW, Unblock, ILOX) {
2428 gg_clearSharerFromL1Response;
2432 // hmmm...keep data or drop. Just drop for now
2433 transition(ILOS, L1_PUTS, ILOSW) {
2434 l_writebackAckDropData;
2435 o_popL1RequestQueue;
2438 transition(ILOSX, L1_PUTS, ILOSXW) {
2439 l_writebackAckDropData;
2440 o_popL1RequestQueue;
2443 transition(ILOSW, Unblock, ILOS) {
2444 gg_clearSharerFromL1Response;
2448 transition(ILOSXW, Unblock, ILOSX) {
2449 gg_clearSharerFromL1Response;
2453 transition(SLS, L1_PUTS, SLSW) {
2454 l_writebackAckDropData;
2455 o_popL1RequestQueue;
2458 transition(SLS, L1_PUTS_only, SW) {
2459 l_writebackAckDropData;
2460 o_popL1RequestQueue;
2463 transition(SW, {Unblock}, S) {
2464 gg_clearSharerFromL1Response;
2468 transition(OLS, L1_PUTS, OLSW) {
2469 l_writebackAckDropData;
2470 o_popL1RequestQueue;
2473 transition(ILS, L1_PUTS, ILSW) {
2474 l_writebackAckNeedData;
2475 o_popL1RequestQueue;
2478 transition(ILS, L1_PUTS_only, IW) {
2479 l_writebackAckNeedData;
2480 o_popL1RequestQueue;
2483 transition(OLS, L1_PUTS_only, OW) {
2484 l_writebackAckDropData;
2485 o_popL1RequestQueue;
2488 transition(OLSX, L1_PUTS_only, OXW) {
2489 l_writebackAckDropData;
2490 o_popL1RequestQueue;
2493 transition(OLSX, L1_PUTS, OLSXW) {
2494 l_writebackAckDropData;
2495 o_popL1RequestQueue;
2498 transition(OLSXW, {Unblock}, OLSX) {
2499 gg_clearSharerFromL1Response;
2503 transition(OW, {Unblock}, O) {
2504 gg_clearSharerFromL1Response;
2508 transition(OXW, {Unblock}, M) {
2509 gg_clearSharerFromL1Response;
2513 transition(ILX, L1_PUTX, ILXW ) {
2514 l_writebackAckNeedData;
2515 o_popL1RequestQueue;
2518 transition(ILXW, L1_WBDIRTYDATA, M) {
2519 gg_clearLocalSharers;
2520 vv_allocateL2CacheBlock;
2521 y_copyDirToCacheAndRemove;
2527 transition(ILXW, L1_WBCLEANDATA, M) {
2528 gg_clearLocalSharers;
2529 vv_allocateL2CacheBlock;
2530 y_copyDirToCacheAndRemove;
2535 transition(ILXW, Unblock, ILX) {
2536 // writeback canceled because L1 invalidated
2540 transition(ILSW, L1_WBCLEANDATA, SLS) {
2541 vv_allocateL2CacheBlock;
2542 y_copyDirToCacheAndRemove;
2544 gg_clearSharerFromL1Response;
2548 transition(IW, L1_WBCLEANDATA, S) {
2549 vv_allocateL2CacheBlock;
2550 y_copyDirToCacheAndRemove;
2552 gg_clearSharerFromL1Response;
2557 // Owner can have dirty data
2558 transition(ILOW, {L1_WBCLEANDATA, L1_WBDIRTYDATA}, O) {
2559 vv_allocateL2CacheBlock;
2560 y_copyDirToCacheAndRemove;
2561 gg_clearOwnerFromL1Response;
2566 transition(ILOXW, L1_WBDIRTYDATA, M) {
2567 vv_allocateL2CacheBlock;
2568 y_copyDirToCacheAndRemove;
2569 gg_clearOwnerFromL1Response;
2574 transition(ILOXW, L1_WBCLEANDATA, M) {
2575 vv_allocateL2CacheBlock;
2576 y_copyDirToCacheAndRemove;
2577 gg_clearOwnerFromL1Response;
2582 transition(ILOSW, {L1_WBCLEANDATA, L1_WBDIRTYDATA}, OLS) {
2583 vv_allocateL2CacheBlock;
2584 y_copyDirToCacheAndRemove;
2585 gg_clearOwnerFromL1Response;
2590 transition(ILOSXW, {L1_WBCLEANDATA, L1_WBDIRTYDATA}, OLSX) {
2591 vv_allocateL2CacheBlock;
2592 y_copyDirToCacheAndRemove;
2593 gg_clearOwnerFromL1Response;
2599 transition(SLSW, {Unblock}, SLS) {
2600 gg_clearSharerFromL1Response;
2604 transition(OLSW, {Unblock}, OLS) {
2605 gg_clearSharerFromL1Response;
2611 transition({I, S}, L2_Replacement, I) {
2612 rr_deallocateL2CacheBlock;
2615 transition(ILS, L2_Replacement) {
2616 y_copyCacheStateToDir;
2617 rr_deallocateL2CacheBlock;
2620 transition(ILX, L2_Replacement ) {
2621 y_copyCacheStateToDir;
2622 rr_deallocateL2CacheBlock;
2625 transition({ILO, ILOS}, L2_Replacement ) {
2626 y_copyCacheStateToDir;
2627 rr_deallocateL2CacheBlock;
2630 transition(SLS, L2_Replacement, ILS) {
2631 y_copyCacheStateToDir;
2632 rr_deallocateL2CacheBlock;
2635 transition({OLS, OLSX}, L2_Replacement, OLSI) {
2636 y_copyCacheStateToDir;
2639 rr_deallocateL2CacheBlock;
2643 transition(O, L2_Replacement, OI) {
2646 rr_deallocateL2CacheBlock;
2649 transition(M, L2_Replacement, MI) {
2652 rr_deallocateL2CacheBlock;
2655 transition(OLSI, Fwd_GETX, ILSI) {
2661 transition(ILSI, IntAck) {
2662 m_decrementNumberOfMessagesInt;
2663 o_checkForIntCompletion;
2667 transition(ILSI, All_Acks, MII) {
2668 gg_clearLocalSharers;
2669 c_sendDataFromTBEToFwdGETX;
2673 transition(OLSI, Fwd_GETS) {
2675 c_sendDataFromTBEToFwdGETS;
2679 transition({MI, OI}, Fwd_GETS, OI) {
2681 c_sendDataFromTBEToFwdGETS;
2685 transition({MI, OI}, Fwd_DMA, OI) {
2686 cd_sendDataFromTBEToFwdDma;
2687 da_sendDmaAckUnblock;
2691 transition(OLSI, Fwd_DMA) {
2692 cd_sendDataFromTBEToFwdDma;
2693 da_sendDmaAckUnblock;
2697 transition({MI, OI}, Fwd_GETX, MII) {
2699 c_sendDataFromTBEToFwdGETX;
2703 transition({MI, OI}, Writeback_Ack, I) {
2704 qq_sendDataFromTBEToMemory;
2709 transition(MII, Writeback_Nack, I) {
2714 transition(OI, Writeback_Nack) {
2719 transition(OLSI, Writeback_Ack, ILS) {
2720 qq_sendDataFromTBEToMemory;
2725 transition(MII, Writeback_Ack, I) {
2731 transition(ILSI, Writeback_Ack, ILS) {