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 state_declaration(State, desc="Cache states", default="L1Cache_State_I") {
59 I, AccessPermission:Invalid, desc="Idle";
60 S, AccessPermission:Read_Only, desc="Shared";
61 O, AccessPermission:Read_Only, desc="Owned";
62 M, AccessPermission:Read_Only, desc="Modified (dirty)";
63 MM, AccessPermission:Read_Write, desc="Modified (dirty and locally modified)";
66 IM, AccessPermission:Busy, "IM", desc="Issued GetX";
67 SM, AccessPermission:Read_Only, "SM", desc="Issued GetX, we still have a valid copy of the line";
68 OM, AccessPermission:Read_Only, "OM", desc="Issued GetX, received data";
69 ISM, AccessPermission:Read_Only, "ISM", desc="Issued GetX, received valid data, waiting for all acks";
70 M_W, AccessPermission:Read_Only, "M^W", desc="Issued GetS, received exclusive data";
71 MM_W, AccessPermission:Read_Write, "MM^W", desc="Issued GetX, received exclusive data";
72 IS, AccessPermission:Busy, "IS", desc="Issued GetS";
73 SS, AccessPermission:Read_Only, "SS", desc="Issued GetS, received data, waiting for all acks";
74 OI, AccessPermission:Busy, "OI", desc="Issued PutO, waiting for ack";
75 MI, AccessPermission:Busy, "MI", desc="Issued PutX, waiting for ack";
76 II, AccessPermission:Busy, "II", desc="Issued PutX/O, saw Other_GETS or Other_GETX, waiting for ack";
77 IT, AccessPermission:Busy, "IT", desc="Invalid block transferring to L1";
78 ST, AccessPermission:Busy, "ST", desc="S block transferring to L1";
79 OT, AccessPermission:Busy, "OT", desc="O block transferring to L1";
80 MT, AccessPermission:Busy, "MT", desc="M block transferring to L1";
81 MMT, AccessPermission:Busy, "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();
161 void wakeUpAllBuffers();
162 void wakeUpBuffers(Address a);
164 Entry getCacheEntry(Address address), return_by_pointer="yes" {
165 Entry L2cache_entry := static_cast(Entry, "pointer", L2cacheMemory.lookup(address));
166 if(is_valid(L2cache_entry)) {
167 return L2cache_entry;
170 Entry L1Dcache_entry := static_cast(Entry, "pointer", L1DcacheMemory.lookup(address));
171 if(is_valid(L1Dcache_entry)) {
172 return L1Dcache_entry;
175 Entry L1Icache_entry := static_cast(Entry, "pointer", L1IcacheMemory.lookup(address));
176 return L1Icache_entry;
179 Entry getL2CacheEntry(Address address), return_by_pointer="yes" {
180 Entry L2cache_entry := static_cast(Entry, "pointer", L2cacheMemory.lookup(address));
181 return L2cache_entry;
184 Entry getL1DCacheEntry(Address address), return_by_pointer="yes" {
185 Entry L1Dcache_entry := static_cast(Entry, "pointer", L1DcacheMemory.lookup(address));
186 return L1Dcache_entry;
189 Entry getL1ICacheEntry(Address address), return_by_pointer="yes" {
190 Entry L1Icache_entry := static_cast(Entry, "pointer", L1IcacheMemory.lookup(address));
191 return L1Icache_entry;
194 State getState(TBE tbe, Entry cache_entry, Address addr) {
197 } else if (is_valid(cache_entry)) {
198 return cache_entry.CacheState;
203 void setState(TBE tbe, Entry cache_entry, Address addr, State state) {
204 assert((L1DcacheMemory.isTagPresent(addr) && L1IcacheMemory.isTagPresent(addr)) == false);
205 assert((L1IcacheMemory.isTagPresent(addr) && L2cacheMemory.isTagPresent(addr)) == false);
206 assert((L1DcacheMemory.isTagPresent(addr) && L2cacheMemory.isTagPresent(addr)) == false);
209 tbe.TBEState := state;
212 if (is_valid(cache_entry)) {
213 cache_entry.CacheState := state;
217 Event mandatory_request_type_to_event(CacheRequestType type) {
218 if (type == CacheRequestType:LD) {
220 } else if (type == CacheRequestType:IFETCH) {
222 } else if ((type == CacheRequestType:ST) || (type == CacheRequestType:ATOMIC)) {
225 error("Invalid CacheRequestType");
229 GenericMachineType getNondirectHitMachType(Address addr, MachineID sender) {
230 if (machineIDToMachineType(sender) == MachineType:L1Cache) {
232 // NOTE direct local hits should not call this
234 return GenericMachineType:L1Cache_wCC;
236 return ConvertMachToGenericMach(machineIDToMachineType(sender));
240 GenericMachineType testAndClearLocalHit(Entry cache_entry) {
241 if (is_valid(cache_entry) && cache_entry.FromL2) {
242 cache_entry.FromL2 := false;
243 return GenericMachineType:L2Cache;
245 return GenericMachineType:L1Cache;
249 bool IsAtomicAccessed(Entry cache_entry) {
250 assert(is_valid(cache_entry));
251 return cache_entry.AtomicAccessed;
254 MessageBuffer triggerQueue, ordered="false";
258 out_port(requestNetwork_out, RequestMsg, requestFromCache);
259 out_port(responseNetwork_out, ResponseMsg, responseFromCache);
260 out_port(unblockNetwork_out, ResponseMsg, unblockFromCache);
261 out_port(triggerQueue_out, TriggerMsg, triggerQueue);
266 in_port(triggerQueue_in, TriggerMsg, triggerQueue, rank=3) {
267 if (triggerQueue_in.isReady()) {
268 peek(triggerQueue_in, TriggerMsg) {
270 Entry cache_entry := getCacheEntry(in_msg.Address);
271 TBE tbe := TBEs[in_msg.Address];
273 if (in_msg.Type == TriggerType:L2_to_L1) {
274 trigger(Event:Complete_L2_to_L1, in_msg.Address, cache_entry, tbe);
275 } else if (in_msg.Type == TriggerType:ALL_ACKS) {
276 trigger(Event:All_acks, in_msg.Address, cache_entry, tbe);
277 } else if (in_msg.Type == TriggerType:ALL_ACKS_NO_SHARERS) {
278 trigger(Event:All_acks_no_sharers, in_msg.Address, cache_entry, tbe);
280 error("Unexpected message");
286 // Nothing from the unblock network
289 in_port(responseToCache_in, ResponseMsg, responseToCache, rank=2) {
290 if (responseToCache_in.isReady()) {
291 peek(responseToCache_in, ResponseMsg, block_on="Address") {
293 Entry cache_entry := getCacheEntry(in_msg.Address);
294 TBE tbe := TBEs[in_msg.Address];
296 if (in_msg.Type == CoherenceResponseType:ACK) {
297 trigger(Event:Ack, in_msg.Address, cache_entry, tbe);
298 } else if (in_msg.Type == CoherenceResponseType:ACK_SHARED) {
299 trigger(Event:Shared_Ack, in_msg.Address, cache_entry, tbe);
300 } else if (in_msg.Type == CoherenceResponseType:DATA) {
301 trigger(Event:Data, in_msg.Address, cache_entry, tbe);
302 } else if (in_msg.Type == CoherenceResponseType:DATA_SHARED) {
303 trigger(Event:Shared_Data, in_msg.Address, cache_entry, tbe);
304 } else if (in_msg.Type == CoherenceResponseType:DATA_EXCLUSIVE) {
305 trigger(Event:Exclusive_Data, in_msg.Address, cache_entry, tbe);
307 error("Unexpected message");
314 in_port(forwardToCache_in, RequestMsg, forwardToCache, rank=1) {
315 if (forwardToCache_in.isReady()) {
316 peek(forwardToCache_in, RequestMsg, block_on="Address") {
318 Entry cache_entry := getCacheEntry(in_msg.Address);
319 TBE tbe := TBEs[in_msg.Address];
321 if (in_msg.Type == CoherenceRequestType:GETX) {
322 trigger(Event:Other_GETX, in_msg.Address, cache_entry, tbe);
323 } else if (in_msg.Type == CoherenceRequestType:MERGED_GETS) {
324 trigger(Event:Merged_GETS, in_msg.Address, cache_entry, tbe);
325 } else if (in_msg.Type == CoherenceRequestType:GETS) {
326 if (machineCount(MachineType:L1Cache) > 1) {
327 if (is_valid(cache_entry)) {
328 if (IsAtomicAccessed(cache_entry) && no_mig_atomic) {
329 trigger(Event:Other_GETS_No_Mig, in_msg.Address, cache_entry, tbe);
331 trigger(Event:Other_GETS, in_msg.Address, cache_entry, tbe);
334 trigger(Event:Other_GETS, in_msg.Address, cache_entry, tbe);
337 trigger(Event:NC_DMA_GETS, in_msg.Address, cache_entry, tbe);
339 } else if (in_msg.Type == CoherenceRequestType:INV) {
340 trigger(Event:Invalidate, in_msg.Address, cache_entry, tbe);
341 } else if (in_msg.Type == CoherenceRequestType:WB_ACK) {
342 trigger(Event:Writeback_Ack, in_msg.Address, cache_entry, tbe);
343 } else if (in_msg.Type == CoherenceRequestType:WB_NACK) {
344 trigger(Event:Writeback_Nack, in_msg.Address, cache_entry, tbe);
346 error("Unexpected message");
352 // Nothing from the request network
355 in_port(mandatoryQueue_in, CacheMsg, mandatoryQueue, desc="...", rank=0) {
356 if (mandatoryQueue_in.isReady()) {
357 peek(mandatoryQueue_in, CacheMsg, block_on="LineAddress") {
359 // Check for data access to blocks in I-cache and ifetchs to blocks in D-cache
360 TBE tbe := TBEs[in_msg.LineAddress];
362 if (in_msg.Type == CacheRequestType:IFETCH) {
363 // ** INSTRUCTION ACCESS ***
365 Entry L1Icache_entry := getL1ICacheEntry(in_msg.LineAddress);
366 if (is_valid(L1Icache_entry)) {
367 // The tag matches for the L1, so the L1 fetches the line. We know it can't be in the L2 due to exclusion
368 trigger(mandatory_request_type_to_event(in_msg.Type),
369 in_msg.LineAddress, L1Icache_entry, tbe);
371 // Check to see if it is in the OTHER L1
372 Entry L1Dcache_entry := getL1DCacheEntry(in_msg.LineAddress);
373 if (is_valid(L1Dcache_entry)) {
374 // The block is in the wrong L1, try to write it to the L2
375 if (L2cacheMemory.cacheAvail(in_msg.LineAddress)) {
376 trigger(Event:L1_to_L2, in_msg.LineAddress, L1Dcache_entry, tbe);
378 Address l2_victim_addr := L2cacheMemory.cacheProbe(in_msg.LineAddress);
379 trigger(Event:L2_Replacement,
381 getL2CacheEntry(l2_victim_addr),
382 TBEs[l2_victim_addr]);
386 if (L1IcacheMemory.cacheAvail(in_msg.LineAddress)) {
387 // L1 does't have the line, but we have space for it in the L1
389 Entry L2cache_entry := getL2CacheEntry(in_msg.LineAddress);
390 if (is_valid(L2cache_entry)) {
391 // L2 has it (maybe not with the right permissions)
392 trigger(Event:Trigger_L2_to_L1I, in_msg.LineAddress,
395 // We have room, the L2 doesn't have it, so the L1 fetches the line
396 trigger(mandatory_request_type_to_event(in_msg.Type),
397 in_msg.LineAddress, L1Icache_entry, tbe);
400 // No room in the L1, so we need to make room
401 Address l1i_victim_addr := L1IcacheMemory.cacheProbe(in_msg.LineAddress);
402 if (L2cacheMemory.cacheAvail(l1i_victim_addr)) {
403 // The L2 has room, so we move the line from the L1 to the L2
404 trigger(Event:L1_to_L2,
406 getL1ICacheEntry(l1i_victim_addr),
407 TBEs[l1i_victim_addr]);
409 Address l2_victim_addr := L2cacheMemory.cacheProbe(l1i_victim_addr);
410 // The L2 does not have room, so we replace a line from the L2
411 trigger(Event:L2_Replacement,
413 getL2CacheEntry(l2_victim_addr),
414 TBEs[l2_victim_addr]);
419 // *** DATA ACCESS ***
421 Entry L1Dcache_entry := getL1DCacheEntry(in_msg.LineAddress);
422 if (is_valid(L1Dcache_entry)) {
423 // The tag matches for the L1, so the L1 fetches the line. We know it can't be in the L2 due to exclusion
424 trigger(mandatory_request_type_to_event(in_msg.Type),
425 in_msg.LineAddress, L1Dcache_entry, tbe);
428 // Check to see if it is in the OTHER L1
429 Entry L1Icache_entry := getL1ICacheEntry(in_msg.LineAddress);
430 if (is_valid(L1Icache_entry)) {
431 // The block is in the wrong L1, try to write it to the L2
432 if (L2cacheMemory.cacheAvail(in_msg.LineAddress)) {
433 trigger(Event:L1_to_L2, in_msg.LineAddress, L1Icache_entry, tbe);
435 Address l2_victim_addr := L2cacheMemory.cacheProbe(in_msg.LineAddress);
436 trigger(Event:L2_Replacement,
438 getL2CacheEntry(l2_victim_addr),
439 TBEs[l2_victim_addr]);
443 if (L1DcacheMemory.cacheAvail(in_msg.LineAddress)) {
444 // L1 does't have the line, but we have space for it in the L1
445 Entry L2cache_entry := getL2CacheEntry(in_msg.LineAddress);
446 if (is_valid(L2cache_entry)) {
447 // L2 has it (maybe not with the right permissions)
448 trigger(Event:Trigger_L2_to_L1D, in_msg.LineAddress,
451 // We have room, the L2 doesn't have it, so the L1 fetches the line
452 trigger(mandatory_request_type_to_event(in_msg.Type),
453 in_msg.LineAddress, L1Dcache_entry, tbe);
456 // No room in the L1, so we need to make room
457 Address l1d_victim_addr := L1DcacheMemory.cacheProbe(in_msg.LineAddress);
458 if (L2cacheMemory.cacheAvail(l1d_victim_addr)) {
459 // The L2 has room, so we move the line from the L1 to the L2
460 trigger(Event:L1_to_L2,
462 getL1DCacheEntry(l1d_victim_addr),
463 TBEs[l1d_victim_addr]);
465 Address l2_victim_addr := L2cacheMemory.cacheProbe(l1d_victim_addr);
466 // The L2 does not have room, so we replace a line from the L2
467 trigger(Event:L2_Replacement,
469 getL2CacheEntry(l2_victim_addr),
470 TBEs[l2_victim_addr]);
481 action(a_issueGETS, "a", desc="Issue GETS") {
482 enqueue(requestNetwork_out, RequestMsg, latency=issue_latency) {
483 assert(is_valid(tbe));
484 out_msg.Address := address;
485 out_msg.Type := CoherenceRequestType:GETS;
486 out_msg.Requestor := machineID;
487 out_msg.Destination.add(map_Address_to_Directory(address));
488 out_msg.MessageSize := MessageSizeType:Request_Control;
489 out_msg.InitialRequestTime := get_time();
490 tbe.NumPendingMsgs := machineCount(MachineType:L1Cache); // One from each other cache (n-1) plus the memory (+1)
494 action(b_issueGETX, "b", desc="Issue GETX") {
495 enqueue(requestNetwork_out, RequestMsg, latency=issue_latency) {
496 assert(is_valid(tbe));
497 out_msg.Address := address;
498 out_msg.Type := CoherenceRequestType:GETX;
499 out_msg.Requestor := machineID;
500 out_msg.Destination.add(map_Address_to_Directory(address));
501 out_msg.MessageSize := MessageSizeType:Request_Control;
502 out_msg.InitialRequestTime := get_time();
503 tbe.NumPendingMsgs := machineCount(MachineType:L1Cache); // One from each other cache (n-1) plus the memory (+1)
507 action(c_sendExclusiveData, "c", desc="Send exclusive data from cache to requestor") {
508 peek(forwardToCache_in, RequestMsg) {
509 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
510 assert(is_valid(cache_entry));
511 out_msg.Address := address;
512 out_msg.Type := CoherenceResponseType:DATA_EXCLUSIVE;
513 out_msg.Sender := machineID;
514 out_msg.Destination.add(in_msg.Requestor);
515 out_msg.DataBlk := cache_entry.DataBlk;
516 out_msg.Dirty := cache_entry.Dirty;
517 if (in_msg.DirectedProbe) {
518 out_msg.Acks := machineCount(MachineType:L1Cache);
522 out_msg.SilentAcks := in_msg.SilentAcks;
523 out_msg.MessageSize := MessageSizeType:Response_Data;
524 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
525 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
530 action(d_issuePUT, "d", desc="Issue PUT") {
531 enqueue(requestNetwork_out, RequestMsg, latency=issue_latency) {
532 out_msg.Address := address;
533 out_msg.Type := CoherenceRequestType:PUT;
534 out_msg.Requestor := machineID;
535 out_msg.Destination.add(map_Address_to_Directory(address));
536 out_msg.MessageSize := MessageSizeType:Writeback_Control;
540 action(e_sendData, "e", desc="Send data from cache to requestor") {
541 peek(forwardToCache_in, RequestMsg) {
542 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
543 assert(is_valid(cache_entry));
544 out_msg.Address := address;
545 out_msg.Type := CoherenceResponseType:DATA;
546 out_msg.Sender := machineID;
547 out_msg.Destination.add(in_msg.Requestor);
548 out_msg.DataBlk := cache_entry.DataBlk;
549 out_msg.Dirty := cache_entry.Dirty;
550 if (in_msg.DirectedProbe) {
551 out_msg.Acks := machineCount(MachineType:L1Cache);
555 out_msg.SilentAcks := in_msg.SilentAcks;
556 out_msg.MessageSize := MessageSizeType:Response_Data;
557 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
558 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
563 action(ee_sendDataShared, "\e", desc="Send data from cache to requestor, keep a shared copy") {
564 peek(forwardToCache_in, RequestMsg) {
565 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
566 assert(is_valid(cache_entry));
567 out_msg.Address := address;
568 out_msg.Type := CoherenceResponseType:DATA_SHARED;
569 out_msg.Sender := machineID;
570 out_msg.Destination.add(in_msg.Requestor);
571 out_msg.DataBlk := cache_entry.DataBlk;
572 out_msg.Dirty := cache_entry.Dirty;
573 DPRINTF(RubySlicc, "%s\n", out_msg.DataBlk);
574 if (in_msg.DirectedProbe) {
575 out_msg.Acks := machineCount(MachineType:L1Cache);
579 out_msg.SilentAcks := in_msg.SilentAcks;
580 out_msg.MessageSize := MessageSizeType:Response_Data;
581 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
582 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
587 action(em_sendDataSharedMultiple, "em", desc="Send data from cache to all requestors") {
588 peek(forwardToCache_in, RequestMsg) {
589 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
590 assert(is_valid(cache_entry));
591 out_msg.Address := address;
592 out_msg.Type := CoherenceResponseType:DATA_SHARED;
593 out_msg.Sender := machineID;
594 out_msg.Destination := in_msg.MergedRequestors;
595 out_msg.DataBlk := cache_entry.DataBlk;
596 out_msg.Dirty := cache_entry.Dirty;
597 DPRINTF(RubySlicc, "%s\n", out_msg.DataBlk);
598 out_msg.Acks := machineCount(MachineType:L1Cache);
599 out_msg.SilentAcks := in_msg.SilentAcks;
600 out_msg.MessageSize := MessageSizeType:Response_Data;
601 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
602 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
607 action(f_sendAck, "f", desc="Send ack from cache to requestor") {
608 peek(forwardToCache_in, RequestMsg) {
609 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
610 out_msg.Address := address;
611 out_msg.Type := CoherenceResponseType:ACK;
612 out_msg.Sender := machineID;
613 out_msg.Destination.add(in_msg.Requestor);
615 out_msg.SilentAcks := in_msg.SilentAcks;
616 assert(in_msg.DirectedProbe == false);
617 out_msg.MessageSize := MessageSizeType:Response_Control;
618 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
619 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
624 action(ff_sendAckShared, "\f", desc="Send shared ack from cache to requestor") {
625 peek(forwardToCache_in, RequestMsg) {
626 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
627 out_msg.Address := address;
628 out_msg.Type := CoherenceResponseType:ACK_SHARED;
629 out_msg.Sender := machineID;
630 out_msg.Destination.add(in_msg.Requestor);
632 out_msg.SilentAcks := in_msg.SilentAcks;
633 assert(in_msg.DirectedProbe == false);
634 out_msg.MessageSize := MessageSizeType:Response_Control;
635 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
636 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
641 action(g_sendUnblock, "g", desc="Send unblock to memory") {
642 enqueue(unblockNetwork_out, ResponseMsg, latency=cache_response_latency) {
643 out_msg.Address := address;
644 out_msg.Type := CoherenceResponseType:UNBLOCK;
645 out_msg.Sender := machineID;
646 out_msg.Destination.add(map_Address_to_Directory(address));
647 out_msg.MessageSize := MessageSizeType:Unblock_Control;
651 action(gm_sendUnblockM, "gm", desc="Send unblock to memory and indicate M/O/E state") {
652 enqueue(unblockNetwork_out, ResponseMsg, latency=cache_response_latency) {
653 out_msg.Address := address;
654 out_msg.Type := CoherenceResponseType:UNBLOCKM;
655 out_msg.Sender := machineID;
656 out_msg.Destination.add(map_Address_to_Directory(address));
657 out_msg.MessageSize := MessageSizeType:Unblock_Control;
661 action(gs_sendUnblockS, "gs", desc="Send unblock to memory and indicate S state") {
662 enqueue(unblockNetwork_out, ResponseMsg, latency=cache_response_latency) {
663 assert(is_valid(tbe));
664 out_msg.Address := address;
665 out_msg.Type := CoherenceResponseType:UNBLOCKS;
666 out_msg.Sender := machineID;
667 out_msg.CurOwner := tbe.CurOwner;
668 out_msg.Destination.add(map_Address_to_Directory(address));
669 out_msg.MessageSize := MessageSizeType:Unblock_Control;
673 action(h_load_hit, "h", desc="Notify sequencer the load completed.") {
674 assert(is_valid(cache_entry));
675 DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
676 sequencer.readCallback(address, testAndClearLocalHit(cache_entry),
677 cache_entry.DataBlk);
680 action(hx_external_load_hit, "hx", desc="load required external msgs") {
681 assert(is_valid(cache_entry));
682 assert(is_valid(tbe));
683 DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
684 peek(responseToCache_in, ResponseMsg) {
686 sequencer.readCallback(address,
687 getNondirectHitMachType(in_msg.Address, in_msg.Sender),
689 tbe.InitialRequestTime,
690 tbe.ForwardRequestTime,
691 tbe.FirstResponseTime);
695 action(hh_store_hit, "\h", desc="Notify sequencer that store completed.") {
696 assert(is_valid(cache_entry));
697 DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
698 peek(mandatoryQueue_in, CacheMsg) {
699 sequencer.writeCallback(address, testAndClearLocalHit(cache_entry),
700 cache_entry.DataBlk);
702 cache_entry.Dirty := true;
703 if (in_msg.Type == CacheRequestType:ATOMIC) {
704 cache_entry.AtomicAccessed := true;
709 action(sx_external_store_hit, "sx", desc="store required external msgs.") {
710 assert(is_valid(cache_entry));
711 assert(is_valid(tbe));
712 DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
713 peek(responseToCache_in, ResponseMsg) {
715 sequencer.writeCallback(address,
716 getNondirectHitMachType(address, in_msg.Sender),
718 tbe.InitialRequestTime,
719 tbe.ForwardRequestTime,
720 tbe.FirstResponseTime);
722 cache_entry.Dirty := true;
725 action(sxt_trig_ext_store_hit, "sxt", desc="store required external msgs.") {
726 assert(is_valid(cache_entry));
727 assert(is_valid(tbe));
728 DPRINTF(RubySlicc, "%s\n", cache_entry.DataBlk);
730 sequencer.writeCallback(address,
731 getNondirectHitMachType(address, tbe.LastResponder),
733 tbe.InitialRequestTime,
734 tbe.ForwardRequestTime,
735 tbe.FirstResponseTime);
737 cache_entry.Dirty := true;
740 action(i_allocateTBE, "i", desc="Allocate TBE") {
741 check_allocate(TBEs);
742 assert(is_valid(cache_entry));
743 TBEs.allocate(address);
744 set_tbe(TBEs[address]);
745 tbe.DataBlk := cache_entry.DataBlk; // Data only used for writebacks
746 tbe.Dirty := cache_entry.Dirty;
747 tbe.Sharers := false;
750 action(j_popTriggerQueue, "j", desc="Pop trigger queue.") {
751 triggerQueue_in.dequeue();
754 action(k_popMandatoryQueue, "k", desc="Pop mandatory queue.") {
755 mandatoryQueue_in.dequeue();
758 action(l_popForwardQueue, "l", desc="Pop forwareded request queue.") {
759 forwardToCache_in.dequeue();
762 action(hp_copyFromTBEToL2, "li", desc="Copy data from TBE to L2 cache entry.") {
763 assert(is_valid(cache_entry));
764 assert(is_valid(tbe));
765 cache_entry.Dirty := tbe.Dirty;
766 cache_entry.DataBlk := tbe.DataBlk;
769 action(nb_copyFromTBEToL1, "fu", desc="Copy data from TBE to L1 cache entry.") {
770 assert(is_valid(cache_entry));
771 assert(is_valid(tbe));
772 cache_entry.Dirty := tbe.Dirty;
773 cache_entry.DataBlk := tbe.DataBlk;
774 cache_entry.FromL2 := true;
777 action(m_decrementNumberOfMessages, "m", desc="Decrement the number of messages for which we're waiting") {
778 peek(responseToCache_in, ResponseMsg) {
779 assert(in_msg.Acks > 0);
780 assert(is_valid(tbe));
781 DPRINTF(RubySlicc, "Sender = %s\n", in_msg.Sender);
782 DPRINTF(RubySlicc, "SilentAcks = %d\n", in_msg.SilentAcks);
783 if (tbe.AppliedSilentAcks == false) {
784 tbe.NumPendingMsgs := tbe.NumPendingMsgs - in_msg.SilentAcks;
785 tbe.AppliedSilentAcks := true;
787 DPRINTF(RubySlicc, "%d\n", tbe.NumPendingMsgs);
788 tbe.NumPendingMsgs := tbe.NumPendingMsgs - in_msg.Acks;
789 DPRINTF(RubySlicc, "%d\n", tbe.NumPendingMsgs);
790 APPEND_TRANSITION_COMMENT(tbe.NumPendingMsgs);
791 APPEND_TRANSITION_COMMENT(in_msg.Sender);
792 tbe.LastResponder := in_msg.Sender;
793 if (tbe.InitialRequestTime != zero_time() && in_msg.InitialRequestTime != zero_time()) {
794 assert(tbe.InitialRequestTime == in_msg.InitialRequestTime);
796 if (in_msg.InitialRequestTime != zero_time()) {
797 tbe.InitialRequestTime := in_msg.InitialRequestTime;
799 if (tbe.ForwardRequestTime != zero_time() && in_msg.ForwardRequestTime != zero_time()) {
800 assert(tbe.ForwardRequestTime == in_msg.ForwardRequestTime);
802 if (in_msg.ForwardRequestTime != zero_time()) {
803 tbe.ForwardRequestTime := in_msg.ForwardRequestTime;
805 if (tbe.FirstResponseTime == zero_time()) {
806 tbe.FirstResponseTime := get_time();
810 action(uo_updateCurrentOwner, "uo", desc="When moving SS state, update current owner.") {
811 peek(responseToCache_in, ResponseMsg) {
812 assert(is_valid(tbe));
813 tbe.CurOwner := in_msg.Sender;
817 action(n_popResponseQueue, "n", desc="Pop response queue") {
818 responseToCache_in.dequeue();
821 action(ll_L2toL1Transfer, "ll", desc="") {
822 enqueue(triggerQueue_out, TriggerMsg, latency=l2_cache_hit_latency) {
823 out_msg.Address := address;
824 out_msg.Type := TriggerType:L2_to_L1;
828 action(o_checkForCompletion, "o", desc="Check if we have received all the messages required for completion") {
829 assert(is_valid(tbe));
830 if (tbe.NumPendingMsgs == 0) {
831 enqueue(triggerQueue_out, TriggerMsg) {
832 out_msg.Address := address;
834 out_msg.Type := TriggerType:ALL_ACKS;
836 out_msg.Type := TriggerType:ALL_ACKS_NO_SHARERS;
842 action(p_decrementNumberOfMessagesByOne, "p", desc="Decrement the number of messages for which we're waiting by one") {
843 assert(is_valid(tbe));
844 tbe.NumPendingMsgs := tbe.NumPendingMsgs - 1;
847 action(pp_incrementNumberOfMessagesByOne, "\p", desc="Increment the number of messages for which we're waiting by one") {
848 assert(is_valid(tbe));
849 tbe.NumPendingMsgs := tbe.NumPendingMsgs + 1;
852 action(q_sendDataFromTBEToCache, "q", desc="Send data from TBE to cache") {
853 peek(forwardToCache_in, RequestMsg) {
854 assert(in_msg.Requestor != machineID);
855 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
856 assert(is_valid(tbe));
857 out_msg.Address := address;
858 out_msg.Type := CoherenceResponseType:DATA;
859 out_msg.Sender := machineID;
860 out_msg.Destination.add(in_msg.Requestor);
861 DPRINTF(RubySlicc, "%s\n", out_msg.Destination);
862 out_msg.DataBlk := tbe.DataBlk;
863 out_msg.Dirty := tbe.Dirty;
864 if (in_msg.DirectedProbe) {
865 out_msg.Acks := machineCount(MachineType:L1Cache);
869 out_msg.SilentAcks := in_msg.SilentAcks;
870 out_msg.MessageSize := MessageSizeType:Response_Data;
871 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
872 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
877 action(qm_sendDataFromTBEToCache, "qm", desc="Send data from TBE to cache, multiple sharers") {
878 peek(forwardToCache_in, RequestMsg) {
879 enqueue(responseNetwork_out, ResponseMsg, latency=cache_response_latency) {
880 assert(is_valid(tbe));
881 out_msg.Address := address;
882 out_msg.Type := CoherenceResponseType:DATA;
883 out_msg.Sender := machineID;
884 out_msg.Destination := in_msg.MergedRequestors;
885 DPRINTF(RubySlicc, "%s\n", out_msg.Destination);
886 out_msg.DataBlk := tbe.DataBlk;
887 out_msg.Dirty := tbe.Dirty;
888 out_msg.Acks := machineCount(MachineType:L1Cache);
889 out_msg.SilentAcks := in_msg.SilentAcks;
890 out_msg.MessageSize := MessageSizeType:Response_Data;
891 out_msg.InitialRequestTime := in_msg.InitialRequestTime;
892 out_msg.ForwardRequestTime := in_msg.ForwardRequestTime;
897 action(qq_sendDataFromTBEToMemory, "\q", desc="Send data from TBE to memory") {
898 enqueue(unblockNetwork_out, ResponseMsg, latency=cache_response_latency) {
899 assert(is_valid(tbe));
900 out_msg.Address := address;
901 out_msg.Sender := machineID;
902 out_msg.Destination.add(map_Address_to_Directory(address));
903 out_msg.Dirty := tbe.Dirty;
905 out_msg.Type := CoherenceResponseType:WB_DIRTY;
906 out_msg.DataBlk := tbe.DataBlk;
907 out_msg.MessageSize := MessageSizeType:Writeback_Data;
909 out_msg.Type := CoherenceResponseType:WB_CLEAN;
910 // NOTE: in a real system this would not send data. We send
911 // data here only so we can check it at the memory
912 out_msg.DataBlk := tbe.DataBlk;
913 out_msg.MessageSize := MessageSizeType:Writeback_Control;
918 action(r_setSharerBit, "r", desc="We saw other sharers") {
919 assert(is_valid(tbe));
923 action(s_deallocateTBE, "s", desc="Deallocate TBE") {
924 TBEs.deallocate(address);
928 action(t_sendExclusiveDataFromTBEToMemory, "t", desc="Send exclusive data from TBE to memory") {
929 enqueue(unblockNetwork_out, ResponseMsg, latency=cache_response_latency) {
930 assert(is_valid(tbe));
931 out_msg.Address := address;
932 out_msg.Sender := machineID;
933 out_msg.Destination.add(map_Address_to_Directory(address));
934 out_msg.DataBlk := tbe.DataBlk;
935 out_msg.Dirty := tbe.Dirty;
937 out_msg.Type := CoherenceResponseType:WB_EXCLUSIVE_DIRTY;
938 out_msg.DataBlk := tbe.DataBlk;
939 out_msg.MessageSize := MessageSizeType:Writeback_Data;
941 out_msg.Type := CoherenceResponseType:WB_EXCLUSIVE_CLEAN;
942 // NOTE: in a real system this would not send data. We send
943 // data here only so we can check it at the memory
944 out_msg.DataBlk := tbe.DataBlk;
945 out_msg.MessageSize := MessageSizeType:Writeback_Control;
950 action(u_writeDataToCache, "u", desc="Write data to cache") {
951 peek(responseToCache_in, ResponseMsg) {
952 assert(is_valid(cache_entry));
953 cache_entry.DataBlk := in_msg.DataBlk;
954 cache_entry.Dirty := in_msg.Dirty;
958 action(v_writeDataToCacheVerify, "v", desc="Write data to cache, assert it was same as before") {
959 peek(responseToCache_in, ResponseMsg) {
960 assert(is_valid(cache_entry));
961 DPRINTF(RubySlicc, "Cached Data Block: %s, Msg Data Block: %s\n",
962 cache_entry.DataBlk, in_msg.DataBlk);
963 assert(cache_entry.DataBlk == in_msg.DataBlk);
964 cache_entry.DataBlk := in_msg.DataBlk;
965 cache_entry.Dirty := in_msg.Dirty || cache_entry.Dirty;
969 action(gg_deallocateL1CacheBlock, "\g", desc="Deallocate cache block. Sets the cache to invalid, allowing a replacement in parallel with a fetch.") {
970 if (L1DcacheMemory.isTagPresent(address)) {
971 L1DcacheMemory.deallocate(address);
973 L1IcacheMemory.deallocate(address);
978 action(ii_allocateL1DCacheBlock, "\i", desc="Set L1 D-cache tag equal to tag of block B.") {
979 if (is_invalid(cache_entry)) {
980 set_cache_entry(L1DcacheMemory.allocate(address, new Entry));
984 action(jj_allocateL1ICacheBlock, "\j", desc="Set L1 I-cache tag equal to tag of block B.") {
985 if (is_invalid(cache_entry)) {
986 set_cache_entry(L1IcacheMemory.allocate(address, new Entry));
990 action(vv_allocateL2CacheBlock, "\v", desc="Set L2 cache tag equal to tag of block B.") {
991 set_cache_entry(L2cacheMemory.allocate(address, new Entry));
994 action(rr_deallocateL2CacheBlock, "\r", desc="Deallocate L2 cache block. Sets the cache to not present, allowing a replacement in parallel with a fetch.") {
995 L2cacheMemory.deallocate(address);
999 action(uu_profileMiss, "\u", desc="Profile the demand miss") {
1000 peek(mandatoryQueue_in, CacheMsg) {
1001 if (L1IcacheMemory.isTagPresent(address)) {
1002 L1IcacheMemory.profileMiss(in_msg);
1003 } else if (L1DcacheMemory.isTagPresent(address)) {
1004 L1DcacheMemory.profileMiss(in_msg);
1006 if (L2cacheMemory.isTagPresent(address) == false) {
1007 L2cacheMemory.profileMiss(in_msg);
1012 action(zz_stallAndWaitMandatoryQueue, "\z", desc="Send the head of the mandatory queue to the back of the queue.") {
1013 stall_and_wait(mandatoryQueue_in, address);
1016 action(kd_wakeUpDependents, "kd", desc="wake-up dependents") {
1017 wakeUpBuffers(address);
1020 action(ka_wakeUpAllDependents, "ka", desc="wake-up all dependents") {
1024 //*****************************************************
1026 //*****************************************************
1028 // Transitions for Load/Store/L2_Replacement from transient states
1029 transition({IM, SM, ISM, OM, IS, SS, OI, MI, II, IT, ST, OT, MT, MMT}, {Store, L2_Replacement}) {
1030 zz_stallAndWaitMandatoryQueue;
1033 transition({M_W, MM_W}, {L2_Replacement}) {
1034 zz_stallAndWaitMandatoryQueue;
1037 transition({IM, IS, OI, MI, II, IT, ST, OT, MT, MMT}, {Load, Ifetch}) {
1038 zz_stallAndWaitMandatoryQueue;
1041 transition({IM, SM, ISM, OM, IS, SS, MM_W, M_W, OI, MI, II, IT, ST, OT, MT, MMT}, L1_to_L2) {
1042 zz_stallAndWaitMandatoryQueue;
1045 transition({IT, ST, OT, MT, MMT}, {Other_GETX, NC_DMA_GETS, Other_GETS, Merged_GETS, Other_GETS_No_Mig, Invalidate}) {
1049 // Transitions moving data between the L1 and L2 caches
1050 transition({I, S, O, M, MM}, L1_to_L2) {
1052 gg_deallocateL1CacheBlock;
1053 vv_allocateL2CacheBlock;
1056 ka_wakeUpAllDependents;
1059 transition(I, Trigger_L2_to_L1D, IT) {
1061 rr_deallocateL2CacheBlock;
1062 ii_allocateL1DCacheBlock;
1063 nb_copyFromTBEToL1; // Not really needed for state I
1066 zz_stallAndWaitMandatoryQueue;
1070 transition(S, Trigger_L2_to_L1D, ST) {
1072 rr_deallocateL2CacheBlock;
1073 ii_allocateL1DCacheBlock;
1077 zz_stallAndWaitMandatoryQueue;
1081 transition(O, Trigger_L2_to_L1D, OT) {
1083 rr_deallocateL2CacheBlock;
1084 ii_allocateL1DCacheBlock;
1088 zz_stallAndWaitMandatoryQueue;
1092 transition(M, Trigger_L2_to_L1D, MT) {
1094 rr_deallocateL2CacheBlock;
1095 ii_allocateL1DCacheBlock;
1099 zz_stallAndWaitMandatoryQueue;
1103 transition(MM, Trigger_L2_to_L1D, MMT) {
1105 rr_deallocateL2CacheBlock;
1106 ii_allocateL1DCacheBlock;
1110 zz_stallAndWaitMandatoryQueue;
1114 transition(I, Trigger_L2_to_L1I, IT) {
1116 rr_deallocateL2CacheBlock;
1117 jj_allocateL1ICacheBlock;
1121 zz_stallAndWaitMandatoryQueue;
1125 transition(S, Trigger_L2_to_L1I, ST) {
1127 rr_deallocateL2CacheBlock;
1128 jj_allocateL1ICacheBlock;
1132 zz_stallAndWaitMandatoryQueue;
1136 transition(O, Trigger_L2_to_L1I, OT) {
1138 rr_deallocateL2CacheBlock;
1139 jj_allocateL1ICacheBlock;
1143 zz_stallAndWaitMandatoryQueue;
1147 transition(M, Trigger_L2_to_L1I, MT) {
1149 rr_deallocateL2CacheBlock;
1150 jj_allocateL1ICacheBlock;
1154 zz_stallAndWaitMandatoryQueue;
1158 transition(MM, Trigger_L2_to_L1I, MMT) {
1160 rr_deallocateL2CacheBlock;
1161 jj_allocateL1ICacheBlock;
1165 zz_stallAndWaitMandatoryQueue;
1169 transition(IT, Complete_L2_to_L1, I) {
1171 kd_wakeUpDependents;
1174 transition(ST, Complete_L2_to_L1, S) {
1176 kd_wakeUpDependents;
1179 transition(OT, Complete_L2_to_L1, O) {
1181 kd_wakeUpDependents;
1184 transition(MT, Complete_L2_to_L1, M) {
1186 kd_wakeUpDependents;
1189 transition(MMT, Complete_L2_to_L1, MM) {
1191 kd_wakeUpDependents;
1194 // Transitions from Idle
1195 transition(I, Load, IS) {
1196 ii_allocateL1DCacheBlock;
1200 k_popMandatoryQueue;
1203 transition(I, Ifetch, IS) {
1204 jj_allocateL1ICacheBlock;
1208 k_popMandatoryQueue;
1211 transition(I, Store, IM) {
1212 ii_allocateL1DCacheBlock;
1216 k_popMandatoryQueue;
1219 transition(I, L2_Replacement) {
1220 rr_deallocateL2CacheBlock;
1221 ka_wakeUpAllDependents;
1224 transition(I, {Other_GETX, NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig, Invalidate}) {
1229 // Transitions from Shared
1230 transition({S, SM, ISM}, {Load, Ifetch}) {
1232 k_popMandatoryQueue;
1235 transition(S, Store, SM) {
1239 k_popMandatoryQueue;
1242 transition(S, L2_Replacement, I) {
1243 rr_deallocateL2CacheBlock;
1244 ka_wakeUpAllDependents;
1247 transition(S, {Other_GETX, Invalidate}, I) {
1252 transition(S, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}) {
1257 // Transitions from Owned
1258 transition({O, OM, SS, MM_W, M_W}, {Load, Ifetch}) {
1260 k_popMandatoryQueue;
1263 transition(O, Store, OM) {
1266 p_decrementNumberOfMessagesByOne;
1268 k_popMandatoryQueue;
1271 transition(O, L2_Replacement, OI) {
1274 rr_deallocateL2CacheBlock;
1275 ka_wakeUpAllDependents;
1278 transition(O, {Other_GETX, Invalidate}, I) {
1283 transition(O, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}) {
1288 transition(O, Merged_GETS) {
1289 em_sendDataSharedMultiple;
1293 // Transitions from Modified
1294 transition(MM, {Load, Ifetch}) {
1296 k_popMandatoryQueue;
1299 transition(MM, Store) {
1301 k_popMandatoryQueue;
1304 transition(MM, L2_Replacement, MI) {
1307 rr_deallocateL2CacheBlock;
1308 ka_wakeUpAllDependents;
1311 transition(MM, {Other_GETX, Invalidate}, I) {
1312 c_sendExclusiveData;
1316 transition(MM, Other_GETS, I) {
1317 c_sendExclusiveData;
1321 transition(MM, NC_DMA_GETS) {
1322 c_sendExclusiveData;
1326 transition(MM, Other_GETS_No_Mig, O) {
1331 transition(MM, Merged_GETS, O) {
1332 em_sendDataSharedMultiple;
1336 // Transitions from Dirty Exclusive
1337 transition(M, {Load, Ifetch}) {
1339 k_popMandatoryQueue;
1342 transition(M, Store, MM) {
1344 k_popMandatoryQueue;
1347 transition(M, L2_Replacement, MI) {
1350 rr_deallocateL2CacheBlock;
1351 ka_wakeUpAllDependents;
1354 transition(M, {Other_GETX, Invalidate}, I) {
1355 c_sendExclusiveData;
1359 transition(M, {Other_GETS, Other_GETS_No_Mig}, O) {
1364 transition(M, NC_DMA_GETS) {
1369 transition(M, Merged_GETS, O) {
1370 em_sendDataSharedMultiple;
1374 // Transitions from IM
1376 transition(IM, {Other_GETX, NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig, Invalidate}) {
1381 transition(IM, Ack) {
1382 m_decrementNumberOfMessages;
1383 o_checkForCompletion;
1387 transition(IM, Data, ISM) {
1389 m_decrementNumberOfMessages;
1390 o_checkForCompletion;
1394 transition(IM, Exclusive_Data, MM_W) {
1396 m_decrementNumberOfMessages;
1397 o_checkForCompletion;
1398 sx_external_store_hit;
1400 kd_wakeUpDependents;
1403 // Transitions from SM
1404 transition(SM, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}) {
1409 transition(SM, {Other_GETX, Invalidate}, IM) {
1414 transition(SM, Ack) {
1415 m_decrementNumberOfMessages;
1416 o_checkForCompletion;
1420 transition(SM, {Data, Exclusive_Data}, ISM) {
1421 v_writeDataToCacheVerify;
1422 m_decrementNumberOfMessages;
1423 o_checkForCompletion;
1427 // Transitions from ISM
1428 transition(ISM, Ack) {
1429 m_decrementNumberOfMessages;
1430 o_checkForCompletion;
1434 transition(ISM, All_acks_no_sharers, MM) {
1435 sxt_trig_ext_store_hit;
1439 kd_wakeUpDependents;
1442 // Transitions from OM
1444 transition(OM, {Other_GETX, Invalidate}, IM) {
1446 pp_incrementNumberOfMessagesByOne;
1450 transition(OM, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}) {
1455 transition(OM, Merged_GETS) {
1456 em_sendDataSharedMultiple;
1460 transition(OM, Ack) {
1461 m_decrementNumberOfMessages;
1462 o_checkForCompletion;
1466 transition(OM, {All_acks, All_acks_no_sharers}, MM) {
1467 sxt_trig_ext_store_hit;
1471 kd_wakeUpDependents;
1474 // Transitions from IS
1476 transition(IS, {Other_GETX, NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig, Invalidate}) {
1481 transition(IS, Ack) {
1482 m_decrementNumberOfMessages;
1483 o_checkForCompletion;
1487 transition(IS, Shared_Ack) {
1488 m_decrementNumberOfMessages;
1490 o_checkForCompletion;
1494 transition(IS, Data, SS) {
1496 m_decrementNumberOfMessages;
1497 o_checkForCompletion;
1498 hx_external_load_hit;
1499 uo_updateCurrentOwner;
1501 kd_wakeUpDependents;
1504 transition(IS, Exclusive_Data, M_W) {
1506 m_decrementNumberOfMessages;
1507 o_checkForCompletion;
1508 hx_external_load_hit;
1510 kd_wakeUpDependents;
1513 transition(IS, Shared_Data, SS) {
1516 m_decrementNumberOfMessages;
1517 o_checkForCompletion;
1518 hx_external_load_hit;
1519 uo_updateCurrentOwner;
1521 kd_wakeUpDependents;
1524 // Transitions from SS
1526 transition(SS, Ack) {
1527 m_decrementNumberOfMessages;
1528 o_checkForCompletion;
1532 transition(SS, Shared_Ack) {
1533 m_decrementNumberOfMessages;
1535 o_checkForCompletion;
1539 transition(SS, All_acks, S) {
1543 kd_wakeUpDependents;
1546 transition(SS, All_acks_no_sharers, S) {
1547 // Note: The directory might still be the owner, so that is why we go to S
1551 kd_wakeUpDependents;
1554 // Transitions from MM_W
1556 transition(MM_W, Store) {
1558 k_popMandatoryQueue;
1561 transition(MM_W, Ack) {
1562 m_decrementNumberOfMessages;
1563 o_checkForCompletion;
1567 transition(MM_W, All_acks_no_sharers, MM) {
1571 kd_wakeUpDependents;
1574 // Transitions from M_W
1576 transition(M_W, Store, MM_W) {
1578 k_popMandatoryQueue;
1581 transition(M_W, Ack) {
1582 m_decrementNumberOfMessages;
1583 o_checkForCompletion;
1587 transition(M_W, All_acks_no_sharers, M) {
1591 kd_wakeUpDependents;
1594 // Transitions from OI/MI
1596 transition({OI, MI}, {Other_GETX, Invalidate}, II) {
1597 q_sendDataFromTBEToCache;
1601 transition({OI, MI}, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig}, OI) {
1602 q_sendDataFromTBEToCache;
1606 transition({OI, MI}, Merged_GETS, OI) {
1607 qm_sendDataFromTBEToCache;
1611 transition(MI, Writeback_Ack, I) {
1612 t_sendExclusiveDataFromTBEToMemory;
1615 kd_wakeUpDependents;
1618 transition(OI, Writeback_Ack, I) {
1619 qq_sendDataFromTBEToMemory;
1622 kd_wakeUpDependents;
1625 // Transitions from II
1626 transition(II, {NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig, Other_GETX, Invalidate}, II) {
1631 transition(II, Writeback_Ack, I) {
1635 kd_wakeUpDependents;
1638 transition(II, Writeback_Nack, I) {
1641 kd_wakeUpDependents;