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

Last change on this file since 81 was 81, checked in by rosiere, 16 years ago
  • Finish Environment (and test)
  • Continue predictor_unit
  • Add external tools
  • svn keyword "Id" set
  • Property svn:keywords set to Id
File size: 1009 bytes
Line 
1#include "../include/Cache_MultiLevel.h"
2#include <sstream>
3
4namespace environment {
5namespace cache {
6namespace cache_multilevel {
7
8  Access Cache_MultiLevel::access (uint32_t num_port, uint32_t address, uint32_t trdid, type_req_cache_t type, direction_req_cache_t dir)
9  {
10    uint32_t         time          = 0;
11    uint32_t         last_nb_level = (param->nb_level==0)?0:(param->nb_level-1);
12    type_rsp_cache_t hit           = MISS;
13   
14    // Scan all cache level
15    for (uint32_t i = 0; i < param->nb_level; i ++)
16      {
17        hit   = hierarchy_cache[i]->access (num_port,address,trdid,type,dir);
18        uint32_t latence = hierarchy_cache[i]->latence(num_port);
19        time += latence;
20
21        _cout(CACHE,"    * Level [%d] - type_hit %d, latence %d, Sum latence %d\n",i,hit,latence,time);
22
23        if ( (hit == HIT_CACHE)        or
24             (hit == HIT_WRITE_BUFFER) or
25             (hit == HIT_BYPASS)       )
26          {
27            last_nb_level = i;
28            break;
29          }
30      }
31   
32    return Access (num_port,hit,time,last_nb_level);
33  }
34
35};
36};
37};
Note: See TracBrowser for help on using the repository browser.