Index: branches/RWT/modules/vci_mem_cache/caba/source/include/mem_cache_directory.h
===================================================================
--- branches/RWT/modules/vci_mem_cache/caba/source/include/mem_cache_directory.h	(revision 495)
+++ branches/RWT/modules/vci_mem_cache/caba/source/include/mem_cache_directory.h	(revision 814)
@@ -1,4 +1,4 @@
 #ifndef SOCLIB_CABA_MEM_CACHE_DIRECTORY_H
-#define SOCLIB_CABA_MEM_CACHE_DIRECTORY_H 
+#define SOCLIB_CABA_MEM_CACHE_DIRECTORY_H
 
 #include <inttypes.h>
@@ -14,5 +14,5 @@
 
   ////////////////////////////////////////////////////////////////////////
-  //                    A LRU entry 
+  //                    A LRU entry
   ////////////////////////////////////////////////////////////////////////
   class LruEntry {
@@ -20,5 +20,5 @@
     public:
 
-      bool recent;            
+      bool recent;
 
       void init()
@@ -33,5 +33,5 @@
   ////////////////////////////////////////////////////////////////////////
   class Owner{
-    
+
     public:
     // Fields
@@ -66,5 +66,5 @@
 
   ////////////////////////////////////////////////////////////////////////
-  //                    A directory entry                               
+  //                    A directory entry
   ////////////////////////////////////////////////////////////////////////
   class DirectoryEntry {
@@ -81,5 +81,5 @@
     tag_t   tag;                    // tag of the entry
     size_t  count;                  // number of copies
-    Owner   owner;                  // an owner of the line 
+    Owner   owner;                  // an owner of the line
     size_t  ptr;                    // pointer to the next owner
 
@@ -109,8 +109,8 @@
       owner         = source.owner;
       ptr           = source.ptr;
-    }          
-
-    /////////////////////////////////////////////////////////////////////
-    // The init() function initializes the entry 
+    }
+
+    /////////////////////////////////////////////////////////////////////
+    // The init() function initializes the entry
     /////////////////////////////////////////////////////////////////////
     void init()
@@ -125,14 +125,14 @@
 
     /////////////////////////////////////////////////////////////////////
-    // The copy() function copies an existing source entry to a target 
+    // The copy() function copies an existing source entry to a target
     /////////////////////////////////////////////////////////////////////
     void copy(const DirectoryEntry &source)
     {
-      valid	    = source.valid;
+      valid     = source.valid;
       cache_coherent = source.cache_coherent;
       is_cnt    = source.is_cnt;
-      dirty	    = source.dirty;
-      lock	    = source.lock;
-      tag	    = source.tag;
+      dirty     = source.dirty;
+      lock      = source.lock;
+      tag       = source.tag;
       count     = source.count;
       owner     = source.owner;
@@ -141,17 +141,17 @@
 
     ////////////////////////////////////////////////////////////////////
-    // The print() function prints the entry 
+    // The print() function prints the entry
     ////////////////////////////////////////////////////////////////////
     void print()
     {
-      std::cout << "Valid = " << valid 
+      std::cout << "Valid = " << valid
                 << " ; COHERENCE = " << cache_coherent
-                << " ; IS COUNT = " << is_cnt 
-                << " ; Dirty = " << dirty 
-                << " ; Lock = " << lock 
-                << " ; Tag = " << std::hex << tag << std::dec 
-                << " ; Count = " << count 
-                << " ; Owner = " << owner.srcid 
-                << " " << owner.inst 
+                << " ; IS COUNT = " << is_cnt
+                << " ; Dirty = " << dirty
+                << " ; Lock = " << lock
+                << " ; Tag = " << std::hex << tag << std::dec
+                << " ; Count = " << count
+                << " ; Owner = " << owner.srcid
+                << " " << owner.inst
                 << " ; Pointer = " << ptr << std::endl;
     }
@@ -160,5 +160,5 @@
 
   ////////////////////////////////////////////////////////////////////////
-  //                       The directory  
+  //                       The directory
   ////////////////////////////////////////////////////////////////////////
   class CacheDirectory {
@@ -171,13 +171,13 @@
 
     // Directory constants
-    size_t					m_ways;
-    size_t					m_sets;
-    size_t					m_words;
-    size_t					m_width;
-    uint32_t                lfsr;
+    size_t   m_ways;
+    size_t   m_sets;
+    size_t   m_words;
+    size_t   m_width;
+    uint32_t lfsr;
 
     // the directory & lru tables
-    DirectoryEntry 				**m_dir_tab;
-    LruEntry	 				**m_lru_tab;
+    DirectoryEntry **m_dir_tab;
+    LruEntry       **m_lru_tab;
 
     public:
@@ -186,7 +186,7 @@
     // Constructor
     ////////////////////////
-    CacheDirectory( size_t ways, size_t sets, size_t words, size_t address_width)	 
-    {
-      m_ways  = ways; 
+    CacheDirectory( size_t ways, size_t sets, size_t words, size_t address_width)
+    {
+      m_ways  = ways;
       m_sets  = sets;
       m_words = words;
@@ -223,7 +223,7 @@
     // LRU is updated.
     // Arguments :
-    // - address : the address of the entry 
+    // - address : the address of the entry
     // - way : (return argument) the way of the entry in case of hit
-    // The function returns a copy of a (valid or invalid) entry  
+    // The function returns a copy of a (valid or invalid) entry
     /////////////////////////////////////////////////////////////////////
     DirectoryEntry read(const addr_t &address, size_t &way)
@@ -240,8 +240,8 @@
         bool valid = m_dir_tab[set][i].valid;
         hit = equal && valid;
-        if ( hit ) {			
+        if ( hit ) {
           way = i;
           break;
-        } 
+        }
       }
       if ( hit ) {
@@ -255,5 +255,5 @@
     /////////////////////////////////////////////////////////////////////
     // The inval function invalidate an entry defined by the set and
-    // way arguments. 
+    // way arguments.
     /////////////////////////////////////////////////////////////////////
     void inval( const size_t &way, const size_t &set )
@@ -266,8 +266,8 @@
     // changing the LRU
     // Arguments :
-    // - address : the address of the entry 
-    // The function returns a copy of a (valid or invalid) entry  
-    /////////////////////////////////////////////////////////////////////
-    DirectoryEntry read_neutral( const addr_t &address, 
+    // - address : the address of the entry
+    // The function returns a copy of a (valid or invalid) entry
+    /////////////////////////////////////////////////////////////////////
+    DirectoryEntry read_neutral( const addr_t &address,
                                  size_t*      ret_way,
                                  size_t*      ret_set )
@@ -279,5 +279,5 @@
 #undef L2
 
-        for ( size_t way = 0 ; way < m_ways ; way++ ) 
+        for ( size_t way = 0 ; way < m_ways ; way++ )
         {
             bool equal = ( m_dir_tab[set][way].tag == tag );
@@ -286,13 +286,13 @@
             {
                 *ret_set = set;
-                *ret_way = way; 
+                *ret_way = way;
                 return DirectoryEntry(m_dir_tab[set][way]);
             }
-        } 
+        }
         return DirectoryEntry();
     } // end read_neutral()
 
     /////////////////////////////////////////////////////////////////////
-    // The write function writes a new entry, 
+    // The write function writes a new entry,
     // and updates the LRU bits if necessary.
     // Arguments :
@@ -301,11 +301,11 @@
     // - entry : the entry value
     /////////////////////////////////////////////////////////////////////
-    void write( const size_t         &set, 
-                const size_t         &way, 
+    void write( const size_t         &set,
+                const size_t         &way,
                 const DirectoryEntry &entry)
     {
-      assert( (set<m_sets) 
+      assert( (set<m_sets)
           && "Cache Directory write : The set index is invalid");
-      assert( (way<m_ways) 
+      assert( (way<m_ways)
           && "Cache Directory write : The way index is invalid");
 
@@ -315,13 +315,13 @@
       // update LRU bits
       bool all_recent = true;
-      for ( size_t i=0 ; i<m_ways ; i++ ) 
+      for ( size_t i=0 ; i<m_ways ; i++ )
       {
           if ( i != way ) all_recent = m_lru_tab[set][i].recent && all_recent;
       }
-      if ( all_recent ) 
+      if ( all_recent )
       {
           for( size_t i=0 ; i<m_ways ; i++ ) m_lru_tab[set][i].recent = false;
-      } 
-      else 
+      }
+      else
       {
           m_lru_tab[set][way].recent = true;
@@ -349,5 +349,5 @@
     DirectoryEntry select(const size_t &set, size_t &way)
     {
-        assert( (set < m_sets) 
+        assert( (set < m_sets)
           && "Cache Directory : (select) The set index is invalid");
 
@@ -404,11 +404,11 @@
 
     /////////////////////////////////////////////////////////////////////
-    // 		Global initialisation function
+    //               Global initialisation function
     /////////////////////////////////////////////////////////////////////
     void init()
     {
-      for ( size_t set=0 ; set<m_sets ; set++ ) 
-      {
-        for ( size_t way=0 ; way<m_ways ; way++ ) 
+      for ( size_t set=0 ; set<m_sets ; set++ )
+      {
+        for ( size_t way=0 ; way<m_ways ; way++ )
         {
           m_dir_tab[set][way].init();
@@ -446,22 +446,22 @@
         owner.inst  = entry.owner.inst;
         owner.srcid = entry.owner.srcid;
-        next           = entry.next;
+        next        = entry.next;
       } // end constructor
 
     /////////////////////////////////////////////////////////////////////
-    // The copy() function copies an existing source entry to a target 
+    // The copy() function copies an existing source entry to a target
     /////////////////////////////////////////////////////////////////////
       void copy(const HeapEntry &entry)
       {
-        owner.inst     = entry.owner.inst;
-        owner.srcid    = entry.owner.srcid;
-        next           = entry.next;
+        owner.inst  = entry.owner.inst;
+        owner.srcid = entry.owner.srcid;
+        next        = entry.next;
       } // end copy()
 
     ////////////////////////////////////////////////////////////////////
-    // The print() function prints the entry 
+    // The print() function prints the entry
     ////////////////////////////////////////////////////////////////////
       void print(){
-        std::cout 
+        std::cout
         << " -- owner.inst     : " << std::dec << owner.inst << std::endl
         << " -- owner.srcid    : " << std::dec << owner.srcid << std::endl
@@ -473,8 +473,8 @@
 
   ////////////////////////////////////////////////////////////////////////
-  //                        The Heap 
+  //                        The Heap
   ////////////////////////////////////////////////////////////////////////
   class HeapDirectory{
-    
+
     private:
     // Registers and the heap
@@ -506,5 +506,5 @@
 
     /////////////////////////////////////////////////////////////////////
-    // 		Global initialisation function
+    //              Global initialisation function
     /////////////////////////////////////////////////////////////////////
       void init(){
@@ -541,5 +541,5 @@
             if(ptr_temp == m_heap_tab[ptr_temp].next) end = true;
             ptr_temp = m_heap_tab[ptr_temp].next;
-        } 
+        }
       } // end print_list()
 
@@ -552,5 +552,5 @@
 
     /////////////////////////////////////////////////////////////////////
-    // The next_free_ptr() function returns the pointer 
+    // The next_free_ptr() function returns the pointer
     // to the next free entry.
     /////////////////////////////////////////////////////////////////////
@@ -560,5 +560,5 @@
 
     /////////////////////////////////////////////////////////////////////
-    // The next_free_entry() function returns 
+    // The next_free_entry() function returns
     // a copy of the next free entry.
     /////////////////////////////////////////////////////////////////////
@@ -566,5 +566,5 @@
         return HeapEntry(m_heap_tab[ptr_free]);
       } // end next_free_entry()
-   
+
     /////////////////////////////////////////////////////////////////////
     // The write_free_entry() function modify the next free entry.
@@ -624,7 +624,7 @@
 
   ////////////////////////////////////////////////////////////////////////
-  //                        Cache Data 
-  ////////////////////////////////////////////////////////////////////////
-  class CacheData 
+  //                        Cache Data
+  ////////////////////////////////////////////////////////////////////////
+  class CacheData
   {
     private:
@@ -639,14 +639,14 @@
       ///////////////////////////////////////////////////////
       CacheData(uint32_t ways, uint32_t sets, uint32_t words)
-        : m_sets(sets), m_ways(ways), m_words(words) 
+        : m_sets(sets), m_ways(ways), m_words(words)
       {
           m_cache_data = new uint32_t ** [ways];
-          for ( size_t i=0 ; i < ways ; i++ ) 
+          for ( size_t i=0 ; i < ways ; i++ )
           {
               m_cache_data[i] = new uint32_t * [sets];
           }
-          for ( size_t i=0; i<ways; i++ ) 
+          for ( size_t i=0; i<ways; i++ )
           {
-              for ( size_t j=0; j<sets; j++ ) 
+              for ( size_t j=0; j<sets; j++ )
               {
                   m_cache_data[i][j] = new uint32_t [words];
@@ -655,5 +655,5 @@
       }
       ////////////
-      ~CacheData() 
+      ~CacheData()
       {
           for(size_t i=0; i<m_ways ; i++)
@@ -673,5 +673,5 @@
       uint32_t read ( const uint32_t &way,
                       const uint32_t &set,
-                      const uint32_t &word) const 
+                      const uint32_t &word) const
       {
           assert((set  < m_sets ) && "Cache data error: Trying to read a wrong set" );
@@ -697,5 +697,5 @@
                    const uint32_t &word,
                    const uint32_t &data,
-                   const uint32_t &be = 0xF) 
+                   const uint32_t &be = 0xF)
       {
 
@@ -707,7 +707,7 @@
           if (be == 0x0) return;
 
-          if (be == 0xF) 
+          if (be == 0xF)
           {
-              m_cache_data[way][set][word] = data; 
+              m_cache_data[way][set][word] = data;
               return;
           }
@@ -719,5 +719,5 @@
           if  (be & 0x8) mask = mask | 0xFF000000;
 
-          m_cache_data[way][set][word] = 
+          m_cache_data[way][set][word] =
               (data & mask) | (m_cache_data[way][set][word] & ~mask);
       }
