source: trunk/IPs/systemC/Environnement/Cache/src/Cache_latence.cpp @ 78

Last change on this file since 78 was 78, checked in by rosiere, 16 years ago

Add :

  • Execute_loop (must be test systemC)
  • Prediction
    • Direction : predifined scheme
    • Branch Target Buffer
  • iFetch_unit
    • ifetch_queue
    • pc management
  • Decod_unit
    • coming soon : support for custom operation
  • Rename_unit
    • RAT
    • Free_list
    • Dependence RAW check
    • Load store unit pointer
  • New Environnement (hierarchy_memory will remove in a next version)


Modif :

  • Manage Custom Operation
  • All component in execute_loop to use the new statistics management

Not Finish :

  • Return Address Stack
  • Environnement
File size: 1.9 KB
Line 
1#include "../include/Cache.h"
2
3namespace environnement {
4namespace cache {
5 
6  // Return the time to have the data
7  // latence is call on the same port in a single cycle, only the last access is save
8  // { NOTE } : type_cache = 0 : icache, 1 : dcache
9  uint32_t Cache::latence (cache_t               type_cache, 
10                           uint32_t              num_entity, 
11                           uint32_t              num_port  , 
12                           uint32_t              address   , 
13                           uint32_t              trdid     , 
14                           type_req_cache_t      type      ,
15                           direction_req_cache_t dir    )
16  {
17    if (num_entity >= param->nb_cache_dedicated)
18      {
19        std::cerr << "<Cache.latence> {ERROR} num_entity must be >= nb_cache_dedicated" << std::endl;
20        exit (1);
21      }
22
23    cache_multilevel::Cache_MultiLevel * cache;
24    if (type_cache == INSTRUCTION_CACHE)
25      cache = icache_dedicated [num_entity];
26    else
27      cache = dcache_dedicated [num_entity];
28
29    if (num_port >= cache->param->nb_port)
30      {
31        std::cerr << "<Cache.latence> {ERROR} num_port can be >= nb_port" << std::endl;
32        exit (1);
33      }
34
35    // Make a access with this level "dedicated"
36    std::cout << "cache dedicated : access" << std::endl;
37    cache_multilevel::Access access_dedicated = cache->access(num_port,address,trdid,type,dir);
38
39    if (access_dedicated.hit == MISS)
40      {
41        std::cout << "cache shared    : access" << std::endl;
42        // Make a access with this level "shared"
43        cache_multilevel::Access access_shared  = cache_shared->access(range_port (type_cache,num_entity)+num_port,address,trdid,type,dir);
44       
45        cache_shared->update_access (access_shared);
46       
47        access_dedicated.last_nb_level = param->nb_cache_dedicated-1; // Update all cache
48        access_dedicated.latence += access_shared.latence;
49      }
50
51    std::cout << "end access, update access" << std::endl;
52
53    cache->update_access (access_dedicated);
54
55    std::cout << "end access, update access" << std::endl;
56
57    return access_dedicated.latence;
58  }
59
60};
61};
Note: See TracBrowser for help on using the repository browser.