Index: /branches/reconfiguration/platforms/tsar_generic_iob/scripts/arch.py
===================================================================
--- /branches/reconfiguration/platforms/tsar_generic_iob/scripts/arch.py	(revision 874)
+++ /branches/reconfiguration/platforms/tsar_generic_iob/scripts/arch.py	(revision 875)
@@ -24,8 +24,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
@@ -44,5 +44,4 @@
 # define architecture constants
 PADDR_WIDTH = 40
-NB_TTYS = 1
 NB_NICS = 2
 FBF_WIDTH = 128
@@ -69,4 +68,5 @@
          y_size=2,
          nb_procs=4,
+         nb_ttys=1,
          fbf_width=FBF_WIDTH):
     """This function describes the tsar_generic_iob platform and defines its
@@ -82,5 +82,5 @@
             (y_size == 16))
 
-    assert NB_TTYS == 1
+    assert ((nb_ttys >= 1) and (nb_ttys <= 16))
 
     assert (((X_IO == 0) and (Y_IO == 0)) or
@@ -160,5 +160,5 @@
 
     mapping.addPeriph('TTY', base=tty_base, size=tty_size,
-                      ptype='TTY', channels=NB_TTYS)
+                      ptype='TTY', channels=nb_ttys)
 
     mapping.addPeriph('NIC', base=nic_base, size=nic_size,
@@ -186,5 +186,7 @@
     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)
+
+    for i in xrange(nb_ttys):
+        mapping.addIrq(pic, index=16+i, isrtype='ISR_TTY_RX', channel=i)
 
     # hardware components replicated in all clusters
Index: /branches/reconfiguration/platforms/tsar_generic_iob/top.cpp
===================================================================
--- /branches/reconfiguration/platforms/tsar_generic_iob/top.cpp	(revision 874)
+++ /branches/reconfiguration/platforms/tsar_generic_iob/top.cpp	(revision 875)
@@ -5,4 +5,6 @@
 // Date : august 2013
 // This program is released under the GNU public license
+//
+// Modified by: Cesar Fuguet
 ///////////////////////////////////////////////////////////////////////////////
 // This file define a generic TSAR architecture with an IO network emulating
@@ -15,4 +17,5 @@
 // - BDEV : Dlock Device controler (one channel)
 // - IOPI : HWI to SWI translator.
+// - SIMH : Simulation Helper
 //
 // The internal physical address space is 40 bits, and the cluster index
@@ -37,11 +40,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:9]    unused       (grounded)
+// - IOPIC HWI[31:16]   connected to IRQ_TTY_RX[15:0]
 //
 // Besides the external peripherals, each cluster contains one XICU component,
@@ -78,5 +80,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)
@@ -241,6 +243,6 @@
 // All initiators are in the same indexing space (14 bits).
 // The SRCID is structured in two fields:
-// - The 10 MSB bits define the cluster index (left aligned)
-// - The 4  LSB bits define the local index.
+// - The 8 MSB bits define the cluster index (left aligned)
+// - The 6 LSB bits define the local index.
 // Two different initiators cannot have the same SRCID, but a given
 // initiator can have two alias SRCIDs:
@@ -467,12 +469,12 @@
            "The Y_SIZE parameter cannot be larger than 16" );
 
-   assert( (NB_PROCS_MAX <= 8) and
-           "The NB_PROCS_MAX parameter cannot be larger than 8" );
+   assert( (NB_PROCS_MAX <= (1 << P_WIDTH)) and
+           "NB_PROCS_MAX parameter cannot be larger than 2^P_WIDTH" );
 
    assert( (NB_DMA_CHANNELS <= 4) and
            "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
@@ -829,5 +831,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];
@@ -1195,6 +1197,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;
 
@@ -1224,6 +1228,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);
     }
@@ -1588,5 +1593,5 @@
             // 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 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;
