Index: /trunk/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp
===================================================================
--- /trunk/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp	(revision 1040)
+++ /trunk/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp	(revision 1041)
@@ -1383,4 +1383,13 @@
             size_t set = r_icache_flush_count.read() % m_icache_sets;
 
+            if (r_icache_flush_count.read() == (m_icache_sets * m_icache_ways))  // last slot
+            {
+                r_dcache_xtn_req = false;
+                m_drsp.valid = true;
+                r_icache_fsm = ICACHE_IDLE;
+                break;
+            }
+
+
 #ifdef INSTRUMENTATION
             m_cpt_icache_dir_read++;
@@ -1404,16 +1413,7 @@
                 r_icache_fsm      = ICACHE_XTN_CACHE_FLUSH_GO;
             }
-            else if (r_icache_flush_count.read() ==
-                      (m_icache_sets*m_icache_ways - 1))  // last slot
-            {
-                r_dcache_xtn_req = false;
-                m_drsp.valid = true;
-                r_icache_fsm = ICACHE_IDLE;
-            }
-
-            // saturation counter, to have the same last slot condition
-            // in ICACHE_XTN_CACHE_FLUSH and ICACHE_XTN_CACHE_FLUSH_GO states
-            if (r_icache_flush_count.read() < (m_icache_sets * m_icache_ways - 1))
-            {
+            else {
+                // saturation counter, to have the same last slot condition
+                // in ICACHE_XTN_CACHE_FLUSH and ICACHE_XTN_CACHE_FLUSH_GO states
                 r_icache_flush_count = r_icache_flush_count.read() + 1;
             }
@@ -1435,15 +1435,11 @@
                            CACHE_SLOT_STATE_ZOMBI);
 
-        if (r_icache_flush_count.read() ==
-                      (m_icache_sets*m_icache_ways - 1))  // last slot
-        {
-            r_dcache_xtn_req = false;
-            m_drsp.valid = true;
+        if (r_icache_flush_count.read() == (m_icache_sets * m_icache_ways - 1))  // last slot
+        {
             r_icache_fsm = ICACHE_IDLE;
-        }
-        else
-        {
-            r_icache_fsm = ICACHE_XTN_CACHE_FLUSH;
-        }
+            break;
+        }
+        r_icache_flush_count = r_icache_flush_count.read() + 1;
+        r_icache_fsm = ICACHE_XTN_CACHE_FLUSH;
         break;
     }
