summaryrefslogtreecommitdiff
path: root/src/gpgpu-sim/gpu-cache.cc
diff options
context:
space:
mode:
authorTor Aamodt <[email protected]>2010-10-16 17:30:52 -0800
committerTor Aamodt <[email protected]>2010-10-16 17:30:52 -0800
commitb577cbcdf229a2c02d1bf8584c6e82be7a14cb33 (patch)
tree373ea8ec8ea8d7d9a7a1df0eaa17f15652df1306 /src/gpgpu-sim/gpu-cache.cc
parent2072e7ff2037c19a0c346e60469949c9437569bf (diff)
1. creating cache_config object to encapsulate cache configuration information
(and parse it before creating the simulator objects). 2. creating core_config to hold only features of a shader_core that are high level enough either (a) the functional simulator needs to know about them, or (b) they affect memory *access* generation. 3. in config files only (so far) separate out notion of write-{through,back}, from notion of when a line is allocated... will use this to distinguish different types of caches. passing CUDA 3.1 regression [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 7870]
Diffstat (limited to 'src/gpgpu-sim/gpu-cache.cc')
-rw-r--r--src/gpgpu-sim/gpu-cache.cc39
1 files changed, 10 insertions, 29 deletions
diff --git a/src/gpgpu-sim/gpu-cache.cc b/src/gpgpu-sim/gpu-cache.cc
index c1acc83..98909ce 100644
--- a/src/gpgpu-sim/gpu-cache.cc
+++ b/src/gpgpu-sim/gpu-cache.cc
@@ -77,39 +77,20 @@ cache_t::~cache_t()
delete m_lines;
}
-cache_t::cache_t( const char *name,
- const char *opt,
- enum cache_write_policy wp,
- int core_id,
- int type_id )
+cache_t::cache_t( const char *name, const cache_config &config, int core_id, int type_id )
+ : m_config(config)
{
- unsigned int nset;
- unsigned int line_sz;
- unsigned int assoc;
- unsigned char policy;
- int ntok = sscanf(opt,"%d:%d:%d:%c", &nset, &line_sz, &assoc, &policy);
- if( ntok != 4 ) {
- printf("GPGPU-Sim uArch: cache configuration string parsing error for cache %s\n", name);
- abort();
- }
- assert(nset && assoc);
-
- unsigned int nlines;
- nlines = nset * assoc;
m_name = name;
- m_nset = nset;
- m_nset_log2 = LOGB2(nset);
- m_assoc = assoc;
- m_line_sz = line_sz;
- m_line_sz_log2 = LOGB2(line_sz);
- m_replacement_policy = policy;
- m_write_policy = wp;
+ m_nset = config.nset;
+ m_nset_log2 = LOGB2(config.nset);
+ m_assoc = config.assoc;
+ m_line_sz = config.line_sz;
+ m_line_sz_log2 = LOGB2(config.line_sz);
+ m_replacement_policy = config.replacement_policy;
+ m_write_policy = config.get_write_policy();
+ unsigned nlines = config.get_num_lines();
m_lines = new cache_block_t[nlines];
- // don't hook up with any logger
- m_core_id = -1;
- m_type_id = -1;
-
// initialize snapshot counters for visualizer
m_prev_snapshot_access = 0;
m_prev_snapshot_miss = 0;