Index: branches/MESI/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h
===================================================================
--- branches/MESI/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h	(revision 719)
+++ branches/MESI/modules/vci_mem_cache/caba/source/include/vci_mem_cache.h	(revision 785)
@@ -38,4 +38,5 @@
 #include <list>
 #include <cassert>
+
 #include "arithmetics.h"
 #include "alloc_elems.h"
@@ -51,5 +52,5 @@
 #include "update_tab.h"
 #include "dspin_interface.h"
-#include "dspin_dhccp_param.h"
+#include "dspin_hmesi_param.h"
 
 #define TRT_ENTRIES      4      // Number of entries in TRT
@@ -69,10 +70,10 @@
     : public soclib::caba::BaseModule
     {
-      typedef typename vci_param_int::fast_addr_t  addr_t;
-      typedef typename sc_dt::sc_uint<64>          wide_data_t;
-      typedef uint32_t                             data_t;
-      typedef uint32_t                             tag_t;
-      typedef uint32_t                             be_t;
-      typedef uint32_t                             copy_t;
+      typedef typename vci_param_int::fast_addr_t addr_t;
+      typedef typename sc_dt::sc_uint<64>         wide_data_t;
+      typedef uint32_t                            data_t;
+      typedef uint32_t                            tag_t;
+      typedef uint32_t                            be_t;
+      typedef uint32_t                            copy_t;
 
       /* States of the TGT_CMD fsm */
@@ -392,12 +393,12 @@
           //  b1 accÃšs table llsc type SW / other
           //  b2 WRITE/CAS/LL/SC
-          TYPE_DATA_UNC               = 0x0,
-          TYPE_READ_DATA_MISS         = 0x1,
-          TYPE_READ_INS_UNC           = 0x2,
-          TYPE_READ_INS_MISS          = 0x3,
-          TYPE_WRITE                  = 0x4,
-          TYPE_CAS                    = 0x5,
-          TYPE_LL                     = 0x6,
-          TYPE_SC                     = 0x7
+          TYPE_DATA_UNC       = 0x0,
+          TYPE_READ_DATA_MISS = 0x1,
+          TYPE_READ_INS_UNC   = 0x2,
+          TYPE_READ_INS_MISS  = 0x3,
+          TYPE_WRITE          = 0x4,
+          TYPE_CAS            = 0x5,
+          TYPE_LL             = 0x6,
+          TYPE_SC             = 0x7
       };
 
@@ -405,168 +406,81 @@
       enum sc_status_type_e
       {
-          SC_SUCCESS  =   0x00000000,
-          SC_FAIL     =   0x00000001
+          SC_SUCCESS = 0x00000000,
+          SC_FAIL    = 0x00000001
       };
 
       // debug variables 
-      bool                 m_debug;
-      size_t               m_debug_previous_valid;
-      size_t               m_debug_previous_count;
-      bool                 m_debug_previous_dirty;
-      data_t *             m_debug_previous_data;
-      data_t *             m_debug_data;
+      bool     m_debug;
+      size_t   m_debug_previous_valid;
+      size_t   m_debug_previous_count;
+      bool     m_debug_previous_dirty;
+      data_t * m_debug_previous_data;
+      data_t * m_debug_data;
 
       // instrumentation counters
-      uint32_t     m_cpt_cycles;        // Counter of cycles
-
-      // Counters accessible in software (not yet but eventually)
-      uint32_t     m_cpt_reset_count;    // Last cycle at which counters have been reset
-      uint32_t     m_cpt_read_miss_local;     // Number of local READ transactions
-      uint32_t     m_cpt_read_miss_remote;    // number of remote READ transactions
-      uint32_t     m_cpt_read_miss_cost;      // Number of (flits * distance) for READs
-
-      uint32_t     m_cpt_getm_miss_local;     // Number of local getm miss  transactions
-      uint32_t     m_cpt_getm_miss_remote;    // number of remote getm miss transactions
-
-      uint32_t     m_cpt_getm_hit_local;     // Number of local getm hit transactions
-      uint32_t     m_cpt_getm_hit_remote;    // number of remote getm hit transactions
-      uint32_t     m_cpt_getm_cost;          // Number of (flits * distance) for getm 
-
-      uint32_t     m_cpt_write_local;    // Number of local WRITE transactions
-      uint32_t     m_cpt_write_remote;   // number of remote WRITE transactions
-      uint32_t     m_cpt_write_flits_local;  // number of flits for local WRITEs
-      uint32_t     m_cpt_write_flits_remote; // number of flits for remote WRITEs
-      uint32_t     m_cpt_write_cost;     // Number of (flits * distance) for WRITEs
-
-      uint32_t     m_cpt_ll_local;       // Number of local LL transactions
-      uint32_t     m_cpt_ll_remote;      // number of remote LL transactions
-      uint32_t     m_cpt_ll_cost;        // Number of (flits * distance) for LLs
-
-      uint32_t     m_cpt_sc_local;       // Number of local SC transactions
-      uint32_t     m_cpt_sc_remote;      // number of remote SC transactions
-      uint32_t     m_cpt_sc_cost;        // Number of (flits * distance) for SCs
-
-      uint32_t     m_cpt_cas_local;      // Number of local SC transactions
-      uint32_t     m_cpt_cas_remote;     // number of remote SC transactions
-      uint32_t     m_cpt_cas_cost;       // Number of (flits * distance) for SCs
-
-      uint32_t     m_cpt_update;         // Number of requests causing an UPDATE
-      uint32_t     m_cpt_update_local;   // Number of local UPDATE transactions
-      uint32_t     m_cpt_update_remote;  // Number of remote UPDATE transactions
-      uint32_t     m_cpt_update_cost;    // Number of (flits * distance) for UPDT
-
-      uint32_t     m_cpt_minval;         // Number of requests causing M_INV
-      uint32_t     m_cpt_minval_local;   // Number of local M_INV transactions
-      uint32_t     m_cpt_minval_remote;  // Number of remote M_INV transactions
-      uint32_t     m_cpt_minval_cost;    // Number of (flits * distance) for M_INV
-
-      uint32_t     m_cpt_binval;         // Number of BROADCAST INVAL
-
-      uint32_t     m_cpt_cleanup_local;  // Number of local CLEANUP transactions
-      uint32_t     m_cpt_cleanup_remote; // Number of remote CLEANUP transactions
-      uint32_t     m_cpt_cleanup_with_data;
-      uint32_t     m_cpt_cleanup_cost;   // Number of (flits * distance) for CLEANUPs
-
-      uint32_t     m_cpt_multi_ack_miss;  // Number of local CLEANUP transactions
-      uint32_t     m_cpt_multi_ack_hit;   // Number of local CLEANUP transactions
-      uint32_t     m_cpt_multi_ack_hit_with_data; // Number of remote CLEANUP transactions
+      uint32_t m_cpt_cycles;        // Counter of cycles
+
+      // Counters
+      // (*) = Counters accessible in software
+      uint32_t m_cpt_reset_count;    // Last cycle at which counters have been reset
+
+      uint32_t m_cpt_read_local;     // Number of local READ transactions (*)
+      uint32_t m_cpt_read_remote;    // number of remote READ transactions (*)
+      uint32_t m_cpt_read_cost;      // Number of (flits * distance) for READs (*)
+
+      uint32_t m_cpt_write_local;    // Number of local WRITE transactions
+      uint32_t m_cpt_write_remote;   // number of remote WRITE transactions
+      uint32_t m_cpt_write_flits_local;  // number of flits for local WRITEs (*)
+      uint32_t m_cpt_write_flits_remote; // number of flits for remote WRITEs (*)
+      uint32_t m_cpt_write_cost;     // Number of (flits * distance) for WRITEs (*)
+
+      uint32_t m_cpt_ll_local;       // Number of local LL transactions (*)
+      uint32_t m_cpt_ll_remote;      // number of remote LL transactions (*)
+      uint32_t m_cpt_ll_cost;        // Number of (flits * distance) for LLs (*)
+
+      uint32_t m_cpt_sc_local;       // Number of local SC transactions (*)
+      uint32_t m_cpt_sc_remote;      // number of remote SC transactions (*)
+      uint32_t m_cpt_sc_cost;        // Number of (flits * distance) for SCs (*)
+
+      uint32_t m_cpt_cas_local;      // Number of local SC transactions (*)
+      uint32_t m_cpt_cas_remote;     // number of remote SC transactions (*)
+      uint32_t m_cpt_cas_cost;       // Number of (flits * distance) for SCs (*)
+
+      uint32_t m_cpt_minval;         // Number of requests causing M_INV (*)
+      uint32_t m_cpt_minval_local;   // Number of local M_INV transactions (*)
+      uint32_t m_cpt_minval_remote;  // Number of remote M_INV transactions (*)
+      uint32_t m_cpt_minval_cost;    // Number of (flits * distance) for M_INV (*)
+
+      uint32_t m_cpt_binval;         // Number of BROADCAST INVAL (*)
+      uint32_t m_cpt_write_broadcast;// Number of BROADCAST INVAL caused by write
+      uint32_t m_cpt_getm_broadcast; // Number of BROADCAST INVAL caused by getm
+
+      uint32_t m_cpt_cleanup_local;  // Number of local CLEANUP transactions (*)
+      uint32_t m_cpt_cleanup_remote; // Number of remote CLEANUP transactions (*)
+      uint32_t m_cpt_cleanup_cost;   // Number of (flits * distance) for CLEANUPs (*)
+      uint32_t m_cpt_cleanup_data_local; //
+      uint32_t m_cpt_cleanup_data_remote; //
+      uint32_t m_cpt_cleanup_data_cost; //
+
+      uint32_t m_cpt_read_miss;      // Number of MISS READ
+      uint32_t m_cpt_write_miss;     // Number of MISS WRITE
+      uint32_t m_cpt_write_dirty;    // Cumulated length for WRITE transactions
+      uint32_t m_cpt_getm_miss;      // Number of getm miss
+
+      uint32_t m_cpt_getm_local;     // Number of local getm miss  transactions
+      uint32_t m_cpt_getm_remote;    // number of remote getm miss transactions
+      uint32_t m_cpt_getm_cost;      // Number of (flits * distance) for getm 
+
+      uint32_t m_cpt_inval_ro_local;  // Number of local INVAL RO (*)
+      uint32_t m_cpt_inval_ro_remote; // Number of local INVAL RO (*)
+      uint32_t m_cpt_inval_ro_cost;   // Cost for INVAL RO (*)
     
-      // Counters not accessible by software
-      uint32_t     m_cpt_read_miss;      // Number of MISS READ
-      uint32_t     m_cpt_getm_miss;      // Number of getm miss
-      uint32_t     m_cpt_getm_broadcast; // Number of BROADCAST INVAL because getm
-      uint32_t     m_cpt_getm_minval;    // Number of MULTI INVAL because getm
-      uint32_t     m_cpt_write_miss;     // Number of MISS WRITE
-      uint32_t     m_cpt_write_dirty;    // Cumulated length for WRITE transactions
-      uint32_t     m_cpt_write_broadcast;// Number of BROADCAST INVAL because write
-      uint32_t     m_cpt_write_minval;   // Number of MULTI INVAL because write
-      uint32_t     m_cpt_cas_broadcast;  // Number of BROADCAST INVAL because cas
-      uint32_t     m_cpt_cas_minval;     // Number of MULTI INVAL because cas
-      uint32_t     m_cpt_cas_miss;
-
-      uint32_t     m_cpt_read_locked_rb; // Read blocked by a locked ligne
-      uint32_t     m_cpt_cas_locked_rb;       // cas  blocked by a locked ligne
-      uint32_t     m_cpt_write_locked_rb;     // wt   blocked by a locked ligne
-
-      uint32_t     m_cpt_trt_rb;        // Read blocked by a hit in trt
-      uint32_t     m_cpt_trt_full;      // Transaction blocked due to a full trt
-      uint32_t     m_cpt_put;     
-      uint32_t     m_cpt_get;
-      
-      uint32_t     m_cpt_read_fsm_dir_lock;        // wait DIR LOCK
-      uint32_t     m_cpt_read_fsm_n_dir_lock;      // NB DIR LOCK
-      uint32_t     m_cpt_write_fsm_dir_lock;       // wait DIR LOCK
-      uint32_t     m_cpt_write_fsm_n_dir_lock;     // NB DIR LOCK
-      uint32_t     m_cpt_xram_rsp_fsm_dir_lock;    // wait DIR LOCK
-      uint32_t     m_cpt_xram_rsp_fsm_n_dir_lock;  // NB DIR LOCK
-      uint32_t     m_cpt_cas_fsm_dir_lock;         // wait DIR LOCK
-      uint32_t     m_cpt_cas_fsm_n_dir_lock;       // NB DIR LOCK
-      uint32_t     m_cpt_cleanup_fsm_dir_lock;     // wait DIR LOCK
-      uint32_t     m_cpt_cleanup_fsm_n_dir_lock;   // NB DIR LOCK
-      uint32_t     m_cpt_multi_ack_fsm_dir_lock;     // wait DIR LOCK
-      uint32_t     m_cpt_multi_ack_fsm_n_dir_lock;   // NB DIR LOCK
-
-      uint32_t     m_cpt_dir_unused;            // NB cycles DIR LOCK unused
-      uint32_t     m_cpt_read_fsm_dir_used;     // NB cycles DIR LOCK used
-      uint32_t     m_cpt_write_fsm_dir_used;    // NB cycles DIR LOCK used
-      uint32_t     m_cpt_cas_fsm_dir_used;      // NB cycles DIR LOCK used
-      uint32_t     m_cpt_xram_rsp_fsm_dir_used; // NB cycles DIR LOCK used
-      uint32_t     m_cpt_cleanup_fsm_dir_used;  // NB cycles DIR LOCK used
-      uint32_t     m_cpt_multi_ack_fsm_dir_used;  // NB cycles DIR LOCK used
-
-      uint32_t     m_cpt_read_fsm_trt_lock;      // wait TRT LOCK
-      uint32_t     m_cpt_write_fsm_trt_lock;     // wait TRT LOCK
-      uint32_t     m_cpt_cas_fsm_trt_lock;       // wait TRT LOCK
-      uint32_t     m_cpt_xram_rsp_fsm_trt_lock;  // wait TRT LOCK
-      uint32_t     m_cpt_ixr_fsm_trt_lock;       // wait TRT LOCK
-      
-      uint32_t     m_cpt_read_fsm_n_trt_lock;      // NB TRT LOCK
-      uint32_t     m_cpt_write_fsm_n_trt_lock;     // NB TRT LOCK
-      uint32_t     m_cpt_cas_fsm_n_trt_lock;       // NB TRT LOCK
-      uint32_t     m_cpt_xram_rsp_fsm_n_trt_lock;  // NB TRT LOCK
-      uint32_t     m_cpt_ixr_cmd_fsm_n_trt_lock;   // NB TRT LOCK
-      uint32_t     m_cpt_ixr_rsp_fsm_n_trt_lock;   // NB TRT LOCK
-
-      uint32_t     m_cpt_read_fsm_trt_used;      // NB cycles TRT LOCK used
-      uint32_t     m_cpt_write_fsm_trt_used;     // NB cycles TRT LOCK used
-      uint32_t     m_cpt_cas_fsm_trt_used;       // NB cycles TRT LOCK used
-      uint32_t     m_cpt_xram_rsp_fsm_trt_used;  // NB cycles TRT LOCK used
-      uint32_t     m_cpt_ixr_cmd_fsm_trt_used;   // NB cycles TRT LOCK used
-      uint32_t     m_cpt_ixr_rsp_fsm_trt_used;   // NB cycles TRT LOCK used
-      uint32_t     m_cpt_cleanup_fsm_trt_used;   // NB cycles TRT LOCK used
-      
-      uint32_t     m_cpt_trt_unused;            // NB cycles TRT LOCK unused
-
-      uint32_t     m_cpt_cleanup_fsm_ivt_lock;   // wait ivt LOCK
-      uint32_t     m_cpt_cleanup_fsm_n_ivt_lock;   // NB cycles UPT LOCK used
-      
-      uint32_t     m_cpt_multi_ack_fsm_ivt_lock;   // wait ivt LOCK
-      uint32_t     m_cpt_multi_ack_fsm_n_ivt_lock;   // NB cycles UPT LOCK used
-
-      uint32_t     m_cpt_ivt_unused;            // NB cycles UPT LOCK unused
-
-      uint32_t     m_cpt_read_fsm_heap_lock;     // wait HEAP LOCK
-      uint32_t     m_cpt_write_fsm_heap_lock;    // wait HEAP LOCK
-      uint32_t     m_cpt_cas_fsm_heap_lock;      // wait HEAP LOCK
-      uint32_t     m_cpt_cleanup_fsm_heap_lock;  // wait HEAP LOCK
-      uint32_t     m_cpt_xram_rsp_fsm_heap_lock; // wait HEAP LOCK
-      uint32_t     m_cpt_multi_ack_fsm_heap_lock; // wait HEAP LOCK
-      
-      uint32_t     m_cpt_read_fsm_n_heap_lock;     // NB HEAP LOCK
-      uint32_t     m_cpt_write_fsm_n_heap_lock;    // NB HEAP LOCK
-      uint32_t     m_cpt_cas_fsm_n_heap_lock;      // NB HEAP LOCK
-      uint32_t     m_cpt_cleanup_fsm_n_heap_lock;  // NB HEAP LOCK
-      uint32_t     m_cpt_xram_rsp_fsm_n_heap_lock; // NB HEAP LOCK
-      uint32_t     m_cpt_multi_ack_fsm_n_heap_lock; // NB HEAP LOCK
-      
-      uint32_t     m_cpt_read_fsm_heap_used;     // NB cycles HEAP LOCK used
-      uint32_t     m_cpt_write_fsm_heap_used;    // NB cycles HEAP LOCK used
-      uint32_t     m_cpt_cas_fsm_heap_used;      // NB cycles HEAP LOCK used
-      uint32_t     m_cpt_cleanup_fsm_heap_used;  // NB cycles HEAP LOCK used
-      uint32_t     m_cpt_xram_rsp_fsm_heap_used; // NB cycles HEAP LOCK used
-      uint32_t     m_cpt_multi_ack_fsm_heap_used; // NB cycles HEAP LOCK used
-      
-      uint32_t     m_cpt_heap_unused;            // NB cycles HEAP LOCK unused
-      uint32_t     m_cpt_slot_inval;           
+      uint32_t m_cpt_trt_rb;         // Read blocked by a hit in trt
+      uint32_t m_cpt_trt_full;       // Transaction blocked due to a full trt
+      uint32_t m_cpt_put;     
+      uint32_t m_cpt_get;
+           
+      uint32_t m_cpt_heap_unused;    // NB cycles HEAP LOCK unused
+      uint32_t m_cpt_slot_inval;           
 
       protected:
@@ -602,5 +516,5 @@
       sc_out<int> p_cc_send_fsm; 
       sc_out<int> p_cc_receive_fsm; 
-      sc_out<int> p_multi_ack_fsm; 
+      sc_out<int> p_multi_ack_fsm;
 #endif
 
@@ -611,5 +525,4 @@
           const soclib::common::IntTab       &srcid_x,        // global index RAM network
           const soclib::common::IntTab       &tgtid_d,        // global index INT network
-          const size_t                       cc_global_id,    // global index CC network
           const size_t                       x_width,         // X width in platform
           const size_t                       y_width,         // Y width in platform
@@ -654,7 +567,8 @@
       const size_t                       m_sets;             // Number of cache sets
       const size_t                       m_words;            // Number of words in a line
-      const size_t                       m_cc_global_id;     // global_index on cc network
-      const size_t                       m_xwidth;           // number of x bits in platform
-      const size_t                       m_ywidth;           // number of y bits in platform
+      size_t                             m_x_self;           // X self coordinate
+      size_t                             m_y_self;           // Y self coordinate
+      const size_t                       m_x_width;          // number of x bits in platform
+      const size_t                       m_y_width;          // number of y bits in platform
       size_t                             m_debug_start_cycle;
       bool                               m_debug_ok;
