diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2015-09-16 11:59:56 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2015-09-16 11:59:56 -0500 |
commit | cd9e4458139658c4ce8f038e3a44bdecd17fa75d (patch) | |
tree | c7403c142a9bf36869f75016c683b9c7ef731399 /src/mem/protocol/MOESI_CMP_token-dir.sm | |
parent | 78a1245b4115373856514eacf2264141e6cd4aca (diff) | |
download | gem5-cd9e4458139658c4ce8f038e3a44bdecd17fa75d.tar.xz |
ruby: message buffer, timer table: significant changes
This patch changes MessageBuffer and TimerTable, two structures used for
buffering messages by components in ruby. These structures would no longer
maintain pointers to clock objects. Functions in these structures have been
changed to take as input current time in Tick. Similarly, these structures
will not operate on Cycle valued latencies for different operations. The
corresponding functions would need to be provided with these latencies by
components invoking the relevant functions. These latencies should also be
in Ticks.
I felt the need for these changes while trying to speed up ruby. The ultimate
aim is to eliminate Consumer class and replace it with an EventManager object in
the MessageBuffer and TimerTable classes. This object would be used for
scheduling events. The event itself would contain information on the object and
function to be invoked.
In hindsight, it seems I should have done this while I was moving away from use
of a single global clock in the memory system. That change led to introduction
of clock objects that replaced the global clock object. It never crossed my
mind that having clock object pointers is not a good design. And now I really
don't like the fact that we have separate consumer, receiver and sender
pointers in message buffers.
Diffstat (limited to 'src/mem/protocol/MOESI_CMP_token-dir.sm')
-rw-r--r-- | src/mem/protocol/MOESI_CMP_token-dir.sm | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/mem/protocol/MOESI_CMP_token-dir.sm b/src/mem/protocol/MOESI_CMP_token-dir.sm index ffef01eb0..63790531f 100644 --- a/src/mem/protocol/MOESI_CMP_token-dir.sm +++ b/src/mem/protocol/MOESI_CMP_token-dir.sm @@ -172,6 +172,8 @@ machine(Directory, "Token protocol") bool starving, default="false"; int l2_select_low_bit, default="RubySystem::getBlockSizeBits()"; + Tick clockEdge(); + Tick cyclesToTicks(Cycles c); void set_tbe(TBE b); void unset_tbe(); @@ -276,7 +278,7 @@ machine(Directory, "Token protocol") // ** IN_PORTS ** // off-chip memory request/response is done in_port(memQueue_in, MemoryMsg, responseFromMemory) { - if (memQueue_in.isReady()) { + if (memQueue_in.isReady(clockEdge())) { peek(memQueue_in, MemoryMsg) { if (in_msg.Type == MemoryRequestType:MEMORY_READ) { trigger(Event:Memory_Data, in_msg.addr, TBEs[in_msg.addr]); @@ -292,14 +294,15 @@ machine(Directory, "Token protocol") // Reissue Timer in_port(reissueTimerTable_in, Addr, reissueTimerTable) { - if (reissueTimerTable_in.isReady()) { - trigger(Event:Request_Timeout, reissueTimerTable.readyAddress(), - TBEs[reissueTimerTable.readyAddress()]); + Tick current_time := clockEdge(); + if (reissueTimerTable_in.isReady(current_time)) { + Addr addr := reissueTimerTable.nextAddress(); + trigger(Event:Request_Timeout, addr, TBEs.lookup(addr)); } } in_port(responseNetwork_in, ResponseMsg, responseToDir) { - if (responseNetwork_in.isReady()) { + if (responseNetwork_in.isReady(clockEdge())) { peek(responseNetwork_in, ResponseMsg) { assert(in_msg.Destination.isElement(machineID)); if (getDirectoryEntry(in_msg.addr).Tokens + in_msg.Tokens == max_tokens()) { @@ -338,7 +341,7 @@ machine(Directory, "Token protocol") } in_port(persistentNetwork_in, PersistentMsg, persistentToDir) { - if (persistentNetwork_in.isReady()) { + if (persistentNetwork_in.isReady(clockEdge())) { peek(persistentNetwork_in, PersistentMsg) { assert(in_msg.Destination.isElement(machineID)); @@ -400,7 +403,7 @@ machine(Directory, "Token protocol") } in_port(requestNetwork_in, RequestMsg, requestToDir) { - if (requestNetwork_in.isReady()) { + if (requestNetwork_in.isReady(clockEdge())) { peek(requestNetwork_in, RequestMsg) { assert(in_msg.Destination.isElement(machineID)); if (in_msg.Type == CoherenceRequestType:GETS) { @@ -415,7 +418,7 @@ machine(Directory, "Token protocol") } in_port(dmaRequestQueue_in, DMARequestMsg, dmaRequestToDir) { - if (dmaRequestQueue_in.isReady()) { + if (dmaRequestQueue_in.isReady(clockEdge())) { peek(dmaRequestQueue_in, DMARequestMsg) { if (in_msg.Type == DMARequestType:READ) { trigger(Event:DMA_READ, in_msg.LineAddress, TBEs[in_msg.LineAddress]); @@ -490,7 +493,7 @@ machine(Directory, "Token protocol") // IssueCount. // Set a wakeup timer - reissueTimerTable.set(address, reissue_wakeup_latency); + reissueTimerTable.set(address, cyclesToTicks(reissue_wakeup_latency)); } } @@ -558,7 +561,7 @@ machine(Directory, "Token protocol") // IssueCount. // Set a wakeup timer - reissueTimerTable.set(address, reissue_wakeup_latency); + reissueTimerTable.set(address, cyclesToTicks(reissue_wakeup_latency)); } } @@ -752,35 +755,35 @@ machine(Directory, "Token protocol") } action(j_popIncomingRequestQueue, "j", desc="Pop incoming request queue") { - requestNetwork_in.dequeue(); + requestNetwork_in.dequeue(clockEdge()); } action(z_recycleRequest, "z", desc="Recycle the request queue") { - requestNetwork_in.recycle(); + requestNetwork_in.recycle(clockEdge(), cyclesToTicks(recycle_latency)); } action(k_popIncomingResponseQueue, "k", desc="Pop incoming response queue") { - responseNetwork_in.dequeue(); + responseNetwork_in.dequeue(clockEdge()); } action(kz_recycleResponse, "kz", desc="Recycle incoming response queue") { - responseNetwork_in.recycle(); + responseNetwork_in.recycle(clockEdge(), cyclesToTicks(recycle_latency)); } action(l_popIncomingPersistentQueue, "l", desc="Pop incoming persistent queue") { - persistentNetwork_in.dequeue(); + persistentNetwork_in.dequeue(clockEdge()); } action(p_popDmaRequestQueue, "pd", desc="pop dma request queue") { - dmaRequestQueue_in.dequeue(); + dmaRequestQueue_in.dequeue(clockEdge()); } action(y_recycleDmaRequestQueue, "y", desc="recycle dma request queue") { - dmaRequestQueue_in.recycle(); + dmaRequestQueue_in.recycle(clockEdge(), cyclesToTicks(recycle_latency)); } action(l_popMemQueue, "q", desc="Pop off-chip request queue") { - memQueue_in.dequeue(); + memQueue_in.dequeue(clockEdge()); } action(r_bounceResponse, "r", desc="Bounce response to starving processor") { @@ -804,7 +807,7 @@ machine(Directory, "Token protocol") // if (reissueTimerTable.isSet(address)) { reissueTimerTable.unset(address); - reissueTimerTable.set(address, fixed_timeout_latency); + reissueTimerTable.set(address, cyclesToTicks(fixed_timeout_latency)); } } @@ -812,7 +815,7 @@ machine(Directory, "Token protocol") // // currently only support a fixed timeout latency // - reissueTimerTable.set(address, fixed_timeout_latency); + reissueTimerTable.set(address, cyclesToTicks(fixed_timeout_latency)); } action(ut_unsetReissueTimer, "ut", desc="Unset reissue timer.") { |