From adff204c976fb821ac3f2d3545fc28e3fa30c088 Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Tue, 10 Jan 2012 10:20:32 -0600 Subject: Sparse Memory: Simplify the structure for an entry The SparseMemEntry structure includes just one void* pointer. It seems unnecessary that we have a structure for this. The patch removes the structure and makes use of a typedef on void* instead. --- src/mem/ruby/system/SparseMemory.hh | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'src/mem/ruby/system/SparseMemory.hh') diff --git a/src/mem/ruby/system/SparseMemory.hh b/src/mem/ruby/system/SparseMemory.hh index f6937ef54..f4cc12f97 100644 --- a/src/mem/ruby/system/SparseMemory.hh +++ b/src/mem/ruby/system/SparseMemory.hh @@ -36,11 +36,7 @@ #include "mem/ruby/common/Address.hh" #include "mem/ruby/common/Global.hh" -struct SparseMemEntry -{ - void* entry; -}; - +typedef void* SparseMemEntry; typedef m5::hash_map SparseMapType; struct CurNextInfo @@ -95,12 +91,4 @@ class SparseMemory uint64_t* m_removes_per_level; }; -inline std::ostream& -operator<<(std::ostream& out, const SparseMemEntry& obj) -{ - out << "SparseMemEntry"; - out << std::flush; - return out; -} - #endif // __MEM_RUBY_SYSTEM_SPARSEMEMORY_HH__ -- cgit v1.2.3 From 8b3ad17cc3189ed7470c82e9108669fe48541f43 Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Wed, 11 Jan 2012 13:29:54 -0600 Subject: Ruby Sparse Memory: Add function for collating blocks This patch adds function to the Sparse Memory so that the blocks can be recorded in a cache trace. The blocks are added to the cache recorder which can later write them into a file. --- src/mem/ruby/system/SparseMemory.hh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/mem/ruby/system/SparseMemory.hh') diff --git a/src/mem/ruby/system/SparseMemory.hh b/src/mem/ruby/system/SparseMemory.hh index f4cc12f97..e4237dbcd 100644 --- a/src/mem/ruby/system/SparseMemory.hh +++ b/src/mem/ruby/system/SparseMemory.hh @@ -1,5 +1,6 @@ /* * Copyright (c) 2009 Advanced Micro Devices, Inc. + * Copyright (c) 2012 Mark D. Hill and David A. Wood * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,9 +33,9 @@ #include #include "base/hashmap.hh" -#include "mem/ruby/slicc_interface/AbstractEntry.hh" #include "mem/ruby/common/Address.hh" -#include "mem/ruby/common/Global.hh" +#include "mem/ruby/recorder/CacheRecorder.hh" +#include "mem/ruby/slicc_interface/AbstractEntry.hh" typedef void* SparseMemEntry; typedef m5::hash_map SparseMapType; @@ -59,6 +60,14 @@ class SparseMemory void add(const Address& address, AbstractEntry*); void remove(const Address& address); + /*! + * Function for recording the contents of memory. This function walks + * through all the levels of the sparse memory in a breadth first + * fashion. This might need more memory than a depth first approach. + * But breadth first seems easier to me than a depth first approach. + */ + void recordBlocks(int cntrl_id, CacheRecorder *) const; + AbstractEntry* lookup(const Address& address); // Print cache contents -- cgit v1.2.3