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

Last change on this file since 131 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.1 KB
Line 
1#include "../include/Cache_OneLevel.h"
2
3namespace environment {
4namespace cache {
5namespace cache_onelevel {
6
7  Cache_OneLevel::Cache_OneLevel (std::string name,
8                                  Parameters * param)
9  {
10    this->name  = name;
11    this->param = param;
12
13    access_port = new Access_Port [param->nb_port];
14    tag         = new Tag *       [param->nb_line/param->associativity];
15    for (uint32_t it = 0; it < param->nb_line/param->associativity; it ++)
16      tag [it] = new Tag [param->associativity];
17   
18    size_address.offset  = (uint32_t) log2(param->size_line * param->size_word);
19    size_address.familly = (uint32_t) log2(param->nb_line/param->associativity);
20    size_address.tag     = 32 - size_address.familly - size_address.offset;
21   
22    param_write_buffer = new queue::Parameters (2);
23   
24    write_buffer = new queue::Sort_Queue_Dynamic<Write_Buffer> (name+"_write_buffer",param_write_buffer);
25  }
26
27  Cache_OneLevel::~Cache_OneLevel (void)
28  {
29    delete    write_buffer;
30    delete    param_write_buffer;
31    for (uint32_t it = 0; it < param->nb_line/param->associativity; it ++)
32      delete [] tag [it];
33    delete [] tag;
34    delete [] access_port;
35  }
36};
37};
38};
Note: See TracBrowser for help on using the repository browser.