changeset 44839e8febbd in /z/repo/gem5 details: http://repo.gem5.org/gem5?cmd=changeset;node=44839e8febbd description: ruby: move files from ruby/system to ruby/structures
The directory ruby/system is crowded and unorganized. Hence, the files the hold actual physical structures, are being moved to the directory ruby/structures. This includes Cache Memory, Directory Memory, Memory Controller, Wire Buffer, TBE Table, Perfect Cache Memory, Timer Table, Bank Array. The directory ruby/systems has the glue code that holds these structures together. diffstat: src/mem/ruby/SConscript | 20 +- src/mem/ruby/buffers/MessageBuffer.cc | 422 ----- src/mem/ruby/buffers/MessageBuffer.hh | 215 -- src/mem/ruby/buffers/MessageBufferNode.cc | 39 - src/mem/ruby/buffers/MessageBufferNode.hh | 75 - src/mem/ruby/buffers/SConscript | 37 - src/mem/ruby/common/MachineID.hh | 83 + src/mem/ruby/common/NetDest.hh | 2 +- src/mem/ruby/network/MessageBuffer.cc | 422 +++++ src/mem/ruby/network/MessageBuffer.hh | 215 ++ src/mem/ruby/network/MessageBufferNode.cc | 39 + src/mem/ruby/network/MessageBufferNode.hh | 75 + src/mem/ruby/network/SConscript | 2 + src/mem/ruby/network/garnet/BaseGarnetNetwork.cc | 2 +- src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc | 2 +- src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc | 2 +- src/mem/ruby/network/simple/PerfectSwitch.cc | 2 +- src/mem/ruby/network/simple/SimpleNetwork.cc | 2 +- src/mem/ruby/network/simple/Switch.cc | 2 +- src/mem/ruby/network/simple/Throttle.cc | 2 +- src/mem/ruby/profiler/Profiler.hh | 2 +- src/mem/ruby/recorder/CacheRecorder.cc | 195 -- src/mem/ruby/recorder/CacheRecorder.hh | 130 - src/mem/ruby/recorder/SConscript | 36 - src/mem/ruby/slicc_interface/AbstractController.hh | 6 +- src/mem/ruby/slicc_interface/RubySlicc_ComponentMapping.hh | 4 +- src/mem/ruby/structures/AbstractReplacementPolicy.hh | 89 + src/mem/ruby/structures/BankedArray.cc | 85 + src/mem/ruby/structures/BankedArray.hh | 72 + src/mem/ruby/structures/Cache.py | 49 + src/mem/ruby/structures/CacheMemory.cc | 565 +++++++ src/mem/ruby/structures/CacheMemory.hh | 173 ++ src/mem/ruby/structures/DirectoryMemory.cc | 212 ++ src/mem/ruby/structures/DirectoryMemory.hh | 104 + src/mem/ruby/structures/DirectoryMemory.py | 44 + src/mem/ruby/structures/LRUPolicy.hh | 95 + src/mem/ruby/structures/MemoryControl.cc | 49 + src/mem/ruby/structures/MemoryControl.hh | 114 + src/mem/ruby/structures/MemoryControl.py | 39 + src/mem/ruby/structures/MemoryNode.cc | 41 + src/mem/ruby/structures/MemoryNode.hh | 92 + src/mem/ruby/structures/MemoryVector.hh | 237 ++ src/mem/ruby/structures/PerfectCacheMemory.hh | 192 ++ src/mem/ruby/structures/PersistentTable.cc | 219 ++ src/mem/ruby/structures/PersistentTable.hh | 100 + src/mem/ruby/structures/Prefetcher.hh | 2 +- src/mem/ruby/structures/PseudoLRUPolicy.hh | 137 + src/mem/ruby/structures/RubyMemoryControl.cc | 791 ++++++++++ src/mem/ruby/structures/RubyMemoryControl.hh | 172 ++ src/mem/ruby/structures/RubyMemoryControl.py | 55 + src/mem/ruby/structures/SConscript | 16 + src/mem/ruby/structures/SparseMemory.cc | 417 +++++ src/mem/ruby/structures/SparseMemory.hh | 98 + src/mem/ruby/structures/TBETable.hh | 124 + src/mem/ruby/structures/TimerTable.cc | 129 + src/mem/ruby/structures/TimerTable.hh | 107 + src/mem/ruby/structures/WireBuffer.cc | 158 + src/mem/ruby/structures/WireBuffer.hh | 102 + src/mem/ruby/structures/WireBuffer.py | 35 + src/mem/ruby/system/AbstractReplacementPolicy.hh | 89 - src/mem/ruby/system/BankedArray.cc | 85 - src/mem/ruby/system/BankedArray.hh | 72 - src/mem/ruby/system/Cache.py | 49 - src/mem/ruby/system/CacheMemory.cc | 565 ------- src/mem/ruby/system/CacheMemory.hh | 173 -- src/mem/ruby/system/CacheRecorder.cc | 195 ++ src/mem/ruby/system/CacheRecorder.hh | 130 + src/mem/ruby/system/DirectoryMemory.cc | 212 -- src/mem/ruby/system/DirectoryMemory.hh | 104 - src/mem/ruby/system/DirectoryMemory.py | 44 - src/mem/ruby/system/LRUPolicy.hh | 95 - src/mem/ruby/system/MachineID.hh | 83 - src/mem/ruby/system/MemoryControl.cc | 49 - src/mem/ruby/system/MemoryControl.hh | 114 - src/mem/ruby/system/MemoryControl.py | 39 - src/mem/ruby/system/MemoryNode.cc | 41 - src/mem/ruby/system/MemoryNode.hh | 92 - src/mem/ruby/system/MemoryVector.hh | 237 -- src/mem/ruby/system/PerfectCacheMemory.hh | 192 -- src/mem/ruby/system/PersistentTable.cc | 219 -- src/mem/ruby/system/PersistentTable.hh | 100 - src/mem/ruby/system/PseudoLRUPolicy.hh | 137 - src/mem/ruby/system/RubyMemoryControl.cc | 791 ---------- src/mem/ruby/system/RubyMemoryControl.hh | 172 -- src/mem/ruby/system/RubyMemoryControl.py | 55 - src/mem/ruby/system/RubyPort.hh | 2 +- src/mem/ruby/system/SConscript | 16 +- src/mem/ruby/system/Sequencer.hh | 2 +- src/mem/ruby/system/SparseMemory.cc | 417 ----- src/mem/ruby/system/SparseMemory.hh | 98 - src/mem/ruby/system/System.hh | 12 +- src/mem/ruby/system/TBETable.hh | 124 - src/mem/ruby/system/TimerTable.cc | 129 - src/mem/ruby/system/TimerTable.hh | 107 - src/mem/ruby/system/WireBuffer.cc | 158 - src/mem/ruby/system/WireBuffer.hh | 102 - src/mem/ruby/system/WireBuffer.py | 35 - src/mem/slicc/symbols/Type.py | 2 +- 98 files changed, 6108 insertions(+), 6177 deletions(-) diffs (truncated from 12816 to 300 lines): diff -r ed3816dae6d5 -r 44839e8febbd src/mem/ruby/SConscript --- a/src/mem/ruby/SConscript Mon Sep 01 16:55:30 2014 -0500 +++ b/src/mem/ruby/SConscript Mon Sep 01 16:55:40 2014 -0500 @@ -118,21 +118,21 @@ MakeInclude('slicc_interface/RubyRequest.hh') # External types -MakeInclude('buffers/MessageBuffer.hh') MakeInclude('common/Address.hh') MakeInclude('common/DataBlock.hh') +MakeInclude('common/MachineID.hh') MakeInclude('common/NetDest.hh') MakeInclude('common/Set.hh') MakeInclude('filters/GenericBloomFilter.hh') +MakeInclude('network/MessageBuffer.hh') MakeInclude('structures/Prefetcher.hh') -MakeInclude('system/CacheMemory.hh') +MakeInclude('structures/CacheMemory.hh') MakeInclude('system/DMASequencer.hh') -MakeInclude('system/DirectoryMemory.hh') -MakeInclude('system/MachineID.hh') -MakeInclude('system/MemoryControl.hh') -MakeInclude('system/WireBuffer.hh') -MakeInclude('system/PerfectCacheMemory.hh') -MakeInclude('system/PersistentTable.hh') +MakeInclude('structures/DirectoryMemory.hh') +MakeInclude('structures/MemoryControl.hh') +MakeInclude('structures/WireBuffer.hh') +MakeInclude('structures/PerfectCacheMemory.hh') +MakeInclude('structures/PersistentTable.hh') MakeInclude('system/Sequencer.hh') -MakeInclude('system/TBETable.hh') -MakeInclude('system/TimerTable.hh') +MakeInclude('structures/TBETable.hh') +MakeInclude('structures/TimerTable.hh') diff -r ed3816dae6d5 -r 44839e8febbd src/mem/ruby/buffers/MessageBuffer.cc --- a/src/mem/ruby/buffers/MessageBuffer.cc Mon Sep 01 16:55:30 2014 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,422 +0,0 @@ -/* - * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood - * 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. - */ - -#include <cassert> - -#include "base/cprintf.hh" -#include "base/misc.hh" -#include "base/stl_helpers.hh" -#include "debug/RubyQueue.hh" -#include "mem/ruby/buffers/MessageBuffer.hh" -#include "mem/ruby/system/System.hh" - -using namespace std; -using m5::stl_helpers::operator<<; - -MessageBuffer::MessageBuffer(const string &name) - : m_time_last_time_size_checked(0), m_time_last_time_enqueue(0), - m_time_last_time_pop(0), m_last_arrival_time(0) -{ - m_msg_counter = 0; - m_consumer = NULL; - m_sender = NULL; - m_receiver = NULL; - - m_ordering_set = false; - m_strict_fifo = true; - m_max_size = 0; - m_randomization = true; - m_size_last_time_size_checked = 0; - m_size_at_cycle_start = 0; - m_msgs_this_cycle = 0; - m_not_avail_count = 0; - m_priority_rank = 0; - m_name = name; - - m_stall_msg_map.clear(); - m_input_link_id = 0; - m_vnet_id = 0; -} - -unsigned int -MessageBuffer::getSize() -{ - if (m_time_last_time_size_checked != m_receiver->curCycle()) { - m_time_last_time_size_checked = m_receiver->curCycle(); - m_size_last_time_size_checked = m_prio_heap.size(); - } - - return m_size_last_time_size_checked; -} - -bool -MessageBuffer::areNSlotsAvailable(unsigned int n) -{ - - // fast path when message buffers have infinite size - if (m_max_size == 0) { - return true; - } - - // determine the correct size for the current cycle - // pop operations shouldn't effect the network's visible size - // until next cycle, but enqueue operations effect the visible - // size immediately - unsigned int current_size = 0; - - if (m_time_last_time_pop < m_sender->clockEdge()) { - // no pops this cycle - heap size is correct - current_size = m_prio_heap.size(); - } else { - if (m_time_last_time_enqueue < m_sender->curCycle()) { - // no enqueues this cycle - m_size_at_cycle_start is correct - current_size = m_size_at_cycle_start; - } else { - // both pops and enqueues occured this cycle - add new - // enqueued msgs to m_size_at_cycle_start - current_size = m_size_at_cycle_start + m_msgs_this_cycle; - } - } - - // now compare the new size with our max size - if (current_size + n <= m_max_size) { - return true; - } else { - DPRINTF(RubyQueue, "n: %d, current_size: %d, heap size: %d, " - "m_max_size: %d\n", - n, current_size, m_prio_heap.size(), m_max_size); - m_not_avail_count++; - return false; - } -} - -const Message* -MessageBuffer::peek() const -{ - DPRINTF(RubyQueue, "Peeking at head of queue.\n"); - assert(isReady()); - - const Message* msg_ptr = m_prio_heap.front().m_msgptr.get(); - assert(msg_ptr); - - DPRINTF(RubyQueue, "Message: %s\n", (*msg_ptr)); - return msg_ptr; -} - -// FIXME - move me somewhere else -Cycles -random_time() -{ - Cycles time(1); - time += Cycles(random() & 0x3); // [0...3] - if ((random() & 0x7) == 0) { // 1 in 8 chance - time += Cycles(100 + (random() % 0xf)); // 100 + [1...15] - } - return time; -} - -void -MessageBuffer::enqueue(MsgPtr message, Cycles delta) -{ - m_msg_counter++; - - // record current time incase we have a pop that also adjusts my size - if (m_time_last_time_enqueue < m_sender->curCycle()) { - m_msgs_this_cycle = 0; // first msg this cycle - m_time_last_time_enqueue = m_sender->curCycle(); - } - m_msgs_this_cycle++; - - assert(m_ordering_set); - - // Calculate the arrival time of the message, that is, the first - // cycle the message can be dequeued. - assert(delta > 0); - Tick current_time = m_sender->clockEdge(); - Tick arrival_time = 0; - - if (!RubySystem::getRandomization() || !m_randomization) { - // No randomization - arrival_time = current_time + delta * m_sender->clockPeriod(); - } else { - // Randomization - ignore delta - if (m_strict_fifo) { - if (m_last_arrival_time < current_time) { - m_last_arrival_time = current_time; - } - arrival_time = m_last_arrival_time + - random_time() * m_sender->clockPeriod(); - } else { - arrival_time = current_time + - random_time() * m_sender->clockPeriod(); - } - } - - // Check the arrival time - assert(arrival_time > current_time); - if (m_strict_fifo) { - if (arrival_time < m_last_arrival_time) { - panic("FIFO ordering violated: %s name: %s current time: %d " - "delta: %d arrival_time: %d last arrival_time: %d\n", - *this, m_name, current_time, - delta * m_sender->clockPeriod(), - arrival_time, m_last_arrival_time); - } - } - - // If running a cache trace, don't worry about the last arrival checks - if (!g_system_ptr->m_warmup_enabled) { - m_last_arrival_time = arrival_time; - } - - // compute the delay cycles and set enqueue time - Message* msg_ptr = message.get(); - assert(msg_ptr != NULL); - - assert(m_sender->clockEdge() >= msg_ptr->getLastEnqueueTime() && - "ensure we aren't dequeued early"); - - msg_ptr->updateDelayedTicks(m_sender->clockEdge()); - msg_ptr->setLastEnqueueTime(arrival_time); - - // Insert the message into the priority heap - MessageBufferNode thisNode(arrival_time, m_msg_counter, message); - m_prio_heap.push_back(thisNode); - push_heap(m_prio_heap.begin(), m_prio_heap.end(), - greater<MessageBufferNode>()); - - DPRINTF(RubyQueue, "Enqueue arrival_time: %lld, Message: %s\n", - arrival_time, *(message.get())); - - // Schedule the wakeup - assert(m_consumer != NULL); - m_consumer->scheduleEventAbsolute(arrival_time); - m_consumer->storeEventInfo(m_vnet_id); -} - -Cycles -MessageBuffer::dequeue() -{ - DPRINTF(RubyQueue, "Popping\n"); - assert(isReady()); - - // get MsgPtr of the message about to be dequeued - MsgPtr message = m_prio_heap.front().m_msgptr; - - // get the delay cycles - message->updateDelayedTicks(m_receiver->clockEdge()); - Cycles delayCycles = - m_receiver->ticksToCycles(message->getDelayedTicks()); - - // record previous size and time so the current buffer size isn't - // adjusted until next cycle - if (m_time_last_time_pop < m_receiver->clockEdge()) { - m_size_at_cycle_start = m_prio_heap.size(); - m_time_last_time_pop = m_receiver->clockEdge(); - } - - pop_heap(m_prio_heap.begin(), m_prio_heap.end(), - greater<MessageBufferNode>()); - m_prio_heap.pop_back(); - - return delayCycles; -} - -void -MessageBuffer::clear() -{ - m_prio_heap.clear(); - - m_msg_counter = 0; - m_time_last_time_enqueue = Cycles(0); - m_time_last_time_pop = 0; - m_size_at_cycle_start = 0; - m_msgs_this_cycle = 0; -} - _______________________________________________ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev