mem: Fix guest corruption when caches handle uncacheable accesses
[gem5.git] / src / mem / protocol / MOESI_CMP_directory-L2cache.sm
1
2 /*
3 * Copyright (c) 1999-2005 Mark D. Hill and David A. Wood
4 * All rights reserved.
5 *
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.
16 *
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.
28 */
29
30 /*
31 * $Id$
32 *
33 */
34
35 machine(L2Cache, "Token protocol")
36 : CacheMemory * L2cacheMemory,
37 int response_latency = 2,
38 int request_latency = 2
39 {
40
41 // L2 BANK QUEUES
42 // From local bank of L2 cache TO the network
43 MessageBuffer L1RequestFromL2Cache, network="To", virtual_network="0", ordered="false", vnet_type="request"; // this L2 bank -> a local L1
44 MessageBuffer GlobalRequestFromL2Cache, network="To", virtual_network="1", ordered="false", vnet_type="request"; // this L2 bank -> mod-directory
45 MessageBuffer responseFromL2Cache, network="To", virtual_network="2", ordered="false", vnet_type="response"; // this L2 bank -> a local L1 || mod-directory
46
47 // FROM the network to this local bank of L2 cache
48 MessageBuffer L1RequestToL2Cache, network="From", virtual_network="0", ordered="false", vnet_type="request"; // a local L1 -> this L2 bank, Lets try this???
49 MessageBuffer GlobalRequestToL2Cache, network="From", virtual_network="1", ordered="false", vnet_type="request"; // mod-directory -> this L2 bank
50 MessageBuffer responseToL2Cache, network="From", virtual_network="2", ordered="false", vnet_type="response"; // a local L1 || mod-directory -> this L2 bank
51 // MessageBuffer L1WritebackToL2Cache, network="From", virtual_network="3", ordered="false", vnet_type="writeback";
52
53 // STATES
54 state_declaration(State, desc="L2 Cache states", default="L2Cache_State_I") {
55
56 // Stable states
57 NP, AccessPermission:Invalid, desc="Not Present";
58 I, AccessPermission:Invalid, desc="Invalid";
59 ILS, AccessPermission:Invalid, desc="Idle/NP, but local sharers exist";
60 ILX, AccessPermission:Invalid, desc="Idle/NP, but local exclusive exists";
61 ILO, AccessPermission:Invalid, desc="Idle/NP, but local owner exists";
62 ILOX, AccessPermission:Invalid, desc="Idle/NP, but local owner exists and chip is exclusive";
63 ILOS, AccessPermission:Invalid, desc="Idle/NP, but local owner exists and local sharers as well";
64 ILOSX, AccessPermission:Invalid, desc="Idle/NP, but local owner exists, local sharers exist, chip is exclusive ";
65 S, AccessPermission:Read_Only, desc="Shared, no local sharers";
66 O, AccessPermission:Read_Only, desc="Owned, no local sharers";
67 OLS, AccessPermission:Read_Only, desc="Owned with local sharers";
68 OLSX, AccessPermission:Read_Only, desc="Owned with local sharers, chip is exclusive";
69 SLS, AccessPermission:Read_Only, desc="Shared with local sharers";
70 M, AccessPermission:Read_Write, desc="Modified";
71
72 // Transient States
73
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";
77 // UNUSED
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";
80
81 OLSF, AccessPermission:Busy, desc="Blocked, got Fwd_GETX with local sharers, waiting for local inv acks";
82
83 // writebacks
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";
97
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";
104
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";
114
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";
122
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";
128
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";
135 }
136
137 // EVENTS
138 enumeration(Event, desc="Cache events") {
139
140 // Requests
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";
152
153 // Responses
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";
161
162 Writeback_Ack, desc="Writeback O.K. from directory";
163 Writeback_Nack, desc="Writeback not O.K. from directory";
164
165 Unblock, desc="Local L1 is telling L2 dir to unblock";
166 Exclusive_Unblock, desc="Local L1 is telling L2 dir to unblock";
167
168 DmaAck, desc="DMA ack from local L1";
169 // events initiated by this L2
170 L2_Replacement, desc="L2 Replacement", format="!r";
171
172 }
173
174 // TYPES
175
176 // CacheEntry
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";
184 }
185
186
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";
192 }
193
194 // TBE fields
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)?";
201
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";
206
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";
211 }
212
213 structure(TBETable, external = "yes") {
214 TBE lookup(Address);
215 void allocate(Address);
216 void deallocate(Address);
217 bool isPresent(Address);
218 }
219
220 structure(PerfectCacheMemory, external = "yes") {
221 void allocate(Address);
222 void deallocate(Address);
223 DirEntry lookup(Address);
224 bool isTagPresent(Address);
225 }
226
227 TBETable TBEs, template="<L2Cache_TBE>", constructor="m_number_of_TBEs";
228 PerfectCacheMemory localDirectory, template="<L2Cache_DirEntry>";
229
230 void set_cache_entry(AbstractCacheEntry b);
231 void unset_cache_entry();
232 void set_tbe(TBE b);
233 void unset_tbe();
234
235 Entry getCacheEntry(Address address), return_by_pointer="yes" {
236 return static_cast(Entry, "pointer", L2cacheMemory[address]);
237 }
238
239 bool isDirTagPresent(Address addr) {
240 return (localDirectory.isTagPresent(addr) );
241 }
242
243 bool isOnlySharer(Entry cache_entry, Address addr, MachineID shar_id) {
244 if (is_valid(cache_entry)) {
245 assert (localDirectory.isTagPresent(addr) == false);
246 if (cache_entry.Sharers.count() > 1) {
247 return false;
248 }
249 else if (cache_entry.Sharers.count() == 1) {
250 if (cache_entry.Sharers.isElement(shar_id)) {
251 return true;
252 }
253 else {
254 return false; // something happened which should cause this PUTS to be nacked
255 }
256 return true;
257 }
258 else {
259 return false;
260 }
261 }
262 else if (localDirectory.isTagPresent(addr)){
263 if (localDirectory[addr].Sharers.count() > 1) {
264 return false;
265 }
266 else if (localDirectory[addr].Sharers.count() == 1) {
267 if (localDirectory[addr].Sharers.isElement(shar_id)) {
268 return true;
269 }
270 else {
271 return false; // something happened which should cause this PUTS to be nacked
272 }
273 }
274 else {
275 return false;
276 }
277 }
278 else {
279 // shouldn't happen unless L1 issues PUTS before unblock received
280 return false;
281 }
282 }
283
284 void copyCacheStateToDir(Entry cache_entry, Address addr) {
285 assert(localDirectory.isTagPresent(addr) == false);
286 assert(is_valid(cache_entry));
287 localDirectory.allocate(addr);
288 localDirectory[addr].DirState := cache_entry.CacheState;
289 localDirectory[addr].Sharers := cache_entry.Sharers;
290 localDirectory[addr].Owner := cache_entry.Owner;
291 localDirectory[addr].OwnerValid := cache_entry.OwnerValid;
292
293 }
294
295 void copyDirToCache(Entry cache_entry, Address addr) {
296 assert(is_valid(cache_entry));
297 cache_entry.Sharers := localDirectory[addr].Sharers;
298 cache_entry.Owner := localDirectory[addr].Owner;
299 cache_entry.OwnerValid := localDirectory[addr].OwnerValid;
300 }
301
302
303 void recordLocalSharerInDir(Entry cache_entry, Address addr, MachineID shar_id) {
304 if (is_valid(cache_entry)) {
305 assert (localDirectory.isTagPresent(addr) == false);
306 cache_entry.Sharers.add(shar_id);
307 }
308 else {
309 if (localDirectory.isTagPresent(addr) == false) {
310 localDirectory.allocate(addr);
311 localDirectory[addr].Sharers.clear();
312 localDirectory[addr].OwnerValid := false;
313 }
314 localDirectory[addr].Sharers.add(shar_id);
315 }
316 }
317
318 void recordNewLocalExclusiveInDir(Entry cache_entry, Address addr, MachineID exc_id) {
319
320 if (is_valid(cache_entry)) {
321 assert (localDirectory.isTagPresent(addr) == false);
322 cache_entry.Sharers.clear();
323 cache_entry.OwnerValid := true;
324 cache_entry.Owner := exc_id;
325 }
326 else {
327 if (localDirectory.isTagPresent(addr) == false) {
328 localDirectory.allocate(addr);
329 }
330 localDirectory[addr].Sharers.clear();
331 localDirectory[addr].OwnerValid := true;
332 localDirectory[addr].Owner := exc_id;
333 }
334 }
335
336 void removeAllLocalSharersFromDir(Entry cache_entry, Address addr) {
337 if (is_valid(cache_entry)) {
338 assert (localDirectory.isTagPresent(addr) == false);
339 cache_entry.Sharers.clear();
340 cache_entry.OwnerValid := false;
341 }
342 else {
343 localDirectory[addr].Sharers.clear();
344 localDirectory[addr].OwnerValid := false;
345 }
346 }
347
348 void removeSharerFromDir(Entry cache_entry, Address addr, MachineID sender) {
349 if (is_valid(cache_entry)) {
350 assert (localDirectory.isTagPresent(addr) == false);
351 cache_entry.Sharers.remove(sender);
352 }
353 else {
354 localDirectory[addr].Sharers.remove(sender);
355 }
356 }
357
358 void removeOwnerFromDir(Entry cache_entry, Address addr, MachineID sender) {
359 if (is_valid(cache_entry)) {
360 assert (localDirectory.isTagPresent(addr) == false);
361 cache_entry.OwnerValid := false;
362 }
363 else {
364 localDirectory[addr].OwnerValid := false;
365 }
366 }
367
368 bool isLocalSharer(Entry cache_entry, Address addr, MachineID shar_id) {
369 if (is_valid(cache_entry)) {
370 assert (localDirectory.isTagPresent(addr) == false);
371 return cache_entry.Sharers.isElement(shar_id);
372 }
373 else {
374 return localDirectory[addr].Sharers.isElement(shar_id);
375 }
376 }
377
378 NetDest getLocalSharers(Entry cache_entry, Address addr) {
379 if (is_valid(cache_entry)) {
380 assert (localDirectory.isTagPresent(addr) == false);
381 return cache_entry.Sharers;
382 }
383 else {
384 return localDirectory[addr].Sharers;
385 }
386 }
387
388 MachineID getLocalOwner(Entry cache_entry, Address addr) {
389 if (is_valid(cache_entry)) {
390 assert (localDirectory.isTagPresent(addr) == false);
391 return cache_entry.Owner;
392 }
393 else {
394 return localDirectory[addr].Owner;
395 }
396 }
397
398 int countLocalSharers(Entry cache_entry, Address addr) {
399 if (is_valid(cache_entry)) {
400 assert (localDirectory.isTagPresent(addr) == false);
401 return cache_entry.Sharers.count();
402 }
403 else {
404 return localDirectory[addr].Sharers.count();
405 }
406 }
407
408 bool isLocalOwnerValid(Entry cache_entry, Address addr) {
409 if (is_valid(cache_entry)) {
410 assert (localDirectory.isTagPresent(addr) == false);
411 return cache_entry.OwnerValid;
412 }
413 else {
414 return localDirectory[addr].OwnerValid;
415 }
416 }
417
418 int countLocalSharersExceptRequestor(Entry cache_entry, Address addr, MachineID requestor) {
419 if (is_valid(cache_entry)) {
420 assert (localDirectory.isTagPresent(addr) == false);
421 if (cache_entry.Sharers.isElement(requestor)) {
422 return ( cache_entry.Sharers.count() - 1 );
423 }
424 else {
425 return cache_entry.Sharers.count();
426 }
427 }
428 else {
429 if (localDirectory[addr].Sharers.isElement(requestor)) {
430 return ( localDirectory[addr].Sharers.count() - 1 );
431 }
432 else {
433 return localDirectory[addr].Sharers.count();
434 }
435 }
436 }
437
438 State getState(TBE tbe, Entry cache_entry, Address addr) {
439
440 if (is_valid(tbe)) {
441 return tbe.TBEState;
442 } else if (is_valid(cache_entry)) {
443 return cache_entry.CacheState;
444 } else if (isDirTagPresent(addr)) {
445 return localDirectory[addr].DirState;
446 } else {
447 return State:NP;
448 }
449 }
450
451 std::string getCoherenceRequestTypeStr(CoherenceRequestType type) {
452 return CoherenceRequestType_to_string(type);
453 }
454
455 void setState(TBE tbe, Entry cache_entry, Address addr, State state) {
456 assert((localDirectory.isTagPresent(addr) && L2cacheMemory.isTagPresent(addr)) == false);
457
458 if (is_valid(tbe)) {
459 tbe.TBEState := state;
460 }
461
462 if (
463 (state == State:M) ||
464 (state == State:O) ||
465 (state == State:S) ||
466 (state == State:OLS) ||
467 (state == State:SLS) ||
468 (state == State:OLSX) ||
469 (state == State:SLS)
470 ) {
471 assert(is_valid(cache_entry));
472 }
473 else if (
474 (state == State:ILS) ||
475 (state == State:ILX) ||
476 (state == State:ILO) ||
477 (state == State:ILOX) ||
478 (state == State:ILOS) ||
479 (state == State:ILOSX)
480 ) {
481 // assert(isCacheTagPresent(addr) == false);
482 }
483
484 if (is_valid(cache_entry)) {
485 if ( ((cache_entry.CacheState != State:M) && (state == State:M)) ||
486 ((cache_entry.CacheState != State:S) && (state == State:S)) ||
487 ((cache_entry.CacheState != State:O) && (state == State:O)) ) {
488 cache_entry.CacheState := state;
489 // disable Coherence Checker for now
490 // sequencer.checkCoherence(addr);
491 }
492 else {
493 cache_entry.CacheState := state;
494 }
495 }
496 else if (localDirectory.isTagPresent(addr)) {
497 localDirectory[addr].DirState := state;
498 }
499 }
500
501 AccessPermission getAccessPermission(Address addr) {
502 TBE tbe := TBEs[addr];
503 if(is_valid(tbe)) {
504 DPRINTF(RubySlicc, "%s\n", L2Cache_State_to_permission(tbe.TBEState));
505 return L2Cache_State_to_permission(tbe.TBEState);
506 }
507
508 Entry cache_entry := getCacheEntry(addr);
509 if(is_valid(cache_entry)) {
510 DPRINTF(RubySlicc, "%s\n", L2Cache_State_to_permission(cache_entry.CacheState));
511 return L2Cache_State_to_permission(cache_entry.CacheState);
512 }
513
514 DPRINTF(RubySlicc, "AccessPermission_NotPresent\n");
515 return AccessPermission:NotPresent;
516 }
517
518 void setAccessPermission(Entry cache_entry, Address addr, State state) {
519 if (is_valid(cache_entry)) {
520 cache_entry.changePermission(L2Cache_State_to_permission(state));
521 }
522 }
523
524 DataBlock getDataBlock(Address addr), return_by_ref="yes" {
525 TBE tbe := TBEs[addr];
526 if(is_valid(tbe)) {
527 return tbe.DataBlk;
528 }
529
530 return getCacheEntry(addr).DataBlk;
531 }
532
533 MessageBuffer triggerQueue, ordered="true";
534
535 out_port(globalRequestNetwork_out, RequestMsg, GlobalRequestFromL2Cache);
536 out_port(localRequestNetwork_out, RequestMsg, L1RequestFromL2Cache);
537 out_port(responseNetwork_out, ResponseMsg, responseFromL2Cache);
538
539 out_port(triggerQueue_out, TriggerMsg, triggerQueue);
540
541
542 // ** IN_PORTS **
543
544 // Trigger Queue
545 in_port(triggerQueue_in, TriggerMsg, triggerQueue) {
546 if (triggerQueue_in.isReady()) {
547 peek(triggerQueue_in, TriggerMsg) {
548 if (in_msg.Type == TriggerType:ALL_ACKS) {
549 trigger(Event:All_Acks, in_msg.Address,
550 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
551 } else {
552 error("Unexpected message");
553 }
554 }
555 }
556 }
557
558
559 // Request Network
560 in_port(requestNetwork_in, RequestMsg, GlobalRequestToL2Cache) {
561 if (requestNetwork_in.isReady()) {
562 peek(requestNetwork_in, RequestMsg) {
563 if (in_msg.Type == CoherenceRequestType:GETX || in_msg.Type == CoherenceRequestType:DMA_WRITE) {
564 if (in_msg.Requestor == machineID) {
565 trigger(Event:Own_GETX, in_msg.Address,
566 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
567 } else {
568 trigger(Event:Fwd_GETX, in_msg.Address,
569 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
570 }
571 } else if (in_msg.Type == CoherenceRequestType:GETS) {
572 trigger(Event:Fwd_GETS, in_msg.Address,
573 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
574 } else if(in_msg.Type == CoherenceRequestType:DMA_READ) {
575 trigger(Event:Fwd_DMA, in_msg.Address,
576 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
577 } else if (in_msg.Type == CoherenceRequestType:INV) {
578 trigger(Event:Inv, in_msg.Address,
579 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
580 } else if (in_msg.Type == CoherenceRequestType:WB_ACK) {
581 trigger(Event:Writeback_Ack, in_msg.Address,
582 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
583 } else if (in_msg.Type == CoherenceRequestType:WB_NACK) {
584 trigger(Event:Writeback_Nack, in_msg.Address,
585 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
586 } else {
587 error("Unexpected message");
588 }
589 }
590 }
591 }
592
593 in_port(L1requestNetwork_in, RequestMsg, L1RequestToL2Cache) {
594 if (L1requestNetwork_in.isReady()) {
595 peek(L1requestNetwork_in, RequestMsg) {
596 assert(in_msg.Destination.isElement(machineID));
597 if (in_msg.Type == CoherenceRequestType:GETX) {
598 trigger(Event:L1_GETX, in_msg.Address,
599 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
600 } else if (in_msg.Type == CoherenceRequestType:GETS) {
601 trigger(Event:L1_GETS, in_msg.Address,
602 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
603 } else if (in_msg.Type == CoherenceRequestType:PUTO) {
604 trigger(Event:L1_PUTO, in_msg.Address,
605 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
606 } else if (in_msg.Type == CoherenceRequestType:PUTX) {
607 trigger(Event:L1_PUTX, in_msg.Address,
608 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
609 } else if (in_msg.Type == CoherenceRequestType:PUTS) {
610 Entry cache_entry := getCacheEntry(in_msg.Address);
611 if (isOnlySharer(cache_entry, in_msg.Address, in_msg.Requestor)) {
612 trigger(Event:L1_PUTS_only, in_msg.Address,
613 cache_entry, TBEs[in_msg.Address]);
614 }
615 else {
616 trigger(Event:L1_PUTS, in_msg.Address,
617 cache_entry, TBEs[in_msg.Address]);
618 }
619 } else {
620 error("Unexpected message");
621 }
622 }
623 }
624 }
625
626
627 // Response Network
628 in_port(responseNetwork_in, ResponseMsg, responseToL2Cache) {
629 if (responseNetwork_in.isReady()) {
630 peek(responseNetwork_in, ResponseMsg) {
631 assert(in_msg.Destination.isElement(machineID));
632 if (in_msg.Type == CoherenceResponseType:ACK) {
633 if (in_msg.SenderMachine == MachineType:L2Cache) {
634 trigger(Event:ExtAck, in_msg.Address,
635 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
636 }
637 else {
638 trigger(Event:IntAck, in_msg.Address,
639 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
640 }
641 } else if (in_msg.Type == CoherenceResponseType:DATA) {
642 trigger(Event:Data, in_msg.Address,
643 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
644 } else if (in_msg.Type == CoherenceResponseType:DATA_EXCLUSIVE) {
645 trigger(Event:Data_Exclusive, in_msg.Address,
646 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
647 } else if (in_msg.Type == CoherenceResponseType:UNBLOCK) {
648 trigger(Event:Unblock, in_msg.Address,
649 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
650 } else if (in_msg.Type == CoherenceResponseType:UNBLOCK_EXCLUSIVE) {
651 trigger(Event:Exclusive_Unblock, in_msg.Address,
652 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
653 } else if (in_msg.Type == CoherenceResponseType:WRITEBACK_DIRTY_DATA) {
654 Entry cache_entry := getCacheEntry(in_msg.Address);
655 if (is_invalid(cache_entry) &&
656 L2cacheMemory.cacheAvail(in_msg.Address) == false) {
657 trigger(Event:L2_Replacement, L2cacheMemory.cacheProbe(in_msg.Address),
658 getCacheEntry(L2cacheMemory.cacheProbe(in_msg.Address)),
659 TBEs[L2cacheMemory.cacheProbe(in_msg.Address)]);
660 }
661 else {
662 trigger(Event:L1_WBDIRTYDATA, in_msg.Address,
663 cache_entry, TBEs[in_msg.Address]);
664 }
665 } else if (in_msg.Type == CoherenceResponseType:WRITEBACK_CLEAN_DATA) {
666 Entry cache_entry := getCacheEntry(in_msg.Address);
667 if (is_invalid(cache_entry) &&
668 L2cacheMemory.cacheAvail(in_msg.Address) == false) {
669 trigger(Event:L2_Replacement, L2cacheMemory.cacheProbe(in_msg.Address),
670 getCacheEntry(L2cacheMemory.cacheProbe(in_msg.Address)),
671 TBEs[L2cacheMemory.cacheProbe(in_msg.Address)]);
672 }
673 else {
674 trigger(Event:L1_WBCLEANDATA, in_msg.Address,
675 cache_entry, TBEs[in_msg.Address]);
676 }
677 } else if (in_msg.Type == CoherenceResponseType:DMA_ACK) {
678 trigger(Event:DmaAck, in_msg.Address,
679 getCacheEntry(in_msg.Address), TBEs[in_msg.Address]);
680 } else {
681 error("Unexpected message");
682 }
683 }
684 }
685 }
686
687
688 // ACTIONS
689
690 action(a_issueGETS, "a", desc="issue local request globally") {
691 peek(L1requestNetwork_in, RequestMsg) {
692 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
693 out_msg.Address := address;
694 out_msg.Type := CoherenceRequestType:GETS;
695 out_msg.RequestorMachine := MachineType:L2Cache;
696 out_msg.Requestor := machineID;
697 out_msg.Destination.add(map_Address_to_Directory(address));
698 out_msg.MessageSize := MessageSizeType:Request_Control;
699 }
700 }
701 }
702
703 action(a_issueGETX, "\a", desc="issue local request globally") {
704 peek(L1requestNetwork_in, RequestMsg) {
705 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
706 out_msg.Address := address;
707 out_msg.Type := CoherenceRequestType:GETX;
708 out_msg.RequestorMachine := MachineType:L2Cache;
709 out_msg.Requestor := machineID;
710 out_msg.Destination.add(map_Address_to_Directory(address));
711 out_msg.MessageSize := MessageSizeType:Request_Control;
712 }
713 }
714 }
715
716 action(b_issuePUTX, "b", desc="Issue PUTX") {
717 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
718 out_msg.Address := address;
719 out_msg.Type := CoherenceRequestType:PUTX;
720 out_msg.RequestorMachine := MachineType:L2Cache;
721 out_msg.Requestor := machineID;
722 out_msg.Destination.add(map_Address_to_Directory(address));
723 out_msg.MessageSize := MessageSizeType:Writeback_Control;
724 }
725 }
726
727 action(b_issuePUTO, "\b", desc="Issue PUTO") {
728 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
729 out_msg.Address := address;
730 out_msg.Type := CoherenceRequestType:PUTO;
731 out_msg.Requestor := machineID;
732 out_msg.RequestorMachine := MachineType:L2Cache;
733 out_msg.Destination.add(map_Address_to_Directory(address));
734 out_msg.MessageSize := MessageSizeType:Writeback_Control;
735 }
736 }
737
738 /* PUTO, but local sharers exist */
739 action(b_issuePUTO_ls, "\bb", desc="Issue PUTO") {
740 enqueue(globalRequestNetwork_out, RequestMsg, latency=request_latency) {
741 out_msg.Address := address;
742 out_msg.Type := CoherenceRequestType:PUTO_SHARERS;
743 out_msg.Requestor := machineID;
744 out_msg.RequestorMachine := MachineType:L2Cache;
745 out_msg.Destination.add(map_Address_to_Directory(address));
746 out_msg.MessageSize := MessageSizeType:Writeback_Control;
747 }
748 }
749
750 action(c_sendDataFromTBEToL1GETS, "c", desc="Send data from TBE to L1 requestors in TBE") {
751 assert(is_valid(tbe));
752 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
753 out_msg.Address := address;
754 out_msg.Type := CoherenceResponseType:DATA;
755 out_msg.Sender := machineID;
756 out_msg.Destination.addNetDest(tbe.L1_GetS_IDs);
757 out_msg.DataBlk := tbe.DataBlk;
758 // out_msg.Dirty := tbe.Dirty;
759 // shared data should be clean
760 out_msg.Dirty := false;
761 out_msg.MessageSize := MessageSizeType:Response_Data;
762 }
763 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
764 address, tbe.DataBlk);
765 }
766
767 action(c_sendDataFromTBEToL1GETX, "\c", desc="Send data from TBE to L1 requestors in TBE") {
768 assert(is_valid(tbe));
769 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
770 out_msg.Address := address;
771 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
772 out_msg.Sender := machineID;
773 out_msg.SenderMachine := MachineType:L2Cache;
774 out_msg.Destination.add(tbe.L1_GetX_ID);
775 out_msg.DataBlk := tbe.DataBlk;
776 out_msg.Dirty := tbe.Dirty;
777 out_msg.Acks := tbe.Local_GETX_IntAcks;
778 out_msg.MessageSize := MessageSizeType:Response_Data;
779 }
780 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
781 address, tbe.DataBlk);
782 }
783
784 action(c_sendExclusiveDataFromTBEToL1GETS, "\cc", desc="Send data from TBE to L1 requestors in TBE") {
785 assert(is_valid(tbe));
786 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
787 out_msg.Address := address;
788 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
789 out_msg.Sender := machineID;
790 out_msg.SenderMachine := MachineType:L2Cache;
791 out_msg.Destination.addNetDest(tbe.L1_GetS_IDs);
792 out_msg.DataBlk := tbe.DataBlk;
793 out_msg.Dirty := tbe.Dirty;
794 out_msg.MessageSize := MessageSizeType:Response_Data;
795 }
796 }
797
798 action(c_sendDataFromTBEToFwdGETX, "cc", desc="Send data from TBE to external GETX") {
799 assert(is_valid(tbe));
800 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
801 out_msg.Address := address;
802 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
803 out_msg.Sender := machineID;
804 out_msg.SenderMachine := MachineType:L2Cache;
805 out_msg.Destination.add(tbe.Fwd_GetX_ID);
806 out_msg.DataBlk := tbe.DataBlk;
807 out_msg.Dirty := tbe.Dirty;
808 out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
809 out_msg.MessageSize := MessageSizeType:Response_Data;
810 }
811 }
812
813 action(cd_sendDataFromTBEToFwdDma, "cd", desc="Send data from TBE to external GETX") {
814 assert(is_valid(tbe));
815 peek(requestNetwork_in, RequestMsg) {
816 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
817 out_msg.Address := address;
818 out_msg.Type := CoherenceResponseType:DATA;
819 out_msg.Sender := machineID;
820 out_msg.Destination.add(in_msg.Requestor);
821 out_msg.DataBlk := tbe.DataBlk;
822 // out_msg.Dirty := tbe.Dirty;
823 // shared data should be clean
824 out_msg.Dirty := false;
825 out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
826 out_msg.MessageSize := MessageSizeType:Response_Data;
827 }
828 }
829 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
830 address, tbe.DataBlk);
831 }
832
833 action(c_sendDataFromTBEToFwdGETS, "ccc", desc="Send data from TBE to external GETX") {
834 assert(is_valid(tbe));
835 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
836 out_msg.Address := address;
837 out_msg.Type := CoherenceResponseType:DATA;
838 out_msg.Sender := machineID;
839 out_msg.Destination.addNetDest(tbe.Fwd_GetS_IDs);
840 out_msg.DataBlk := tbe.DataBlk;
841 // out_msg.Dirty := tbe.Dirty;
842 // shared data should be clean
843 out_msg.Dirty := false;
844 out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
845 out_msg.MessageSize := MessageSizeType:Response_Data;
846 }
847 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
848 address, tbe.DataBlk);
849 }
850
851 action(c_sendExclusiveDataFromTBEToFwdGETS, "\ccc", desc="Send data from TBE to external GETX") {
852 assert(is_valid(tbe));
853 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
854 out_msg.Address := address;
855 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
856 out_msg.Sender := machineID;
857 out_msg.SenderMachine := MachineType:L2Cache;
858 out_msg.Destination.addNetDest(tbe.Fwd_GetS_IDs);
859 out_msg.DataBlk := tbe.DataBlk;
860 out_msg.Dirty := tbe.Dirty;
861 out_msg.Acks := tbe.Fwd_GETX_ExtAcks;
862 out_msg.MessageSize := MessageSizeType:Response_Data;
863 }
864 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
865 address, tbe.DataBlk);
866 }
867
868 action(d_sendDataToL1GETS, "d", desc="Send data directly to L1 requestor") {
869 assert(is_valid(cache_entry));
870 peek(L1requestNetwork_in, RequestMsg) {
871 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
872 out_msg.Address := address;
873 out_msg.Type := CoherenceResponseType:DATA;
874 out_msg.Sender := machineID;
875 out_msg.Destination.add(in_msg.Requestor);
876 out_msg.DataBlk := cache_entry.DataBlk;
877 // out_msg.Dirty := cache_entry.Dirty;
878 // shared data should be clean
879 out_msg.Dirty := false;
880 out_msg.MessageSize := MessageSizeType:ResponseL2hit_Data;
881 }
882 }
883 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
884 address, cache_entry.DataBlk);
885 }
886
887 action(d_sendDataToL1GETX, "\d", desc="Send data and a token from TBE to L1 requestor") {
888 assert(is_valid(cache_entry));
889 peek(L1requestNetwork_in, RequestMsg) {
890 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
891 assert(is_valid(tbe));
892 out_msg.Address := address;
893 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
894 out_msg.Sender := machineID;
895 out_msg.SenderMachine := MachineType:L2Cache;
896 out_msg.Destination.add(in_msg.Requestor);
897 out_msg.DataBlk := cache_entry.DataBlk;
898 out_msg.Dirty := cache_entry.Dirty;
899 out_msg.MessageSize := MessageSizeType:ResponseL2hit_Data;
900 out_msg.Acks := tbe.Local_GETX_IntAcks;
901 }
902 }
903 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
904 address, cache_entry.DataBlk);
905 }
906
907 action(dd_sendDataToFwdGETX, "dd", desc="send data") {
908 assert(is_valid(cache_entry));
909 peek(requestNetwork_in, RequestMsg) {
910 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
911 out_msg.Address := address;
912 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
913 out_msg.Sender := machineID;
914 out_msg.SenderMachine := MachineType:L2Cache;
915 out_msg.Destination.add(in_msg.Requestor);
916 out_msg.DataBlk := cache_entry.DataBlk;
917 out_msg.Dirty := cache_entry.Dirty;
918 out_msg.MessageSize := MessageSizeType:Response_Data;
919 out_msg.Acks := in_msg.Acks;
920 }
921 }
922 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
923 address, cache_entry.DataBlk);
924 }
925
926
927 action(dd_sendDataToFwdGETS, "\dd", desc="send data") {
928 assert(is_valid(cache_entry));
929 peek(requestNetwork_in, RequestMsg) {
930 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
931 out_msg.Address := address;
932 out_msg.Type := CoherenceResponseType:DATA;
933 out_msg.Sender := machineID;
934 out_msg.Destination.add(in_msg.Requestor);
935 out_msg.DataBlk := cache_entry.DataBlk;
936 // out_msg.Dirty := cache_entry.Dirty;
937 // shared data should be clean
938 out_msg.Dirty := false;
939 out_msg.MessageSize := MessageSizeType:Response_Data;
940 }
941 }
942 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
943 address, cache_entry.DataBlk);
944 }
945
946 action(dd_sendExclusiveDataToFwdGETS, "\d\d", desc="send data") {
947 assert(is_valid(cache_entry));
948 peek(requestNetwork_in, RequestMsg) {
949 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
950 out_msg.Address := address;
951 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
952 out_msg.Sender := machineID;
953 out_msg.Destination.add(in_msg.Requestor);
954 out_msg.DataBlk := cache_entry.DataBlk;
955 out_msg.Dirty := cache_entry.Dirty;
956 out_msg.MessageSize := MessageSizeType:Response_Data;
957 }
958 }
959 }
960
961 action(e_sendAck, "e", desc="Send ack with the tokens we've collected thus far.") {
962 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
963 assert(is_valid(tbe));
964 out_msg.Address := address;
965 out_msg.Type := CoherenceResponseType:ACK;
966 out_msg.Sender := machineID;
967 out_msg.SenderMachine := MachineType:L2Cache;
968
969 out_msg.Destination.add( tbe.Fwd_GetX_ID);
970 out_msg.Acks := 0 - 1;
971 out_msg.MessageSize := MessageSizeType:Response_Control;
972 }
973 }
974
975 action(e_sendAckToL1Requestor, "\e", desc="Send ack with the tokens we've collected thus far.") {
976 peek(L1requestNetwork_in, RequestMsg) {
977 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
978 out_msg.Address := address;
979 out_msg.Type := CoherenceResponseType:ACK;
980 out_msg.Sender := machineID;
981 out_msg.SenderMachine := MachineType:L2Cache;
982 out_msg.Destination.add(in_msg.Requestor);
983 out_msg.Acks := 0 - 1;
984 out_msg.MessageSize := MessageSizeType:Response_Control;
985 }
986 }
987 }
988
989 action(e_sendAckToL1RequestorFromTBE, "eee", desc="Send ack with the tokens we've collected thus far.") {
990 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
991 assert(is_valid(tbe));
992 out_msg.Address := address;
993 out_msg.Type := CoherenceResponseType:ACK;
994 out_msg.Sender := machineID;
995 out_msg.SenderMachine := MachineType:L2Cache;
996 out_msg.Destination.add(tbe.L1_GetX_ID);
997 out_msg.Acks := 0 - 1;
998 out_msg.MessageSize := MessageSizeType:Response_Control;
999 }
1000 }
1001
1002 action(ee_sendLocalInv, "\ee", desc="Send local invalidates") {
1003 assert(is_valid(tbe));
1004 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
1005 DPRINTF(RubySlicc, "Address: %s, Local Sharers: %s, Pending Acks: %d\n",
1006 address, getLocalSharers(cache_entry, address),
1007 tbe.NumIntPendingAcks);
1008 if (isLocalOwnerValid(cache_entry, address)) {
1009 tbe.NumIntPendingAcks := tbe.NumIntPendingAcks + 1;
1010 DPRINTF(RubySlicc, "%s\n", getLocalOwner(cache_entry, address));
1011 }
1012
1013 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1014 out_msg.Address := address;
1015 out_msg.Type := CoherenceRequestType:INV;
1016 out_msg.Requestor := machineID;
1017 out_msg.RequestorMachine := MachineType:L2Cache;
1018 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
1019 if (isLocalOwnerValid(cache_entry, address))
1020 {
1021 out_msg.Destination.add(getLocalOwner(cache_entry, address));
1022 }
1023 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
1024 }
1025 }
1026
1027 action(ee_sendLocalInvSharersOnly, "\eee", desc="Send local invalidates to sharers if they exist") {
1028
1029 // assert(countLocalSharers(address) > 0);
1030 assert(is_valid(tbe));
1031 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
1032
1033 if (countLocalSharers(cache_entry, address) > 0) {
1034 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1035 out_msg.Address := address;
1036 out_msg.Type := CoherenceRequestType:INV;
1037 out_msg.Requestor := machineID;
1038 out_msg.RequestorMachine := MachineType:L2Cache;
1039 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
1040 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
1041 }
1042 }
1043 }
1044
1045 action(ee_addLocalIntAck, "e\ee", desc="add a local ack to wait for") {
1046 assert(is_valid(tbe));
1047 tbe.NumIntPendingAcks := tbe.NumIntPendingAcks + 1;
1048 }
1049
1050 action(ee_issueLocalInvExceptL1Requestor, "\eeee", desc="Send local invalidates to sharers if they exist") {
1051 peek(L1requestNetwork_in, RequestMsg) {
1052
1053 // assert(countLocalSharers(address) > 0);
1054 if (countLocalSharers(cache_entry, address) == 0) {
1055 tbe.NumIntPendingAcks := 0;
1056 }
1057 else {
1058
1059 if (isLocalSharer(cache_entry, address, in_msg.Requestor)) {
1060 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address) - 1;
1061 }
1062 else {
1063 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
1064 }
1065
1066 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1067 out_msg.Address := address;
1068 out_msg.Type := CoherenceRequestType:INV;
1069 out_msg.Requestor := in_msg.Requestor;
1070 out_msg.RequestorMachine := MachineType:L1Cache;
1071 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
1072 out_msg.Destination.remove(in_msg.Requestor);
1073 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
1074 }
1075 }
1076 }
1077 }
1078
1079 action(ee_issueLocalInvExceptL1RequestorInTBE, "\eeeeee", desc="Send local invalidates to sharers if they exist") {
1080 assert(is_valid(tbe));
1081 if (countLocalSharers(cache_entry, address) == 0) {
1082 tbe.NumIntPendingAcks := 0;
1083 }
1084 else {
1085 if (isLocalSharer(cache_entry, address, tbe.L1_GetX_ID)) {
1086 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address) - 1;
1087 }
1088 else {
1089 tbe.NumIntPendingAcks := countLocalSharers(cache_entry, address);
1090 }
1091 }
1092 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1093 out_msg.Address := address;
1094 out_msg.Type := CoherenceRequestType:INV;
1095 out_msg.Requestor := tbe.L1_GetX_ID;
1096 out_msg.RequestorMachine := MachineType:L1Cache;
1097 out_msg.Destination.addNetDest(getLocalSharers(cache_entry, address));
1098 out_msg.Destination.remove(tbe.L1_GetX_ID);
1099 out_msg.MessageSize := MessageSizeType:Invalidate_Control;
1100 }
1101 }
1102
1103
1104 action(f_sendUnblock, "f", desc="Send unblock to global directory") {
1105 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
1106 out_msg.Address := address;
1107 out_msg.Type := CoherenceResponseType:UNBLOCK;
1108 out_msg.Destination.add(map_Address_to_Directory(address));
1109 out_msg.Sender := machineID;
1110 out_msg.SenderMachine := MachineType:L2Cache;
1111 out_msg.MessageSize := MessageSizeType:Unblock_Control;
1112 }
1113 }
1114
1115
1116 action(f_sendExclusiveUnblock, "\f", desc="Send unblock to global directory") {
1117 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
1118 out_msg.Address := address;
1119 out_msg.Type := CoherenceResponseType:UNBLOCK_EXCLUSIVE;
1120 out_msg.Destination.add(map_Address_to_Directory(address));
1121 out_msg.Sender := machineID;
1122 out_msg.SenderMachine := MachineType:L2Cache;
1123 out_msg.MessageSize := MessageSizeType:Unblock_Control;
1124 }
1125 }
1126
1127
1128 action(g_recordLocalSharer, "g", desc="Record new local sharer from unblock message") {
1129 peek(responseNetwork_in, ResponseMsg) {
1130 recordLocalSharerInDir(cache_entry, in_msg.Address, in_msg.Sender);
1131 }
1132 }
1133
1134 action(g_recordLocalExclusive, "\g", desc="Record new local exclusive sharer from unblock message") {
1135 peek(responseNetwork_in, ResponseMsg) {
1136 recordNewLocalExclusiveInDir(cache_entry, address, in_msg.Sender);
1137 }
1138 }
1139
1140 action(gg_clearLocalSharers, "gg", desc="Clear local sharers") {
1141 removeAllLocalSharersFromDir(cache_entry, address);
1142 }
1143
1144 action(gg_clearSharerFromL1Response, "\gg", desc="Clear sharer from L1 response queue") {
1145 peek(responseNetwork_in, ResponseMsg) {
1146 removeSharerFromDir(cache_entry, in_msg.Address, in_msg.Sender);
1147 }
1148 }
1149
1150 action(gg_clearOwnerFromL1Response, "g\g", desc="Clear sharer from L1 response queue") {
1151 peek(responseNetwork_in, ResponseMsg) {
1152 removeOwnerFromDir(cache_entry, in_msg.Address, in_msg.Sender);
1153 }
1154 }
1155
1156 action(h_countLocalSharersExceptRequestor, "h", desc="counts number of acks needed for L1 GETX") {
1157 peek(L1requestNetwork_in, RequestMsg) {
1158 assert(is_valid(tbe));
1159 tbe.Local_GETX_IntAcks := countLocalSharersExceptRequestor(cache_entry, address, in_msg.Requestor);
1160 }
1161 }
1162
1163 action(h_clearIntAcks, "\h", desc="clear IntAcks") {
1164 assert(is_valid(tbe));
1165 tbe.Local_GETX_IntAcks := 0;
1166 }
1167
1168 action(hh_countLocalSharersExceptL1GETXRequestorInTBE, "hh", desc="counts number of acks needed for L1 GETX") {
1169 assert(is_valid(tbe));
1170 tbe.Local_GETX_IntAcks := countLocalSharersExceptRequestor(cache_entry, address, tbe.L1_GetX_ID);
1171 }
1172
1173 action(i_copyDataToTBE, "\i", desc="Copy data from response queue to TBE") {
1174 peek(responseNetwork_in, ResponseMsg) {
1175 assert(is_valid(tbe));
1176 tbe.DataBlk := in_msg.DataBlk;
1177 tbe.Dirty := in_msg.Dirty;
1178 APPEND_TRANSITION_COMMENT(in_msg.Sender);
1179 }
1180 }
1181
1182 action(i_allocateTBE, "i", desc="Allocate TBE for internal/external request(isPrefetch=0, number of invalidates=0)") {
1183 check_allocate(TBEs);
1184 TBEs.allocate(address);
1185 set_tbe(TBEs[address]);
1186 if(is_valid(cache_entry)) {
1187 tbe.DataBlk := cache_entry.DataBlk;
1188 tbe.Dirty := cache_entry.Dirty;
1189 }
1190 tbe.NumIntPendingAcks := 0; // default value
1191 tbe.NumExtPendingAcks := 0; // default value
1192 tbe.Fwd_GetS_IDs.clear();
1193 tbe.L1_GetS_IDs.clear();
1194 }
1195
1196
1197
1198 action(j_forwardGlobalRequestToLocalOwner, "j", desc="Forward external request to local owner") {
1199 peek(requestNetwork_in, RequestMsg) {
1200 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1201 out_msg.Address := in_msg.Address;
1202 out_msg.Type := in_msg.Type;
1203 out_msg.Requestor := machineID;
1204 out_msg.RequestorMachine := MachineType:L2Cache;
1205 out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.Address));
1206 out_msg.Type := in_msg.Type;
1207 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1208 out_msg.Acks := 0 - 1;
1209 }
1210 }
1211 }
1212
1213 action(jd_forwardDmaRequestToLocalOwner, "jd", desc="Forward dma request to local owner") {
1214 peek(requestNetwork_in, RequestMsg) {
1215 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1216 out_msg.Address := in_msg.Address;
1217 out_msg.Type := in_msg.Type;
1218 out_msg.Requestor := in_msg.Requestor;
1219 out_msg.RequestorMachine := in_msg.RequestorMachine;
1220 out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.Address));
1221 out_msg.Type := in_msg.Type;
1222 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1223 out_msg.Acks := 0 - 1;
1224 }
1225 }
1226 }
1227
1228
1229 action(k_forwardLocalGETSToLocalSharer, "k", desc="Forward local request to local sharer/owner") {
1230 peek(L1requestNetwork_in, RequestMsg) {
1231 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1232 out_msg.Address := in_msg.Address;
1233 out_msg.Type := CoherenceRequestType:GETS;
1234 out_msg.Requestor := in_msg.Requestor;
1235 out_msg.RequestorMachine := MachineType:L1Cache;
1236 // should randomize this so one node doesn't get abused more than others
1237 out_msg.Destination.add(localDirectory[in_msg.Address].Sharers.smallestElement(MachineType:L1Cache));
1238 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1239 }
1240 }
1241 }
1242
1243 action(k_forwardLocalGETXToLocalOwner, "\k", desc="Forward local request to local owner") {
1244 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1245 assert(is_valid(tbe));
1246 out_msg.Address := address;
1247 out_msg.Type := CoherenceRequestType:GETX;
1248 out_msg.Requestor := tbe.L1_GetX_ID;
1249 out_msg.RequestorMachine := MachineType:L1Cache;
1250 out_msg.Destination.add(localDirectory[address].Owner);
1251 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1252 out_msg.Acks := 1 + tbe.Local_GETX_IntAcks;
1253 }
1254 }
1255
1256 // same as previous except that it assumes to TBE is present to get number of acks
1257 action(kk_forwardLocalGETXToLocalExclusive, "kk", desc="Forward local request to local owner") {
1258 peek(L1requestNetwork_in, RequestMsg) {
1259 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1260 out_msg.Address := in_msg.Address;
1261 out_msg.Type := CoherenceRequestType:GETX;
1262 out_msg.Requestor := in_msg.Requestor;
1263 out_msg.RequestorMachine := MachineType:L1Cache;
1264 out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.Address));
1265 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1266 out_msg.Acks := 1;
1267 }
1268 }
1269 }
1270
1271 action(kk_forwardLocalGETSToLocalOwner, "\kk", desc="Forward local request to local owner") {
1272 peek(L1requestNetwork_in, RequestMsg) {
1273 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1274 out_msg.Address := in_msg.Address;
1275 out_msg.Type := CoherenceRequestType:GETS;
1276 out_msg.Requestor := in_msg.Requestor;
1277 out_msg.RequestorMachine := MachineType:L1Cache;
1278 out_msg.Destination.add(getLocalOwner(cache_entry, in_msg.Address));
1279 out_msg.MessageSize := MessageSizeType:Forwarded_Control;
1280 }
1281 }
1282 }
1283
1284
1285 action(l_writebackAckNeedData, "l", desc="Send writeback ack to L1 requesting data") {
1286 peek(L1requestNetwork_in, RequestMsg) {
1287 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1288 out_msg.Address := in_msg.Address;
1289 // out_msg.Type := CoherenceResponseType:WRITEBACK_SEND_DATA;
1290 out_msg.Type := CoherenceRequestType:WB_ACK_DATA;
1291 out_msg.Requestor := machineID;
1292 out_msg.RequestorMachine := MachineType:L2Cache;
1293 out_msg.Destination.add(in_msg.Requestor);
1294 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1295 }
1296 }
1297 }
1298
1299 action(l_writebackAckDropData, "\l", desc="Send writeback ack to L1 indicating to drop data") {
1300 peek(L1requestNetwork_in, RequestMsg) {
1301 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1302 out_msg.Address := in_msg.Address;
1303 // out_msg.Type := CoherenceResponseType:WRITEBACK_ACK;
1304 out_msg.Type := CoherenceRequestType:WB_ACK;
1305 out_msg.Requestor := machineID;
1306 out_msg.RequestorMachine := MachineType:L2Cache;
1307 out_msg.Destination.add(in_msg.Requestor);
1308 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1309 }
1310 }
1311 }
1312
1313 action(ll_writebackNack, "\ll", desc="Send writeback nack to L1") {
1314 peek(L1requestNetwork_in, RequestMsg) {
1315 enqueue( localRequestNetwork_out, RequestMsg, latency=response_latency ) {
1316 out_msg.Address := in_msg.Address;
1317 out_msg.Type := CoherenceRequestType:WB_NACK;
1318 out_msg.Requestor := machineID;
1319 out_msg.RequestorMachine := MachineType:L2Cache;
1320 out_msg.Destination.add(in_msg.Requestor);
1321 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1322 }
1323 }
1324 }
1325
1326 action(m_popRequestQueue, "m", desc="Pop request queue.") {
1327 requestNetwork_in.dequeue();
1328 }
1329
1330 action(m_decrementNumberOfMessagesInt, "\m", desc="Decrement the number of messages for which we're waiting") {
1331 peek(responseNetwork_in, ResponseMsg) {
1332 assert(is_valid(tbe));
1333 tbe.NumIntPendingAcks := tbe.NumIntPendingAcks + in_msg.Acks;
1334 }
1335 }
1336
1337 action(m_decrementNumberOfMessagesExt, "\mmm", desc="Decrement the number of messages for which we're waiting") {
1338 peek(responseNetwork_in, ResponseMsg) {
1339 assert(is_valid(tbe));
1340 tbe.NumExtPendingAcks := tbe.NumExtPendingAcks - in_msg.Acks;
1341 }
1342 }
1343
1344 action(mm_decrementNumberOfMessagesExt, "\mm", desc="Decrement the number of messages for which we're waiting") {
1345 peek(requestNetwork_in, RequestMsg) {
1346 assert(is_valid(tbe));
1347 tbe.NumExtPendingAcks := tbe.NumExtPendingAcks - in_msg.Acks;
1348 }
1349 }
1350
1351 action(n_popResponseQueue, "n", desc="Pop response queue") {
1352 responseNetwork_in.dequeue();
1353 }
1354
1355 action(n_popTriggerQueue, "\n", desc="Pop trigger queue.") {
1356 triggerQueue_in.dequeue();
1357 }
1358
1359 action(o_popL1RequestQueue, "o", desc="Pop L1 request queue.") {
1360 L1requestNetwork_in.dequeue();
1361 }
1362
1363
1364 action(o_checkForIntCompletion, "\o", desc="Check if we have received all the messages required for completion") {
1365 assert(is_valid(tbe));
1366 if (tbe.NumIntPendingAcks == 0) {
1367 enqueue(triggerQueue_out, TriggerMsg) {
1368 out_msg.Address := address;
1369 out_msg.Type := TriggerType:ALL_ACKS;
1370 }
1371 }
1372 }
1373
1374 action(o_checkForExtCompletion, "\oo", desc="Check if we have received all the messages required for completion") {
1375 assert(is_valid(tbe));
1376 if (tbe.NumExtPendingAcks == 0) {
1377 enqueue(triggerQueue_out, TriggerMsg) {
1378 out_msg.Address := address;
1379 out_msg.Type := TriggerType:ALL_ACKS;
1380 }
1381 }
1382 }
1383
1384
1385 action( qq_sendDataFromTBEToMemory, "qq", desc="Send data from TBE to directory") {
1386 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
1387 assert(is_valid(tbe));
1388 out_msg.Address := address;
1389 out_msg.Sender := machineID;
1390 out_msg.SenderMachine := MachineType:L2Cache;
1391 out_msg.Destination.add(map_Address_to_Directory(address));
1392 out_msg.Dirty := tbe.Dirty;
1393 if (tbe.Dirty) {
1394 out_msg.Type := CoherenceResponseType:WRITEBACK_DIRTY_DATA;
1395 out_msg.DataBlk := tbe.DataBlk;
1396 out_msg.MessageSize := MessageSizeType:Writeback_Data;
1397 } else {
1398 out_msg.Type := CoherenceResponseType:WRITEBACK_CLEAN_ACK;
1399 // NOTE: in a real system this would not send data. We send
1400 // data here only so we can check it at the memory
1401 out_msg.DataBlk := tbe.DataBlk;
1402 out_msg.MessageSize := MessageSizeType:Writeback_Control;
1403 }
1404 }
1405 }
1406
1407 action( r_setMRU, "\rrr", desc="manually set the MRU bit for cache line" ) {
1408 if(is_valid(cache_entry)) {
1409 L2cacheMemory.setMRU(address);
1410 }
1411 }
1412
1413 action( s_recordGetXL1ID, "ss", desc="record local GETX requestor") {
1414 peek(L1requestNetwork_in, RequestMsg) {
1415 assert(is_valid(tbe));
1416 tbe.L1_GetX_ID := in_msg.Requestor;
1417 }
1418 }
1419
1420 action(s_deallocateTBE, "s", desc="Deallocate external TBE") {
1421 TBEs.deallocate(address);
1422 unset_tbe();
1423 }
1424
1425 action( s_recordGetSL1ID, "\ss", desc="record local GETS requestor") {
1426 peek(L1requestNetwork_in, RequestMsg) {
1427 assert(is_valid(tbe));
1428 tbe.L1_GetS_IDs.add(in_msg.Requestor);
1429 }
1430 }
1431
1432 action(t_recordFwdXID, "t", desc="record global GETX requestor") {
1433 peek(requestNetwork_in, RequestMsg) {
1434 assert(is_valid(tbe));
1435 tbe.Fwd_GetX_ID := in_msg.Requestor;
1436 tbe.Fwd_GETX_ExtAcks := in_msg.Acks;
1437 }
1438 }
1439
1440 action(t_recordFwdSID, "\t", desc="record global GETS requestor") {
1441 peek(requestNetwork_in, RequestMsg) {
1442 assert(is_valid(tbe));
1443 tbe.Fwd_GetS_IDs.clear();
1444 tbe.Fwd_GetS_IDs.add(in_msg.Requestor);
1445 }
1446 }
1447
1448
1449 action(u_writeDataToCache, "u", desc="Write data to cache") {
1450 peek(responseNetwork_in, ResponseMsg) {
1451 assert(is_valid(cache_entry));
1452 cache_entry.DataBlk := in_msg.DataBlk;
1453 DPRINTF(RubySlicc, "Address: %s, Data Block: %s\n",
1454 address, cache_entry.DataBlk);
1455 if ((cache_entry.Dirty == false) && in_msg.Dirty) {
1456 cache_entry.Dirty := in_msg.Dirty;
1457 }
1458 }
1459 }
1460
1461 action(vv_allocateL2CacheBlock, "\v", desc="Set L2 cache tag equal to tag of block B.") {
1462 set_cache_entry(L2cacheMemory.allocate(address, new Entry));
1463 }
1464
1465 action(rr_deallocateL2CacheBlock, "\r", desc="Deallocate L2 cache block. Sets the cache to not present, allowing a replacement in parallel with a fetch.") {
1466 L2cacheMemory.deallocate(address);
1467 unset_cache_entry();
1468 }
1469
1470
1471 action(w_assertIncomingDataAndCacheDataMatch, "w", desc="Assert that the incoming data and the data in the cache match") {
1472 peek(responseNetwork_in, ResponseMsg) {
1473 assert(is_valid(cache_entry));
1474 assert(cache_entry.DataBlk == in_msg.DataBlk);
1475 }
1476 }
1477
1478 action(uu_profileMiss, "\u", desc="Profile the demand miss") {
1479 peek(L1requestNetwork_in, RequestMsg) {
1480 // AccessModeType not implemented
1481 // profile_L2Cache_miss(convertToGenericType(in_msg.Type), in_msg.AccessMode, MessageSizeTypeToInt(in_msg.MessageSize), in_msg.Prefetch, machineIDToNodeID(in_msg.Requestor));
1482 }
1483 }
1484
1485 action(y_copyCacheStateToDir, "y", desc="Copy cache state to directory state") {
1486 copyCacheStateToDir(cache_entry, address);
1487 }
1488
1489 action(y_copyDirToCacheAndRemove, "/y", desc="Copy dir state to cache and remove") {
1490 copyDirToCache(cache_entry, address);
1491 localDirectory.deallocate(address);
1492 }
1493
1494 action(z_stall, "z", desc="Stall") {
1495 }
1496
1497 action(zz_recycleL1RequestQueue, "zz", desc="Send the head of the mandatory queue to the back of the queue.") {
1498 peek(L1requestNetwork_in, RequestMsg) {
1499 APPEND_TRANSITION_COMMENT(in_msg.Requestor);
1500 }
1501 L1requestNetwork_in.recycle();
1502 }
1503
1504 action(zz_recycleRequestQueue, "\zz", desc="Send the head of the mandatory queue to the back of the queue.") {
1505 peek(requestNetwork_in, RequestMsg) {
1506 APPEND_TRANSITION_COMMENT(in_msg.Requestor);
1507 }
1508 requestNetwork_in.recycle();
1509 }
1510
1511 action(zz_recycleResponseQueue, "\z\z", desc="Send the head of the mandatory queue to the back of the queue.") {
1512 peek(responseNetwork_in, ResponseMsg) {
1513 APPEND_TRANSITION_COMMENT(in_msg.Sender);
1514 }
1515 responseNetwork_in.recycle();
1516 }
1517
1518 action(da_sendDmaAckUnblock, "da", desc="Send dma ack to global directory") {
1519 enqueue(responseNetwork_out, ResponseMsg, latency=response_latency) {
1520 out_msg.Address := address;
1521 out_msg.Type := CoherenceResponseType:DMA_ACK;
1522 out_msg.Destination.add(map_Address_to_Directory(address));
1523 out_msg.Sender := machineID;
1524 out_msg.SenderMachine := MachineType:L2Cache;
1525 out_msg.MessageSize := MessageSizeType:Unblock_Control;
1526 }
1527 }
1528
1529
1530
1531 //*****************************************************
1532 // TRANSITIONS
1533 //*****************************************************
1534
1535 transition({II, IFGX, IFGS, ISFGS, IFGXX, IFLXO, OFGX, ILOW, ILOXW, ILOSW, ILOSXW, SLSW, OLSW, ILSW, IW, OW, SW, OXW, OLSXW, ILXW, IFLS, IFLO, IFLOX, IFLOXX, IFLOSX, OLSXS, IGS, IGM, IGMLS, IGMO, IGMIO, OGMIO, IGMIOF, OGMIOF, MM, SS, OO, OI, MI, MII, OLSI, ILSI, SLSS, OLSS, OLSF, IGMIOFS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {L1_PUTO, L1_PUTS, L1_PUTS_only, L1_PUTX}) {
1536 zz_recycleL1RequestQueue;
1537 }
1538
1539 transition({II, IFGX, IFGS, ISFGS, IFGXX, IFLXO, OFGX, ILOW, ILOXW, ILOSW, ILOSXW, SLSW, OLSW, ILSW, IW, OW, SW, OXW, OLSXW, ILXW, IFLS, IFLO, IFLOX, IFLOXX, IFLOSX, OLSXS, IGS, IGM, IGMLS, IGMO, IGMIO, OGMIO, IGMIOF, OGMIOF, MM, SS, OO, OI, MI, MII, OLSI, ILSI, SLSS, OLSS, OLSF, IGMIOFS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {L1_GETX, L1_GETS}) {
1540 zz_recycleL1RequestQueue;
1541 }
1542
1543 transition({IFGX, IFGS, ISFGS, IFGXX, IFLXO, OFGX, ILOW, ILOXW, ILOSW, ILOSXW, SLSW, OLSW, ILSW, IW, ILXW, OW, SW, OXW, OLSXW, IFLS, IFLO, IFLOX, IFLOXX, IFLOSX,OLSXS, IGS, IGM, IGMLS, IGMO, MM, SS, OO, OI, MI, MII, OLSI, ILSI, SLSS, OLSS, OLSF, IGMIOFS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, L2_Replacement) {
1544 zz_recycleResponseQueue;
1545 }
1546
1547 transition({IFGX, IFGS, ISFGS, IFGXX, IFLXO, OFGX, ILOW, ILOXW, ILOSW, ILOSXW, SLSW, OLSW, ILSW, IW, OW, SW, OXW, OLSXW, ILXW, IFLS, IFLO, IFLOX, IFLOXX, IFLOSX,OLSXS, IGS, IGM, MM, SS, OO, SLSS, OLSS, OLSF, IGMIOFS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {Fwd_GETX, Fwd_GETS, Fwd_DMA}) {
1548 zz_recycleRequestQueue;
1549 }
1550
1551 transition({OGMIO, IGMIO, IGMO}, Fwd_DMA) {
1552 zz_recycleRequestQueue;
1553 }
1554
1555 transition({IFGX, IFGS, ISFGS, IFGXX, IFLXO, OFGX, ILOW, ILOXW, ILOSW, ILOSXW, SLSW, OLSW, ILSW, IW, OW, SW, OXW, OLSXW, ILXW, IFLS, IFLO, IFLOX, IFLOXX, IFLOSX,OLSXS, MM, SS, OO, SLSS, OLSS, OLSF, IGMIOFS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {Inv}) {
1556 zz_recycleRequestQueue;
1557 }
1558
1559 transition({IGM, IGS, ILOSD, ILOSXD, ILOD, ILXD, ILOXD}, {Own_GETX}) {
1560 zz_recycleRequestQueue;
1561 }
1562
1563 // must happened because we forwarded GETX to local exclusive trying to do wb
1564 transition({I, M, O, ILS, ILOX, OLS, OLSX, SLS, S}, L1_PUTX) {
1565 ll_writebackNack;
1566 o_popL1RequestQueue;
1567 }
1568
1569 transition({M}, {L1_PUTS, L1_PUTO} ) {
1570 ll_writebackNack;
1571 o_popL1RequestQueue;
1572 }
1573
1574 transition({ILS, OLSX}, L1_PUTO){
1575 ll_writebackNack;
1576 o_popL1RequestQueue;
1577 }
1578
1579 // happened if we forwarded GETS to exclusive who tried to do writeback
1580 // ?? should we just Nack these instead? Could be a bugs here
1581 transition(ILO, L1_PUTX, ILOW) {
1582 l_writebackAckNeedData;
1583 o_popL1RequestQueue;
1584 }
1585
1586 // this can happen if we forwarded a L1_GETX to exclusiver after it issued a PUTX
1587 transition(ILOS, L1_PUTX, ILOSW) {
1588 l_writebackAckNeedData;
1589 o_popL1RequestQueue;
1590 }
1591
1592 transition(ILOSX, L1_PUTX, ILOSXW) {
1593 l_writebackAckNeedData;
1594 o_popL1RequestQueue;
1595 }
1596
1597 // must happened because we got Inv when L1 attempted PUTS
1598 transition(I, L1_PUTS) {
1599 ll_writebackNack;
1600 o_popL1RequestQueue;
1601 }
1602
1603 transition(I, L1_PUTO) {
1604 ll_writebackNack;
1605 o_popL1RequestQueue;
1606 }
1607
1608 // FORWARDED REQUESTS
1609
1610 transition({ILO, ILX, ILOX}, Fwd_GETS, IFGS) {
1611 i_allocateTBE;
1612 t_recordFwdSID;
1613 j_forwardGlobalRequestToLocalOwner;
1614 m_popRequestQueue;
1615 }
1616
1617 transition({ILOS, ILOSX}, Fwd_GETS, ISFGS) {
1618 i_allocateTBE;
1619 t_recordFwdSID;
1620 j_forwardGlobalRequestToLocalOwner;
1621 m_popRequestQueue;
1622 }
1623
1624 transition(ILOS, Fwd_DMA, ILOSD) {
1625 i_allocateTBE;
1626 jd_forwardDmaRequestToLocalOwner;
1627 m_popRequestQueue;
1628 }
1629
1630 transition(ILOSD, DmaAck, ILOS) {
1631 s_deallocateTBE;
1632 da_sendDmaAckUnblock;
1633 n_popResponseQueue;
1634 }
1635
1636 transition(ILOSX, Fwd_DMA, ILOSXD) {
1637 i_allocateTBE;
1638 t_recordFwdSID;
1639 jd_forwardDmaRequestToLocalOwner;
1640 m_popRequestQueue;
1641 }
1642
1643 transition(ILOSXD, DmaAck, ILOSX) {
1644 s_deallocateTBE;
1645 da_sendDmaAckUnblock;
1646 n_popResponseQueue;
1647 }
1648
1649 transition(ILO, Fwd_DMA, ILOD) {
1650 i_allocateTBE;
1651 t_recordFwdSID;
1652 jd_forwardDmaRequestToLocalOwner;
1653 m_popRequestQueue;
1654 }
1655
1656 transition(ILOD, DmaAck, ILO) {
1657 s_deallocateTBE;
1658 da_sendDmaAckUnblock;
1659 n_popResponseQueue;
1660 }
1661
1662 transition(ILX, Fwd_DMA, ILXD) {
1663 i_allocateTBE;
1664 t_recordFwdSID;
1665 jd_forwardDmaRequestToLocalOwner;
1666 m_popRequestQueue;
1667 }
1668
1669 transition(ILXD, DmaAck, ILX) {
1670 s_deallocateTBE;
1671 da_sendDmaAckUnblock;
1672 n_popResponseQueue;
1673 }
1674
1675 transition(ILOX, Fwd_DMA, ILOXD) {
1676 i_allocateTBE;
1677 t_recordFwdSID;
1678 jd_forwardDmaRequestToLocalOwner;
1679 m_popRequestQueue;
1680 }
1681
1682 transition(ILOXD, DmaAck, ILOX) {
1683 s_deallocateTBE;
1684 da_sendDmaAckUnblock;
1685 n_popResponseQueue;
1686 }
1687
1688 transition({ILOS, ILOSX, ILO, ILX, ILOX, ILXW}, Data) {
1689 i_copyDataToTBE;
1690 c_sendDataFromTBEToFwdGETS;
1691 s_deallocateTBE;
1692 n_popResponseQueue;
1693 }
1694
1695 transition(IFGS, Data, ILO) {
1696 i_copyDataToTBE;
1697 c_sendDataFromTBEToFwdGETS;
1698 s_deallocateTBE;
1699 n_popResponseQueue;
1700 }
1701
1702 transition(ISFGS, Data, ILOS) {
1703 i_copyDataToTBE;
1704 c_sendDataFromTBEToFwdGETS;
1705 s_deallocateTBE;
1706 n_popResponseQueue;
1707 }
1708
1709 transition(IFGS, Data_Exclusive, I) {
1710 i_copyDataToTBE;
1711 c_sendExclusiveDataFromTBEToFwdGETS;
1712 gg_clearLocalSharers;
1713 s_deallocateTBE;
1714 n_popResponseQueue;
1715 }
1716
1717
1718 transition({ILX, ILO, ILOX}, Fwd_GETX, IFGX) {
1719 i_allocateTBE;
1720 t_recordFwdXID;
1721 j_forwardGlobalRequestToLocalOwner;
1722 m_popRequestQueue;
1723 }
1724
1725 transition(IFGX, {Data_Exclusive, Data}, I) {
1726 i_copyDataToTBE;
1727 c_sendDataFromTBEToFwdGETX;
1728 gg_clearLocalSharers;
1729 s_deallocateTBE;
1730 n_popResponseQueue;
1731 }
1732
1733 transition({ILOSX, ILOS}, Fwd_GETX, IFGXX) {
1734 i_allocateTBE;
1735 t_recordFwdXID;
1736 j_forwardGlobalRequestToLocalOwner;
1737 ee_sendLocalInvSharersOnly;
1738 ee_addLocalIntAck;
1739 m_popRequestQueue;
1740 }
1741
1742
1743 transition(IFGXX, IntAck) {
1744 m_decrementNumberOfMessagesInt;
1745 o_checkForIntCompletion;
1746 n_popResponseQueue;
1747 }
1748
1749 transition(IFGXX, Data_Exclusive) {
1750 i_copyDataToTBE;
1751 m_decrementNumberOfMessagesInt;
1752 o_checkForIntCompletion;
1753 n_popResponseQueue;
1754 }
1755
1756 transition(IFGXX, All_Acks, I) {
1757 c_sendDataFromTBEToFwdGETX;
1758 gg_clearLocalSharers;
1759 s_deallocateTBE;
1760 n_popTriggerQueue;
1761 }
1762
1763
1764 // transition({O, OX}, Fwd_GETX, I) {
1765 transition(O, Fwd_GETX, I) {
1766 dd_sendDataToFwdGETX;
1767 y_copyCacheStateToDir;
1768 rr_deallocateL2CacheBlock;
1769 m_popRequestQueue;
1770 }
1771
1772 transition({O, OLS}, Fwd_GETS) {
1773 dd_sendDataToFwdGETS;
1774 m_popRequestQueue;
1775 }
1776
1777 transition({O, OLS}, Fwd_DMA) {
1778 dd_sendDataToFwdGETS;
1779 da_sendDmaAckUnblock;
1780 m_popRequestQueue;
1781 }
1782
1783 // transition({OLSX, OX}, Fwd_GETS, O) {
1784 transition(OLSX, Fwd_GETS, OLS) {
1785 dd_sendDataToFwdGETS;
1786 m_popRequestQueue;
1787 }
1788
1789 transition(OLSX, Fwd_DMA) {
1790 dd_sendDataToFwdGETS;
1791 da_sendDmaAckUnblock;
1792 m_popRequestQueue;
1793 }
1794
1795 transition(M, Fwd_GETX, I) {
1796 dd_sendDataToFwdGETX;
1797 rr_deallocateL2CacheBlock;
1798 m_popRequestQueue;
1799 }
1800
1801 // MAKE THIS THE SAME POLICY FOR NOW
1802
1803 // transition(M, Fwd_GETS, O) {
1804 // dd_sendDataToFwdGETS;
1805 // m_popRequestQueue;
1806 // }
1807
1808 transition(M, Fwd_GETS, I) {
1809 dd_sendExclusiveDataToFwdGETS;
1810 rr_deallocateL2CacheBlock;
1811 m_popRequestQueue;
1812 }
1813
1814 transition(M, Fwd_DMA) {
1815 dd_sendExclusiveDataToFwdGETS;
1816 da_sendDmaAckUnblock;
1817 m_popRequestQueue;
1818 }
1819
1820 transition({OLS, OLSX}, Fwd_GETX, OLSF) {
1821 i_allocateTBE;
1822 t_recordFwdXID;
1823 ee_sendLocalInv;
1824 m_popRequestQueue;
1825 }
1826
1827 transition(OLSF, IntAck) {
1828 m_decrementNumberOfMessagesInt;
1829 o_checkForIntCompletion;
1830 n_popResponseQueue;
1831 }
1832
1833 transition(OLSF, All_Acks, I) {
1834 c_sendDataFromTBEToFwdGETX;
1835 gg_clearLocalSharers;
1836 s_deallocateTBE;
1837 rr_deallocateL2CacheBlock;
1838 n_popTriggerQueue;
1839 }
1840
1841
1842
1843 // INVALIDATIONS FROM GLOBAL DIRECTORY
1844
1845 transition({IGM, IGS}, Inv) {
1846 t_recordFwdXID;
1847 e_sendAck;
1848 m_popRequestQueue;
1849 }
1850
1851 transition({I,NP}, Inv) {
1852 i_allocateTBE;
1853 t_recordFwdXID;
1854 e_sendAck;
1855 s_deallocateTBE;
1856 m_popRequestQueue;
1857 }
1858
1859 // NEED INV for S state
1860
1861 transition({ILS, ILO, ILX}, Inv, II) {
1862 i_allocateTBE;
1863 t_recordFwdXID;
1864 ee_sendLocalInv;
1865 gg_clearLocalSharers;
1866 m_popRequestQueue;
1867 }
1868
1869 transition(SLS, Inv, II) {
1870 i_allocateTBE;
1871 t_recordFwdXID;
1872 ee_sendLocalInv;
1873 rr_deallocateL2CacheBlock;
1874 m_popRequestQueue;
1875 }
1876
1877 transition(II, IntAck) {
1878 m_decrementNumberOfMessagesInt;
1879 o_checkForIntCompletion;
1880 n_popResponseQueue;
1881 }
1882
1883 transition(II, All_Acks, I) {
1884 e_sendAck;
1885 s_deallocateTBE;
1886 n_popTriggerQueue;
1887 }
1888
1889 transition(S, Inv, I) {
1890 i_allocateTBE;
1891 t_recordFwdXID;
1892 e_sendAck;
1893 s_deallocateTBE;
1894 rr_deallocateL2CacheBlock;
1895 m_popRequestQueue;
1896 }
1897
1898
1899 // LOCAL REQUESTS SATISFIED LOCALLY
1900
1901 transition(OLSX, L1_GETX, IFLOX) {
1902 i_allocateTBE;
1903 s_recordGetXL1ID;
1904 // count number of INVs needed that doesn't include requestor
1905 h_countLocalSharersExceptRequestor;
1906 // issue INVs to everyone except requestor
1907 ee_issueLocalInvExceptL1Requestor;
1908 d_sendDataToL1GETX
1909 y_copyCacheStateToDir;
1910 r_setMRU;
1911 rr_deallocateL2CacheBlock;
1912 uu_profileMiss;
1913 o_popL1RequestQueue;
1914 }
1915
1916 transition(IFLOX, Exclusive_Unblock, ILX) {
1917 g_recordLocalExclusive;
1918 s_deallocateTBE;
1919 n_popResponseQueue;
1920 }
1921
1922 transition(OLSX, L1_GETS, OLSXS) {
1923 d_sendDataToL1GETS;
1924 r_setMRU;
1925 o_popL1RequestQueue;
1926 }
1927
1928 transition(OLSXS, Unblock, OLSX) {
1929 g_recordLocalSharer;
1930 n_popResponseQueue;
1931 }
1932
1933 // after this, can't get Fwd_GETX
1934 transition(IGMO, Own_GETX) {
1935 mm_decrementNumberOfMessagesExt;
1936 o_checkForExtCompletion;
1937 m_popRequestQueue;
1938
1939 }
1940
1941
1942 transition(ILX, L1_GETS, IFLOXX) {
1943 kk_forwardLocalGETSToLocalOwner;
1944 uu_profileMiss;
1945 o_popL1RequestQueue;
1946 }
1947
1948 transition(ILOSX, L1_GETS, IFLOSX) {
1949 kk_forwardLocalGETSToLocalOwner;
1950 uu_profileMiss;
1951 o_popL1RequestQueue;
1952 }
1953
1954 transition({ILOS, ILO}, L1_GETS, IFLO) {
1955 kk_forwardLocalGETSToLocalOwner;
1956 uu_profileMiss;
1957 o_popL1RequestQueue;
1958 }
1959
1960 transition(ILS, L1_GETS, IFLS) {
1961 k_forwardLocalGETSToLocalSharer;
1962 uu_profileMiss;
1963 o_popL1RequestQueue;
1964 }
1965
1966 transition({ILX, ILOX}, L1_GETX, IFLOXX) {
1967 kk_forwardLocalGETXToLocalExclusive;
1968 e_sendAckToL1Requestor;
1969 uu_profileMiss;
1970 o_popL1RequestQueue;
1971 }
1972
1973 transition(ILOX, L1_GETS, IFLOX) {
1974 kk_forwardLocalGETSToLocalOwner;
1975 uu_profileMiss;
1976 o_popL1RequestQueue;
1977 }
1978
1979 transition(IFLOX, Unblock, ILOSX) {
1980 g_recordLocalSharer;
1981 n_popResponseQueue;
1982 }
1983
1984 transition(IFLS, Unblock, ILS) {
1985 g_recordLocalSharer;
1986 n_popResponseQueue;
1987 }
1988
1989 transition(IFLOXX, Unblock, ILOSX) {
1990 g_recordLocalSharer;
1991 n_popResponseQueue;
1992 }
1993
1994 transition(IFLOSX, Unblock, ILOSX) {
1995 g_recordLocalSharer;
1996 n_popResponseQueue;
1997 }
1998
1999 transition({IFLOSX, IFLOXX}, Exclusive_Unblock, ILX) {
2000 g_recordLocalExclusive;
2001 n_popResponseQueue;
2002 }
2003
2004 transition(IFLO, Unblock, ILOS) {
2005 g_recordLocalSharer;
2006 n_popResponseQueue;
2007 }
2008
2009
2010 transition(ILOSX, L1_GETX, IFLXO) {
2011 i_allocateTBE;
2012 s_recordGetXL1ID;
2013 h_countLocalSharersExceptRequestor;
2014 ee_issueLocalInvExceptL1Requestor;
2015 k_forwardLocalGETXToLocalOwner;
2016 e_sendAckToL1RequestorFromTBE;
2017 uu_profileMiss;
2018 o_popL1RequestQueue;
2019 }
2020
2021 transition(IFLXO, Exclusive_Unblock, ILX) {
2022 g_recordLocalExclusive;
2023 s_deallocateTBE;
2024 n_popResponseQueue;
2025 }
2026
2027 // LOCAL REQUESTS THAT MUST ISSUE
2028
2029 transition(NP, {L1_PUTS, L1_PUTX, L1_PUTO}) {
2030 ll_writebackNack;
2031 o_popL1RequestQueue;
2032 }
2033
2034 transition({NP, I}, L1_GETS, IGS) {
2035 i_allocateTBE;
2036 s_recordGetSL1ID;
2037 a_issueGETS;
2038 uu_profileMiss;
2039 o_popL1RequestQueue;
2040 }
2041
2042 transition({NP, I}, L1_GETX, IGM) {
2043 i_allocateTBE;
2044 s_recordGetXL1ID;
2045 a_issueGETX;
2046 uu_profileMiss;
2047 o_popL1RequestQueue;
2048 }
2049
2050 transition(S, L1_GETX, IGM) {
2051 i_allocateTBE;
2052 s_recordGetXL1ID;
2053 a_issueGETX;
2054 y_copyCacheStateToDir;
2055 r_setMRU;
2056 rr_deallocateL2CacheBlock;
2057 uu_profileMiss;
2058 o_popL1RequestQueue;
2059 }
2060
2061 transition(ILS, L1_GETX, IGMLS) {
2062 i_allocateTBE;
2063 s_recordGetXL1ID;
2064 a_issueGETX;
2065 // count number of INVs (just sharers?) needed that doesn't include requestor
2066 h_countLocalSharersExceptRequestor;
2067 uu_profileMiss;
2068 o_popL1RequestQueue;
2069 }
2070
2071 transition(IGMLS, Inv) {
2072 t_recordFwdXID;
2073 ee_sendLocalInv;
2074 m_popRequestQueue;
2075 }
2076
2077 transition(IGMLS, IntAck) {
2078 m_decrementNumberOfMessagesInt;
2079 o_checkForIntCompletion;
2080 n_popResponseQueue;
2081 }
2082
2083 transition(IGMLS, All_Acks, IGM) {
2084 gg_clearLocalSharers;
2085 h_clearIntAcks;
2086 e_sendAck;
2087 n_popTriggerQueue;
2088 }
2089
2090 // transition(IGMLS, ExtAck, IGMO) {
2091 transition(IGMLS, ExtAck) {
2092 m_decrementNumberOfMessagesExt;
2093 o_checkForExtCompletion;
2094 n_popResponseQueue;
2095 }
2096
2097 transition(IGMLS, {Data, Data_Exclusive}, IGMO) {
2098 ee_issueLocalInvExceptL1RequestorInTBE;
2099 i_copyDataToTBE;
2100 m_decrementNumberOfMessagesExt;
2101 o_checkForExtCompletion;
2102 n_popResponseQueue;
2103 }
2104
2105
2106 transition(ILOS, L1_GETX, IGMIO) {
2107 i_allocateTBE;
2108 s_recordGetXL1ID;
2109 a_issueGETX;
2110 uu_profileMiss;
2111 o_popL1RequestQueue;
2112 }
2113
2114 // new exclusive happened while sharer attempted writeback
2115 transition(ILX, {L1_PUTS, L1_PUTS_only, L1_PUTO}) {
2116 ll_writebackNack;
2117 o_popL1RequestQueue;
2118 }
2119
2120 transition(S, L1_PUTS) {
2121 ll_writebackNack;
2122 o_popL1RequestQueue;
2123 }
2124
2125 transition(OLS, L1_GETX, OGMIO) {
2126 i_allocateTBE;
2127 s_recordGetXL1ID;
2128 a_issueGETX;
2129 h_countLocalSharersExceptRequestor;
2130 // COPY DATA FROM CACHE TO TBE (happens during i_allocateTBE)
2131 y_copyCacheStateToDir;
2132 rr_deallocateL2CacheBlock;
2133 uu_profileMiss;
2134 o_popL1RequestQueue;
2135 }
2136
2137 transition(OGMIO, Fwd_GETS) {
2138 t_recordFwdSID;
2139 c_sendDataFromTBEToFwdGETS;
2140 m_popRequestQueue;
2141 }
2142
2143 transition(ILO, L1_GETX, IGMIO) {
2144 i_allocateTBE;
2145 s_recordGetXL1ID;
2146 a_issueGETX;
2147 // the following, of course, returns 0 sharers but do anyways for consistency
2148 h_countLocalSharersExceptRequestor;
2149 uu_profileMiss;
2150 o_popL1RequestQueue;
2151 }
2152
2153 transition({ILO, ILOX}, L1_PUTS) {
2154 ll_writebackNack;
2155 o_popL1RequestQueue;
2156 }
2157
2158 transition(IGMIO, Fwd_GETX, IGMIOF) {
2159 t_recordFwdXID;
2160 j_forwardGlobalRequestToLocalOwner;
2161 ee_sendLocalInvSharersOnly;
2162 ee_addLocalIntAck;
2163 m_popRequestQueue;
2164 }
2165
2166 transition(IGMIO, Fwd_GETS, IGMIOFS) {
2167 t_recordFwdSID;
2168 j_forwardGlobalRequestToLocalOwner;
2169 m_popRequestQueue;
2170 }
2171
2172 transition(IGMIOFS, Data, IGMIO) {
2173 i_copyDataToTBE;
2174 c_sendDataFromTBEToFwdGETS;
2175 n_popResponseQueue;
2176 }
2177
2178 transition(OGMIO, Fwd_GETX, OGMIOF) {
2179 t_recordFwdXID;
2180 ee_sendLocalInvSharersOnly;
2181 m_popRequestQueue;
2182 }
2183
2184 transition(OGMIOF, IntAck) {
2185 m_decrementNumberOfMessagesInt;
2186 o_checkForIntCompletion;
2187 n_popResponseQueue;
2188 }
2189
2190 transition(OGMIOF, All_Acks, IGM) {
2191 gg_clearLocalSharers;
2192 hh_countLocalSharersExceptL1GETXRequestorInTBE;
2193 c_sendDataFromTBEToFwdGETX;
2194 n_popTriggerQueue;
2195 }
2196
2197 transition(IGMIOF, IntAck) {
2198 m_decrementNumberOfMessagesInt;
2199 o_checkForIntCompletion;
2200 n_popResponseQueue;
2201 }
2202
2203 transition(IGMIOF, Data_Exclusive) {
2204 i_copyDataToTBE;
2205 m_decrementNumberOfMessagesInt;
2206 o_checkForIntCompletion;
2207 n_popResponseQueue;
2208 }
2209
2210 transition(IGMIOF, All_Acks, IGM) {
2211 gg_clearLocalSharers;
2212 c_sendDataFromTBEToFwdGETX;
2213 n_popTriggerQueue;
2214 }
2215
2216 transition(IGMIO, All_Acks, IGMO) {
2217 hh_countLocalSharersExceptL1GETXRequestorInTBE;
2218 ee_issueLocalInvExceptL1RequestorInTBE;
2219 k_forwardLocalGETXToLocalOwner;
2220 e_sendAckToL1RequestorFromTBE;
2221 n_popTriggerQueue;
2222 }
2223
2224 transition(OGMIO, All_Acks, IGMO) {
2225 ee_issueLocalInvExceptL1RequestorInTBE;
2226 c_sendDataFromTBEToL1GETX;
2227 n_popTriggerQueue;
2228 }
2229
2230 transition({IGMIO, OGMIO}, Own_GETX) {
2231 mm_decrementNumberOfMessagesExt;
2232 o_checkForExtCompletion;
2233 m_popRequestQueue;
2234
2235 }
2236
2237 transition(IGM, {Data, Data_Exclusive}, IGMO) {
2238 i_copyDataToTBE;
2239 m_decrementNumberOfMessagesExt;
2240 o_checkForExtCompletion;
2241 n_popResponseQueue;
2242 }
2243
2244 transition({IGM, IGMIO, OGMIO}, ExtAck) {
2245 m_decrementNumberOfMessagesExt;
2246 o_checkForExtCompletion;
2247 n_popResponseQueue;
2248 }
2249
2250 transition(IGMO, ExtAck) {
2251 m_decrementNumberOfMessagesExt;
2252 o_checkForExtCompletion;
2253 n_popResponseQueue;
2254 }
2255
2256 transition(IGS, Data) {
2257 i_copyDataToTBE;
2258 m_decrementNumberOfMessagesExt;
2259 c_sendDataFromTBEToL1GETS;
2260 n_popResponseQueue;
2261 }
2262
2263 transition(IGS, Data_Exclusive) {
2264 i_copyDataToTBE;
2265 m_decrementNumberOfMessagesExt;
2266 c_sendExclusiveDataFromTBEToL1GETS;
2267 n_popResponseQueue;
2268 }
2269
2270 transition(IGS, Unblock, ILS) {
2271 g_recordLocalSharer;
2272 f_sendUnblock;
2273 s_deallocateTBE;
2274 n_popResponseQueue;
2275 }
2276
2277 transition(IGS, Exclusive_Unblock, ILX) {
2278 g_recordLocalExclusive;
2279 f_sendExclusiveUnblock;
2280 s_deallocateTBE;
2281 n_popResponseQueue;
2282 }
2283
2284 transition(IGMO, All_Acks) {
2285 c_sendDataFromTBEToL1GETX;
2286 n_popTriggerQueue;
2287 }
2288
2289 transition(IGMO, Exclusive_Unblock, ILX) {
2290 g_recordLocalExclusive;
2291 f_sendExclusiveUnblock;
2292 s_deallocateTBE;
2293 n_popResponseQueue;
2294 }
2295
2296
2297 transition(SLS, L1_GETX, IGMLS) {
2298 i_allocateTBE;
2299 s_recordGetXL1ID;
2300 a_issueGETX;
2301 // count number of INVs needed that doesn't include requestor
2302 h_countLocalSharersExceptRequestor;
2303 // issue INVs to everyone except requestor
2304 y_copyCacheStateToDir;
2305 rr_deallocateL2CacheBlock;
2306 uu_profileMiss;
2307 o_popL1RequestQueue;
2308
2309 }
2310
2311 transition(SLS, L1_GETS, SLSS ) {
2312 d_sendDataToL1GETS;
2313 r_setMRU;
2314 o_popL1RequestQueue;
2315 }
2316
2317 transition(SLSS, Unblock, SLS) {
2318 g_recordLocalSharer;
2319 n_popResponseQueue;
2320 }
2321
2322
2323 transition(O, L1_GETX, IGMO) {
2324 i_allocateTBE;
2325 s_recordGetXL1ID;
2326 a_issueGETX;
2327 y_copyCacheStateToDir;
2328 rr_deallocateL2CacheBlock;
2329 uu_profileMiss;
2330 o_popL1RequestQueue;
2331 }
2332
2333 transition(OLS, L1_GETS, OLSS) {
2334 d_sendDataToL1GETS;
2335 r_setMRU;
2336 o_popL1RequestQueue;
2337 }
2338
2339 transition(OLSS, Unblock, OLS) {
2340 g_recordLocalSharer;
2341 n_popResponseQueue;
2342 }
2343
2344 transition(IGMO, Fwd_GETX, IGM) {
2345 t_recordFwdXID;
2346 c_sendDataFromTBEToFwdGETX;
2347 m_popRequestQueue;
2348
2349 }
2350
2351 transition(IGMO, Fwd_GETS) {
2352 t_recordFwdSID;
2353 c_sendDataFromTBEToFwdGETS;
2354 m_popRequestQueue;
2355 }
2356
2357
2358 // LOCAL REQUESTS SATISFIED DIRECTLY BY L2
2359
2360 transition(M, L1_GETX, MM) {
2361 i_allocateTBE;
2362 // should count 0 of course
2363 h_countLocalSharersExceptRequestor;
2364 d_sendDataToL1GETX
2365 y_copyCacheStateToDir;
2366 rr_deallocateL2CacheBlock;
2367 s_deallocateTBE;
2368 o_popL1RequestQueue;
2369 }
2370
2371 transition(MM, Exclusive_Unblock, ILX) {
2372 g_recordLocalExclusive;
2373 n_popResponseQueue;
2374 }
2375
2376 transition(M, L1_GETS, OO) {
2377 i_allocateTBE;
2378 // should count 0 of course
2379 h_countLocalSharersExceptRequestor;
2380 d_sendDataToL1GETX;
2381 r_setMRU;
2382 s_deallocateTBE;
2383 o_popL1RequestQueue;
2384 }
2385
2386 transition(S, L1_GETS, SS) {
2387 d_sendDataToL1GETS;
2388 r_setMRU;
2389 o_popL1RequestQueue;
2390 }
2391
2392 transition(SS, Unblock, SLS) {
2393 g_recordLocalSharer;
2394 n_popResponseQueue;
2395 }
2396
2397 transition(O, L1_GETS, OO) {
2398 d_sendDataToL1GETS;
2399 r_setMRU;
2400 o_popL1RequestQueue;
2401 }
2402
2403 transition(OO, Unblock, OLS) {
2404 g_recordLocalSharer;
2405 n_popResponseQueue;
2406 }
2407
2408 transition(OO, Exclusive_Unblock, ILX) {
2409 g_recordLocalExclusive
2410 y_copyCacheStateToDir;
2411 rr_deallocateL2CacheBlock;
2412 n_popResponseQueue;
2413 }
2414
2415
2416 // L1 WRITEBACKS
2417 transition(ILO, L1_PUTO, ILOW) {
2418 l_writebackAckNeedData;
2419 o_popL1RequestQueue;
2420 }
2421
2422 transition(ILOX, L1_PUTO, ILOXW) {
2423 l_writebackAckNeedData;
2424 o_popL1RequestQueue;
2425 }
2426
2427
2428 transition(ILOS, L1_PUTO, ILOSW) {
2429 l_writebackAckNeedData;
2430 o_popL1RequestQueue;
2431 }
2432
2433 transition(ILOSX, L1_PUTO, ILOSXW) {
2434 l_writebackAckNeedData;
2435 o_popL1RequestQueue;
2436 }
2437
2438
2439 // hmmm...keep data or drop. Just drop for now
2440 transition(ILOS, L1_PUTS_only, ILOW) {
2441 l_writebackAckDropData;
2442 o_popL1RequestQueue;
2443 }
2444
2445 transition(ILSW, Unblock, ILS) {
2446 gg_clearSharerFromL1Response;
2447 n_popResponseQueue;
2448 }
2449
2450 transition(ILOW, Unblock, ILO) {
2451 gg_clearSharerFromL1Response;
2452 n_popResponseQueue;
2453 }
2454
2455 transition(ILOSX, L1_PUTS_only, ILOXW) {
2456 l_writebackAckDropData;
2457 o_popL1RequestQueue;
2458 }
2459
2460 transition(ILOXW, Unblock, ILOX) {
2461 gg_clearSharerFromL1Response;
2462 n_popResponseQueue;
2463 }
2464
2465 // hmmm...keep data or drop. Just drop for now
2466 transition(ILOS, L1_PUTS, ILOSW) {
2467 l_writebackAckDropData;
2468 o_popL1RequestQueue;
2469 }
2470
2471 transition(ILOSX, L1_PUTS, ILOSXW) {
2472 l_writebackAckDropData;
2473 o_popL1RequestQueue;
2474 }
2475
2476 transition(ILOSW, Unblock, ILOS) {
2477 gg_clearSharerFromL1Response;
2478 n_popResponseQueue;
2479 }
2480
2481 transition(ILOSXW, Unblock, ILOSX) {
2482 gg_clearSharerFromL1Response;
2483 n_popResponseQueue;
2484 }
2485
2486 transition(SLS, L1_PUTS, SLSW) {
2487 l_writebackAckDropData;
2488 o_popL1RequestQueue;
2489 }
2490
2491 transition(SLS, L1_PUTS_only, SW) {
2492 l_writebackAckDropData;
2493 o_popL1RequestQueue;
2494 }
2495
2496 transition(SW, {Unblock}, S) {
2497 gg_clearSharerFromL1Response;
2498 n_popResponseQueue;
2499 }
2500
2501 transition(OLS, L1_PUTS, OLSW) {
2502 l_writebackAckDropData;
2503 o_popL1RequestQueue;
2504 }
2505
2506 transition(ILS, L1_PUTS, ILSW) {
2507 l_writebackAckNeedData;
2508 o_popL1RequestQueue;
2509 }
2510
2511 transition(ILS, L1_PUTS_only, IW) {
2512 l_writebackAckNeedData;
2513 o_popL1RequestQueue;
2514 }
2515
2516 transition(OLS, L1_PUTS_only, OW) {
2517 l_writebackAckDropData;
2518 o_popL1RequestQueue;
2519 }
2520
2521 transition(OLSX, L1_PUTS_only, OXW) {
2522 l_writebackAckDropData;
2523 o_popL1RequestQueue;
2524 }
2525
2526 transition(OLSX, L1_PUTS, OLSXW) {
2527 l_writebackAckDropData;
2528 o_popL1RequestQueue;
2529 }
2530
2531 transition(OLSXW, {Unblock}, OLSX) {
2532 gg_clearSharerFromL1Response;
2533 n_popResponseQueue;
2534 }
2535
2536 transition(OW, {Unblock}, O) {
2537 gg_clearSharerFromL1Response;
2538 n_popResponseQueue;
2539 }
2540
2541 transition(OXW, {Unblock}, M) {
2542 gg_clearSharerFromL1Response;
2543 n_popResponseQueue;
2544 }
2545
2546 transition(ILX, L1_PUTX, ILXW ) {
2547 l_writebackAckNeedData;
2548 o_popL1RequestQueue;
2549 }
2550
2551 transition(ILXW, L1_WBDIRTYDATA, M) {
2552 gg_clearLocalSharers;
2553 vv_allocateL2CacheBlock;
2554 y_copyDirToCacheAndRemove;
2555 u_writeDataToCache;
2556 n_popResponseQueue;
2557 }
2558
2559 // clean writeback
2560 transition(ILXW, L1_WBCLEANDATA, M) {
2561 gg_clearLocalSharers;
2562 vv_allocateL2CacheBlock;
2563 y_copyDirToCacheAndRemove;
2564 u_writeDataToCache;
2565 n_popResponseQueue;
2566 }
2567
2568 transition(ILXW, Unblock, ILX) {
2569 // writeback canceled because L1 invalidated
2570 n_popResponseQueue;
2571 }
2572
2573 transition(ILSW, L1_WBCLEANDATA, SLS) {
2574 vv_allocateL2CacheBlock;
2575 y_copyDirToCacheAndRemove;
2576 u_writeDataToCache;
2577 gg_clearSharerFromL1Response;
2578 n_popResponseQueue;
2579 }
2580
2581 transition(IW, L1_WBCLEANDATA, S) {
2582 vv_allocateL2CacheBlock;
2583 y_copyDirToCacheAndRemove;
2584 u_writeDataToCache;
2585 gg_clearSharerFromL1Response;
2586 n_popResponseQueue;
2587
2588 }
2589
2590 // Owner can have dirty data
2591 transition(ILOW, {L1_WBCLEANDATA, L1_WBDIRTYDATA}, O) {
2592 vv_allocateL2CacheBlock;
2593 y_copyDirToCacheAndRemove;
2594 gg_clearOwnerFromL1Response;
2595 u_writeDataToCache;
2596 n_popResponseQueue;
2597 }
2598
2599 transition(ILOXW, L1_WBDIRTYDATA, M) {
2600 vv_allocateL2CacheBlock;
2601 y_copyDirToCacheAndRemove;
2602 gg_clearOwnerFromL1Response;
2603 u_writeDataToCache;
2604 n_popResponseQueue;
2605 }
2606
2607 transition(ILOXW, L1_WBCLEANDATA, M) {
2608 vv_allocateL2CacheBlock;
2609 y_copyDirToCacheAndRemove;
2610 gg_clearOwnerFromL1Response;
2611 u_writeDataToCache;
2612 n_popResponseQueue;
2613 }
2614
2615 transition(ILOSW, {L1_WBCLEANDATA, L1_WBDIRTYDATA}, OLS) {
2616 vv_allocateL2CacheBlock;
2617 y_copyDirToCacheAndRemove;
2618 gg_clearOwnerFromL1Response;
2619 u_writeDataToCache;
2620 n_popResponseQueue;
2621 }
2622
2623 transition(ILOSXW, {L1_WBCLEANDATA, L1_WBDIRTYDATA}, OLSX) {
2624 vv_allocateL2CacheBlock;
2625 y_copyDirToCacheAndRemove;
2626 gg_clearOwnerFromL1Response;
2627 u_writeDataToCache;
2628 n_popResponseQueue;
2629 }
2630
2631
2632 transition(SLSW, {Unblock}, SLS) {
2633 gg_clearSharerFromL1Response;
2634 n_popResponseQueue;
2635 }
2636
2637 transition(OLSW, {Unblock}, OLS) {
2638 gg_clearSharerFromL1Response;
2639 n_popResponseQueue;
2640 }
2641
2642
2643 // L2 WRITEBACKS
2644 transition({I, S}, L2_Replacement, I) {
2645 rr_deallocateL2CacheBlock;
2646 }
2647
2648 transition(ILS, L2_Replacement) {
2649 y_copyCacheStateToDir;
2650 rr_deallocateL2CacheBlock;
2651 }
2652
2653 transition(ILX, L2_Replacement ) {
2654 y_copyCacheStateToDir;
2655 rr_deallocateL2CacheBlock;
2656 }
2657
2658 transition({ILO, ILOS}, L2_Replacement ) {
2659 y_copyCacheStateToDir;
2660 rr_deallocateL2CacheBlock;
2661 }
2662
2663 transition(SLS, L2_Replacement, ILS) {
2664 y_copyCacheStateToDir;
2665 rr_deallocateL2CacheBlock;
2666 }
2667
2668 transition({OLS, OLSX}, L2_Replacement, OLSI) {
2669 y_copyCacheStateToDir;
2670 b_issuePUTO_ls;
2671 i_allocateTBE;
2672 rr_deallocateL2CacheBlock;
2673 }
2674
2675
2676 transition(O, L2_Replacement, OI) {
2677 b_issuePUTO;
2678 i_allocateTBE;
2679 rr_deallocateL2CacheBlock;
2680 }
2681
2682 transition(M, L2_Replacement, MI) {
2683 b_issuePUTX;
2684 i_allocateTBE;
2685 rr_deallocateL2CacheBlock;
2686 }
2687
2688 transition(OLSI, Fwd_GETX, ILSI) {
2689 t_recordFwdXID;
2690 ee_sendLocalInv;
2691 m_popRequestQueue;
2692 }
2693
2694 transition(ILSI, IntAck) {
2695 m_decrementNumberOfMessagesInt;
2696 o_checkForIntCompletion;
2697 n_popResponseQueue;
2698 }
2699
2700 transition(ILSI, All_Acks, MII) {
2701 gg_clearLocalSharers;
2702 c_sendDataFromTBEToFwdGETX;
2703 n_popTriggerQueue;
2704 }
2705
2706 transition(OLSI, Fwd_GETS) {
2707 t_recordFwdSID;
2708 c_sendDataFromTBEToFwdGETS;
2709 m_popRequestQueue;
2710 }
2711
2712 transition({MI, OI}, Fwd_GETS, OI) {
2713 t_recordFwdSID;
2714 c_sendDataFromTBEToFwdGETS;
2715 m_popRequestQueue;
2716 }
2717
2718 transition({MI, OI}, Fwd_DMA, OI) {
2719 cd_sendDataFromTBEToFwdDma;
2720 da_sendDmaAckUnblock;
2721 m_popRequestQueue;
2722 }
2723
2724 transition(OLSI, Fwd_DMA) {
2725 cd_sendDataFromTBEToFwdDma;
2726 da_sendDmaAckUnblock;
2727 m_popRequestQueue;
2728 }
2729
2730 transition({MI, OI}, Fwd_GETX, MII) {
2731 t_recordFwdXID;
2732 c_sendDataFromTBEToFwdGETX;
2733 m_popRequestQueue;
2734 }
2735
2736 transition({MI, OI}, Writeback_Ack, I) {
2737 qq_sendDataFromTBEToMemory;
2738 s_deallocateTBE;
2739 m_popRequestQueue;
2740 }
2741
2742 transition(MII, Writeback_Nack, I) {
2743 s_deallocateTBE;
2744 m_popRequestQueue;
2745 }
2746
2747 transition(OI, Writeback_Nack) {
2748 b_issuePUTO;
2749 m_popRequestQueue;
2750 }
2751
2752 transition(OLSI, Writeback_Ack, ILS) {
2753 qq_sendDataFromTBEToMemory;
2754 s_deallocateTBE;
2755 m_popRequestQueue;
2756 }
2757
2758 transition(MII, Writeback_Ack, I) {
2759 f_sendUnblock;
2760 s_deallocateTBE;
2761 m_popRequestQueue;
2762 }
2763
2764 transition(ILSI, Writeback_Ack, ILS) {
2765 f_sendUnblock;
2766 s_deallocateTBE;
2767 m_popRequestQueue;
2768 }
2769 }