source: trunk/IPs/systemC/Environnement/Cache/src/Cache_OneLevel_transition.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.4 KB
Line 
1#include "../include/Cache_OneLevel.h"
2
3namespace environnement {
4namespace cache {
5namespace cache_onelevel {
6
7  void Cache_OneLevel::transition (void)
8  {
9    // scan all port - test if have a transaction
10    for (int32_t x = param->nb_port-1; x >= 0; x --)
11      {
12        if (access_port[x].valid == true)
13          {
14            access_port[x].valid = false;
15           
16            // Update LRU
17            //  * hit  : now
18            //  * miss : after the return of next cache
19           
20            if (access_port[x].hit == HIT_CACHE)
21              {// Hit
22                update_lru(access_port[x].address.familly,access_port[x].num_associativity);
23              }
24           
25            if (access_port[x].hit == MISS)
26              {// Miss
27                // Write in write_buffer
28                write_buffer->push(access_port[x].latence,Write_Buffer(access_port[x].address,access_port[x].trdid));
29              }
30          }
31      }
32   
33    write_buffer->transition();
34
35    // Test if a write_buffer have the result
36    while ((write_buffer->empty() == false) && (write_buffer->read(0)._delay == 0))
37      {
38        // Save in the cache
39        Write_Buffer val     = write_buffer->pop();
40       
41        uint32_t num_tag     = val.address.tag;
42        uint32_t num_familly = val.address.familly;
43        uint32_t num_associativity = index_victim(num_familly);
44       
45        tag [num_familly][num_associativity].valid    = true;
46        tag [num_familly][num_associativity].address  = num_tag;
47        tag [num_familly][num_associativity].trdid    = val.trdid;
48       
49        update_lru(num_familly,num_associativity);
50      }
51   
52  }
53};
54};
55};
Note: See TracBrowser for help on using the repository browser.