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 627)
+++ trunk/modules/vci_cc_vcache_wrapper/caba/source/src/vci_cc_vcache_wrapper.cpp	(revision 668)
@@ -809,5 +809,7 @@
         m_debug_previous_i_hit     = false;
         m_debug_previous_d_hit     = false;
-        m_debug_activated	       = false;
+        m_debug_icache_fsm	       = false;
+        m_debug_dcache_fsm	       = false;
+        m_debug_cmd_fsm 	       = false;
 
         // activity counters
@@ -950,5 +952,10 @@
     m_cpt_total_cycles++;
 
-    m_debug_activated = (m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok;
+    m_debug_icache_fsm = m_debug_icache_fsm ||
+        ((m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok);
+    m_debug_dcache_fsm = m_debug_dcache_fsm ||
+        ((m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok);
+    m_debug_cmd_fsm = m_debug_cmd_fsm ||
+        ((m_cpt_total_cycles > m_debug_start_cycle) and m_debug_ok);
 
     /////////////////////////////////////////////////////////////////////
@@ -1209,5 +1216,5 @@
                     r_icache_fsm      = ICACHE_MISS_SELECT;
 #if DEBUG_ICACHE
-if ( m_debug_activated )
+if ( m_debug_icache_fsm )
 std::cout << "  <PROC " << name() << " ICACHE_IDLE> READ MISS in icache" 
           << " : PADDR = " << std::hex << paddr << std::endl;
@@ -1231,5 +1238,5 @@
                     r_icache_fsm       = ICACHE_IDLE;
 #if DEBUG_ICACHE
-if ( m_debug_activated )
+if ( m_debug_icache_fsm )
 std::cout << "  <PROC " << name() << " ICACHE_IDLE> READ HIT in icache" 
           << " : PADDR = " << std::hex << paddr << std::endl;
@@ -1243,5 +1250,5 @@
 
 #if DEBUG_ICACHE
-if ( m_debug_activated )
+if ( m_debug_icache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -1589,5 +1596,5 @@
 
 #if DEBUG_ICACHE
-if ( m_debug_activated )
+if ( m_debug_icache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -1614,5 +1621,5 @@
                             CACHE_SLOT_STATE_ZOMBI);
 #if DEBUG_ICACHE
-if ( m_debug_activated )
+if ( m_debug_icache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -1689,5 +1696,5 @@
                             r_vci_rsp_fifo_icache.read() );
 #if DEBUG_ICACHE
-if ( m_debug_activated )
+if ( m_debug_icache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -1767,5 +1774,5 @@
                                         CACHE_SLOT_STATE_ZOMBI );
 #if DEBUG_ICACHE
-if ( m_debug_activated )
+if ( m_debug_icache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -1791,5 +1798,5 @@
                                     CACHE_SLOT_STATE_VALID );
 #if DEBUG_ICACHE
-if ( m_debug_activated )
+if ( m_debug_icache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -1886,5 +1893,5 @@
 
 #if DEBUG_ICACHE
-if ( m_debug_activated )
+if ( m_debug_icache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -1927,5 +1934,5 @@
             }
 #if DEBUG_ICACHE
-if ( m_debug_activated )
+if ( m_debug_icache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -2013,5 +2020,5 @@
 
 #if DEBUG_ICACHE
-if ( m_debug_activated )
+if ( m_debug_icache_fsm )
 {
 std::cout << "  <PROC " << name()
@@ -2053,5 +2060,5 @@
 
 #if DEBUG_ICACHE
-if ( m_debug_activated )
+if ( m_debug_icache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -2314,5 +2321,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 std::cout << "  <PROC " << name() << " DCACHE_IDLE>"
           << " Cache update in P1 stage" << std::dec
@@ -2601,4 +2608,12 @@
 		            break;
 
+                    case iss_t::XTN_DEBUG_MASK:     // debug mask
+                        m_debug_dcache_fsm = ((m_dreq.wdata & 0x1) != 0);
+                        m_debug_icache_fsm = ((m_dreq.wdata & 0x2) != 0);
+                        m_debug_cmd_fsm = ((m_dreq.wdata & 0x4) != 0);
+                        m_drsp.valid = true;
+                        r_dcache_fsm = DCACHE_IDLE;
+                        break;
+
                     default:
                         r_mmu_detr   = MMU_WRITE_UNDEFINED_XTN;
@@ -2658,5 +2673,5 @@
                             m_drsp.rdata = 0;
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 std::cout << "  <PROC " << name() << " DCACHE_IDLE>"
           << " HIT in dtlb, but privilege violation" << std::endl;
@@ -2674,5 +2689,5 @@
                             m_drsp.rdata = 0;
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 std::cout << "  <PROC " << name() << " DCACHE_IDLE>"
           << " HIT in dtlb, but writable violation" << std::endl;
@@ -2715,5 +2730,5 @@
                                 r_dcache_fsm          = DCACHE_MISS_SELECT;
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 std::cout << "  <PROC " << name() << " DCACHE_IDLE>"
           << " READ MISS in dcache" 
@@ -2726,5 +2741,5 @@
                                 r_dcache_fsm   = DCACHE_IDLE;
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 std::cout << "  <PROC " << name() << " DCACHE_IDLE>"
           << " Pending cleanup, stalled until cleanup acknowledge"
@@ -2742,5 +2757,5 @@
                                 m_drsp.rdata   = cache_rdata;
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 std::cout << "  <PROC " << name() << " DCACHE_IDLE>"
           << " READ HIT in dcache" 
@@ -2757,5 +2772,5 @@
                             r_dcache_fsm            = DCACHE_UNC_WAIT;
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 std::cout << "  <PROC " << name() << " DCACHE_IDLE>"
           << " READ UNCACHEABLE in dcache" 
@@ -2955,5 +2970,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     if ( r_dcache_tlb_ins.read() )
@@ -3025,5 +3040,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name() 
@@ -3062,5 +3077,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name() 
@@ -3084,5 +3099,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name() 
@@ -3111,5 +3126,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name() 
@@ -3152,5 +3167,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     if ( r_dcache_tlb_ins.read() )
@@ -3224,5 +3239,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name() 
@@ -3248,5 +3263,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name() 
@@ -3265,5 +3280,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name() 
@@ -3333,5 +3348,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -3353,5 +3368,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name() 
@@ -3369,5 +3384,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name() 
@@ -3386,5 +3401,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -3424,5 +3439,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     if ( r_dcache_tlb_ins.read() )
@@ -3500,5 +3515,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -3524,5 +3539,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -3542,5 +3557,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -3555,5 +3570,5 @@
     {
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -3608,5 +3623,5 @@
         {
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -3623,5 +3638,5 @@
     {
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -3894,5 +3909,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -3937,5 +3952,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -3997,5 +4012,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -4093,5 +4108,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -4123,5 +4138,5 @@
                             CACHE_SLOT_STATE_ZOMBI );
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -4268,5 +4283,5 @@
                                 r_vci_rsp_fifo_dcache.read() );
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -4346,5 +4361,5 @@
                                         CACHE_SLOT_STATE_ZOMBI );
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 std::cout << "  <PROC " << name()
           << " DCACHE_MISS_DIR_UPDT> Switch slot to ZOMBI state"
@@ -4369,5 +4384,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 std::cout << "  <PROC " << name()
           << " DCACHE_MISS_DIR_UPDT> Switch slot to VALID state"
@@ -4574,5 +4589,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -4622,5 +4637,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -4670,5 +4685,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -4713,5 +4728,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -4774,5 +4789,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -4811,5 +4826,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -4837,5 +4852,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -4873,5 +4888,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -4902,5 +4917,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated )
+if ( m_debug_dcache_fsm )
 {
     std::cout << "  <PROC " << name()
@@ -4963,5 +4978,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated and ok )
+if ( m_debug_dcache_fsm and ok )
 {
     std::cout << "  <PROC " << name()
@@ -4979,5 +4994,5 @@
 
 #if DEBUG_DCACHE
-if ( m_debug_activated and ok )
+if ( m_debug_dcache_fsm and ok )
 std::cout << "  <PROC " << name() << " DCACHE_INVAL_TLB_SCAN>"
           << " Invalidate DTLB entry" << std::hex
@@ -5184,5 +5199,5 @@
 
 #if DEBUG_CMD
-if ( m_debug_activated )
+if ( m_debug_cmd_fsm )
 {
 std::cout << "  <PROC " << name() << " CMD_IDLE>"
