diff -r 9b8dd8082902 -r 38192485c8d0 src/mem/protocol/MOESI_CMP_token-L1cache.sm --- a/src/mem/protocol/MOESI_CMP_token-L1cache.sm Thu Jan 06 15:36:47 2011 -0800 +++ b/src/mem/protocol/MOESI_CMP_token-L1cache.sm Thu Jan 06 15:37:20 2011 -0800 @@ -427,7 +427,7 @@ // ** IN_PORTS ** // Use Timer - in_port(useTimerTable_in, Address, useTimerTable) { + in_port(useTimerTable_in, Address, useTimerTable, rank=5) { if (useTimerTable_in.isReady()) { if (persistentTable.isLocked(useTimerTable.readyAddress()) && (persistentTable.findSmallest(useTimerTable.readyAddress()) != machineID)) { if (persistentTable.typeOfSmallest(useTimerTable.readyAddress()) == AccessType:Write) { @@ -447,16 +447,14 @@ } // Reissue Timer - in_port(reissueTimerTable_in, Address, reissueTimerTable) { + in_port(reissueTimerTable_in, Address, reissueTimerTable, rank=4) { if (reissueTimerTable_in.isReady()) { trigger(Event:Request_Timeout, reissueTimerTable.readyAddress()); } } - - // Persistent Network - in_port(persistentNetwork_in, PersistentMsg, persistentToL1Cache) { + in_port(persistentNetwork_in, PersistentMsg, persistentToL1Cache, rank=3) { if (persistentNetwork_in.isReady()) { peek(persistentNetwork_in, PersistentMsg, block_on="Address") { assert(in_msg.Destination.isElement(machineID)); @@ -497,46 +495,8 @@ } } - - // Request Network - in_port(requestNetwork_in, RequestMsg, requestToL1Cache) { - if (requestNetwork_in.isReady()) { - peek(requestNetwork_in, RequestMsg, block_on="Address") { - assert(in_msg.Destination.isElement(machineID)); - if (in_msg.Type == CoherenceRequestType:GETX) { - if (in_msg.isLocal) { - trigger(Event:Transient_Local_GETX, in_msg.Address); - } - else { - trigger(Event:Transient_GETX, in_msg.Address); - } - } else if (in_msg.Type == CoherenceRequestType:GETS) { - if (getTokens(in_msg.Address) == 1 || - getTokens(in_msg.Address) == (max_tokens() / 2) + 1) { - if (in_msg.isLocal) { - trigger(Event:Transient_Local_GETS_Last_Token, in_msg.Address); - } - else { - trigger(Event:Transient_GETS_Last_Token, in_msg.Address); - } - } - else { - if (in_msg.isLocal) { - trigger(Event:Transient_Local_GETS, in_msg.Address); - } - else { - trigger(Event:Transient_GETS, in_msg.Address); - } - } - } else { - error("Unexpected message"); - } - } - } - } - // Response Network - in_port(responseNetwork_in, ResponseMsg, responseToL1Cache) { + in_port(responseNetwork_in, ResponseMsg, responseToL1Cache, rank=2) { if (responseNetwork_in.isReady()) { peek(responseNetwork_in, ResponseMsg, block_on="Address") { assert(in_msg.Destination.isElement(machineID)); @@ -604,8 +564,45 @@ } } + // Request Network + in_port(requestNetwork_in, RequestMsg, requestToL1Cache, rank=1) { + if (requestNetwork_in.isReady()) { + peek(requestNetwork_in, RequestMsg, block_on="Address") { + assert(in_msg.Destination.isElement(machineID)); + if (in_msg.Type == CoherenceRequestType:GETX) { + if (in_msg.isLocal) { + trigger(Event:Transient_Local_GETX, in_msg.Address); + } + else { + trigger(Event:Transient_GETX, in_msg.Address); + } + } else if (in_msg.Type == CoherenceRequestType:GETS) { + if (getTokens(in_msg.Address) == 1 || + getTokens(in_msg.Address) == (max_tokens() / 2) + 1) { + if (in_msg.isLocal) { + trigger(Event:Transient_Local_GETS_Last_Token, in_msg.Address); + } + else { + trigger(Event:Transient_GETS_Last_Token, in_msg.Address); + } + } + else { + if (in_msg.isLocal) { + trigger(Event:Transient_Local_GETS, in_msg.Address); + } + else { + trigger(Event:Transient_GETS, in_msg.Address); + } + } + } else { + error("Unexpected message"); + } + } + } + } + // Mandatory Queue - in_port(mandatoryQueue_in, CacheMsg, mandatoryQueue, desc="...") { + in_port(mandatoryQueue_in, CacheMsg, mandatoryQueue, desc="...", rank=0) { if (mandatoryQueue_in.isReady()) { peek(mandatoryQueue_in, CacheMsg, block_on="LineAddress") { // Check for data access to blocks in I-cache and ifetchs to blocks in D-cache @@ -1267,6 +1264,11 @@ L1_TBEs[address].IssueTime := get_time(); } + action(ta_traceStalledAddress, "ta", desc="Trace Stalled Address") { + peek(mandatoryQueue_in, CacheMsg) { + APPEND_TRANSITION_COMMENT(in_msg.LineAddress); + } + } action(j_unsetReissueTimer, "j", desc="Unset reissue timer.") { if (reissueTimerTable.isSet(address)) { @@ -1446,8 +1448,19 @@ } } - action(zz_recycleMandatoryQueue, "\z", desc="Send the head of the mandatory queue to the back of the queue.") { - mandatoryQueue_in.recycle(); + action(zz_stallAndWaitMandatoryQueue, "\z", desc="Send the head of the mandatory queue to the back of the queue.") { + peek(mandatoryQueue_in, CacheMsg) { + APPEND_TRANSITION_COMMENT(in_msg.LineAddress); + } + stall_and_wait(mandatoryQueue_in, address); + } + + action(kd_wakeUpDependents, "kd", desc="wake-up dependents") { + wake_up_dependents(address); + } + + action(ka_wakeUpAllDependents, "ka", desc="wake-up all dependents") { + wake_up_all_dependents(); } //***************************************************** @@ -1456,15 +1469,16 @@ // Transitions for Load/Store/L2_Replacement from transient states transition({IM, SM, OM, IS, IM_L, IS_L, I_L, S_L, SM_L, M_W, MM_W}, L1_Replacement) { - zz_recycleMandatoryQueue; + ta_traceStalledAddress; + zz_stallAndWaitMandatoryQueue; } transition({IM, SM, OM, IS, IM_L, IS_L, SM_L}, {Store, Atomic}) { - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; } transition({IM, IS, IM_L, IS_L}, {Load, Ifetch}) { - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; } @@ -1534,8 +1548,10 @@ } transition(I, L1_Replacement) { + ta_traceStalledAddress; tr_tokenReplacement; gg_deallocateL1CacheBlock; + ka_wakeUpAllDependents; } transition(I, {Transient_GETX, Transient_Local_GETX}) { @@ -1593,8 +1609,10 @@ } transition(S, L1_Replacement, I) { + ta_traceStalledAddress; cc_sharedReplacement; // Only needed in some cases gg_deallocateL1CacheBlock; + ka_wakeUpAllDependents; } transition(S, {Transient_GETX, Transient_Local_GETX}, I) { @@ -1669,8 +1687,10 @@ } transition(O, L1_Replacement, I) { + ta_traceStalledAddress; c_ownedReplacement; gg_deallocateL1CacheBlock; + ka_wakeUpAllDependents; } transition(O, {Transient_GETX, Transient_Local_GETX}, I) { @@ -1754,8 +1774,10 @@ } transition(MM, L1_Replacement, I) { + ta_traceStalledAddress; c_ownedReplacement; gg_deallocateL1CacheBlock; + ka_wakeUpAllDependents; } transition(MM, {Transient_GETX, Transient_Local_GETX, Transient_GETS, Transient_Local_GETS}, I) { @@ -1783,11 +1805,13 @@ transition(MM_W, Use_TimeoutNoStarvers, MM) { s_deallocateTBE; jj_unsetUseTimer; + kd_wakeUpDependents; } transition(MM_W, Use_TimeoutNoStarvers_NoMig, M) { s_deallocateTBE; jj_unsetUseTimer; + kd_wakeUpDependents; } // Transitions from Dirty Exclusive @@ -1817,8 +1841,10 @@ } transition(M, L1_Replacement, I) { + ta_traceStalledAddress; c_ownedReplacement; gg_deallocateL1CacheBlock; + ka_wakeUpAllDependents; } transition(M, {Transient_GETX, Transient_Local_GETX}, I) { @@ -1867,6 +1893,7 @@ transition(M_W, {Use_TimeoutNoStarvers, Use_TimeoutNoStarvers_NoMig}, M) { s_deallocateTBE; jj_unsetUseTimer; + kd_wakeUpDependents; } transition(M_W, Use_TimeoutStarverX, I_L) { @@ -1975,6 +2002,7 @@ o_scheduleUseTimeout; j_unsetReissueTimer; n_popResponseQueue; + kd_wakeUpDependents; } transition(SM, Data_Shared) { @@ -1996,6 +2024,7 @@ o_scheduleUseTimeout; j_unsetReissueTimer; n_popResponseQueue; + kd_wakeUpDependents; } transition({IM, SM}, {Transient_GETX, Transient_Local_GETX}, IM) { // We don't have the data yet, but we might have collected some tokens. We give them up here to avoid livelock @@ -2025,6 +2054,7 @@ o_scheduleUseTimeout; j_unsetReissueTimer; n_popResponseQueue; + kd_wakeUpDependents; } transition(OM, Data_Shared) { @@ -2040,6 +2070,7 @@ o_scheduleUseTimeout; j_unsetReissueTimer; n_popResponseQueue; + kd_wakeUpDependents; } transition(OM, Request_Timeout) { @@ -2061,6 +2092,7 @@ s_deallocateTBE; j_unsetReissueTimer; n_popResponseQueue; + kd_wakeUpDependents; } transition(IS, Data_Owner, O) { @@ -2070,6 +2102,7 @@ s_deallocateTBE; j_unsetReissueTimer; n_popResponseQueue; + kd_wakeUpDependents; } transition(IS, Data_All_Tokens, M_W) { @@ -2079,6 +2112,7 @@ o_scheduleUseTimeout; j_unsetReissueTimer; n_popResponseQueue; + kd_wakeUpDependents; } transition(IS, Request_Timeout) { @@ -2166,6 +2200,7 @@ j_unsetReissueTimer; o_scheduleUseTimeout; n_popResponseQueue; + kd_wakeUpDependents; } transition(SM_L, Data_All_Tokens, S_L) { @@ -2207,6 +2242,7 @@ j_unsetReissueTimer; o_scheduleUseTimeout; n_popResponseQueue; + kd_wakeUpDependents; } @@ -2214,22 +2250,27 @@ transition(I_L, Own_Lock_or_Unlock, I) { l_popPersistentQueue; + kd_wakeUpDependents; } transition(S_L, Own_Lock_or_Unlock, S) { l_popPersistentQueue; + kd_wakeUpDependents; } transition(IM_L, Own_Lock_or_Unlock, IM) { l_popPersistentQueue; + kd_wakeUpDependents; } transition(IS_L, Own_Lock_or_Unlock, IS) { l_popPersistentQueue; + kd_wakeUpDependents; } transition(SM_L, Own_Lock_or_Unlock, SM) { l_popPersistentQueue; + kd_wakeUpDependents; } } diff -r 9b8dd8082902 -r 38192485c8d0 src/mem/protocol/MOESI_hammer-cache.sm --- a/src/mem/protocol/MOESI_hammer-cache.sm Thu Jan 06 15:36:47 2011 -0800 +++ b/src/mem/protocol/MOESI_hammer-cache.sm Thu Jan 06 15:37:20 2011 -0800 @@ -266,7 +266,7 @@ // ** IN_PORTS ** // Trigger Queue - in_port(triggerQueue_in, TriggerMsg, triggerQueue) { + in_port(triggerQueue_in, TriggerMsg, triggerQueue, rank=3) { if (triggerQueue_in.isReady()) { peek(triggerQueue_in, TriggerMsg) { if (in_msg.Type == TriggerType:L2_to_L1) { @@ -282,10 +282,31 @@ } } - // Nothing from the request network + // Nothing from the unblock network + + // Response Network + in_port(responseToCache_in, ResponseMsg, responseToCache, rank=2) { + if (responseToCache_in.isReady()) { + peek(responseToCache_in, ResponseMsg, block_on="Address") { + if (in_msg.Type == CoherenceResponseType:ACK) { + trigger(Event:Ack, in_msg.Address); + } else if (in_msg.Type == CoherenceResponseType:ACK_SHARED) { + trigger(Event:Shared_Ack, in_msg.Address); + } else if (in_msg.Type == CoherenceResponseType:DATA) { + trigger(Event:Data, in_msg.Address); + } else if (in_msg.Type == CoherenceResponseType:DATA_SHARED) { + trigger(Event:Shared_Data, in_msg.Address); + } else if (in_msg.Type == CoherenceResponseType:DATA_EXCLUSIVE) { + trigger(Event:Exclusive_Data, in_msg.Address); + } else { + error("Unexpected message"); + } + } + } + } // Forward Network - in_port(forwardToCache_in, RequestMsg, forwardToCache) { + in_port(forwardToCache_in, RequestMsg, forwardToCache, rank=1) { if (forwardToCache_in.isReady()) { peek(forwardToCache_in, RequestMsg, block_on="Address") { if (in_msg.Type == CoherenceRequestType:GETX) { @@ -319,31 +340,10 @@ } } - // Response Network - in_port(responseToCache_in, ResponseMsg, responseToCache) { - if (responseToCache_in.isReady()) { - peek(responseToCache_in, ResponseMsg, block_on="Address") { - if (in_msg.Type == CoherenceResponseType:ACK) { - trigger(Event:Ack, in_msg.Address); - } else if (in_msg.Type == CoherenceResponseType:ACK_SHARED) { - trigger(Event:Shared_Ack, in_msg.Address); - } else if (in_msg.Type == CoherenceResponseType:DATA) { - trigger(Event:Data, in_msg.Address); - } else if (in_msg.Type == CoherenceResponseType:DATA_SHARED) { - trigger(Event:Shared_Data, in_msg.Address); - } else if (in_msg.Type == CoherenceResponseType:DATA_EXCLUSIVE) { - trigger(Event:Exclusive_Data, in_msg.Address); - } else { - error("Unexpected message"); - } - } - } - } - - // Nothing from the unblock network + // Nothing from the request network // Mandatory Queue - in_port(mandatoryQueue_in, CacheMsg, mandatoryQueue, desc="...") { + in_port(mandatoryQueue_in, CacheMsg, mandatoryQueue, desc="...", rank=0) { if (mandatoryQueue_in.isReady()) { peek(mandatoryQueue_in, CacheMsg, block_on="LineAddress") { @@ -932,8 +932,16 @@ } } - action(zz_recycleMandatoryQueue, "\z", desc="Send the head of the mandatory queue to the back of the queue.") { - mandatoryQueue_in.recycle(); + action(zz_stallAndWaitMandatoryQueue, "\z", desc="Send the head of the mandatory queue to the back of the queue.") { + stall_and_wait(mandatoryQueue_in, address); + } + + action(kd_wakeUpDependents, "kd", desc="wake-up dependents") { + wake_up_dependents(address); + } + + action(ka_wakeUpAllDependents, "ka", desc="wake-up all dependents") { + wake_up_all_dependents(); } //***************************************************** @@ -942,19 +950,19 @@ // Transitions for Load/Store/L2_Replacement from transient states transition({IM, SM, ISM, OM, IS, SS, OI, MI, II, IT, ST, OT, MT, MMT}, {Store, L2_Replacement}) { - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; } transition({M_W, MM_W}, {L2_Replacement}) { - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; } transition({IM, IS, OI, MI, II, IT, ST, OT, MT, MMT}, {Load, Ifetch}) { - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; } transition({IM, SM, ISM, OM, IS, SS, MM_W, M_W, OI, MI, II, IT, ST, OT, MT, MMT}, L1_to_L2) { - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; } transition({IT, ST, OT, MT, MMT}, {Other_GETX, NC_DMA_GETS, Other_GETS, Merged_GETS, Other_GETS_No_Mig, Invalidate}) { @@ -968,6 +976,7 @@ vv_allocateL2CacheBlock; hp_copyFromTBEToL2; s_deallocateTBE; + ka_wakeUpAllDependents; } transition(I, Trigger_L2_to_L1D, IT) { @@ -977,7 +986,7 @@ nb_copyFromTBEToL1; // Not really needed for state I s_deallocateTBE; uu_profileMiss; - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; ll_L2toL1Transfer; } @@ -988,7 +997,7 @@ nb_copyFromTBEToL1; s_deallocateTBE; uu_profileMiss; - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; ll_L2toL1Transfer; } @@ -999,7 +1008,7 @@ nb_copyFromTBEToL1; s_deallocateTBE; uu_profileMiss; - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; ll_L2toL1Transfer; } @@ -1010,7 +1019,7 @@ nb_copyFromTBEToL1; s_deallocateTBE; uu_profileMiss; - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; ll_L2toL1Transfer; } @@ -1021,7 +1030,7 @@ nb_copyFromTBEToL1; s_deallocateTBE; uu_profileMiss; - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; ll_L2toL1Transfer; } @@ -1032,7 +1041,7 @@ nb_copyFromTBEToL1; s_deallocateTBE; uu_profileMiss; - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; ll_L2toL1Transfer; } @@ -1043,7 +1052,7 @@ nb_copyFromTBEToL1; s_deallocateTBE; uu_profileMiss; - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; ll_L2toL1Transfer; } @@ -1054,7 +1063,7 @@ nb_copyFromTBEToL1; s_deallocateTBE; uu_profileMiss; - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; ll_L2toL1Transfer; } @@ -1065,7 +1074,7 @@ nb_copyFromTBEToL1; s_deallocateTBE; uu_profileMiss; - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; ll_L2toL1Transfer; } @@ -1076,28 +1085,33 @@ nb_copyFromTBEToL1; s_deallocateTBE; uu_profileMiss; - zz_recycleMandatoryQueue; + zz_stallAndWaitMandatoryQueue; ll_L2toL1Transfer; } transition(IT, Complete_L2_to_L1, I) { j_popTriggerQueue; + kd_wakeUpDependents; } transition(ST, Complete_L2_to_L1, S) { j_popTriggerQueue; + kd_wakeUpDependents; } transition(OT, Complete_L2_to_L1, O) { j_popTriggerQueue; + kd_wakeUpDependents; } transition(MT, Complete_L2_to_L1, M) { j_popTriggerQueue; + kd_wakeUpDependents; } transition(MMT, Complete_L2_to_L1, MM) { j_popTriggerQueue; + kd_wakeUpDependents; } // Transitions from Idle @@ -1127,6 +1141,7 @@ transition(I, L2_Replacement) { rr_deallocateL2CacheBlock; + ka_wakeUpAllDependents; } transition(I, {Other_GETX, NC_DMA_GETS, Other_GETS, Other_GETS_No_Mig, Invalidate}) { @@ -1149,6 +1164,7 @@ transition(S, L2_Replacement, I) { rr_deallocateL2CacheBlock; + ka_wakeUpAllDependents; } transition(S, {Other_GETX, Invalidate}, I) { @@ -1179,6 +1195,7 @@ i_allocateTBE; d_issuePUT; rr_deallocateL2CacheBlock; + ka_wakeUpAllDependents; } transition(O, {Other_GETX, Invalidate}, I) { @@ -1211,6 +1228,7 @@ i_allocateTBE; d_issuePUT; rr_deallocateL2CacheBlock; + ka_wakeUpAllDependents; } transition(MM, {Other_GETX, Invalidate}, I) { @@ -1253,6 +1271,7 @@ i_allocateTBE; d_issuePUT; rr_deallocateL2CacheBlock; + ka_wakeUpAllDependents; } transition(M, {Other_GETX, Invalidate}, I) { @@ -1301,6 +1320,7 @@ o_checkForCompletion; sx_external_store_hit; n_popResponseQueue; + kd_wakeUpDependents; } // Transitions from SM @@ -1339,6 +1359,7 @@ gm_sendUnblockM; s_deallocateTBE; j_popTriggerQueue; + kd_wakeUpDependents; } // Transitions from OM @@ -1370,6 +1391,7 @@ gm_sendUnblockM; s_deallocateTBE; j_popTriggerQueue; + kd_wakeUpDependents; } // Transitions from IS @@ -1399,6 +1421,7 @@ hx_external_load_hit; uo_updateCurrentOwner; n_popResponseQueue; + kd_wakeUpDependents; } transition(IS, Exclusive_Data, M_W) { @@ -1407,6 +1430,7 @@ o_checkForCompletion; hx_external_load_hit; n_popResponseQueue; + kd_wakeUpDependents; } transition(IS, Shared_Data, SS) { @@ -1417,6 +1441,7 @@ hx_external_load_hit; uo_updateCurrentOwner; n_popResponseQueue; + kd_wakeUpDependents; } // Transitions from SS @@ -1464,6 +1489,7 @@ gm_sendUnblockM; s_deallocateTBE; j_popTriggerQueue; + kd_wakeUpDependents; } // Transitions from M_W @@ -1483,6 +1509,7 @@ gm_sendUnblockM; s_deallocateTBE; j_popTriggerQueue; + kd_wakeUpDependents; } // Transitions from OI/MI @@ -1506,12 +1533,14 @@ t_sendExclusiveDataFromTBEToMemory; s_deallocateTBE; l_popForwardQueue; + kd_wakeUpDependents; } transition(OI, Writeback_Ack, I) { qq_sendDataFromTBEToMemory; s_deallocateTBE; l_popForwardQueue; + kd_wakeUpDependents; } // Transitions from II @@ -1524,11 +1553,13 @@ g_sendUnblock; s_deallocateTBE; l_popForwardQueue; + kd_wakeUpDependents; } transition(II, Writeback_Nack, I) { s_deallocateTBE; l_popForwardQueue; + kd_wakeUpDependents; } } diff -r 9b8dd8082902 -r 38192485c8d0 src/mem/ruby/buffers/MessageBuffer.hh --- a/src/mem/ruby/buffers/MessageBuffer.hh Thu Jan 06 15:36:47 2011 -0800 +++ b/src/mem/ruby/buffers/MessageBuffer.hh Thu Jan 06 15:37:20 2011 -0800 @@ -60,6 +60,7 @@ } void reanalyzeMessages(const Address& addr); + void reanalyzeAllMessages(); void stallMessage(const Address& addr); // TRUE if head of queue timestamp <= SystemTime diff -r 9b8dd8082902 -r 38192485c8d0 src/mem/ruby/buffers/MessageBuffer.cc --- a/src/mem/ruby/buffers/MessageBuffer.cc Thu Jan 06 15:36:47 2011 -0800 +++ b/src/mem/ruby/buffers/MessageBuffer.cc Thu Jan 06 15:37:20 2011 -0800 @@ -54,6 +54,8 @@ m_not_avail_count = 0; m_priority_rank = 0; m_name = name; + + m_stall_msg_map.clear(); } int @@ -335,11 +337,43 @@ m_prio_heap.push_back(msgNode); push_heap(m_prio_heap.begin(), m_prio_heap.end(), - greater()); + greater()); g_eventQueue_ptr->scheduleEventAbsolute(m_consumer_ptr, msgNode.m_time); m_stall_msg_map[addr].pop_front(); } + m_stall_msg_map.erase(addr); +} + +void +MessageBuffer::reanalyzeAllMessages() +{ + DPRINTF(RubyQueue, "ReanalyzeAllMessages %s\n", m_name); + + // + // Put all stalled messages associated with this address back on the + // prio heap + // + for (StallMsgMapType::iterator map_iter = m_stall_msg_map.begin(); + map_iter != m_stall_msg_map.end(); + ++map_iter) { + + while(!(map_iter->second).empty()) { + m_msg_counter++; + MessageBufferNode msgNode(g_eventQueue_ptr->getTime() + 1, + m_msg_counter, + (map_iter->second).front()); + + m_prio_heap.push_back(msgNode); + push_heap(m_prio_heap.begin(), m_prio_heap.end(), + greater()); + + g_eventQueue_ptr->scheduleEventAbsolute(m_consumer_ptr, + msgNode.m_time); + (map_iter->second).pop_front(); + } + } + m_stall_msg_map.clear(); } void diff -r 9b8dd8082902 -r 38192485c8d0 src/mem/slicc/ast/WakeUpAllDependentsStatementAST.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mem/slicc/ast/WakeUpAllDependentsStatementAST.py Thu Jan 06 15:37:20 2011 -0800 @@ -0,0 +1,43 @@ +# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood +# Copyright (c) 2009 The Hewlett-Packard Development Company +# Copyright (c) 2010 Advanced Micro Devices, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer; +# redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +from slicc.ast.StatementAST import StatementAST + +class WakeUpAllDependentsStatementAST(StatementAST): + def __init__(self, slicc): + super(StatementAST, self).__init__(slicc) + + def __repr__(self): + return "[WakeUpAllDependentsStatementAst: %r]" % self.variable + + def generate(self, code, return_type): + code(''' + if (m_waiting_buffers.size() > 0) { + wakeUpAllBuffers(); + } + ''') diff -r 9b8dd8082902 -r 38192485c8d0 src/mem/slicc/ast/__init__.py --- a/src/mem/slicc/ast/__init__.py Thu Jan 06 15:36:47 2011 -0800 +++ b/src/mem/slicc/ast/__init__.py Thu Jan 06 15:37:20 2011 -0800 @@ -69,4 +69,5 @@ from slicc.ast.TypeFieldMemberAST import * from slicc.ast.TypeFieldMethodAST import * from slicc.ast.VarExprAST import * +from slicc.ast.WakeUpAllDependentsStatementAST import * from slicc.ast.WakeUpDependentsStatementAST import * diff -r 9b8dd8082902 -r 38192485c8d0 src/mem/slicc/parser.py --- a/src/mem/slicc/parser.py Thu Jan 06 15:36:47 2011 -0800 +++ b/src/mem/slicc/parser.py Thu Jan 06 15:37:20 2011 -0800 @@ -159,6 +159,7 @@ 'peek' : 'PEEK', 'stall_and_wait' : 'STALL_AND_WAIT', 'wake_up_dependents' : 'WAKE_UP_DEPENDENTS', + 'wake_up_all_dependents' : 'WAKE_UP_ALL_DEPENDENTS', 'enqueue' : 'ENQUEUE', 'copy_head' : 'COPY_HEAD', 'check_allocate' : 'CHECK_ALLOCATE', @@ -558,6 +559,10 @@ "statement : WAKE_UP_DEPENDENTS '(' var ')' SEMI" p[0] = ast.WakeUpDependentsStatementAST(self, p[3]) + def p_statement__wake_up_all_dependents(self, p): + "statement : WAKE_UP_ALL_DEPENDENTS '(' ')' SEMI" + p[0] = ast.WakeUpAllDependentsStatementAST(self) + def p_statement__peek(self, p): "statement : PEEK '(' var ',' type pairs ')' statements" p[0] = ast.PeekStatementAST(self, p[3], p[5], p[6], p[8], "peek") diff -r 9b8dd8082902 -r 38192485c8d0 src/mem/slicc/symbols/StateMachine.py --- a/src/mem/slicc/symbols/StateMachine.py Thu Jan 06 15:36:47 2011 -0800 +++ b/src/mem/slicc/symbols/StateMachine.py Thu Jan 06 15:37:20 2011 -0800 @@ -240,6 +240,7 @@ const MachineType getMachineType() const; void stallBuffer(MessageBuffer* buf, Address addr); void wakeUpBuffers(Address addr); + void wakeUpAllBuffers(); void initNetworkPtr(Network* net_ptr) { m_net_ptr = net_ptr; } void print(std::ostream& out) const; void printConfig(std::ostream& out) const; @@ -663,6 +664,37 @@ } void +$c_ident::wakeUpAllBuffers() +{ + // + // Wake up all possible buffers that could be waiting on any message. + // + + std::vector wokeUpMsgVecs; + + for (WaitingBufType::iterator buf_iter = m_waiting_buffers.begin(); + buf_iter != m_waiting_buffers.end(); + ++buf_iter) { + for (MsgVecType::iterator vec_iter = buf_iter->second->begin(); + vec_iter != buf_iter->second->end(); + ++vec_iter) { + if (*vec_iter != NULL) { + (*vec_iter)->reanalyzeAllMessages(); + } + } + wokeUpMsgVecs.push_back(buf_iter->second); + } + + for (std::vector::iterator wb_iter = wokeUpMsgVecs.begin(); + wb_iter != wokeUpMsgVecs.end(); + ++wb_iter) { + delete (*wb_iter); + } + + m_waiting_buffers.clear(); +} + +void $c_ident::blockOnQueue(Address addr, MessageBuffer* port) { m_is_blocking = true;