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