Ignore:
Timestamp:
Apr 15, 2008, 8:40:01 PM (17 years ago)
Author:
rosiere
Message:
  • Finish Environment (and test)
  • Continue predictor_unit
  • Add external tools
  • svn keyword "Id" set
Location:
trunk/IPs/systemC/Environment/Cache
Files:
48 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/Environment/Cache/Makefile

    • Property svn:keywords set to Id
    r80 r81  
    55#-----[ Variable ]-----------------------------------------
    66
    7 OBJECTS_DEPS                    = $(patsubst $(DIR_QUEUE)/%.cpp,$(DIR_OBJ)/%.o,$(wildcard $(DIR_QUEUE)/*.cpp))
     7OBJECTS_DEPS                    = $(patsubst $(DIR_QUEUE)/$(DIR_SRC)/%.cpp,$(DIR_QUEUE)/$(DIR_OBJ)/%.o,$(wildcard $(DIR_QUEUE)/$(DIR_SRC)/*.cpp))
    88
    99#-----[ Rules ]--------------------------------------------
  • trunk/IPs/systemC/Environment/Cache/include/Cache.h

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/include/Cache_MultiLevel.h

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/include/Cache_MultiLevel_Access.h

    • Property svn:keywords set to Id
    r80 r81  
    1717  public : Access ()
    1818    {
     19      this->num_port      = 0;
     20      this->hit           = MISS;
     21      this->latence       = 0;
     22      this->last_nb_level = 0;
    1923    }
    2024
  • trunk/IPs/systemC/Environment/Cache/include/Cache_MultiLevel_Parameters.h

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/include/Cache_OneLevel.h

    • Property svn:keywords set to Id
    r80 r81  
    88#include "Cache_OneLevel_Parameters.h"
    99#include "../../Queue/include/Sort_Queue_Dynamic.h"
     10#include "../../Common/include/Debug.h"
    1011
    1112namespace environment {
  • trunk/IPs/systemC/Environment/Cache/include/Cache_OneLevel_Access_Port.h

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/include/Cache_OneLevel_Address.h

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/include/Cache_OneLevel_Parameters.h

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/include/Cache_OneLevel_Tag.h

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/include/Cache_OneLevel_Write_Buffer.h

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/include/Cache_Parameters.h

    • Property svn:keywords set to Id
    r80 r81  
    1414  public : uint32_t nb_cache_dedicated;
    1515  public : uint32_t nb_iport;
     16  public : uint32_t nb_dport;
    1617
    1718  public : cache_multilevel::Parameters ** param_icache_dedicated;
     
    4748      this->nb_cache_dedicated = nb_cache_dedicated;
    4849
     50      if (nb_cache_dedicated == 0)
     51        {
     52          std::cerr << "[  ERROR  ] nb_cache_dedicated > 0" << std::endl;
     53          exit(0);
     54        }
     55
    4956      uint32_t cache_shared_nb_port = 0;
    50       uint32_t nb_iport = 0;
     57      nb_iport = 0;
     58      nb_dport = 0;
     59
    5160      for (uint32_t i=0; i<nb_cache_dedicated; i++)
    5261        {
    5362          nb_iport             += icache_dedicated_nb_port [i];
     63          nb_dport             += dcache_dedicated_nb_port [i];
    5464          cache_shared_nb_port += icache_dedicated_nb_port [i];
    5565          cache_shared_nb_port += dcache_dedicated_nb_port [i];
     
    108118    {
    109119      std::string tab (depth,'\t');
    110       std::stringstream str;
     120      std::stringstream str ("");
    111121
    112122      str << tab << "* Nb Cache dedicated    : " << nb_cache_dedicated << std::endl
    113           << tab << "* Nb iport              : " << nb_iport << std::endl;
     123          << tab << "* Nb iport              : " << nb_iport << std::endl
     124          << tab << "* Nb dport              : " << nb_dport << std::endl
     125;
    114126
    115127      for (uint32_t i=0; i<nb_cache_dedicated; i++)
  • trunk/IPs/systemC/Environment/Cache/include/Types.h

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/selftest/main.cpp

    • Property svn:keywords set to Id
    r80 r81  
     1#include "../include/Cache.h"
    12#include <iostream>
    2 #include "../include/Cache.h"
    33
    44using namespace std;
     
    66using namespace environment::cache;
    77
    8 #define TEST(x,y)                               \
    9   {                                             \
    10     cout << "Line " << __LINE__ << " : ";       \
    11     if (x==y)                                   \
    12       {                                         \
    13         cout << "Test OK" << endl;              \
    14       }                                         \
    15     else                                        \
    16       {                                         \
    17         cout << "Test KO" << endl;              \
    18         exit (EXIT_FAILURE);                    \
    19       }                                         \
     8#define TEST(x,y)                                                       \
     9  {                                                                     \
     10    if (x==y)                                                           \
     11      {                                                                 \
     12        cout << "Line " << __LINE__ << " : " << "Test OK" << endl;      \
     13      }                                                                 \
     14    else                                                                \
     15      {                                                                 \
     16        cout << "Line " << __LINE__ << " : " << "Test KO" << endl;      \
     17        exit (EXIT_FAILURE);                                            \
     18      }                                                                 \
    2019  } while (0)
    2120   
    2221
    2322
    24 int main (void)
     23#ifdef SYSTEMC
     24int sc_main (int argc, char * argv[])
     25#else
     26int    main (int argc, char * argv[])
     27#endif
    2528{
    2629  cout << "<main> Begin" << endl;
     
    3841       );
    3942
    40     cout << *param << endl;
     43//     cout << *param << endl;
    4144
    4245    cache_onelevel::Cache_OneLevel * cache = new cache_onelevel::Cache_OneLevel ("my_cache",param);
    4346    cache->reset();
    4447   
    45     cout << *cache << endl;
     48//     cout << *cache << endl;
    4649   
    4750    cache->transition();
    4851    cache->transition();
    4952
    50     cout << *cache << endl;
     53//     cout << *cache << endl;
    5154
    5255    TEST(cache->access(0, 0x100, 0, CACHED, WRITE), MISS);
     
    8992
    9093    cache->transition(); // miss cycle 1
    91     cout << *cache << endl;
     94//     cout << *cache << endl;
    9295
    9396    TEST(cache->access(0, 0x200, 0, CACHED, WRITE), MISS      );
     
    99102    cache->transition(); // miss cycle 2
    100103    cache->transition(); // miss cycle 3
    101     cout << *cache << endl;
     104//     cout << *cache << endl;
    102105
    103106    // line 0 : all way is use
     
    113116
    114117    cache->transition();
    115     cout << *cache << endl;
     118//     cout << *cache << endl;
    116119   
    117120    TEST(cache->access(0, 0x500, 0,  CACHED, WRITE), MISS      );
     
    141144    TEST(cache->latence(3), 5);
    142145   
    143     cout << *cache << endl;
     146//     cout << *cache << endl;
    144147
    145148    delete cache;
     
    174177       );
    175178
    176     cout << *param << endl;
     179//     cout << *param << endl;
    177180 
    178181    cache_multilevel::Cache_MultiLevel * cache = new cache_multilevel::Cache_MultiLevel ("my_cache",param);
    179182
    180     cout << *cache << endl;
    181183    cache->reset();
    182     cout << *cache << endl;
     184//     cout << *cache << endl;
    183185 
    184186    cache_multilevel::Access access;
     
    202204    cache->transition(); //11
    203205    cache->transition(); //10
    204     cout << *cache << endl;
     206//     cout << *cache << endl;
    205207
    206208    access = cache->access (0, 0x100, 0, CACHED, WRITE);
     
    238240    TEST(access.latence      , 1);
    239241    TEST(access.last_nb_level, 0);
    240     cout << *cache << endl;
     242//     cout << *cache << endl;
    241243
    242244    cache->transition();
     
    303305    cache->transition(); //11
    304306    cache->transition(); //10
    305     cout << *cache << endl;
     307//     cout << *cache << endl;
    306308
    307309    access = cache->access (0, 0x100, 0, CACHED, WRITE);
     
    358360
    359361    access = cache->access (1, 0x100, 0, CACHED, WRITE);
    360     cout << access<< endl;
     362//     cout << access<< endl;
    361363   
    362364    cache->update_access(access);
     
    367369    TEST(access.last_nb_level, 1);
    368370
    369     cout << *cache << endl;
     371//     cout << *cache << endl;
    370372    delete cache;
    371373    delete param;
     
    389391    cache_shared_size_line     [0] = 8 ;
    390392    cache_shared_size_word     [0] = 4 ;
    391     cache_shared_associativity [0] = 4 ;
     393    cache_shared_associativity [0] = 8 ;
    392394    cache_shared_hit_latence   [0] = 2 ;
    393395    cache_shared_miss_penality [0] = 5 ;
     
    467469
    468470    dcache_nb_level      [1]    = 2;
    469     dcache_nb_port       [1]    = 2;
     471    dcache_nb_port       [1]    = 8; // to test
    470472    dcache_nb_line       [1]    = new uint32_t [2];
    471473    dcache_size_line     [1]    = new uint32_t [2];
     
    519521       );
    520522
    521     cout << *param << endl;
     523//     cout << *param << endl;
    522524
    523525    cache::Cache * cache = new cache::Cache ("my_cache",param);
    524526
     527    cache->reset();
     528//     cout << *cache << endl;
     529
     530    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 16);
     531    cache->transition();
     532    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 15);
     533    cache->transition();
     534    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 14);
     535    cache->transition();
     536    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 13);
     537    cache->transition();
     538    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 12);
     539    cache->transition();
     540    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 11);
     541    cache->transition();
     542    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 10);
     543    cache->transition();
     544    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  9);
     545    cache->transition();
     546    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  8);
     547    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 16); // miss thread !=
     548    TEST(cache->latence (DATA_CACHE, 0, 0, 0x100, 0, CACHED, WRITE),  6); // miss L1, hit L2
     549    cache->transition();
     550    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  7);
     551    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 15);
     552    cache->transition();
     553    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  6);
     554    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 14);
     555    cache->transition();
     556    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  5);
     557    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 13);
     558    cache->transition();
     559    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  4);
     560    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 12);
     561    cache->transition();
     562    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  3);
     563    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 11);
     564    cache->transition();
     565    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  2);
     566    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE), 10);
     567    cache->transition();
     568    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
     569    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  9);
     570    cache->transition();
     571    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
     572    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  8);
     573    cache->transition();
     574    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
     575    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  7);
     576    cache->transition();
     577    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
     578    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  6);
     579    cache->transition();
     580    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
     581    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  5);
     582    cache->transition();
     583    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
     584    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  4);
     585    cache->transition();
     586    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
     587    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  3);
     588    cache->transition();
     589    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
     590    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  2);
     591    cache->transition();
     592
     593    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  5); // L1 is direct map, hit L2
     594    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1); // write in L1
     595    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 16);
     596    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 16);
     597    cache->transition();
     598
     599    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  4);
     600    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
     601    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 15);
     602    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 15);
     603    cache->transition();
     604    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  3);
     605    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
     606    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 14);
     607    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 14);
     608    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 16);
     609    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 16);
     610    cache->transition();
     611    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  2);
     612    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
     613    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 13);
     614    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 13);
     615    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 15);
     616    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 15);
     617
     618
     619    cache->transition();
     620    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
     621    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  5);
     622    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 12);
     623    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 12);
     624    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 14);
     625    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 14);
     626
     627
     628    cache->transition();
     629    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
     630    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  4);
     631    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 11);
     632    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 11);
     633    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 13);
     634    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 13);
     635
     636    // in cache L2 : context 0,1,2,3
     637
     638    cache->transition();
     639    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
     640    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  3);
     641    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE), 10);
     642    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 10);
     643    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 12);
     644    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 12);
     645
     646    cache->transition();
     647    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
     648    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  2);
     649    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  9);
     650    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  9);
     651    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 11);
     652    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 11);
     653
     654    cache->transition();
     655    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  5);
     656    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
     657    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  8);
     658    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  8);
     659    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE), 10); // write in L2
     660    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE), 10); // write in L2
     661
     662    cache->transition();
     663    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  4);
     664    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
     665    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  7);
     666    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  7);
     667    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  9);
     668    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  9);
     669
     670    cache->transition();
     671    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  3);
     672    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
     673    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  6);
     674    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  6);
     675    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  8);
     676    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  8);
     677
     678    cache->transition();
     679    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  2);
     680    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
     681    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  5);
     682    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  5);
     683    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  7);
     684    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  7);
     685
     686    cache->transition();
     687    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
     688    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  5);
     689    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  4);
     690    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  4);
     691    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  6);
     692    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  6);
     693
     694    cache->transition();
     695    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
     696    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  4);
     697    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  3);
     698    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  3);
     699    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  5);
     700    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  5);
     701
     702    cache->transition();
     703    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE),  1);
     704    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  3);
     705    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  2);
     706    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE),  2);
     707    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  4);
     708    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  4);
     709
    525710    cout << *cache << endl;
    526     cache->reset();
    527     cout << *cache << endl;
    528 
    529     TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 16);
    530     cache->transition();
    531     TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 15);
    532     cache->transition();
    533 
    534     cout << *cache << endl;
    535 
     711
     712    cache->transition();
     713    // In L2 : context 1,2,4,5 : also context 0 and 3 miss L1 and L2, hit L3
     714    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 11);
     715    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  2);
     716    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  1);
     717    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 11);
     718    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  3);
     719    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  3);
     720
     721    cache->transition();
     722    TEST(cache->latence (DATA_CACHE, 1, 0, 0x100, 0, CACHED, WRITE), 10);
     723    TEST(cache->latence (DATA_CACHE, 1, 1, 0x100, 1, CACHED, WRITE),  1);
     724    TEST(cache->latence (DATA_CACHE, 1, 2, 0x100, 2, CACHED, WRITE),  5);
     725    TEST(cache->latence (DATA_CACHE, 1, 3, 0x100, 3, CACHED, WRITE), 10);
     726    TEST(cache->latence (DATA_CACHE, 1, 4, 0x100, 4, CACHED, WRITE),  2);
     727    TEST(cache->latence (DATA_CACHE, 1, 5, 0x100, 5, CACHED, WRITE),  2);
     728
     729// //     cout << *cache << endl;
    536730
    537731    delete    cache;
     732
    538733    delete    param;
    539734    delete [] cache_shared_nb_line      ;
  • trunk/IPs/systemC/Environment/Cache/src/Cache.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_MultiLevel.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_MultiLevel_access.cpp

    • Property svn:keywords set to Id
    r80 r81  
    1616      {
    1717        hit   = hierarchy_cache[i]->access (num_port,address,trdid,type,dir);
    18         time += hierarchy_cache[i]->latence(num_port);
     18        uint32_t latence = hierarchy_cache[i]->latence(num_port);
     19        time += latence;
    1920
    20         std::cout << "SETH : "
    21                   << " * i    : " << i
    22                   << " * hit  : " << hit
    23                   << " * time  :" << time << std::endl;
    24        
     21        _cout(CACHE,"    * Level [%d] - type_hit %d, latence %d, Sum latence %d\n",i,hit,latence,time);
     22
    2523        if ( (hit == HIT_CACHE)        or
    2624             (hit == HIT_WRITE_BUFFER) or
  • trunk/IPs/systemC/Environment/Cache/src/Cache_MultiLevel_information.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_MultiLevel_latence.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_MultiLevel_print.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_MultiLevel_reset.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_MultiLevel_transition.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_MultiLevel_update_access.cpp

    • Property svn:keywords set to Id
    r80 r81  
    88  uint32_t Cache_MultiLevel::update_access (Access cur_access)
    99  {
    10     if (cur_access.last_nb_level > 0)
     10//     if (cur_access.last_nb_level > 0)
    1111      {
    1212        uint32_t latence = cur_access.latence;
     13
     14        _cout(CACHE,"Cache_MultiLevel::update_access [%d] : latence : %d, last_nb_level : %d (nb_level : %d)\n",cur_access.num_port,latence,cur_access.last_nb_level,param->nb_level);
    1315       
    14         for (uint32_t it = 0; it <= cur_access.last_nb_level; it ++)
    15           latence = hierarchy_cache [it]->update_latence (cur_access.num_port,latence);
    16        
     16        for (uint32_t it = 0; it < cur_access.last_nb_level; it ++)
     17          {
     18            latence = hierarchy_cache [it]->update_latence (cur_access.num_port,latence);
     19          }
    1720//      if (latence != 0)
    1821//        {
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_access.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_access_cached.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_access_flush.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_access_invalidate.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_access_uncached.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_hit_access_port.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_hit_cache.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_hit_write_buffer.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_index_victim.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_information.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_latence.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_need_slot.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_print.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_reset.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_transition.cpp

    • Property svn:keywords set to Id
    r80 r81  
    3434
    3535    // Test if a write_buffer have the result
    36     while ((write_buffer->empty() == false) && (write_buffer->read(0)._delay == 0))
     36    while ((write_buffer->empty() == false) and
     37           (write_buffer->read(0)._delay == 0))
    3738      {
    3839        // Save in the cache
    39         Write_Buffer val     = write_buffer->pop();
     40        Write_Buffer val = write_buffer->pop();
    4041       
    41         uint32_t num_tag     = val.address.tag;
    42         uint32_t num_familly = val.address.familly;
     42        uint32_t num_tag           = val.address.tag;
     43        uint32_t num_familly       = val.address.familly;
    4344        uint32_t num_associativity = index_victim(num_familly);
    4445       
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_translate_address.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_update_latence.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_OneLevel_update_lru.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_information.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_latence.cpp

    • Property svn:keywords set to Id
    r80 r81  
    2222
    2323    cache_multilevel::Cache_MultiLevel * cache;
     24    cache_multilevel::Parameters * param_cache_dedicated;
     25    _cout(CACHE," * Access Cache_Dedicated_");
    2426    if (type_cache == INSTRUCTION_CACHE)
    25       cache = icache_dedicated [num_entity];
     27      {
     28        _cout(CACHE,"Instruction");
     29        cache                 = icache_dedicated [num_entity];
     30        param_cache_dedicated = param->param_icache_dedicated [num_entity];
     31      }
    2632    else
    27       cache = dcache_dedicated [num_entity];
     33      {
     34        _cout(CACHE,"Data");
     35        cache                 = dcache_dedicated [num_entity];
     36        param_cache_dedicated = param->param_dcache_dedicated [num_entity];
     37      }
     38    _cout(CACHE," [%d] - entity : %d, address : 0x%.x\n",num_port,num_entity,address);
    2839
    2940    if (num_port >= cache->param->nb_port)
     
    3445
    3546    // Make a access with this level "dedicated"
    36     std::cout << "cache dedicated : access" << std::endl;
    3747    cache_multilevel::Access access_dedicated = cache->access(num_port,address,trdid,type,dir);
    3848
    3949    if (access_dedicated.hit == MISS)
    4050      {
    41         std::cout << "cache shared    : access" << std::endl;
     51        _cout(CACHE," * Access Cache_shared");
     52
    4253        // Make a access with this level "shared"
    4354        cache_multilevel::Access access_shared  = cache_shared->access(range_port (type_cache,num_entity)+num_port,address,trdid,type,dir);
     
    4556        cache_shared->update_access (access_shared);
    4657       
    47         access_dedicated.last_nb_level = param->nb_cache_dedicated-1; // Update all cache
     58        access_dedicated.last_nb_level = param_cache_dedicated->nb_level; // Update all cache
    4859        access_dedicated.latence += access_shared.latence;
    4960      }
    5061
    51     std::cout << "end access, update access" << std::endl;
    52 
    5362    cache->update_access (access_dedicated);
    5463
    55     std::cout << "end access, update access" << std::endl;
    56 
     64    _cout(CACHE,"Access latence : %d\n",access_dedicated.latence);
    5765    return access_dedicated.latence;
    5866  }
  • trunk/IPs/systemC/Environment/Cache/src/Cache_print.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_range_port.cpp

    • Property svn:keywords set to Id
    r80 r81  
    1616    else
    1717      {
    18         std::cout << "nb_port_dedicated : " << nb_port_dedicated<< std::endl;
     18//      std::cout << "nb_port_dedicated : " << nb_port_dedicated<< std::endl;
    1919        nb_port_dedicated += param->nb_iport;
    20         std::cout << "nb_port_dedicated : " << param->nb_iport<< std::endl;
     20//      std::cout << "nb_port_dedicated : " << param->nb_iport<< std::endl;
    2121   
    2222        for (uint32_t i = 1; i < num_entity; i++)
     
    2424      }
    2525
    26     std::cout << "nb_port_dedicated : " << num_entity << std::endl;
    27     std::cout << "nb_port_dedicated : " << nb_port_dedicated<< std::endl;
     26//     std::cout << "nb_port_dedicated : " << num_entity << std::endl;
     27//     std::cout << "nb_port_dedicated : " << nb_port_dedicated<< std::endl;
    2828       
    2929    return nb_port_dedicated;
  • trunk/IPs/systemC/Environment/Cache/src/Cache_reset.cpp

    • Property svn:keywords set to Id
  • trunk/IPs/systemC/Environment/Cache/src/Cache_transition.cpp

    • Property svn:keywords set to Id
Note: See TracChangeset for help on using the changeset viewer.