source: trunk/IPs/systemC/Environnement/Cache/src/Cache_OneLevel_access_cached.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: 2.2 KB
Line 
1#include "../include/Cache_OneLevel.h"
2
3namespace environnement {
4namespace cache {
5namespace cache_onelevel {
6
7  type_rsp_cache_t Cache_OneLevel::access_cached (uint32_t num_port, uint32_t address, uint32_t trdid, direction_req_cache_t dir)
8  {
9    Address  address_translate  = translate_address(address);
10    uint32_t num_associativity  = hit_cache        (trdid, address_translate);
11    uint32_t num_access_port    = hit_access_port  (trdid, address_translate);
12    uint32_t num_write_buffer   = hit_write_buffer (trdid, address_translate);
13   
14    if (num_access_port == param->nb_port)
15      num_access_port = num_port;
16   
17    uint32_t         latence            ;
18    type_rsp_cache_t res                = MISS;
19   
20    bool             is_in_cache        = (num_associativity != param->associativity);
21    bool             is_in_access_port  = (num_access_port != num_port);
22    bool             is_in_write_buffer = false;
23   
24    if (is_in_access_port == true)
25      {
26        res     = HIT_BYPASS;
27        latence = access_port[num_access_port].latence; //already compute
28      }
29    else
30      if (is_in_cache == true)
31        {       
32          res     = HIT_CACHE;
33          latence = 0; // Hit !!!
34        }
35      else
36        {
37
38          // Search in the write buffer, and test if have a miss
39          if ( num_write_buffer == write_buffer->nb_slot_use())
40            {
41              res     = MISS;
42              latence = param->miss_penality; // miss -> access at down of cache,  + respons at the up of cache
43            }
44          else
45            {
46              res                = HIT_WRITE_BUFFER;
47              is_in_write_buffer = true;
48              latence            = write_buffer->read(num_write_buffer)._delay;
49            }
50        }
51   
52    // access_port valid = there are a new request to update
53    //  -> no previous request in the same     cycle (hit in a access port)
54    //  -> no previous request in the previous cycle (hit in the write buffer)
55   
56    access_port[num_port].valid             = ((is_in_access_port || is_in_write_buffer) == false);
57    access_port[num_port].address           = address_translate;
58    access_port[num_port].trdid             = trdid;
59    access_port[num_port].hit               = res;
60    access_port[num_port].num_associativity = num_associativity;
61    access_port[num_port].latence           = latence;
62   
63    return res;
64  }
65
66};
67};
68};
Note: See TracBrowser for help on using the repository browser.