Index: trunk/platforms/tsar_generic_iob/top.cpp
===================================================================
--- trunk/platforms/tsar_generic_iob/top.cpp	(revision 569)
+++ trunk/platforms/tsar_generic_iob/top.cpp	(revision 584)
@@ -36,9 +36,6 @@
 // peripherals (MTTY, MNIC, CDMA) is limited by the number of IRQ ports...
 //
-// In all clusters, the IRQs are connected to XICU as follow:
-// - IRQ_IN[0]  to IRQ_IN[3] not connected (reserved  for context switch)
-// - IRQ_IN[4]  to IRQ_IN[7] are connected to 4 MDMA channels
-//
-// In external peripheral IRQs are connected in cluster(0,0) only:
+// In cluster(0,0), the XICU HWI input ports are connected as follow:
+// - IRQ_IN[0]  to IRQ_IN[7]  grounded (reserved for PTI or SWI)
 // - IRQ_IN[8]  to IRQ_IN[9]  are connected to 2 NIC_RX channels.
 // - IRQ_IN[10] to IRQ_IN[11] are connected to 2 NIC_TX channels.
@@ -46,4 +43,5 @@
 // - IRQ_IN[16] to IRQ_IN[30] are connected to 15 TTY channels
 // - IRQ_IN[31]               is connected to BDEV
+// In other clusters, the XICU HWI input ports are grounded.
 // 
 // All clusters are identical, but cluster(0,0) and cluster(XMAX-1,YMAX-1)
@@ -178,5 +176,5 @@
 //////////////////////i/////////////////////////////////////
 
-#include "giet_vm/hard_config.h"
+#include "/Users/alain/soc/giet_vm/hard_config.h"
 
 ////////////////////////////////////////////////////////////
@@ -231,5 +229,5 @@
 /////////////////////////////////////////////////////////
 
-// Non replicated peripherals
+// Non replicated peripherals (must be in cluster 0)
 
 #define BROM_BASE             0x00BFC00000      
@@ -254,5 +252,5 @@
 #define FBUF_SIZE             FBUF_X_SIZE * FBUF_Y_SIZE
 
-// replicated segments : address is incremented by a cluster offset 
+// Replicated peripherals : address is incremented by a cluster offset 
 //     offset  = cluster(x,y) << (address_width-x_width-y_width);
 
@@ -266,7 +264,9 @@
 #define MDMA_SIZE             0x0000001000 * NB_DMA_CHANNELS // 4 Kbytes per channel  
 
+// Replicated memory segments (XRAM) : address is incremented by a cluster offset 
+//     offset  = cluster(x,y) << (address_width-x_width-y_width);
+
 #define MEMC_BASE             0x00B2000000      
 #define MEMC_SIZE             0x0000001000   // 4 Kbytes 
-
 
 ////////////////////////////////////////////////////////////////////////
@@ -429,5 +429,5 @@
             std::cout << "     -MEMCID index_memc_to_be_traced" << std::endl;
             std::cout << "     -PROCID index_proc_to_be_traced" << std::endl;
-            std::cout << "     -IOBID  index_iob_to_be_traced" << std::endl;
+            std::cout << "     -IOB    non_zero_value" << std::endl;
             exit(0);
          }
@@ -782,5 +782,5 @@
     sc_signal<bool>                   signal_resetn("resetn");
 
-    sc_signal<bool>                   signal_unused_irq[32];
+    sc_signal<bool>                   signal_irq_false;
     sc_signal<bool>                   signal_irq_bdev;
     sc_signal<bool>                   signal_irq_mnic_rx[NB_NIC_CHANNELS];
@@ -1054,18 +1054,18 @@
 
     // IOX network connexion
-    iox_network->p_clk                                       (signal_clk);
-    iox_network->p_resetn                                    (signal_resetn);
-    iox_network->p_to_ini[IOX_IOB0_INI_ID]                   (signal_vci_ini_iob0);
-    iox_network->p_to_ini[IOX_IOB1_INI_ID]                   (signal_vci_ini_iob1);
-    iox_network->p_to_ini[IOX_BDEV_INI_ID]                   (signal_vci_ini_bdev);
-    iox_network->p_to_ini[IOX_CDMA_INI_ID]                   (signal_vci_ini_cdma);
-    iox_network->p_to_tgt[IOX_IOB0_TGT_ID]                   (signal_vci_tgt_iob0);
-    iox_network->p_to_tgt[IOX_IOB1_TGT_ID]                   (signal_vci_tgt_iob1);
-    iox_network->p_to_tgt[IOX_MTTY_TGT_ID]                   (signal_vci_tgt_mtty);
-    iox_network->p_to_tgt[IOX_FBUF_TGT_ID]                   (signal_vci_tgt_fbuf);
-    iox_network->p_to_tgt[IOX_MNIC_TGT_ID]                   (signal_vci_tgt_mnic);
-    iox_network->p_to_tgt[IOX_BROM_TGT_ID]                   (signal_vci_tgt_brom);
-    iox_network->p_to_tgt[IOX_BDEV_TGT_ID]                   (signal_vci_tgt_bdev);
-    iox_network->p_to_tgt[IOX_CDMA_TGT_ID]                   (signal_vci_tgt_cdma);
+    iox_network->p_clk                                   (signal_clk);
+    iox_network->p_resetn                                (signal_resetn);
+    iox_network->p_to_ini[IOX_IOB0_INI_ID]               (signal_vci_ini_iob0);
+    iox_network->p_to_ini[IOX_IOB1_INI_ID]               (signal_vci_ini_iob1);
+    iox_network->p_to_ini[IOX_BDEV_INI_ID]               (signal_vci_ini_bdev);
+    iox_network->p_to_ini[IOX_CDMA_INI_ID]               (signal_vci_ini_cdma);
+    iox_network->p_to_tgt[IOX_IOB0_TGT_ID]               (signal_vci_tgt_iob0);
+    iox_network->p_to_tgt[IOX_IOB1_TGT_ID]               (signal_vci_tgt_iob1);
+    iox_network->p_to_tgt[IOX_MTTY_TGT_ID]               (signal_vci_tgt_mtty);
+    iox_network->p_to_tgt[IOX_FBUF_TGT_ID]               (signal_vci_tgt_fbuf);
+    iox_network->p_to_tgt[IOX_MNIC_TGT_ID]               (signal_vci_tgt_mnic);
+    iox_network->p_to_tgt[IOX_BROM_TGT_ID]               (signal_vci_tgt_brom);
+    iox_network->p_to_tgt[IOX_BDEV_TGT_ID]               (signal_vci_tgt_bdev);
+    iox_network->p_to_tgt[IOX_CDMA_TGT_ID]               (signal_vci_tgt_cdma);
 
     // BDEV connexion
@@ -1073,6 +1073,8 @@
     bdev->p_resetn                                       (signal_resetn);
     bdev->p_irq                                          (signal_irq_bdev);
+
     // For AHCI
     // bdev->p_channel_irq[0]                               (signal_irq_bdev);
+
     bdev->p_vci_target                                   (signal_vci_tgt_bdev);
     bdev->p_vci_initiator                                (signal_vci_ini_bdev);
@@ -1129,5 +1131,5 @@
     std::cout << "  - CDMA connected" << std::endl;
 
-    // IRQ connexions (for cluster_iob0 only)
+    // IRQ connexions from external peripherals (cluster_iob0 only)
     // IRQ_MNIC_RX  -> IRQ[08] to IRQ[09]
     // IRQ_MNIC_TX  -> IRQ[10] to IRQ[11]
@@ -1139,10 +1141,18 @@
     for ( size_t n=0 ; n<32 ; n++ )
     {
-        if      ( n < 8  ) (*clusters[0][0]->p_irq[n])       (signal_unused_irq[n]);
-        else if ( n < 10 ) (*clusters[0][0]->p_irq[n])       (signal_irq_mnic_rx[n-8]);
-        else if ( n < 12 ) (*clusters[0][0]->p_irq[n])       (signal_irq_mnic_tx[n-10]);
-        else if ( n < 16 ) (*clusters[0][0]->p_irq[n])       (signal_irq_cdma[n-12]);
+        if      ( n < 8  ) (*clusters[0][0]->p_irq[n])       (signal_irq_false);
+
+        else if ( n < 10 ) (*clusters[0][0]->p_irq[n])       (signal_irq_false);
+//      else if ( n < 10 ) (*clusters[0][0]->p_irq[n])       (signal_irq_mnic_rx[n-8]);
+
+        else if ( n < 12 ) (*clusters[0][0]->p_irq[n])       (signal_irq_false);
+//      else if ( n < 12 ) (*clusters[0][0]->p_irq[n])       (signal_irq_mnic_tx[n-10]);
+
+        else if ( n < 16 ) (*clusters[0][0]->p_irq[n])       (signal_irq_false);
+//      else if ( n < 16 ) (*clusters[0][0]->p_irq[n])       (signal_irq_cdma[n-12]);
+
         else if ( n < mx ) (*clusters[0][0]->p_irq[n])       (signal_irq_mtty[n-16]);
-        else if ( n < 31 ) (*clusters[0][0]->p_irq[n])       (signal_unused_irq[n]);
+        else if ( n < 31 ) (*clusters[0][0]->p_irq[n])       (signal_irq_false);
+
         else               (*clusters[0][0]->p_irq[n])       (signal_irq_bdev);
     }
@@ -1338,5 +1348,8 @@
 
    sc_start(sc_core::sc_time(0, SC_NS));
+
    signal_resetn = false;
+
+   signal_irq_false = false;
 
    // network boundaries signals
@@ -1381,7 +1394,7 @@
     for (size_t n = 1; n < ncycles; n++)
     {
-        // Monitor a specific address for L1 & L2 caches
-        // clusters[1][1]->proc[0]->cache_monitor(0x8ba4ULL);
-        // clusters[0][0]->memc->cache_monitor(   0x12180ULL);
+        // Monitor a specific address for L1 and/or L2 caches
+        // clusters[1][1]->proc[0]->cache_monitor(0x50090ULL);
+        // clusters[0][0]->memc->cache_monitor(   0x50090ULL);
 
         if (debug_ok and (n > debug_from) and (n % debug_period == 0))
@@ -1390,13 +1403,15 @@
             std::cout << " ************************************************" << std::endl;
 
-            // trace proc[debug_proc_id] 
+         
+            // trace proc[debug_proc_id] ... or several procs
+//          for( debug_proc_id = 0 ; debug_proc_id < 2 ; debug_proc_id++ )
+
             if ( debug_proc_id < XMAX*YMAX*NB_PROCS_MAX )
             {
-
                 size_t l = debug_proc_id % NB_PROCS_MAX ;
                 size_t y = (debug_proc_id / NB_PROCS_MAX) % YMAX ;
                 size_t x = debug_proc_id / (YMAX * NB_PROCS_MAX) ;
 
-                clusters[x][y]->proc[l]->print_trace(0);
+                clusters[x][y]->proc[l]->print_trace(1);
 
                 std::ostringstream proc_signame;
@@ -1404,4 +1419,14 @@
                 clusters[x][y]->signal_int_vci_ini_proc[l].print_trace(proc_signame.str());
 
+                clusters[x][y]->xicu->print_trace(l);
+
+                std::ostringstream xicu_signame;
+                xicu_signame << "[SIG]XICU_" << x << "_" << y;
+                clusters[x][y]->signal_int_vci_tgt_xicu.print_trace(xicu_signame.str());
+
+                if( clusters[x][y]->signal_proc_it[0].read() ) 
+                    std::cout << "### IRQ_PROC_" << std::dec
+                              << x << "_" << y << " ACTIVE" << std::endl;
+                
 //              std::ostringstream p2m_signame;
 //              p2m_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " P2M" ;
@@ -1419,4 +1444,5 @@
 //              p_rsp_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " RSP" ;
 //              clusters[x][y]->signal_int_dspin_rsp_proc_i[l].print_trace(p_rsp_signame.str());
+
             }   
 
@@ -1459,12 +1485,12 @@
             }
 
-            // trace RAM network
-            for( size_t cluster = 0 ; cluster < XMAX*YMAX ; cluster++ )
-            {
-                size_t x = cluster / YMAX;
-                size_t y = cluster % YMAX;
-                clusters[x][y]->ram_router_cmd->print_trace();
-                clusters[x][y]->ram_router_rsp->print_trace();
-            }
+            // trace RAM network routers
+//          for( size_t cluster = 0 ; cluster < XMAX*YMAX ; cluster++ )
+//          {
+//              size_t x = cluster / YMAX;
+//              size_t y = cluster % YMAX;
+//              clusters[x][y]->ram_router_cmd->print_trace();
+//              clusters[x][y]->ram_router_rsp->print_trace();
+//          }
         
             // trace iob, iox and external peripherals  
@@ -1479,6 +1505,6 @@
                 signal_vci_tgt_iob0.print_trace("[SIG]IOB0_IOX_TGT");
 
-                signal_dspin_cmd_iob0_loopback.print_trace("[SIG]IOB0_CMD_LOOPBACK"); 
-                signal_dspin_rsp_iob0_loopback.print_trace("[SIG]IOB0_RSP_LOOPBACK"); 
+//              signal_dspin_cmd_iob0_loopback.print_trace("[SIG]IOB0_CMD_LOOPBACK"); 
+//              signal_dspin_rsp_iob0_loopback.print_trace("[SIG]IOB0_RSP_LOOPBACK"); 
 
 //              cdma->print_trace();
@@ -1486,6 +1512,6 @@
 //              signal_vci_ini_cdma.print_trace("[SIG]IOX_CDMA_INI");
 
-//              brom->print_trace();
-//              signal_vci_tgt_brom.print_trace("[SIG]IOX_BROM_TGT");
+                brom->print_trace();
+                signal_vci_tgt_brom.print_trace("[SIG]IOX_BROM_TGT");
 
 //              mtty->print_trace();
