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