Index: soft/giet_vm/applications/classif/classif.py
===================================================================
--- soft/giet_vm/applications/classif/classif.py	(revision 610)
+++ soft/giet_vm/applications/classif/classif.py	(revision 708)
@@ -10,8 +10,9 @@
 #  This file describes the mapping of the multi-threaded "classif" 
 #  application on a multi-clusters, multi-processors architecture.
-#  The mapping of tasks on processors is the following:
-#    - one "load" task per cluster containing processors, 
-#    - one "store" task per cluster containing processors, 
-#    - (nprocs-2) "analyse" task per cluster containing processors.
+#  The mapping of threads on processors is the following:
+#    - the "main" on cluster[0][0]  
+#    - one "load" thread per cluster containing processors, 
+#    - one "store" thread per cluster containing processors, 
+#    - (nprocs-2) "analyse" thread per cluster containing processors.
 #  The mapping of virtual segments is the following:
 #    - There is one shared data vseg in cluster[0][0]
@@ -39,21 +40,21 @@
     y_width   = mapping.y_width
 
-    assert (nprocs >= 3)
+    assert (nprocs >= 3) and (nprocs <= 8)
 
     # define vsegs base & size
-    code_base  = 0x10000000
-    code_size  = 0x00010000     # 64 Kbytes (replicated in each cluster)
+    code_base  = 0x10000000     
+    code_size  = 0x00010000     # 64 Kbytes (per cluster)
     
     data_base  = 0x20000000
-    data_size  = 0x00010000     # 64 Kbytes 
+    data_size  = 0x00010000     # 64 Kbytes (non replicated) 
 
     heap_base  = 0x30000000
-    heap_size  = 0x00040000     # 256 Kbytes (per cluster)      
+    heap_size  = 0x00200000     # 2M bytes (per cluster)      
 
     stack_base = 0x40000000 
-    stack_size = 0x00200000     # 2 Mbytes (per cluster)
+    stack_size = 0x00010000     # 64 Kbytes (per thread)
 
     # create vspace
-    vspace = mapping.addVspace( name = 'classif', startname = 'classif_data' )
+    vspace = mapping.addVspace( name = 'classif', startname = 'classif_data', active = False )
     
     # data vseg : shared / cluster[0][0]
@@ -73,7 +74,7 @@
                 mapping.addVseg( vspace, 'classif_heap_%d_%d' %(x,y), base , size, 
                                  'C_WU', vtype = 'HEAP', x = x, y = y, pseg = 'RAM', 
-                                 local = False )
+                                 local = False, big = True )
 
-    # code vsegs : local (one copy in each cluster)
+    # code vsegs : local (one copy per cluster)
     for x in xrange (x_size):
         for y in xrange (y_size):
@@ -88,4 +89,10 @@
 
     # stacks vsegs: local (one stack per processor => nprocs stacks per cluster)
+    # ... plus main_stack in cluster[0][0]
+    mapping.addVseg( vspace, 'main_stack',
+                     stack_base, stack_size, 'C_WU', vtype = 'BUFFER', 
+                     x = 0 , y = 0 , pseg = 'RAM',
+                     local = True )
+
     for x in xrange (x_size):
         for y in xrange (y_size):
@@ -94,13 +101,18 @@
                 for p in xrange( nprocs ):
                     proc_id = (((x * y_size) + y) * nprocs) + p
-                    size    = (stack_size / nprocs) & 0xFFFFF000
-                    base    = stack_base + (proc_id * size)
+                    base    = stack_base + (proc_id * stack_size) + stack_size 
 
                     mapping.addVseg( vspace, 'classif_stack_%d_%d_%d' % (x,y,p), 
-                                     base, size, 'C_WU', vtype = 'BUFFER', 
+                                     base, stack_size, 'C_WU', vtype = 'BUFFER', 
                                      x = x , y = y , pseg = 'RAM',
-                                     local = True, big = True )
+                                     local = True )
 
-    # distributed tasks / one task per processor
+    # distributed threads / one thread per processor
+    # ... plus main on P[0][0][0]
+    mapping.addThread( vspace, 'main', True, 0, 0, 1,
+                       'main_stack',
+                       'classif_heap_0_0',
+                       0 )                      # index in start_vector
+
     for x in xrange (x_size):
         for y in xrange (y_size):
@@ -108,19 +120,18 @@
             if ( mapping.clusters[cluster_id].procs ):
                 for p in xrange( nprocs ):
-                    trdid = (((x * y_size) + y) * nprocs) + p
-                    if  ( p== 0 ):                              # task load
-                        task_index = 2
-                        task_name  = 'load_%d_%d_%d' %(x,y,p)            
-                    elif  ( p== 1 ):                            # task store
-                        task_index = 1
-                        task_name  = 'store_%d_%d_%d' %(x,y,p)            
-                    else :                                      # task analyse
-                        task_index = 0
-                        task_name  = 'analyse_%d_%d_%d' % (x,y,p)
+                    if  ( p== 0 ):                              # thread load
+                        start_index = 3
+                        thread_name = 'load_%d_%d_%d' %(x,y,p)            
+                    elif  ( p== 1 ):                            # thread store
+                        start_index = 2
+                        thread_name = 'store_%d_%d_%d' %(x,y,p)            
+                    else :                                      # thread analyse
+                        start_index = 1
+                        thread_name = 'analyse_%d_%d_%d' % (x,y,p)
 
-                    mapping.addTask( vspace, task_name, trdid, x, y, p,
-                                     'classif_stack_%d_%d_%d' % (x,y,p), 
-                                     'classif_heap_%d_%d' % (x,y),
-                                     task_index )
+                    mapping.addThread( vspace, thread_name, False , x, y, p,
+                                       'classif_stack_%d_%d_%d' % (x,y,p), 
+                                       'classif_heap_%d_%d' % (x,y),
+                                       start_index )   # index in start_vector
 
     # extend mapping name
