2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * Copyright (c) 2009 Advanced Micro Devices, Inc.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer;
10 * redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution;
13 * neither the name of the copyright holders nor the names of its
14 * contributors may be used to endorse or promote products derived from
15 * this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 * AMD's contributions to the MOESI hammer protocol do not constitute an
30 * endorsement of its similarity to any AMD products.
32 * Authors: Milo Martin
36 machine(L1Cache, "AMD Hammer-like protocol")
37 : Sequencer * sequencer,
38 CacheMemory * L1IcacheMemory,
39 CacheMemory * L1DcacheMemory,
40 CacheMemory * L2cacheMemory,
41 int cache_response_latency = 10,
42 int issue_latency = 2,
43 int l2_cache_hit_latency = 10,
44 bool no_mig_atomic = true
48 MessageBuffer requestFromCache, network="To", virtual_network="2", ordered="false";
49 MessageBuffer responseFromCache, network="To", virtual_network="4", ordered="false";
50 MessageBuffer unblockFromCache, network="To", virtual_network="5", ordered="false";
52 MessageBuffer forwardToCache, network="From", virtual_network="3", ordered="false";
53 MessageBuffer responseToCache, network="From", virtual_network="4", ordered="false";
57 enumeration(State, desc="Cache states", default="L1Cache_State_I") {
62 M, desc="Modified (dirty)";
63 MM, desc="Modified (dirty and locally modified)";
66 IM, "IM", desc="Issued GetX";
67 SM, "SM", desc="Issued GetX, we still have an old copy of the line";
68 OM, "OM", desc="Issued GetX, received data";
69 ISM, "ISM", desc="Issued GetX, received data, waiting for all acks";
70 M_W, "M^W", desc="Issued GetS, received exclusive data";
71 MM_W, "MM^W", desc="Issued GetX, received exclusive data";
72 IS, "IS", desc="Issued GetS";
73 SS, "SS", desc="Issued GetS, received data, waiting for all acks";
74 OI, "OI", desc="Issued PutO, waiting for ack";
75 MI, "MI", desc="Issued PutX, waiting for ack";
76 II, "II", desc="Issued PutX/O, saw Other_GETS or Other_GETX, waiting for ack";
77 IT, "IT", desc="Invalid block transferring to L1";
78 ST, "ST", desc="S block transferring to L1";
79 OT, "OT", desc="O block transferring to L1";
80 MT, "MT", desc="M block transferring to L1";
81 MMT, "MMT", desc="MM block transferring to L1";
85 enumeration(Event, desc="Cache events") {
86 Load, desc="Load request from the processor";
87 Ifetch, desc="I-fetch request from the processor";
88 Store, desc="Store request from the processor";
89 L2_Replacement, desc="L2 Replacement";
90 L1_to_L2, desc="L1 to L2 transfer";
91 Trigger_L2_to_L1D, desc="Trigger L2 to L1-Data transfer";
92 Trigger_L2_to_L1I, desc="Trigger L2 to L1-Instruction transfer";
93 Complete_L2_to_L1, desc="L2 to L1 transfer completed";
96 Other_GETX, desc="A GetX from another processor";
97 Other_GETS, desc="A GetS from another processor";
98 Merged_GETS, desc="A Merged GetS from another processor";
99 Other_GETS_No_Mig, desc="A GetS from another processor";
100 NC_DMA_GETS, desc="special GetS when only DMA exists";
101 Invalidate, desc="Invalidate block";
104 Ack, desc="Received an ack message";
105 Shared_Ack, desc="Received an ack message, responder has a shared copy";
106 Data, desc="Received a data message";
107 Shared_Data, desc="Received a data message, responder has a shared copy";
108 Exclusive_Data, desc="Received a data message, responder had an exclusive copy, they gave it to us";
110 Writeback_Ack, desc="Writeback O.K. from directory";
111 Writeback_Nack, desc="Writeback not O.K. from directory";
114 All_acks, desc="Received all required data and message acks";
115 All_acks_no_sharers, desc="Received all acks and no other processor has a shared copy";
120 // STRUCTURE DEFINITIONS
122 MessageBuffer mandatoryQueue, ordered="false";
125 structure(Entry, desc="...", interface="AbstractCacheEntry") {
126 State CacheState, desc="cache state";
127 bool Dirty, desc="Is the data dirty (different than memory)?";
128 DataBlock DataBlk, desc="data for the block";
129 bool FromL2, default="false", desc="block just moved from L2";
130 bool AtomicAccessed, default="false", desc="block just moved from L2";
134 structure(TBE, desc="...") {
135 State TBEState, desc="Transient state";
136 DataBlock DataBlk, desc="data for the block, required for concurrent writebacks";
137 bool Dirty, desc="Is the data dirty (different than memory)?";
138 int NumPendingMsgs, desc="Number of acks/data messages that this processor is waiting for";
139 bool Sharers, desc="On a GetS, did we find any other sharers in the system";
140 bool AppliedSilentAcks, default="false", desc="for full-bit dir, does the pending msg count reflect the silent acks";
141 MachineID LastResponder, desc="last machine to send a response for this request";
142 MachineID CurOwner, desc="current owner of the block, used for UnblockS responses";
143 Time InitialRequestTime, default="0", desc="time the initial requests was sent from the L1Cache";
144 Time ForwardRequestTime, default="0", desc="time the dir forwarded the request";
145 Time FirstResponseTime, default="0", desc="the time the first response was received";
148 external_type(TBETable) {
150 void allocate(Address);
151 void deallocate(Address);
152 bool isPresent(Address);
155 TBETable TBEs, template_hack="<L1Cache_TBE>";
157 void set_cache_entry(AbstractCacheEntry b);
158 void unset_cache_entry();
162 Entry getCacheEntry(Address address), return_by_pointer="yes" {
163 Entry L2cache_entry := static_cast(Entry, "pointer", L2cacheMemory.lookup(address));
164 if(is_valid(L2cache_entry)) {
165 return L2cache_entry;
168 Entry L1Dcache_entry := static_cast(Entry, "pointer", L1DcacheMemory.lookup(address));
169 if(is_valid(L1Dcache_entry)) {
170 return L1Dcache_entry;
173 Entry L1Icache_entry := static_cast(Entry, "pointer", L1IcacheMemory.lookup(address));
174 return L1Icache_entry;
177 Entry getL2CacheEntry(Address address), return_by_pointer="yes" {
178 Entry L2cache_entry := static_cast(Entry, "pointer", L2cacheMemory.lookup(address));
179 return L2cache_entry;
182 Entry getL1DCacheEntry(Address address), return_by_pointer="yes" {
183 Entry L1Dcache_entry := static_cast(Entry, "pointer", L1DcacheMemory.lookup(address));
184 return L1Dcache_entry;
187 Entry getL1ICacheEntry(Address address), return_by_pointer="yes" {
188 Entry L1Icache_entry := static_cast(Entry, "pointer", L1IcacheMemory.lookup(address));
189 return L1Icache_entry;
192 State getState(TBE tbe, Entry cache_entry, Address addr) {
195 } else if (is_valid(cache_entry)) {
196 return cache_entry.CacheState;
201 void setState(TBE tbe, Entry cache_entry, Address addr, State state) {
202 assert((L1DcacheMemory.isTagPresent(addr) && L1IcacheMemory.isTagPresent(addr)) == false);
203 assert((L1IcacheMemory.isTagPresent(addr) && L2cacheMemory.isTagPresent(addr)) == false);
204 assert((L1DcacheMemory.isTagPresent(addr) && L2cacheMemory.isTagPresent(addr)) == false);
207 tbe.TBEState := state;
210 if (is_valid(cache_entry)) {
211 cache_entry.CacheState := state;
214 if ((state == State:MM) ||
215 (state == State:MM_W)) {
216 cache_entry.changePermission(AccessPermission:Read_Write);
217 } else if (state == State:S ||
220 state == State:M_W ||
222 state == State:ISM ||
225 cache_entry.changePermission(AccessPermission:Read_Only);
227 cache_entry.changePermission(AccessPermission:Invalid);
232 Event mandatory_request_type_to_event(CacheRequestType type) {
233 if (type == CacheRequestType:LD) {
235 } else if (type == CacheRequestType:IFETCH) {
237 } else if ((type == CacheRequestType:ST) || (type == CacheRequestType:ATOMIC)) {
240 error("Invalid CacheRequestType");
244 GenericMachineType getNondirectHitMachType(Address addr, MachineID sender) {
245 if (machineIDToMachineType(sender) == MachineType:L1Cache) {
247 // NOTE direct local hits should not call this
249 return GenericMachineType:L1Cache_wCC;
251 return ConvertMachToGenericMach(machineIDToMachineType(sender));
255 GenericMachineType testAndClearLocalHit(Entry cache_entry) {
256 if (is_valid(cache_entry) && cache_entry.FromL2) {
257 cache_entry.FromL2 := false;
258 return GenericMachineType:L2Cache;
260 return GenericMachineType:L1Cache;
264 bool IsAtomicAccessed(Entry cache_entry) {
265 assert(is_valid(cache_entry));
266 return cache_entry.AtomicAccessed;
269 MessageBuffer triggerQueue, ordered="false";
273 out_port(requestNetwork_out, RequestMsg, requestFromCache);
274 out_port(responseNetwork_out, ResponseMsg, responseFromCache);
275 out_port(unblockNetwork_out, ResponseMsg, unblockFromCache);
276 out_port(triggerQueue_out, TriggerMsg, triggerQueue);
281 in_port(triggerQueue_in, TriggerMsg, triggerQueue, rank=3) {
282 if (triggerQueue_in.isReady()) {
283 peek(triggerQueue_in, TriggerMsg) {
285 Entry cache_entry := getCacheEntry(in_msg.Address);
286 TBE tbe := TBEs[in_msg.Address];
288 if (in_msg.Type == TriggerType:L2_to_L1) {
289 trigger(Event:Complete_L2_to_L1, in_msg.Address, cache_entry, tbe);
290 } else if (in_msg.Type == TriggerType:ALL_ACKS) {
291 trigger(Event:All_acks, in_msg.Address, cache_entry, tbe);
292 } else if (in_msg.Type == TriggerType:ALL_ACKS_NO_SHARERS) {
293 trigger(Event:All_acks_no_sharers, in_msg.Address, cache_entry, tbe);
295 error("Unexpected message");
301 // Nothing from the unblock network
304 in_port(responseToCache_in, ResponseMsg, responseToCache, rank=2) {
305 if (responseToCache_in.isReady()) {
306 peek(responseToCache_in, ResponseMsg, block_on="Address") {
308 Entry cache_entry := getCacheEntry(in_msg.Address);
309 TBE tbe := TBEs[in_msg.Address];
311 if (in_msg.Type == CoherenceResponseType:ACK) {
312 trigger(Event:Ack, in_msg.Address, cache_entry, tbe);
313 } else if (in_msg.Type == CoherenceResponseType:ACK_SHARED) {
314 trigger(Event:Shared_Ack, in_msg.Address, cache_entry, tbe);
315 } else if (in_msg.Type == CoherenceResponseType:DATA) {
316 trigger(Event:Data, in_msg.Address, cache_entry, tbe);
317 } else if (in_msg.Type == CoherenceResponseType:DATA_SHARED) {
318 trigger(Event:Shared_Data, in_msg.Address, cache_entry, tbe);
319 } else if (in_msg.Type == CoherenceResponseType:DATA_EXCLUSIVE) {
320 trigger(Event:Exclusive_Data, in_msg.Address, cache_entry, tbe);
322 error("Unexpected message");
329 in_port(forwardToCache_in, RequestMsg, forwardToCache, rank=1) {
330 if (forwardToCache_in.isReady()) {
331 peek(forwardToCache_in, RequestMsg, block_on="Address") {
333 Entry cache_entry := getCacheEntry(in_msg.Address);
334 TBE tbe := TBEs[in_msg.Address];
336 if (in_msg.Type == CoherenceRequestType:GETX) {
337 trigger(Event:Other_GETX, in_msg.Address, cache_entry, tbe);
338 } else if (in_msg.Type == CoherenceRequestType:MERGED_GETS) {
339 trigger(Event:Merged_GETS, in_msg.Address, cache_entry, tbe);
340 } else if (in_msg.Type == CoherenceRequestType:GETS) {
341 if (machineCount(MachineType:L1Cache) > 1) {
342 if (is_valid(cache_entry)) {
343 if (IsAtomicAccessed(cache_entry) && no_mig_atomic) {
344 trigger(Event:Other_GETS_No_Mig, in_msg.Address, cache_entry, tbe);
346 trigger(Event:Other_GETS, in_msg.Address, cache_entry, tbe);
349 trigger(Event:Other_GETS, in_msg.Address, cache_entry, tbe);
352 trigger(Event:NC_DMA_GETS, in_msg.Address, cache_entry, tbe);
354 } else if (in_msg.Type == CoherenceRequestType:INV) {
355 trigger(Event:Invalidate, in_msg.Address, cache_entry, tbe);
356 } else if (in_msg.Type == CoherenceRequestType:WB_ACK) {
357 trigger(Event:Writeback_Ack, in_msg.Address, cache_entry, tbe);
358 } else if (in_msg.Type == CoherenceRequestType:WB_NACK) {
359 trigger(Event:Writeback_Nack, in_msg.Address, cache_entry, tbe);
361 error("Unexpected message");
367 // Nothing from the request network
370 in_port(mandatoryQueue_in, CacheMsg, mandatoryQueue, desc="...", rank=0) {
371 if (mandatoryQueue_in.isReady()) {
372 peek(mandatoryQueue_in, CacheMsg, block_on="LineAddress") {
374 // Check for data access to blocks in I-cache and ifetchs to blocks in D-cache
375 TBE tbe := TBEs[in_msg.LineAddress];
377 if (in_msg.Type == CacheRequestType:IFETCH) {
378 // ** INSTRUCTION ACCESS ***
380 // Check to see if it is in the OTHER L1
381 Entry L1Dcache_entry := getL1DCacheEntry(in_msg.LineAddress);
382 if (is_valid(L1Dcache_entry)) {
383 // The block is in the wrong L1, try to write it to the L2
384 if (L2cacheMemory.cacheAvail(in_msg.LineAddress)) {
385 trigger(Event:L1_to_L2, in_msg.LineAddress, L1Dcache_entry, tbe);
387 trigger(Event:L2_Replacement,
388 L2cacheMemory.cacheProbe(in_msg.LineAddress),
389 getL2CacheEntry(L2cacheMemory.cacheProbe(in_msg.LineAddress)),
390 TBEs[L2cacheMemory.cacheProbe(in_msg.LineAddress)]);
394 Entry L1Icache_entry := getL1ICacheEntry(in_msg.LineAddress);
395 if (is_valid(L1Icache_entry)) {
396 // The tag matches for the L1, so the L1 fetches the line. We know it can't be in the L2 due to exclusion
397 trigger(mandatory_request_type_to_event(in_msg.Type),
398 in_msg.LineAddress, L1Icache_entry, tbe);
400 if (L1IcacheMemory.cacheAvail(in_msg.LineAddress)) {
401 // L1 does't have the line, but we have space for it in the L1
403 Entry L2cache_entry := getL2CacheEntry(in_msg.LineAddress);
404 if (is_valid(L2cache_entry)) {
405 // L2 has it (maybe not with the right permissions)
406 trigger(Event:Trigger_L2_to_L1I, in_msg.LineAddress,
409 // We have room, the L2 doesn't have it, so the L1 fetches the line
410 trigger(mandatory_request_type_to_event(in_msg.Type),
411 in_msg.LineAddress, L1Icache_entry, tbe);
414 // No room in the L1, so we need to make room
415 if (L2cacheMemory.cacheAvail(L1IcacheMemory.cacheProbe(in_msg.LineAddress))) {
416 // The L2 has room, so we move the line from the L1 to the L2
417 trigger(Event:L1_to_L2,
418 L1IcacheMemory.cacheProbe(in_msg.LineAddress),
419 getL1ICacheEntry(L1IcacheMemory.cacheProbe(in_msg.LineAddress)),
420 TBEs[L1IcacheMemory.cacheProbe(in_msg.LineAddress)]);
422 // The L2 does not have room, so we replace a line from the L2
423 trigger(Event:L2_Replacement,
424 L2cacheMemory.cacheProbe(L1IcacheMemory.cacheProbe(in_msg.LineAddress)),
425 getL2CacheEntry(L2cacheMemory.cacheProbe(L1IcacheMemory.cacheProbe(in_msg.LineAddress))),
426 TBEs[L2cacheMemory.cacheProbe(L1IcacheMemory.cacheProbe(in_msg.LineAddress))]);
431 // *** DATA ACCESS ***
433 // Check to see if it is in the OTHER L1
434 Entry L1Icache_entry := getL1ICacheEntry(in_msg.LineAddress);
435 if (is_valid(L1Icache_entry)) {
436 // The block is in the wrong L1, try to write it to the L2
437 if (L2cacheMemory.cacheAvail(in_msg.LineAddress)) {
438 trigger(Event:L1_to_L2, in_msg.LineAddress, L1Icache_entry, tbe);
440 trigger(Event:L2_Replacement,
441 L2cacheMemory.cacheProbe(in_msg.LineAddress),
442 getL2CacheEntry(L2cacheMemory.cacheProbe(in_msg.LineAddress)),
443 TBEs[L2cacheMemory.cacheProbe(in_msg.LineAddress)]);
447 Entry L1Dcache_entry := getL1DCacheEntry(in_msg.LineAddress);
448 if (is_valid(L1Dcache_entry)) {
449 // The tag matches for the L1, so the L1 fetches the line. We know it can't be in the L2 due to exclusion
450 trigger(mandatory_request_type_to_event(in_msg.Type),
451 in_msg.LineAddress, L1Dcache_entry, tbe);
453 if (L1DcacheMemory.cacheAvail(in_msg.LineAddress)) {
454 // L1 does't have the line, but we have space for it in the L1
455 Entry L2cache_entry := getL2CacheEntry(in_msg.LineAddress);
456 if (is_valid(L2cache_entry)) {
457 // L2 has it (maybe not with the right permissions)
458 trigger(Event:Trigger_L2_to_L1D, in_msg.LineAddress,
461 // We have room, the L2 doesn't have it, so the L1 fetches the line
462 trigger(mandatory_request_type_to_event(in_msg.Type),
463 in_msg.LineAddress, L1Dcache_entry, tbe);
466 // No room in the L1, so we need to make room
467 if (L2cacheMemory.cacheAvail(L1DcacheMemory.cacheProbe(in_msg.LineAddress))) {
468 // The L2 has room, so we move the line from the L1 to the L2
469 trigger(Event:L1_to_L2,
470 L1DcacheMemory.cacheProbe(in_msg.LineAddress),
471 getL1DCacheEntry(L1DcacheMemory.cacheProbe(in_msg.LineAddress)),
472 TBEs[L1DcacheMemory.cacheProbe(in_msg.LineAddress)]);
474 // The L2 does not have room, so we replace a line from the L2
475 trigger(Event:L2_Replacement,
476 L2cacheMemory.cacheProbe(L1DcacheMemory.cacheProbe(in_msg.LineAddress)),
477 getL2CacheEntry(L2cacheMemory.cacheProbe(L1DcacheMemory.cacheProbe(in_msg.LineAddress))),
478 TBEs[L2cacheMemory.cacheProbe(L1DcacheMemory.cacheProbe(in_msg.LineAddress))]);
489 action(a_issueGETS, "a", desc="Issue GETS") {
490 enqueue(requestNetwork_out, RequestMsg, latency=issue_latency) {
491 assert(is_valid(tbe));
492 out_msg.Address := address;
493 out_msg.Type := CoherenceRequestType:GETS;
494 out_msg.Requestor := machineID;
495 out_msg.Destination.add(map_Address_to_Directory(address));
496 out_msg.MessageSize := MessageSizeType:Request_Control;
497 out_msg.InitialRequestTime := get_time();
498 tbe.NumPendingMsgs := machineCount(MachineType:L1Cache); // One from each other cache (n-1) plus the memory (+1)
502 action(b_issueGETX, "b", desc="Issue GETX") {
503 enqueue(requestNetwork_out, RequestMsg, latency=issue_latency) {
504 assert(is_valid(tbe));
505 out_msg.Address := address;
506 out_msg.Type := CoherenceRequestType:GETX;
507 out_msg.Requestor := machineID;
508 out_msg.Destination.add(map_Address_to_Directory(address));
509 out_msg.MessageSize := MessageSizeType:Request_Control;
510 out_msg.InitialRequestTime := get_time();
511 tbe.NumPendingMsgs := machineCount(MachineType:L1Cache); // One from each other cache (n-1) plus the memory (+1)
515 action(c_sendExclusiveData, "c", desc="Send exclusive data from cache to requestor") {
516 peek(forwardToCache_in, RequestMsg) {
517 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
518 assert(is_valid(cache_entry));
519 out_msg.Address := address;
520 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
521 out_msg.Sender := machineID;
522 out_msg.Destination.add(in_msg.Requestor);
523 out_msg.DataBlk := cache_entry.DataBlk;
524 out_msg.Dirty := cache_entry.Dirty;
525 if (in_msg.DirectedProbe) {
526 out_msg.Acks := machineCount(MachineType:L1Cache);
530 out_msg.SilentAcks := in_msg.SilentAcks;
531 out_msg.MessageSize := MessageSizeType:Response_Data;
532 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
533 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
538 action(d_issuePUT, "d", desc="Issue PUT") {
539 enqueue(requestNetwork_out, RequestMsg, latency=issue_latency) {
540 out_msg.Address := address;
541 out_msg.Type := CoherenceRequestType:PUT;
542 out_msg.Requestor := machineID;
543 out_msg.Destination.add(map_Address_to_Directory(address));
544 out_msg.MessageSize := MessageSizeType:Writeback_Control;
548 action(e_sendData, "e", desc="Send data from cache to requestor") {
549 peek(forwardToCache_in, RequestMsg) {
550 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
551 assert(is_valid(cache_entry));
552 out_msg.Address := address;
553 out_msg.Type := CoherenceResponseType:DATA;
554 out_msg.Sender := machineID;
555 out_msg.Destination.add(in_msg.Requestor);
556 out_msg.DataBlk := cache_entry.DataBlk;
557 out_msg.Dirty := cache_entry.Dirty;
558 if (in_msg.DirectedProbe) {
559 out_msg.Acks := machineCount(MachineType:L1Cache);
563 out_msg.SilentAcks := in_msg.SilentAcks;
564 out_msg.MessageSize := MessageSizeType:Response_Data;
565 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
566 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
571 action(ee_sendDataShared, "\e", desc="Send data from cache to requestor, keep a shared copy") {
572 peek(forwardToCache_in, RequestMsg) {
573 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
574 assert(is_valid(cache_entry));
575 out_msg.Address := address;
576 out_msg.Type := CoherenceResponseType:DATA_SHARED;
577 out_msg.Sender := machineID;
578 out_msg.Destination.add(in_msg.Requestor);
579 out_msg.DataBlk := cache_entry.DataBlk;
580 out_msg.Dirty := cache_entry.Dirty;
581 DPRINTF(RubySlicc, "%s\n", out_msg.DataBlk);
582 if (in_msg.DirectedProbe) {
583 out_msg.Acks := machineCount(MachineType:L1Cache);
587 out_msg.SilentAcks := in_msg.SilentAcks;
588 out_msg.MessageSize := MessageSizeType:Response_Data;
589 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
590 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
595 action(em_sendDataSharedMultiple, "em", desc="Send data from cache to all requestors") {
596 peek(forwardToCache_in, RequestMsg) {
597 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
598 assert(is_valid(cache_entry));
599 out_msg.Address := address;
600 out_msg.Type := CoherenceResponseType:DATA_SHARED;
601 out_msg.Sender := machineID;
602 out_msg.Destination := in_msg.MergedRequestors;
603 out_msg.DataBlk := cache_entry.DataBlk;
604 out_msg.Dirty := cache_entry.Dirty;
605 DPRINTF(RubySlicc, "%s\n", out_msg.DataBlk);
606 out_msg.Acks := machineCount(MachineType:L1Cache);
607 out_msg.SilentAcks := in_msg.SilentAcks;
608 out_msg.MessageSize := MessageSizeType:Response_Data;
609 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
610 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
615 action(f_sendAck, "f", desc="Send ack from cache to requestor") {
616 peek(forwardToCache_in, RequestMsg) {
617 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
618 out_msg.Address := address;
619 out_msg.Type := CoherenceResponseType:ACK;
620 out_msg.Sender := machineID;
621 out_msg.Destination.add(in_msg.Requestor);
623 out_msg.SilentAcks := in_msg.SilentAcks;
624 assert(in_msg.DirectedProbe == false);
625 out_msg.MessageSize := MessageSizeType:Response_Control;
626 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
627 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
632 action(ff_sendAckShared, "\f", desc="Send shared ack from cache to requestor") {
633 peek(forwardToCache_in, RequestMsg) {
634 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
635 out_msg.Address := address;
636 out_msg.Type := CoherenceResponseType:ACK_SHARED;
637 out_msg.Sender := machineID;
638 out_msg.Destination.add(in_msg.Requestor);
640 out_msg.SilentAcks := in_msg.SilentAcks;
641 assert(in_msg.DirectedProbe == false);
642 out_msg.MessageSize := MessageSizeType:Response_Control;
643 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
644 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
649 action(g_sendUnblock, "g", desc="Send unblock to memory") {
650 enqueue(unblockNetwork_out, ResponseMsg, latency=cache_response_latency) {
651 out_msg.Address := address;
652 out_msg.Type := CoherenceResponseType:UNBLOCK;
653 out_msg.Sender := machineID;
654 out_msg.Destination.add(map_Address_to_Directory(address));
655 out_msg.MessageSize := MessageSizeType:Unblock_Control;
659 action(gm_sendUnblockM, "gm", desc="Send unblock to memory and indicate M/O/E state") {
660 enqueue(unblockNetwork_out, ResponseMsg, latency=cache_response_latency) {
661 out_msg.Address := address;
662 out_msg.Type := CoherenceResponseType:UNBLOCKM;
663 out_msg.Sender := machineID;
664 out_msg.Destination.add(map_Address_to_Directory(address));
665 out_msg.MessageSize := MessageSizeType:Unblock_Control;
669 action(gs_sendUnblockS, "gs", desc="Send unblock to memory and indicate S state") {
670 enqueue(unblockNetwork_out, ResponseMsg, latency=cache_response_latency) {
671 assert(is_valid(tbe));
672 out_msg.Address := address;
673 out_msg.Type := CoherenceResponseType:UNBLOCKS;
674 out_msg.Sender := machineID;
675 out_msg.CurOwner := tbe.CurOwner;
676 out_msg.Destination.add(map_Address_to_Directory(address));
677 out_msg.MessageSize := MessageSizeType:Unblock_Control;
681 action(h_load_hit, "h", desc="Notify sequencer the load completed.") {
682 assert(is_valid(cache_entry));
683 DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
684 sequencer.readCallback(address, testAndClearLocalHit(cache_entry),
685 cache_entry.DataBlk);
688 action(hx_external_load_hit, "hx", desc="load required external msgs") {
689 assert(is_valid(cache_entry));
690 assert(is_valid(tbe));
691 DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
692 peek(responseToCache_in, ResponseMsg) {
694 sequencer.readCallback(address,
695 getNondirectHitMachType(in_msg.Address, in_msg.Sender),
697 tbe.InitialRequestTime,
698 tbe.ForwardRequestTime,
699 tbe.FirstResponseTime);
703 action(hh_store_hit, "\h", desc="Notify sequencer that store completed.") {
704 assert(is_valid(cache_entry));
705 DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
706 peek(mandatoryQueue_in, CacheMsg) {
707 sequencer.writeCallback(address, testAndClearLocalHit(cache_entry),
708 cache_entry.DataBlk);
710 cache_entry.Dirty := true;
711 if (in_msg.Type == CacheRequestType:ATOMIC) {
712 cache_entry.AtomicAccessed := true;
717 action(sx_external_store_hit, "sx", desc="store required external msgs.") {
718 assert(is_valid(cache_entry));
719 assert(is_valid(tbe));
720 DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
721 peek(responseToCache_in, ResponseMsg) {
723 sequencer.writeCallback(address,
724 getNondirectHitMachType(address, in_msg.Sender),
726 tbe.InitialRequestTime,
727 tbe.ForwardRequestTime,
728 tbe.FirstResponseTime);
730 cache_entry.Dirty := true;
733 action(sxt_trig_ext_store_hit, "sxt", desc="store required external msgs.") {
734 assert(is_valid(cache_entry));
735 assert(is_valid(tbe));
736 DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
738 sequencer.writeCallback(address,
739 getNondirectHitMachType(address, tbe.LastResponder),
741 tbe.InitialRequestTime,
742 tbe.ForwardRequestTime,
743 tbe.FirstResponseTime);
745 cache_entry.Dirty := true;
748 action(i_allocateTBE, "i", desc="Allocate TBE") {
749 check_allocate(TBEs);
750 assert(is_valid(cache_entry));
751 TBEs.allocate(address);
752 set_tbe(TBEs[address]);
753 tbe.DataBlk := cache_entry.DataBlk; // Data only used for writebacks
754 tbe.Dirty := cache_entry.Dirty;
755 tbe.Sharers := false;
758 action(j_popTriggerQueue, "j", desc="Pop trigger queue.") {
759 triggerQueue_in.dequeue();
762 action(k_popMandatoryQueue, "k", desc="Pop mandatory queue.") {
763 mandatoryQueue_in.dequeue();
766 action(l_popForwardQueue, "l", desc="Pop forwareded request queue.") {
767 forwardToCache_in.dequeue();
770 action(hp_copyFromTBEToL2, "li", desc="Copy data from TBE to L2 cache entry.") {
771 assert(is_valid(cache_entry));
772 assert(is_valid(tbe));
773 cache_entry.Dirty := tbe.Dirty;
774 cache_entry.DataBlk := tbe.DataBlk;
777 action(nb_copyFromTBEToL1, "fu", desc="Copy data from TBE to L1 cache entry.") {
778 assert(is_valid(cache_entry));
779 assert(is_valid(tbe));
780 cache_entry.Dirty := tbe.Dirty;
781 cache_entry.DataBlk := tbe.DataBlk;
782 cache_entry.FromL2 := true;
785 action(m_decrementNumberOfMessages, "m", desc="Decrement the number of messages for which we're waiting") {
786 peek(responseToCache_in, ResponseMsg) {
787 assert(in_msg.Acks > 0);
788 assert(is_valid(tbe));
789 DPRINTF(RubySlicc, "Sender = %s\n", in_msg.Sender);
790 DPRINTF(RubySlicc, "SilentAcks = %d\n", in_msg.SilentAcks);
791 if (tbe.AppliedSilentAcks == false) {
792 tbe.NumPendingMsgs := tbe.NumPendingMsgs - in_msg.SilentAcks;
793 tbe.AppliedSilentAcks := true;
795 DPRINTF(RubySlicc, "%d\n", tbe.NumPendingMsgs);
796 tbe.NumPendingMsgs := tbe.NumPendingMsgs - in_msg.Acks;
797 DPRINTF(RubySlicc, "%d\n", tbe.NumPendingMsgs);
798 APPEND_TRANSITION_COMMENT(tbe.NumPendingMsgs);
799 APPEND_TRANSITION_COMMENT(in_msg.Sender);
800 tbe.LastResponder := in_msg.Sender;
801 if (tbe.InitialRequestTime != zero_time() && in_msg.InitialRequestTime != zero_time()) {
802 assert(tbe.InitialRequestTime == in_msg.InitialRequestTime);
804 if (in_msg.InitialRequestTime != zero_time()) {
805 tbe.InitialRequestTime := in_msg.InitialRequestTime;
807 if (tbe.ForwardRequestTime != zero_time() && in_msg.ForwardRequestTime != zero_time()) {
808 assert(tbe.ForwardRequestTime == in_msg.ForwardRequestTime);
810 if (in_msg.ForwardRequestTime != zero_time()) {
811 tbe.ForwardRequestTime := in_msg.ForwardRequestTime;
813 if (tbe.FirstResponseTime == zero_time()) {
814 tbe.FirstResponseTime := get_time();
818 action(uo_updateCurrentOwner, "uo", desc="When moving SS state, update current owner.") {
819 peek(responseToCache_in, ResponseMsg) {
820 assert(is_valid(tbe));
821 tbe.CurOwner := in_msg.Sender;
825 action(n_popResponseQueue, "n", desc="Pop response queue") {
826 responseToCache_in.dequeue();
829 action(ll_L2toL1Transfer, "ll", desc="") {
830 enqueue(triggerQueue_out, TriggerMsg, latency=l2_cache_hit_latency) {
831 out_msg.Address := address;
832 out_msg.Type := TriggerType:L2_to_L1;
836 action(o_checkForCompletion, "o", desc="Check if we have received all the messages required for completion") {
837 assert(is_valid(tbe));
838 if (tbe.NumPendingMsgs == 0) {
839 enqueue(triggerQueue_out, TriggerMsg) {
840 out_msg.Address := address;
842 out_msg.Type := TriggerType:ALL_ACKS;
844 out_msg.Type := TriggerType:ALL_ACKS_NO_SHARERS;
850 action(p_decrementNumberOfMessagesByOne, "p", desc="Decrement the number of messages for which we're waiting by one") {
851 assert(is_valid(tbe));
852 tbe.NumPendingMsgs := tbe.NumPendingMsgs - 1;
855 action(pp_incrementNumberOfMessagesByOne, "\p", desc="Increment the number of messages for which we're waiting by one") {
856 assert(is_valid(tbe));
857 tbe.NumPendingMsgs := tbe.NumPendingMsgs + 1;
860 action(q_sendDataFromTBEToCache, "q", desc="Send data from TBE to cache") {
861 peek(forwardToCache_in, RequestMsg) {
862 assert(in_msg.Requestor != machineID);
863 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
864 assert(is_valid(tbe));
865 out_msg.Address := address;
866 out_msg.Type := CoherenceResponseType:DATA;
867 out_msg.Sender := machineID;
868 out_msg.Destination.add(in_msg.Requestor);
869 DPRINTF(RubySlicc, "%s\n", out_msg.Destination);
870 out_msg.DataBlk := tbe.DataBlk;
871 out_msg.Dirty := tbe.Dirty;
872 if (in_msg.DirectedProbe) {
873 out_msg.Acks := machineCount(MachineType:L1Cache);
877 out_msg.SilentAcks := in_msg.SilentAcks;
878 out_msg.MessageSize := MessageSizeType:Response_Data;
879 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
880 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
885 action(qm_sendDataFromTBEToCache, "qm", desc="Send data from TBE to cache, multiple sharers") {
886 peek(forwardToCache_in, RequestMsg) {
887 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
888 assert(is_valid(tbe));
889 out_msg.Address := address;
890 out_msg.Type := CoherenceResponseType:DATA;
891 out_msg.Sender := machineID;
892 out_msg.Destination := in_msg.MergedRequestors;
893 DPRINTF(RubySlicc, "%s\n", out_msg.Destination);
894 out_msg.DataBlk := tbe.DataBlk;
895 out_msg.Dirty := tbe.Dirty;
896 out_msg.Acks := machineCount(MachineType:L1Cache);
897 out_msg.SilentAcks := in_msg.SilentAcks;
898 out_msg.MessageSize := MessageSizeType:Response_Data;
899 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
900 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
905 action(qq_sendDataFromTBEToMemory, "\q", desc="Send data from TBE to memory") {
906 enqueue(unblockNetwork_out, ResponseMsg, latency=cache_response_latency) {
907 assert(is_valid(tbe));
908 out_msg.Address := address;
909 out_msg.Sender := machineID;
910 out_msg.Destination.add(map_Address_to_Directory(address));
911 out_msg.Dirty := tbe.Dirty;
913 out_msg.Type := CoherenceResponseType:WB_DIRTY;
914 out_msg.DataBlk := tbe.DataBlk;
915 out_msg.MessageSize := MessageSizeType:Writeback_Data;
917 out_msg.Type := CoherenceResponseType:WB_CLEAN;
918 // NOTE: in a real system this would not send data. We send
919 // data here only so we can check it at the memory
920 out_msg.DataBlk := tbe.DataBlk;
921 out_msg.MessageSize := MessageSizeType:Writeback_Control;
926 action(r_setSharerBit, "r", desc="We saw other sharers") {
927 assert(is_valid(tbe));
931 action(s_deallocateTBE, "s", desc="Deallocate TBE") {
932 TBEs.deallocate(address);
936 action(t_sendExclusiveDataFromTBEToMemory, "t", desc="Send exclusive data from TBE to memory") {
937 enqueue(unblockNetwork_out, ResponseMsg, latency=cache_response_latency) {
938 assert(is_valid(tbe));
939 out_msg.Address := address;
940 out_msg.Sender := machineID;
941 out_msg.Destination.add(map_Address_to_Directory(address));
942 out_msg.DataBlk := tbe.DataBlk;
943 out_msg.Dirty := tbe.Dirty;
945 out_msg.Type := CoherenceResponseType:WB_EXCLUSIVE_DIRTY;
946 out_msg.DataBlk := tbe.DataBlk;
947 out_msg.MessageSize := MessageSizeType:Writeback_Data;
949 out_msg.Type := CoherenceResponseType:WB_EXCLUSIVE_CLEAN;
950 // NOTE: in a real system this would not send data. We send
951 // data here only so we can check it at the memory
952 out_msg.DataBlk := tbe.DataBlk;
953 out_msg.MessageSize := MessageSizeType:Writeback_Control;
958 action(u_writeDataToCache, "u", desc="Write data to cache") {
959 peek(responseToCache_in, ResponseMsg) {
960 assert(is_valid(cache_entry));
961 cache_entry.DataBlk := in_msg.DataBlk;
962 cache_entry.Dirty := in_msg.Dirty;
966 action(v_writeDataToCacheVerify, "v", desc="Write data to cache, assert it was same as before") {
967 peek(responseToCache_in, ResponseMsg) {
968 assert(is_valid(cache_entry));
969 DPRINTF(RubySlicc, "Cached Data Block: %s, Msg Data Block: %s\n",
970 cache_entry.DataBlk, in_msg.DataBlk);
971 assert(cache_entry.DataBlk == in_msg.DataBlk);
972 cache_entry.DataBlk := in_msg.DataBlk;
973 cache_entry.Dirty := in_msg.Dirty || cache_entry.Dirty;
977 action(gg_deallocateL1CacheBlock, "\g", desc="Deallocate cache block. Sets the cache to invalid, allowing a replacement in parallel with a fetch.") {
978 if (L1DcacheMemory.isTagPresent(address)) {
979 L1DcacheMemory.deallocate(address);
981 L1IcacheMemory.deallocate(address);
986 action(ii_allocateL1DCacheBlock, "\i", desc="Set L1 D-cache tag equal to tag of block B.") {
987 if (is_invalid(cache_entry)) {
988 set_cache_entry(L1DcacheMemory.allocate(address, new Entry));
992 action(jj_allocateL1ICacheBlock, "\j", desc="Set L1 I-cache tag equal to tag of block B.") {
993 if (is_invalid(cache_entry)) {
994 set_cache_entry(L1IcacheMemory.allocate(address, new Entry));
998 action(vv_allocateL2CacheBlock, "\v", desc="Set L2 cache tag equal to tag of block B.") {
999 set_cache_entry(L2cacheMemory.allocate(address, new Entry));
1002 action(rr_deallocateL2CacheBlock, "\r", desc="Deallocate L2 cache block. Sets the cache to not present, allowing a replacement in parallel with a fetch.") {
1003 L2cacheMemory.deallocate(address);
1004 unset_cache_entry();
1007 action(uu_profileMiss, "\u", desc="Profile the demand miss") {
1008 peek(mandatoryQueue_in, CacheMsg) {
1009 if (L1IcacheMemory.isTagPresent(address)) {
1010 L1IcacheMemory.profileMiss(in_msg);
1011 } else if (L1DcacheMemory.isTagPresent(address)) {
1012 L1DcacheMemory.profileMiss(in_msg);
1014 if (L2cacheMemory.isTagPresent(address) == false) {
1015 L2cacheMemory.profileMiss(in_msg);
1020 action(zz_stallAndWaitMandatoryQueue, "\z", desc="Send the head of the mandatory queue to the back of the queue.") {
1021 stall_and_wait(mandatoryQueue_in, address);
1024 action(kd_wakeUpDependents, "kd", desc="wake-up dependents") {
1025 wake_up_dependents(address);
1028 action(ka_wakeUpAllDependents, "ka", desc="wake-up all dependents") {
1029 wake_up_all_dependents();
1032 //*****************************************************
1034 //*****************************************************
1036 // Transitions for Load/Store/L2_Replacement from transient states
1037 transition({IM, SM, ISM, OM, IS, SS, OI, MI, II, IT, ST, OT, MT, MMT}, {Store, L2_Replacement}) {
1038 zz_stallAndWaitMandatoryQueue;
1041 transition({M_W, MM_W}, {L2_Replacement}) {
1042 zz_stallAndWaitMandatoryQueue;
1045 transition({IM, IS, OI, MI, II, IT, ST, OT, MT, MMT}, {Load, Ifetch}) {
1046 zz_stallAndWaitMandatoryQueue;
1049 transition({IM, SM, ISM, OM, IS, SS, MM_W, M_W, OI, MI, II, IT, ST, OT, MT, MMT}, L1_to_L2) {
1050 zz_stallAndWaitMandatoryQueue;
1053 transition({IT, ST, OT, MT, MMT}, {Other_GETX, NC_DMA_GETS, Other_GETS, Merged_GETS, Other_GETS_No_Mig, Invalidate}) {
1057 // Transitions moving data between the L1 and L2 caches
1058 transition({I, S, O, M, MM}, L1_to_L2) {
1060 gg_deallocateL1CacheBlock;
1061 vv_allocateL2CacheBlock;
1064 ka_wakeUpAllDependents;
1067 transition(I, Trigger_L2_to_L1D, IT) {
1069 rr_deallocateL2CacheBlock;
1070 ii_allocateL1DCacheBlock;
1071 nb_copyFromTBEToL1; // Not really needed for state I
1074 zz_stallAndWaitMandatoryQueue;
1078 transition(S, Trigger_L2_to_L1D, ST) {
1080 rr_deallocateL2CacheBlock;
1081 ii_allocateL1DCacheBlock;
1085 zz_stallAndWaitMandatoryQueue;
1089 transition(O, Trigger_L2_to_L1D, OT) {
1091 rr_deallocateL2CacheBlock;
1092 ii_allocateL1DCacheBlock;
1096 zz_stallAndWaitMandatoryQueue;
1100 transition(M, Trigger_L2_to_L1D, MT) {
1102 rr_deallocateL2CacheBlock;
1103 ii_allocateL1DCacheBlock;
1107 zz_stallAndWaitMandatoryQueue;
1111 transition(MM, Trigger_L2_to_L1D, MMT) {
1113 rr_deallocateL2CacheBlock;
1114 ii_allocateL1DCacheBlock;
1118 zz_stallAndWaitMandatoryQueue;
1122 transition(I, Trigger_L2_to_L1I, IT) {
1124 rr_deallocateL2CacheBlock;
1125 jj_allocateL1ICacheBlock;
1129 zz_stallAndWaitMandatoryQueue;
1133 transition(S, Trigger_L2_to_L1I, ST) {
1135 rr_deallocateL2CacheBlock;
1136 jj_allocateL1ICacheBlock;
1140 zz_stallAndWaitMandatoryQueue;
1144 transition(O, Trigger_L2_to_L1I, OT) {
1146 rr_deallocateL2CacheBlock;
1147 jj_allocateL1ICacheBlock;
1151 zz_stallAndWaitMandatoryQueue;
1155 transition(M, Trigger_L2_to_L1I, MT) {
1157 rr_deallocateL2CacheBlock;
1158 jj_allocateL1ICacheBlock;
1162 zz_stallAndWaitMandatoryQueue;
1166 transition(MM, Trigger_L2_to_L1I, MMT) {
1168 rr_deallocateL2CacheBlock;
1169 jj_allocateL1ICacheBlock;
1173 zz_stallAndWaitMandatoryQueue;
1177 transition(IT, Complete_L2_to_L1, I) {
1179 kd_wakeUpDependents;
1182 transition(ST, Complete_L2_to_L1, S) {
1184 kd_wakeUpDependents;
1187 transition(OT, Complete_L2_to_L1, O) {
1189 kd_wakeUpDependents;
1192 transition(MT, Complete_L2_to_L1, M) {
1194 kd_wakeUpDependents;
1197 transition(MMT, Complete_L2_to_L1, MM) {
1199 kd_wakeUpDependents;
1202 // Transitions from Idle
1203 transition(I, Load, IS) {
1204 ii_allocateL1DCacheBlock;
1208 k_popMandatoryQueue;
1211 transition(I, Ifetch, IS) {
1212 jj_allocateL1ICacheBlock;
1216 k_popMandatoryQueue;
1219 transition(I, Store, IM) {
1220 ii_allocateL1DCacheBlock;
1224 k_popMandatoryQueue;
1227 transition(I, L2_Replacement) {
1228 rr_deallocateL2CacheBlock;
1229 ka_wakeUpAllDependents;
1232 transition(I, {Other_GETX, NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig, Invalidate}) {
1237 // Transitions from Shared
1238 transition({S, SM, ISM}, {Load, Ifetch}) {
1240 k_popMandatoryQueue;
1243 transition(S, Store, SM) {
1247 k_popMandatoryQueue;
1250 transition(S, L2_Replacement, I) {
1251 rr_deallocateL2CacheBlock;
1252 ka_wakeUpAllDependents;
1255 transition(S, {Other_GETX, Invalidate}, I) {
1260 transition(S, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}) {
1265 // Transitions from Owned
1266 transition({O, OM, SS, MM_W, M_W}, {Load, Ifetch}) {
1268 k_popMandatoryQueue;
1271 transition(O, Store, OM) {
1274 p_decrementNumberOfMessagesByOne;
1276 k_popMandatoryQueue;
1279 transition(O, L2_Replacement, OI) {
1282 rr_deallocateL2CacheBlock;
1283 ka_wakeUpAllDependents;
1286 transition(O, {Other_GETX, Invalidate}, I) {
1291 transition(O, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}) {
1296 transition(O, Merged_GETS) {
1297 em_sendDataSharedMultiple;
1301 // Transitions from Modified
1302 transition(MM, {Load, Ifetch}) {
1304 k_popMandatoryQueue;
1307 transition(MM, Store) {
1309 k_popMandatoryQueue;
1312 transition(MM, L2_Replacement, MI) {
1315 rr_deallocateL2CacheBlock;
1316 ka_wakeUpAllDependents;
1319 transition(MM, {Other_GETX, Invalidate}, I) {
1320 c_sendExclusiveData;
1324 transition(MM, Other_GETS, I) {
1325 c_sendExclusiveData;
1329 transition(MM, NC_DMA_GETS) {
1330 c_sendExclusiveData;
1334 transition(MM, Other_GETS_No_Mig, O) {
1339 transition(MM, Merged_GETS, O) {
1340 em_sendDataSharedMultiple;
1344 // Transitions from Dirty Exclusive
1345 transition(M, {Load, Ifetch}) {
1347 k_popMandatoryQueue;
1350 transition(M, Store, MM) {
1352 k_popMandatoryQueue;
1355 transition(M, L2_Replacement, MI) {
1358 rr_deallocateL2CacheBlock;
1359 ka_wakeUpAllDependents;
1362 transition(M, {Other_GETX, Invalidate}, I) {
1363 c_sendExclusiveData;
1367 transition(M, {Other_GETS, Other_GETS_No_Mig}, O) {
1372 transition(M, NC_DMA_GETS) {
1377 transition(M, Merged_GETS, O) {
1378 em_sendDataSharedMultiple;
1382 // Transitions from IM
1384 transition(IM, {Other_GETX, NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig, Invalidate}) {
1389 transition(IM, Ack) {
1390 m_decrementNumberOfMessages;
1391 o_checkForCompletion;
1395 transition(IM, Data, ISM) {
1397 m_decrementNumberOfMessages;
1398 o_checkForCompletion;
1402 transition(IM, Exclusive_Data, MM_W) {
1404 m_decrementNumberOfMessages;
1405 o_checkForCompletion;
1406 sx_external_store_hit;
1408 kd_wakeUpDependents;
1411 // Transitions from SM
1412 transition(SM, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}) {
1417 transition(SM, {Other_GETX, Invalidate}, IM) {
1422 transition(SM, Ack) {
1423 m_decrementNumberOfMessages;
1424 o_checkForCompletion;
1428 transition(SM, {Data, Exclusive_Data}, ISM) {
1429 v_writeDataToCacheVerify;
1430 m_decrementNumberOfMessages;
1431 o_checkForCompletion;
1435 // Transitions from ISM
1436 transition(ISM, Ack) {
1437 m_decrementNumberOfMessages;
1438 o_checkForCompletion;
1442 transition(ISM, All_acks_no_sharers, MM) {
1443 sxt_trig_ext_store_hit;
1447 kd_wakeUpDependents;
1450 // Transitions from OM
1452 transition(OM, {Other_GETX, Invalidate}, IM) {
1454 pp_incrementNumberOfMessagesByOne;
1458 transition(OM, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}) {
1463 transition(OM, Merged_GETS) {
1464 em_sendDataSharedMultiple;
1468 transition(OM, Ack) {
1469 m_decrementNumberOfMessages;
1470 o_checkForCompletion;
1474 transition(OM, {All_acks, All_acks_no_sharers}, MM) {
1475 sxt_trig_ext_store_hit;
1479 kd_wakeUpDependents;
1482 // Transitions from IS
1484 transition(IS, {Other_GETX, NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig, Invalidate}) {
1489 transition(IS, Ack) {
1490 m_decrementNumberOfMessages;
1491 o_checkForCompletion;
1495 transition(IS, Shared_Ack) {
1496 m_decrementNumberOfMessages;
1498 o_checkForCompletion;
1502 transition(IS, Data, SS) {
1504 m_decrementNumberOfMessages;
1505 o_checkForCompletion;
1506 hx_external_load_hit;
1507 uo_updateCurrentOwner;
1509 kd_wakeUpDependents;
1512 transition(IS, Exclusive_Data, M_W) {
1514 m_decrementNumberOfMessages;
1515 o_checkForCompletion;
1516 hx_external_load_hit;
1518 kd_wakeUpDependents;
1521 transition(IS, Shared_Data, SS) {
1524 m_decrementNumberOfMessages;
1525 o_checkForCompletion;
1526 hx_external_load_hit;
1527 uo_updateCurrentOwner;
1529 kd_wakeUpDependents;
1532 // Transitions from SS
1534 transition(SS, Ack) {
1535 m_decrementNumberOfMessages;
1536 o_checkForCompletion;
1540 transition(SS, Shared_Ack) {
1541 m_decrementNumberOfMessages;
1543 o_checkForCompletion;
1547 transition(SS, All_acks, S) {
1553 transition(SS, All_acks_no_sharers, S) {
1554 // Note: The directory might still be the owner, so that is why we go to S
1560 // Transitions from MM_W
1562 transition(MM_W, Store) {
1564 k_popMandatoryQueue;
1567 transition(MM_W, Ack) {
1568 m_decrementNumberOfMessages;
1569 o_checkForCompletion;
1573 transition(MM_W, All_acks_no_sharers, MM) {
1577 kd_wakeUpDependents;
1580 // Transitions from M_W
1582 transition(M_W, Store, MM_W) {
1584 k_popMandatoryQueue;
1587 transition(M_W, Ack) {
1588 m_decrementNumberOfMessages;
1589 o_checkForCompletion;
1593 transition(M_W, All_acks_no_sharers, M) {
1597 kd_wakeUpDependents;
1600 // Transitions from OI/MI
1602 transition({OI, MI}, {Other_GETX, Invalidate}, II) {
1603 q_sendDataFromTBEToCache;
1607 transition({OI, MI}, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}, OI) {
1608 q_sendDataFromTBEToCache;
1612 transition({OI, MI}, Merged_GETS, OI) {
1613 qm_sendDataFromTBEToCache;
1617 transition(MI, Writeback_Ack, I) {
1618 t_sendExclusiveDataFromTBEToMemory;
1621 kd_wakeUpDependents;
1624 transition(OI, Writeback_Ack, I) {
1625 qq_sendDataFromTBEToMemory;
1628 kd_wakeUpDependents;
1631 // Transitions from II
1632 transition(II, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig, Other_GETX, Invalidate}, II) {
1637 transition(II, Writeback_Ack, I) {
1641 kd_wakeUpDependents;
1644 transition(II, Writeback_Nack, I) {
1647 kd_wakeUpDependents;