Index: /branches/v5/modules/vci_cc_vcache_wrapper_dspin_coherence/caba/source/include/vci_cc_vcache_wrapper.h
===================================================================
--- /branches/v5/modules/vci_cc_vcache_wrapper_dspin_coherence/caba/source/include/vci_cc_vcache_wrapper.h	(revision 322)
+++ /branches/v5/modules/vci_cc_vcache_wrapper_dspin_coherence/caba/source/include/vci_cc_vcache_wrapper.h	(revision 323)
@@ -376,5 +376,4 @@
     sc_signal<size_t>       r_icache_cc_word;		    // word counter for cc update
     sc_signal<bool>         r_icache_cc_need_write;     // activate the cache for writing
-    sc_signal<bool>         r_icache_cc_fifo_done;      // tels when fifo is all poped
 
     // icache flush handling
@@ -450,5 +449,4 @@
     sc_signal<size_t>       r_dcache_cc_word;		    // word counter for cc update
     sc_signal<bool>         r_dcache_cc_need_write;     // activate the cache for writing
-    sc_signal<bool>         r_dcache_cc_fifo_done;      // tels when fifo is all poped
 
     // dcache flush handling
Index: /branches/v5/modules/vci_cc_vcache_wrapper_dspin_coherence/caba/source/src/vci_cc_vcache_wrapper.cpp
===================================================================
--- /branches/v5/modules/vci_cc_vcache_wrapper_dspin_coherence/caba/source/src/vci_cc_vcache_wrapper.cpp	(revision 322)
+++ /branches/v5/modules/vci_cc_vcache_wrapper_dspin_coherence/caba/source/src/vci_cc_vcache_wrapper.cpp	(revision 323)
@@ -140,5 +140,5 @@
     };
 
-const char *cc_receive_fsm_state_str[] {
+const char *cc_receive_fsm_state_str[] = {
         "CC_RECEIVE_IDLE",
         "CC_RECEIVE_CLACK",
@@ -152,5 +152,5 @@
     };
 
-const char *cc_send_fsm_state_str[] {
+const char *cc_send_fsm_state_str[] = {
         "CC_SEND_IDLE",
         "CC_SEND_CLEANUP_1",
@@ -255,5 +255,4 @@
       r_icache_cc_word("r_icache_cc_word"),
       r_icache_cc_need_write("r_icache_cc_need_write"),
-      r_icache_cc_fifo_done("r_icache_cc_fifo_done"),
 
       r_icache_flush_count("r_icache_flush_count"),
@@ -316,5 +315,4 @@
       r_dcache_cc_word("r_dcache_cc_word"),
       r_dcache_cc_need_write("r_dcache_cc_need_write"),
-      r_dcache_cc_fifo_done("r_dcache_cc_fifo_done"),
 
       r_dcache_flush_count("r_dcache_flush_count"),
@@ -1770,5 +1768,4 @@
                 // just pop the fifo , don't write in icache
                 r_icache_cc_need_write = false;
-                r_icache_cc_fifo_done = false;
             }
             // the request is dealt with
@@ -1814,5 +1811,4 @@
                     r_icache_fsm          = ICACHE_CC_UPDT;
                     r_icache_cc_word      = r_cc_receive_word_idx.read();
-                    r_icache_cc_fifo_done = false;
                 }
                 else if (r_cc_receive_icache_type.read() == CC_TYPE_INVAL)   // hit inval
@@ -1834,5 +1830,4 @@
                     // just pop the fifo , don't write in icache
                     r_icache_cc_need_write = false;
-                    r_icache_cc_fifo_done = false;
                 }
                 else // No response needed
@@ -1910,42 +1905,37 @@
         size_t  set   = r_icache_cc_set.read();
 
-        if (not r_icache_cc_fifo_done.read())
-        {
-            if (r_cc_receive_updt_fifo_be.rok())
-            {
-                if (r_icache_cc_need_write.read())
+        if (r_cc_receive_updt_fifo_be.rok())
+        {
+            if (r_icache_cc_need_write.read())
+            {
+                r_icache.write( way,
+                                set,
+                                word,
+                                r_cc_receive_updt_fifo_data.read(),
+                                r_cc_receive_updt_fifo_be.read() );
+
+                r_icache_cc_word = word+1;
+            }
+            if ( r_cc_receive_updt_fifo_eop.read() )	// last word
+            {
+                // no need to write in the cache anymore
+                r_icache_cc_need_write = false;
+                // wait to send a request to cc_send_fsm
+                if(not r_icache_cc_send_req.read()) // cc_send is available
                 {
-                    r_icache.write( way,
-                                    set,
-                                    word,
-                                    r_cc_receive_updt_fifo_data.read(),
-                                    r_cc_receive_updt_fifo_be.read() );
-
-                    r_icache_cc_word = word+1;
+                    // coherence request completed
+                    r_cc_receive_icache_req = false;
+                    // request multicast acknowledgement
+                    r_icache_cc_send_req = true;
+                    r_icache_cc_send_updt_tab_idx = r_cc_receive_icache_updt_tab_idx.read();
+                    r_icache_cc_send_type = CC_TYPE_MULTI_ACK;
+
+                    r_icache_fsm          = r_icache_fsm_save.read();
                 }
-                if ( r_cc_receive_updt_fifo_eop.read() )	// last word
-                {
-                    // the fifo is all poped
-                    r_icache_cc_fifo_done = true;
-                    // no need to write in the cache anymore
-                    r_icache_cc_need_write = false;
-                }
-                //consume fifo
+            }
+            else
+            {
+                //consume fifo if not eop
                 cc_receive_updt_fifo_get  = true;
-            }
-        }
-        else
-        {
-            // wait to send a request to cc_send_fsm
-            if(not r_icache_cc_send_req.read()) // cc_send is available
-            {
-                // coherence request completed
-                r_cc_receive_icache_req = false;
-                // request multicast acknowledgement
-                r_icache_cc_send_req = true;
-                r_icache_cc_send_updt_tab_idx = r_cc_receive_icache_updt_tab_idx.read();
-                r_icache_cc_send_type = CC_TYPE_MULTI_ACK;
-
-                r_icache_fsm          = r_icache_fsm_save.read();
             }
         }
@@ -4392,5 +4382,4 @@
                 // just pop the fifo , don't write in icache
                 r_dcache_cc_need_write = false;
-                r_dcache_cc_fifo_done = false;
             }
             // the request is dealt with
@@ -4438,5 +4427,4 @@
                     r_dcache_fsm          = DCACHE_CC_UPDT;
                     r_dcache_cc_word      = r_cc_receive_word_idx.read();
-                    r_dcache_cc_fifo_done = false;
                 }
                 else if (r_cc_receive_dcache_type.read() == CC_TYPE_INVAL)   // hit inval
@@ -4458,5 +4446,4 @@
                     // just pop the fifo , don't write in icache
                     r_dcache_cc_need_write = false;
-                    r_dcache_cc_fifo_done = false;
                 }
                 else // No response needed
@@ -4556,26 +4543,24 @@
         size_t	 set        = r_dcache_cc_set.read();
 
-        if (not r_dcache_cc_fifo_done.read())
-        {
-            if (r_cc_receive_updt_fifo_be.rok())
-            {
-                if (r_dcache_cc_need_write.read())
+        if (r_cc_receive_updt_fifo_be.rok())
+        {
+            if (r_dcache_cc_need_write.read())
+            {
+                if ( r_dcache_in_tlb[way*m_dcache_sets+set] ) 			// selective TLB inval
                 {
-                    if ( r_dcache_in_tlb[way*m_dcache_sets+set] ) 			// selective TLB inval
+                    r_dcache_in_tlb[way*m_dcache_sets+set] = false;
+                    r_dcache_tlb_inval_line  = r_cc_receive_dcache_nline.read() / (m_dcache_words<<2);
+                    r_dcache_tlb_inval_set   = 0;
+                    r_dcache_fsm_scan_save   = r_dcache_fsm.read();
+                    r_dcache_fsm             = DCACHE_INVAL_TLB_SCAN;
+                    break;
+                }
+                else
+                {
+                    if ( r_dcache_contains_ptd[way*m_dcache_sets+set] ) 	// TLB flush
                     {
-                        r_dcache_in_tlb[way*m_dcache_sets+set] = false;
-                        r_dcache_tlb_inval_line  = r_cc_receive_dcache_nline.read() / (m_dcache_words<<2);
-                        r_dcache_tlb_inval_set   = 0;
-                        r_dcache_fsm_scan_save   = r_dcache_fsm.read();
-                        r_dcache_fsm             = DCACHE_INVAL_TLB_SCAN;
-                        break;
-                    }
-                    else
-                    {
-                        if ( r_dcache_contains_ptd[way*m_dcache_sets+set] ) 	// TLB flush
-                        {
-                            r_itlb.reset();
-                            r_dtlb.reset();
-                            r_dcache_contains_ptd[way*m_dcache_sets+set] = false;
+                        r_itlb.reset();
+                        r_dtlb.reset();
+                        r_dcache_contains_ptd[way*m_dcache_sets+set] = false;
 
 #if DEBUG_DCACHE
@@ -4586,16 +4571,16 @@
 }
 #endif
-                        }
+                    }
 
 #ifdef INSTRUMENTATION
 m_cpt_dcache_data_write++;
 #endif
-                        r_dcache.write( way,
-                                        set,
-                                        word,
-                                        r_cc_receive_updt_fifo_data.read(),
-                                        r_cc_receive_updt_fifo_be.read() );
-
-                        r_dcache_cc_word = word + 1;
+                    r_dcache.write( way,
+                                    set,
+                                    word,
+                                    r_cc_receive_updt_fifo_data.read(),
+                                    r_cc_receive_updt_fifo_be.read() );
+
+                    r_dcache_cc_word = word + 1;
 
 #if DEBUG_DCACHE
@@ -4610,31 +4595,36 @@
 }
 #endif
-                    }
                 }
-                if ( r_cc_receive_updt_fifo_eop.read() )	// last word
+            }
+
+            if ( r_cc_receive_updt_fifo_eop.read() )	// last word
+            {
+                // no need to write in the cache anymore
+                r_dcache_cc_need_write = false;
+
+                // wait to send a request to cc_send_fsm
+                if(not r_icache_cc_send_req.read())
+                // cc_send is available
                 {
-                    // the fifo is all poped
-                    r_dcache_cc_fifo_done = true;
-                    // no need to write in the cache anymore
-                    r_dcache_cc_need_write = false;
+                    //consume last fifo flit if eop and request to cc_send possible
+                    cc_receive_updt_fifo_get  = true;
+
+                    // coherence request completed
+                    r_cc_receive_dcache_req = false;
+
+                    // request multicast acknowledgement
+                    r_dcache_cc_send_req = true;
+                    r_dcache_cc_send_updt_tab_idx = r_cc_receive_dcache_updt_tab_idx.read();
+                    r_dcache_cc_send_type = CC_TYPE_MULTI_ACK;
+
+                    r_dcache_fsm          = r_dcache_fsm_cc_save.read();
                 }
-                //consume fifo
+            }
+            else
+            {
+                //consume fifo if not eop
                 cc_receive_updt_fifo_get  = true;
             }
-        }
-        else
-        {
-            // wait to send a request to cc_send_fsm
-            if(not r_icache_cc_send_req.read()) // cc_send is available
-            {
-                // coherence request completed
-                r_cc_receive_dcache_req = false;
-                // request multicast acknowledgement
-                r_dcache_cc_send_req = true;
-                r_dcache_cc_send_updt_tab_idx = r_cc_receive_dcache_updt_tab_idx.read();
-                r_dcache_cc_send_type = CC_TYPE_MULTI_ACK;
-
-                r_dcache_fsm          = r_dcache_fsm_cc_save.read();
-            }
+
         }
         break;
