Index: /trunk/platforms/tsar_generic_iob/arch.py
===================================================================
--- /trunk/platforms/tsar_generic_iob/arch.py	(revision 873)
+++ /trunk/platforms/tsar_generic_iob/arch.py	(revision 874)
@@ -19,8 +19,8 @@
 #  - y_size         : number of clusters in a column
 #  - nb_procs       : number of processors per cluster
+#  - nb_ttys        : number of TTY channels
 #  - fbf_width      : frame_buffer width = frame_buffer heigth
 #
 #  The "hidden" parameters (defined below) are:
-#  - nb_ttys        : number of TTY channels
 #  - nb_nics        : number of NIC channels
 #  - x_io           : cluster_io x coordinate
@@ -48,9 +48,9 @@
           y_size    = 2,
           nb_procs  = 2,
+          nb_ttys   = 1,
           fbf_width = 128 ):
 
     ### define architecture constants
 
-    nb_ttys         = 1
     nb_nics         = 2 
     x_io            = 0
@@ -76,10 +76,10 @@
              or (y_size == 8) or (y_size == 16) )
 
-    assert( nb_ttys == 1 )
+    assert( (nb_ttys >= 1) and (nb_ttys <= 16) )
 
     assert( ((x_io == 0) and (y_io == 0)) or
             ((x_io == x_size-1) and (y_io == y_size-1)) )
 
-    platform_name  = 'tsar_iob_%d_%d_%d_%d' % ( x_size, y_size, nb_procs, fbf_width )
+    platform_name  = 'tsar_iob_%d_%d_%d_%d_%d' % (x_size,y_size,nb_procs,nb_ttys,fbf_width)
 
     ### define replicated physical segments
@@ -116,5 +116,5 @@
 
     fbf_base  = 0x00B7000000 + offset_io
-    fbf_size  = fbf_width * fbf_width      # fbf_width * fbf_width bytes
+    fbf_size  = fbf_width * fbf_width     # fbf_width * fbf_width bytes
 
     pic_base  = 0x00B8000000 + offset_io
@@ -207,18 +207,33 @@
     pic = mapping.addPeriph( 'PIC', base = pic_base, size = pic_size, ptype = 'PIC', channels = 32 )
 
-    mapping.addIrq( pic, index = 0, isrtype = 'ISR_NIC_RX', channel = 0 )
-    mapping.addIrq( pic, index = 1, isrtype = 'ISR_NIC_RX', channel = 1 )
-
-    mapping.addIrq( pic, index = 2, isrtype = 'ISR_NIC_TX', channel = 0 )
-    mapping.addIrq( pic, index = 3, isrtype = 'ISR_NIC_TX', channel = 1 )
-
-    mapping.addIrq( pic, index = 4, isrtype = 'ISR_CMA'   , channel = 0 )
-    mapping.addIrq( pic, index = 5, isrtype = 'ISR_CMA'   , channel = 1 )
-    mapping.addIrq( pic, index = 6, isrtype = 'ISR_CMA'   , channel = 2 )
-    mapping.addIrq( pic, index = 7, isrtype = 'ISR_CMA'   , channel = 3 )
-
-    mapping.addIrq( pic, index = 8, isrtype = 'ISR_BDV'   , channel = 0 )
-
-    mapping.addIrq( pic, index = 9, isrtype = 'ISR_TTY_RX', channel = 0 )
+    mapping.addIrq( pic, index = 0,  isrtype = 'ISR_NIC_RX', channel = 0 )
+    mapping.addIrq( pic, index = 1,  isrtype = 'ISR_NIC_RX', channel = 1 )
+
+    mapping.addIrq( pic, index = 2,  isrtype = 'ISR_NIC_TX', channel = 0 )
+    mapping.addIrq( pic, index = 3,  isrtype = 'ISR_NIC_TX', channel = 1 )
+
+    mapping.addIrq( pic, index = 4,  isrtype = 'ISR_CMA'   , channel = 0 )
+    mapping.addIrq( pic, index = 5,  isrtype = 'ISR_CMA'   , channel = 1 )
+    mapping.addIrq( pic, index = 6,  isrtype = 'ISR_CMA'   , channel = 2 )
+    mapping.addIrq( pic, index = 7,  isrtype = 'ISR_CMA'   , channel = 3 )
+
+    mapping.addIrq( pic, index = 8,  isrtype = 'ISR_BDV'   , channel = 0 )
+
+    mapping.addIrq( pic, index = 16, isrtype = 'ISR_TTY_RX', channel = 0 )
+    mapping.addIrq( pic, index = 17, isrtype = 'ISR_TTY_RX', channel = 1 )
+    mapping.addIrq( pic, index = 18, isrtype = 'ISR_TTY_RX', channel = 2 )
+    mapping.addIrq( pic, index = 19, isrtype = 'ISR_TTY_RX', channel = 3 )
+    mapping.addIrq( pic, index = 20, isrtype = 'ISR_TTY_RX', channel = 4 )
+    mapping.addIrq( pic, index = 21, isrtype = 'ISR_TTY_RX', channel = 5 )
+    mapping.addIrq( pic, index = 22, isrtype = 'ISR_TTY_RX', channel = 6 )
+    mapping.addIrq( pic, index = 23, isrtype = 'ISR_TTY_RX', channel = 7 )
+    mapping.addIrq( pic, index = 24, isrtype = 'ISR_TTY_RX', channel = 8 )
+    mapping.addIrq( pic, index = 25, isrtype = 'ISR_TTY_RX', channel = 9 )
+    mapping.addIrq( pic, index = 26, isrtype = 'ISR_TTY_RX', channel = 10 )
+    mapping.addIrq( pic, index = 27, isrtype = 'ISR_TTY_RX', channel = 11 )
+    mapping.addIrq( pic, index = 28, isrtype = 'ISR_TTY_RX', channel = 12 )
+    mapping.addIrq( pic, index = 29, isrtype = 'ISR_TTY_RX', channel = 13 )
+    mapping.addIrq( pic, index = 30, isrtype = 'ISR_TTY_RX', channel = 14 )
+    mapping.addIrq( pic, index = 31, isrtype = 'ISR_TTY_RX', channel = 15 )
 
     ### hardware components replicated in all clusters
@@ -272,6 +287,17 @@
                        identity = True , local = False, big = True )
 
-    ### global vsegs kernel_code, kernel_init : local / big page
-    ### replicated in all clusters with the same name (same vbase)
+    ### Global vsegs kernel_ptab_x_y : big page
+    ### one vseg per cluster: name indexed by (x,y) 
+    ### vbase address incremented by (cluster_xy * vseg_increment)
+    for x in xrange( x_size ):
+        for y in xrange( y_size ):
+            offset = ((x << y_width) + y) * ptab_increment
+            base   = kernel_ptab_vbase + offset
+            mapping.addGlobal( 'seg_kernel_ptab_%d_%d' %(x,y), base, kernel_ptab_size,
+                               'CXW_', vtype = 'PTAB', x = x, y = y, pseg = 'RAM', 
+                               local = False , big = True )
+
+    ### global vsegs kernel_code, kernel_init : big page
+    ### replicated in all clusters with the same name & same vbase
     for x in xrange( x_size ):
         for y in xrange( y_size ):
@@ -286,5 +312,5 @@
                                local = True, big = True )
 
-    ### global vseg kernel_data: non local / big page
+    ### global vseg kernel_data : big page
     ### Only mapped in cluster[0][0]
     mapping.addGlobal( 'seg_kernel_data', kernel_data_vbase, kernel_data_size, 
@@ -293,5 +319,5 @@
                        local = False, big = True )
 
-    ### global vseg kernel_uncdata: non local / small page
+    ### global vseg kernel_uncdata : small page
     ### Only mapped in cluster[0][0]
     mapping.addGlobal( 'seg_kernel_uncdata', kernel_uncdata_vbase, kernel_uncdata_size,
@@ -300,16 +326,6 @@
                        local = False, big = False )
 
-    ### Global vsegs kernel_ptab_x_y: non local / big pages
-    ### replicated in all clusters with name indexed by (x,y) 
-    ### as vbase address is incremented by (cluster_xy * vseg_increment)
-    for x in xrange( x_size ):
-        for y in xrange( y_size ):
-            offset = ((x << y_width) + y) * ptab_increment
-            mapping.addGlobal( 'seg_kernel_ptab_%d_%d' %(x,y), kernel_ptab_vbase + offset , kernel_ptab_size,
-                               'CXW_', vtype = 'PTAB', x = x, y = y, pseg = 'RAM', 
-                               local = False , big = True )
-
-    ### global vsegs kernel_sched : non local / small pages 
-    ### allocated in all clusters with name indexed by (x,y) 
+    ### global vsegs kernel_sched_x_y : small pages 
+    ### one vseg per cluster with name indexed by (x,y) 
     ### as vbase address is incremented by (cluster_xy * vseg_increment)
     for x in xrange( x_size ):
Index: /trunk/platforms/tsar_generic_iob/top.cpp
===================================================================
--- /trunk/platforms/tsar_generic_iob/top.cpp	(revision 873)
+++ /trunk/platforms/tsar_generic_iob/top.cpp	(revision 874)
@@ -38,10 +38,10 @@
 // The external peripherals HWI IRQs are translated to WTI IRQs by the
 // external IOPIC component, that must be configured by the OS to route
-// these WTI ITQS to one or several internal XICU components.
+// these WTI IRQS to one or several internal XICU components.
 // - IOPIC HWI[1:0]     connected to IRQ_NIC_RX[1:0]
 // - IOPIC HWI[3:2]     connected to IRQ_NIC_TX[1:0]
 // - IOPIC HWI[7:4]     connected to IRQ_CMA_TX[3:0]]
 // - IOPIC HWI[8]       connected to IRQ_BDEV
-// - IOPIC HWI[9]       connected to IRQ_TTY_RX[0]
+// - IOPIC HWI[31:16]   connected to IRQ_TTY_RX[15:0]
 //
 // Besides the external peripherals, each cluster contains one XICU component,
@@ -78,5 +78,5 @@
 // - Y_SIZE           : number of clusters in a column
 // - NB_PROCS_MAX     : number of processors per cluster (power of 2)
-// - NB_TTY_CHANNELS  : number of TTY channels in I/O network (must be 1)
+// - NB_TTY_CHANNELS  : number of TTY channels in I/O network (up to 16)
 // - NB_NIC_CHANNELS  : number of NIC channels in I/O network (up to 2)
 // - NB_CMA_CHANNELS  : number of CMA channels in I/O network (up to 4)
@@ -454,6 +454,6 @@
            "The NB_DMA_CHANNELS parameter cannot be larger than 4" );
 
-   assert( (NB_TTY_CHANNELS == 1) and
-           "The NB_TTY_CHANNELS parameter must be 1" );
+   assert( (NB_TTY_CHANNELS >= 1) and (NB_TTY_CHANNELS <= 16) and
+           "The NB_TTY_CHANNELS parameter cannot be larger than 16" );
 
    assert( (NB_NIC_CHANNELS == 2) and
@@ -801,5 +801,5 @@
     sc_signal<bool>                   signal_irq_false;
     sc_signal<bool>                   signal_irq_bdev;
-    sc_signal<bool>                   signal_irq_mtty_rx;
+    sc_signal<bool>                   signal_irq_mtty_rx[NB_TTY_CHANNELS];
     sc_signal<bool>                   signal_irq_mnic_rx[NB_NIC_CHANNELS];
     sc_signal<bool>                   signal_irq_mnic_tx[NB_NIC_CHANNELS];
@@ -1156,6 +1156,8 @@
     mtty->p_resetn                                       (signal_resetn);
     mtty->p_vci                                          (signal_vci_tgt_mtty);
-    mtty->p_irq[0]                                       (signal_irq_mtty_rx);
-
+    for ( size_t i=0 ; i<NB_TTY_CHANNELS ; i++ )
+    {
+        mtty->p_irq[i]                                   (signal_irq_mtty_rx[i]);
+    }
     std::cout << "  - MTTY connected" << std::endl;
 
@@ -1185,6 +1187,7 @@
        else if(i < 4+NB_CMA_CHANNELS)  iopi->p_hwi[i] (signal_irq_cdma[i-4]);
        else if(i < 8)                  iopi->p_hwi[i] (signal_irq_false);
-       else if(i == 8)                 iopi->p_hwi[i] (signal_irq_bdev);
-       else if(i == 9)                 iopi->p_hwi[i] (signal_irq_mtty_rx);
+       else if(i < 9)                  iopi->p_hwi[i] (signal_irq_bdev);
+       else if(i < 16)                 iopi->p_hwi[i] (signal_irq_false);
+       else if(i < 16+NB_TTY_CHANNELS) iopi->p_hwi[i] (signal_irq_mtty_rx[i-16]);
        else                            iopi->p_hwi[i] (signal_irq_false);
     }
@@ -1523,5 +1526,4 @@
             {
                 clusters[0][0]->iob->print_trace();
-                clusters[XMAX-1][YMAX-1]->iob->print_trace();
 //              clusters[0][0]->signal_int_vci_tgt_iobx.print_trace( "[SIG]IOB0_INT_TGT");
 //              clusters[0][0]->signal_int_vci_ini_iobx.print_trace( "[SIG]IOB0_INT_INI");
@@ -1531,7 +1533,7 @@
 //              signal_vci_tgt_iob0.print_trace("[SIG]IOB0_IOX_TGT");
 
-//              cdma->print_trace();
-//              signal_vci_tgt_cdma.print_trace("[SIG]IOX_CDMA_TGT");
-//              signal_vci_ini_cdma.print_trace("[SIG]IOX_CDMA_INI");
+                cdma->print_trace();
+                signal_vci_tgt_cdma.print_trace("[SIG]IOX_CDMA_TGT");
+                signal_vci_ini_cdma.print_trace("[SIG]IOX_CDMA_INI");
 
 //              brom->print_trace();
@@ -1541,7 +1543,7 @@
 //              signal_vci_tgt_mtty.print_trace("[SIG]IOX_MTTY_TGT");
 
-                bdev->print_trace();
-                signal_vci_tgt_bdev.print_trace("[SIG]BDEV_TGT");
-                signal_vci_ini_bdev.print_trace("[SIG]BDEV_INI");
+//              bdev->print_trace();
+//              signal_vci_tgt_bdev.print_trace("[SIG]BDEV_TGT");
+//              signal_vci_ini_bdev.print_trace("[SIG]BDEV_INI");
 
 //              mnic->print_trace();
@@ -1551,12 +1553,12 @@
 //              signal_vci_tgt_fbuf.print_trace("[SIG]FBUF");
 
-                iopi->print_trace();
-                signal_vci_ini_iopi.print_trace("[SIG]IOPI_INI");
-                signal_vci_tgt_iopi.print_trace("[SIG]IOPI_TGT");
-                iox_network->print_trace();
+//              iopi->print_trace();
+//              signal_vci_ini_iopi.print_trace("[SIG]IOPI_INI");
+//              signal_vci_tgt_iopi.print_trace("[SIG]IOPI_TGT");
+//              iox_network->print_trace();
 
                 // interrupts
                 if (signal_irq_bdev)       std::cout << "### IRQ_BDEV ACTIVE"       << std::endl;
-                if (signal_irq_mtty_rx)    std::cout << "### IRQ_MTTY ACTIVE"       << std::endl;
+                if (signal_irq_mtty_rx[0]) std::cout << "### IRQ_MTTY_RX[0] ACTIVE" << std::endl;
                 if (signal_irq_mnic_rx[0]) std::cout << "### IRQ_MNIC_RX[0] ACTIVE" << std::endl;
                 if (signal_irq_mnic_rx[1]) std::cout << "### IRQ_MNIC_RX[1] ACTIVE" << std::endl;
