source: trunk/IPs/systemC/Environment/Cache/src/Cache.cpp @ 112

Last change on this file since 112 was 81, checked in by rosiere, 17 years ago
  • Finish Environment (and test)
  • Continue predictor_unit
  • Add external tools
  • svn keyword "Id" set
  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1#include "../include/Cache.h"
2#include <sstream>
3
4namespace environment {
5namespace cache {
6
7  Cache::Cache (std::string name,
8                Parameters * param)
9  {
10    this->name  = name;
11    this->param = param;
12
13    cache_shared = new cache_multilevel::Cache_MultiLevel (name+"_cache_shared",param->param_cache_shared);
14
15    icache_dedicated = new cache_multilevel::Cache_MultiLevel * [param->nb_cache_dedicated];
16    dcache_dedicated = new cache_multilevel::Cache_MultiLevel * [param->nb_cache_dedicated];
17
18      for (uint32_t i=0; i<param->nb_cache_dedicated; i++)
19        {
20          {
21            std::stringstream str;
22            str << name << "_icache_dedicated_" << i;
23
24            icache_dedicated [i] = new cache_multilevel::Cache_MultiLevel(str.str(),param->param_icache_dedicated [i]);
25          }
26          {
27            std::stringstream str;
28            str << name << "_dcache_dedicated_" << i;
29
30            dcache_dedicated [i] = new cache_multilevel::Cache_MultiLevel(str.str(),param->param_dcache_dedicated [i]);
31          }
32        }
33  }
34
35  Cache::~Cache (void)
36  {
37    for (uint32_t i=0; i<param->nb_cache_dedicated; i++)
38      {
39        delete    icache_dedicated [i];
40        delete    dcache_dedicated [i];
41      }
42    delete [] icache_dedicated;
43    delete [] dcache_dedicated;
44    delete    cache_shared    ;
45  }
46};
47};
Note: See TracBrowser for help on using the repository browser.