Index: trunk/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp
===================================================================
--- trunk/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp	(revision 781)
+++ trunk/modules/vci_mem_cache/caba/source/src/vci_mem_cache.cpp	(revision 789)
@@ -827,7 +827,9 @@
     {
         m_cpt_reset_count        = m_cpt_cycles;
+
         m_cpt_read_local         = 0;
         m_cpt_read_remote        = 0;
         m_cpt_read_cost          = 0;
+
         m_cpt_write_local        = 0;
         m_cpt_write_remote       = 0;
@@ -835,28 +837,38 @@
         m_cpt_write_flits_remote = 0;
         m_cpt_write_cost         = 0;
+
         m_cpt_ll_local           = 0;
         m_cpt_ll_remote          = 0;
         m_cpt_ll_cost            = 0;
+
         m_cpt_sc_local           = 0;
         m_cpt_sc_remote          = 0;
         m_cpt_sc_cost            = 0;
+
         m_cpt_cas_local          = 0;
         m_cpt_cas_remote         = 0;
         m_cpt_cas_cost           = 0;
+
         m_cpt_update             = 0;
         m_cpt_update_local       = 0;
         m_cpt_update_remote      = 0;
         m_cpt_update_cost        = 0;
+
         m_cpt_minval             = 0;
         m_cpt_minval_local       = 0;
         m_cpt_minval_remote      = 0;
         m_cpt_minval_cost        = 0;
+
         m_cpt_binval             = 0;
+        m_cpt_write_broadcast    = 0;
+
         m_cpt_cleanup_local      = 0;
         m_cpt_cleanup_remote     = 0;
         m_cpt_cleanup_cost       = 0;
+        
         m_cpt_read_miss          = 0;
         m_cpt_write_miss         = 0;
         m_cpt_write_dirty        = 0;
+
         m_cpt_trt_rb             = 0;
         m_cpt_trt_full           = 0;
@@ -915,13 +927,17 @@
                 << "[080] BROADCAT INVAL            = " << m_cpt_binval << std::endl
                 << "[081] WRITE BROADCAST           = " << m_cpt_write_broadcast << std::endl
+                << "[082] GETM BROADCAST            = " << "0" << std::endl
                 << std::endl
                 << "[090] LOCAL CLEANUP             = " << m_cpt_cleanup_local << std::endl
                 << "[091] REMOTE CLEANUP            = " << m_cpt_cleanup_remote << std::endl
                 << "[092] CLNUP COST (FLITS * DIST) = " << m_cpt_cleanup_cost << std::endl
-                << "[093] CLEANUP DATA              = " << "0" << std::endl
+                << "[093] LOCAL CLEANUP DATA        = " << "0" << std::endl
+                << "[094] REMOTE CLEANUP DATA       = " << "0" << std::endl
+                << "[095] CLEANUP DATA COST         = " << "0" << std::endl
                 << std::endl
                 << "[100] READ MISS                 = " << m_cpt_read_miss << std::endl
                 << "[101] WRITE MISS                = " << m_cpt_write_miss << std::endl
                 << "[102] WRITE DIRTY               = " << m_cpt_write_dirty << std::endl
+                << "[103] GETM MISS                 = " << "0" << std::endl
                 << std::endl
                 << "[110] RD BLOCKED BY HIT IN TRT  = " << m_cpt_trt_rb << std::endl
@@ -933,56 +949,15 @@
                 << "[140] NCC TO CC (READ)          = " << "0" << std::endl
                 << "[141] NCC TO CC (WRITE)         = " << "0" << std::endl
+                << std::endl
+                << "[150] LOCAL GETM                = " << "0" << std::endl
+                << "[151] REMOTE GETM               = " << "0" << std::endl
+                << "[152] GETM COST (FLITS * DIST)  = " << "0" << std::endl
+                << std::endl
+                << "[160] LOCAL INVAL RO            = " << "0" << std::endl
+                << "[161] REMOTE INVAL RO           = " << "0" << std::endl
+                << "[162] INVAL RO COST             = " << "0" << std::endl
                 << std::endl;
         }
-
-        if (stats) {
-            std::cout << "----------------------------------" << std::dec << std::endl;
-            std::cout << "---      Calculated Stats      ---" << std::dec << std::endl;
-            std::cout << "----------------------------------" << std::dec << std::endl;
-            std::cout
-                << "[300] READ TOTAL            = " << m_cpt_read_local + m_cpt_read_remote << std::endl
-                << "[301] READ RATE             = " << (double) (m_cpt_read_local + m_cpt_read_remote) / m_cpt_cycles << std::endl
-                << "[302] LOCAL READ RATE       = " << (double) m_cpt_read_local / m_cpt_cycles << std::endl
-                << "[303] REMOTE READ RATE      = " << (double) m_cpt_read_remote / m_cpt_cycles << std::endl
-                << "[304] READ MISS RATE        = " << (double) m_cpt_read_miss / (m_cpt_read_local + m_cpt_read_remote) << std::endl
-                << std::endl
-                << "[305] WRITE TOTAL           = " << m_cpt_write_local + m_cpt_write_remote << std::endl
-                << "[306] WRITE RATE            = " << (double) (m_cpt_write_local + m_cpt_write_remote) / m_cpt_cycles << std::endl
-                << "[307] LOCAL WRITE RATE      = " << (double) m_cpt_write_local / m_cpt_cycles << std::endl
-                << "[308] REMOTE WRITE RATE     = " << (double) m_cpt_write_remote / m_cpt_cycles << std::endl
-                << "[309] WRITE MISS RATE       = " << (double) m_cpt_write_miss / (m_cpt_write_local + m_cpt_write_remote) << std::endl
-                << "[310] WRITE BURST TOTAL     = " << m_cpt_write_flits_local + m_cpt_write_flits_remote << std::endl
-                << "[311] WRITE BURST AVERAGE   = " << (double) (m_cpt_write_flits_local + m_cpt_write_flits_remote) / (m_cpt_write_local + m_cpt_write_remote) << std::endl
-                << "[312] LOCAL WRITE BURST AV. = " << (double) m_cpt_write_flits_local / (m_cpt_write_local + m_cpt_write_remote) << std::endl
-                << "[313] REMOTE WRITE BURST AV = " << (double) m_cpt_write_flits_remote / (m_cpt_write_local + m_cpt_write_remote) << std::endl
-                << std::endl
-                << "[314] UPDATE RATE                = " << (double) m_cpt_update / m_cpt_cycles << std::endl
-                << "[315] AV. UPDATE PER UP REQ      = " << (double) (m_cpt_update_local + m_cpt_update_remote) / m_cpt_update << std::endl
-                << "[316] AV. LOC UPDT PER UP REQ    = " << (double) m_cpt_update_local / m_cpt_update << std::endl
-                << "[317] AV. REMOTE UPDT PER UP REQ = " << (double) m_cpt_update_remote / m_cpt_update << std::endl
-                << std::endl
-                << "[318] INVAL MULTICAST RATE  = " << (double) m_cpt_minval / m_cpt_cycles << std::endl
-                << "[319] AVE. INVAL PER M_INV  = " << (double) (m_cpt_minval_local + m_cpt_minval_remote) / m_cpt_minval << std::endl
-                << "[320] AV. LOC INV PER M_INV = " << (double) m_cpt_minval_local / m_cpt_minval << std::endl
-                << "[321] AV. REM INV PER M_INV = " << (double) m_cpt_minval_remote / m_cpt_minval << std::endl
-                << std::endl
-                << "[322] INVAL BROADCAST RATE  = " << (double) m_cpt_binval / m_cpt_cycles << std::endl
-                << "[323] WRITE DIRTY RATE      = " << (double) m_cpt_write_dirty / m_cpt_cycles << std::endl
-                << std::endl
-                << "[324] CLEANUP RATE          = " << (double) (m_cpt_cleanup_local + m_cpt_cleanup_remote) / m_cpt_cycles << std::endl
-                << "[325] LOCAL CLEANUP RATE    = " << (double) m_cpt_cleanup_local / m_cpt_cycles << std::endl
-                << "[326] REMOTE CLEANUP RATE   = " << (double) m_cpt_cleanup_remote / m_cpt_cycles << std::endl
-                << "[327] LL RATE               = " << (double) (m_cpt_ll_local + m_cpt_ll_remote) / m_cpt_cycles << std::endl
-                << "[328] LOCAL LL RATE         = " << (double) m_cpt_ll_local / m_cpt_cycles << std::endl
-                << "[329] REMOTE LL RATE        = " << (double) m_cpt_ll_remote / m_cpt_cycles << std::endl
-                << "[330] SC RATE               = " << (double) (m_cpt_sc_local + m_cpt_sc_remote) / m_cpt_cycles << std::endl
-                << "[331] LOCAL SC RATE         = " << (double) m_cpt_sc_local / m_cpt_cycles << std::endl
-                << "[332] REMOTE SC RATE        = " << (double) m_cpt_sc_remote / m_cpt_cycles << std::endl
-                << "[333] CAS RATE              = " << (double) (m_cpt_cas_local + m_cpt_cas_remote) / m_cpt_cycles << std::endl
-                << "[334] LOCAL CAS RATE        = " << (double) m_cpt_cas_local / m_cpt_cycles << std::endl
-                << "[335] REMOTE CAS RATE       = " << (double) m_cpt_cas_remote / m_cpt_cycles << std::endl
-                << std::endl
-                << std::endl;
-        }
+        // No more computed stats
     }
 
@@ -1141,7 +1116,9 @@
             m_cpt_cycles             = 0;
             m_cpt_reset_count        = 0;
+
             m_cpt_read_local         = 0;
             m_cpt_read_remote        = 0;
             m_cpt_read_cost          = 0;
+
             m_cpt_write_local        = 0;
             m_cpt_write_remote       = 0;
@@ -1149,34 +1126,42 @@
             m_cpt_write_flits_remote = 0;
             m_cpt_write_cost         = 0;
+
             m_cpt_ll_local           = 0;
             m_cpt_ll_remote          = 0;
             m_cpt_ll_cost            = 0;
+
             m_cpt_sc_local           = 0;
             m_cpt_sc_remote          = 0;
             m_cpt_sc_cost            = 0;
+
             m_cpt_cas_local          = 0;
             m_cpt_cas_remote         = 0;
             m_cpt_cas_cost           = 0;
+
             m_cpt_update             = 0;
             m_cpt_update_local       = 0;
             m_cpt_update_remote      = 0;
             m_cpt_update_cost        = 0;
+
             m_cpt_minval             = 0;
             m_cpt_minval_local       = 0;
             m_cpt_minval_remote      = 0;
             m_cpt_minval_cost        = 0;
+
             m_cpt_binval             = 0;
+            m_cpt_write_broadcast    = 0;
+
             m_cpt_cleanup_local      = 0;
             m_cpt_cleanup_remote     = 0;
             m_cpt_cleanup_cost       = 0;
 
-            m_cpt_read_miss       = 0;
-            m_cpt_write_miss      = 0;
-            m_cpt_write_dirty     = 0;
-            m_cpt_write_broadcast = 0;
-            m_cpt_trt_rb          = 0;
-            m_cpt_trt_full        = 0;
-            m_cpt_get             = 0;
-            m_cpt_put             = 0;
+            m_cpt_read_miss          = 0;
+            m_cpt_write_miss         = 0;
+            m_cpt_write_dirty        = 0;
+            
+            m_cpt_trt_rb             = 0;
+            m_cpt_trt_full           = 0;
+            m_cpt_get                = 0;
+            m_cpt_put                = 0;
 
             return;
@@ -1692,12 +1677,26 @@
                     // <Activity counters>
                     if (p_vci_tgt.cmd.read() == vci_param_int::CMD_LOCKED_READ) {
-                        if (is_local_req(p_vci_tgt.srcid.read())) m_cpt_ll_local++;
-                        else                                      m_cpt_ll_remote++;
-                        m_cpt_ll_cost += req_distance(p_vci_tgt.srcid.read()); // LL on a single word
+                        if (is_local_req(p_vci_tgt.srcid.read()))
+                        {
+                            m_cpt_ll_local++;
+                        }
+                        else
+                        {
+                            m_cpt_ll_remote++;
+                        }
+                        // (1 (CMD) + 2 (RSP)) VCI flits for LL => 2 + 3 dspin flits
+                        m_cpt_ll_cost += 5 * req_distance(p_vci_tgt.srcid.read());
                     }
                     else {
-                        if (is_local_req(p_vci_tgt.srcid.read())) m_cpt_read_local++;
-                        else                                      m_cpt_read_remote++;
-                        m_cpt_read_cost += req_distance(p_vci_tgt.srcid.read());
+                        if (is_local_req(p_vci_tgt.srcid.read())) 
+                        {
+                            m_cpt_read_local++;
+                        }
+                        else 
+                        {
+                            m_cpt_read_remote++;
+                        }
+                        // (1 (CMD) + m_words (RSP)) flits VCI => 2 + m_words + 1 flits dspin
+                        m_cpt_read_cost += (3 + m_words) * req_distance(p_vci_tgt.srcid.read());
                     }
                     // </Activity counters>
@@ -1710,5 +1709,5 @@
                 if (p_vci_tgt.cmdval and m_cmd_write_addr_fifo.wok())
                 {
-
+                    uint32_t plen = p_vci_tgt.plen.read();
 #if DEBUG_MEMC_TGT_CMD
                     if (m_debug)
@@ -1725,10 +1724,18 @@
                     // <Activity counters>
                     if (p_vci_tgt.cmd.read() == vci_param_int::CMD_NOP) {
-                        m_cpt_sc_cost += req_distance(p_vci_tgt.srcid.read());
+                        // (2 (CMD) + 1 (RSP)) flits VCI => 4 + (1 (success) || 2 (failure)) flits dspin
+                        m_cpt_sc_cost += 5 * req_distance(p_vci_tgt.srcid.read());
                     }
                     else {
-                        if (is_local_req(p_vci_tgt.srcid.read())) m_cpt_write_flits_local++;
-                        else                                      m_cpt_write_flits_remote++;
-                        m_cpt_write_cost += req_distance(p_vci_tgt.srcid.read());
+                        if (is_local_req(p_vci_tgt.srcid.read())) 
+                        {
+                            m_cpt_write_flits_local++;
+                        }
+                        else
+                        {
+                            m_cpt_write_flits_remote++;
+                        }
+                        // (burst_size (CMD) + 1 (RSP) flits VCI => 2 + burst_size + 1 flits dspin
+                        m_cpt_write_cost += (3 + (plen >> 2)) * req_distance(p_vci_tgt.srcid.read());
                     }
                     // </Activity counters>
@@ -1737,11 +1744,22 @@
                         // <Activity counters>
                         if (p_vci_tgt.cmd.read() == vci_param_int::CMD_NOP) {
-                            if (is_local_req(p_vci_tgt.srcid.read())) m_cpt_sc_local++;
-                            else                                      m_cpt_sc_remote++;
-
+                            if (is_local_req(p_vci_tgt.srcid.read()))
+                            {
+                                m_cpt_sc_local++;
+                            }
+                            else
+                            {
+                                m_cpt_sc_remote++;
+                            }
                         }
                         else {
-                            if (is_local_req(p_vci_tgt.srcid.read())) m_cpt_write_local++;
-                            else                                      m_cpt_write_remote++;
+                            if (is_local_req(p_vci_tgt.srcid.read()))
+                            {
+                                m_cpt_write_local++;
+                            }
+                            else
+                            {
+                                m_cpt_write_remote++;
+                            }
                         }
                         // </Activity counters>
@@ -1777,7 +1795,14 @@
                     if (p_vci_tgt.eop) {
                         // <Activity counters>
-                        if (is_local_req(p_vci_tgt.srcid.read())) m_cpt_cas_local++;
-                        else                                      m_cpt_cas_remote++;
-                        m_cpt_cas_cost += req_distance(p_vci_tgt.srcid.read());
+                        if (is_local_req(p_vci_tgt.srcid.read()))
+                        {
+                            m_cpt_cas_local++;
+                        }
+                        else             
+                        {
+                            m_cpt_cas_remote++;
+                        }
+                        // (2 (CMD) + 1 (RSP)) flits VCI => 4 + (1 (success) || 2 (failure)) flits dspin
+                        m_cpt_cas_cost += 5 * req_distance(p_vci_tgt.srcid.read());
                         // </Activity counters>
                         r_tgt_cmd_fsm = TGT_CMD_IDLE;
@@ -6575,6 +6600,7 @@
                         {
                             m_cpt_minval_remote++;
-                            m_cpt_minval_cost += req_distance(m_config_to_cc_send_srcid_fifo.read());
-                        }
+                        }
+                        // 2 flits for multi inval
+                        m_cpt_minval_cost += 2 * req_distance(m_config_to_cc_send_srcid_fifo.read());
                         // </Activity Counters>
                         r_cc_send_fsm = CC_SEND_CONFIG_INVAL_NLINE;
@@ -6642,6 +6668,7 @@
                         {
                             m_cpt_minval_remote++;
-                            m_cpt_minval_cost += req_distance(m_xram_rsp_to_cc_send_srcid_fifo.read());
-                        }
+                        }
+                        // 2 flits for multi inval
+                        m_cpt_minval_cost += 2 * req_distance(m_xram_rsp_to_cc_send_srcid_fifo.read());
                         // </Activity Counters>
                         r_cc_send_fsm = CC_SEND_XRAM_RSP_INVAL_NLINE;
@@ -6737,6 +6764,7 @@
                         {
                             m_cpt_update_remote++;
-                            m_cpt_update_cost += req_distance(m_write_to_cc_send_srcid_fifo.read());
-                        }
+                        }
+                        // 2 flits for multi update
+                        m_cpt_update_cost += 2 * req_distance(m_write_to_cc_send_srcid_fifo.read());
                         // </Activity Counters>
 
@@ -6826,6 +6854,7 @@
                         {
                             m_cpt_update_remote++;
-                            m_cpt_update_cost += req_distance(m_cas_to_cc_send_srcid_fifo.read());
-                        }
+                        }
+                        // 2 flits for multi update
+                        m_cpt_update_cost += 2 * req_distance(m_cas_to_cc_send_srcid_fifo.read());
                         // </Activity Counters>
                         r_cc_send_fsm = CC_SEND_CAS_UPDT_NLINE;
@@ -6951,6 +6980,7 @@
                     else {
                         m_cpt_cleanup_remote++;
-                        m_cpt_cleanup_cost += req_distance(srcid);
-                    }
+                    }
+                    // 2 flits for cleanup without data
+                    m_cpt_cleanup_cost += 2 * req_distance(srcid);
                     // </Activity Counters>
 
