Index: soft/giet_vm/giet_python/mapping.py
===================================================================
--- soft/giet_vm/giet_python/mapping.py	(revision 673)
+++ soft/giet_vm/giet_python/mapping.py	(revision 709)
@@ -10,5 +10,5 @@
 #  This file contains the classes required to define a mapping for the GIET_VM.
 # - A 'Mapping' contains a set of 'Cluster'   (hardware architecture)
-#                        a set of 'Vseg'      (kernel glogals virtual segments)
+#                        a set of 'Vseg'      (kernel global virtual segments)
 #                        a set of 'Vspace'    (one or several user applications)
 # - A 'Cluster' contains a set of 'Pseg'      (physical segments in cluster)
@@ -16,5 +16,5 @@
 #                        a set of 'Periph'    (peripherals in cluster)
 # - A 'Vspace' contains  a set of 'Vseg'      (user virtual segments)
-#                        a set of 'Task'      (user parallel tasks)
+#                        a set of 'Thread'    (POSIX thread)
 # - A 'Periph' contains  a set of 'Irq'       (only for XCU and PIC types )
 ###################################################################################
@@ -22,5 +22,5 @@
 # The objects used to describe a mapping are distributed in the PYTHON structure:
 # For example the psegs set is split in several subsets (one subset per cluster),
-# or the tasks set is split in several subsets (one subset per vspace), etc...
+# or the threads set is split in several subsets (one subset per vspace), etc...
 # In the C binary data structure used by the giet_vm, all objects of same type
 # are stored in a linear array (one single array for all psegs for example).
@@ -192,5 +192,5 @@
         self.total_psegs    = 0
         self.total_vsegs    = 0
-        self.total_tasks    = 0
+        self.total_threads  = 0
         self.total_procs    = 0
         self.total_irqs     = 0
@@ -406,26 +406,27 @@
         return vseg
 
-    ################################    add a task in a vspace
-    def addTask( self,
-                 vspace,                # vspace containing task
-                 name,                  # task name
-                 trdid,                 # task index in vspace
-                 x,                     # destination x coordinate
-                 y,                     # destination y coordinate
-                 lpid,                  # destination processor local index
-                 stackname,             # name of vseg containing stack
-                 heapname,              # name of vseg containing heap
-                 startid ):             # index in start_vector
-
-        assert (x < self.x_size) and (y < self.y_size)
-        assert lpid < self.nprocs
-
-        # add one task into mapping
-        task = Task( name, trdid, x, y, lpid, stackname, heapname, startid )
-        vspace.tasks.append( task )
-        task.index = self.total_tasks
-        self.total_tasks += 1
-
-        return task
+    ################################    add a thread in a vspace
+    def addThread( self,
+                   vspace,                # vspace containing thread
+                   name,                  # thread name
+                   is_main,               # Boolean (one thread per vspace)
+                   x,                     # destination x coordinate
+                   y,                     # destination y coordinate
+                   p,                     # destination processor local index
+                   stackname,             # name of vseg containing stack
+                   heapname,              # name of vseg containing heap
+                   startid ):             # index in start_vector
+
+        assert x < self.x_size
+        assert y < self.y_size
+        assert p < self.nprocs
+
+        # add one thread into mapping
+        thread = Thread( name, is_main, x, y, p, stackname, heapname, startid )
+        vspace.threads.append( thread )
+        thread.index = self.total_threads
+        self.total_threads += 1
+
+        return thread
 
     #################################
@@ -497,22 +498,22 @@
 
         # header
-        byte_stream += self.int2bytes(4,  self.signature)
-        byte_stream += self.int2bytes(4,  self.x_size)
-        byte_stream += self.int2bytes(4,  self.y_size)
-        byte_stream += self.int2bytes(4,  self.x_width)
-        byte_stream += self.int2bytes(4,  self.y_width)
-        byte_stream += self.int2bytes(4,  self.x_io)
-        byte_stream += self.int2bytes(4,  self.y_io)
-        byte_stream += self.int2bytes(4,  self.irq_per_proc)
-        byte_stream += self.int2bytes(4,  self.use_ramdisk)
-        byte_stream += self.int2bytes(4,  self.total_globals)
-        byte_stream += self.int2bytes(4,  self.total_vspaces)
-        byte_stream += self.int2bytes(4,  self.total_psegs)
-        byte_stream += self.int2bytes(4,  self.total_vsegs)
-        byte_stream += self.int2bytes(4,  self.total_tasks)
-        byte_stream += self.int2bytes(4,  self.total_procs)
-        byte_stream += self.int2bytes(4,  self.total_irqs)
-        byte_stream += self.int2bytes(4,  self.total_periphs)
-        byte_stream += self.str2bytes(64, self.name)
+        byte_stream += self.int2bytes(4,   self.signature)
+        byte_stream += self.int2bytes(4,   self.x_size)
+        byte_stream += self.int2bytes(4,   self.y_size)
+        byte_stream += self.int2bytes(4,   self.x_width)
+        byte_stream += self.int2bytes(4,   self.y_width)
+        byte_stream += self.int2bytes(4,   self.x_io)
+        byte_stream += self.int2bytes(4,   self.y_io)
+        byte_stream += self.int2bytes(4,   self.irq_per_proc)
+        byte_stream += self.int2bytes(4,   self.use_ramdisk)
+        byte_stream += self.int2bytes(4,   self.total_globals)
+        byte_stream += self.int2bytes(4,   self.total_vspaces)
+        byte_stream += self.int2bytes(4,   self.total_psegs)
+        byte_stream += self.int2bytes(4,   self.total_vsegs)
+        byte_stream += self.int2bytes(4,   self.total_threads)
+        byte_stream += self.int2bytes(4,   self.total_procs)
+        byte_stream += self.int2bytes(4,   self.total_irqs)
+        byte_stream += self.int2bytes(4,   self.total_periphs)
+        byte_stream += self.str2bytes(256, self.name)
 
         if ( verbose ):
@@ -531,5 +532,5 @@
             print 'total_psegs   = %d' % self.total_psegs
             print 'total_vsegs   = %d' % self.total_vsegs
-            print 'total_tasks   = %d' % self.total_tasks
+            print 'total_threads   = %d' % self.total_threads
             print 'total_procs   = %d' % self.total_procs
             print 'total_irqs    = %d' % self.total_irqs
@@ -574,9 +575,9 @@
         if ( verbose ): print '\n'
 
-        # tasks array
+        # threads array
         index = 0
         for vspace in self.vspaces:
-            for task in vspace.tasks:
-                byte_stream += task.cbin( self, verbose, index, vspace )
+            for thread in vspace.threads:
+                byte_stream += thread.cbin( self, verbose, index, vspace )
                 index += 1
 
@@ -985,5 +986,5 @@
         if ( (boot_stack_found == False) or (boot_stack_identity == False) ):
              print '[genmap error] in giet_vsegs()'
-             print '    seg_boot_stask missing or not identity mapping'
+             print '    seg_boot_stack missing or not identity mapping'
              sys.exit()
 
@@ -1926,5 +1927,5 @@
         self.active    = active         # active at boot if true
         self.vsegs     = []
-        self.tasks     = []
+        self.threads   = []
 
         return
@@ -1936,5 +1937,5 @@
                             %(self.name , self.startname , self.active)
         for vseg in self.vsegs: s += vseg.xml()
-        for task in self.tasks: s += task.xml()
+        for thread in self.threads: s += thread.xml()
         s += '        </vspace>\n'
 
@@ -1965,11 +1966,11 @@
             sys.exit(1)
 
-        # compute first vseg and first task global index
+        # compute first vseg and first thread global index
         first_vseg_id = self.vsegs[0].index
-        first_task_id = self.tasks[0].index
-
-        # compute number of tasks and number of vsegs
+        first_thread_id = self.threads[0].index
+
+        # compute number of threads and number of vsegs
         nb_vsegs = len( self.vsegs )
-        nb_tasks = len( self.tasks )
+        nb_threads = len( self.threads )
 
         byte_stream = bytearray()
@@ -1977,7 +1978,7 @@
         byte_stream += mapping.int2bytes(4, vseg_start_id)     # vseg start_vector
         byte_stream += mapping.int2bytes(4, nb_vsegs)          # number of vsegs
-        byte_stream += mapping.int2bytes(4, nb_tasks)          # number of tasks
+        byte_stream += mapping.int2bytes(4, nb_threads)        # number of threads
         byte_stream += mapping.int2bytes(4, first_vseg_id)     # global index
-        byte_stream += mapping.int2bytes(4, first_task_id)     # global index
+        byte_stream += mapping.int2bytes(4, first_thread_id)     # global index
         byte_stream += mapping.int2bytes(4, self.active)       # always active if non zero
 
@@ -1985,7 +1986,7 @@
             print 'start_id   = %d' %  vseg_start_id
             print 'nb_vsegs   = %d' %  nb_vsegs
-            print 'nb_tasks   = %d' %  nb_tasks
+            print 'nb_threads = %d' %  nb_threads
             print 'vseg_id    = %d' %  first_vseg_id
-            print 'task_id    = %d' %  first_task_id
+            print 'thread_id  = %d' %  first_thread_id
             print 'active     = %d' %  self.active
 
@@ -1993,9 +1994,9 @@
 
 ##################################################################################
-class Task( object ):
+class Thread( object ):
 ##################################################################################
     def __init__( self,
                   name,
-                  trdid,
+                  is_main,
                   x,
                   y,
@@ -2005,7 +2006,7 @@
                   startid ):
 
-        self.index     = 0             # global index value set by addTask()
-        self.name      = name          # tsk name
-        self.trdid     = trdid         # task index (unique in vspace)
+        self.index     = 0             # global index value set by addThread()
+        self.name      = name          # thread name
+        self.is_main   = is_main       # Boolean (one main per vspace)
         self.x         = x             # cluster x coordinate
         self.y         = y             # cluster y coordinate
@@ -2016,9 +2017,9 @@
         return
 
-    ######################################
-    def xml( self ):    # xml for one task
-
-        s =  '            <task name="%s"' % self.name
-        s += ' trdid="%d"'                 % self.trdid
+    ########################################
+    def xml( self ):    # xml for one thread
+
+        s =  '            <thread name="%s"' % self.name
+        s += ' is_main="%d"'               % self.is_main
         s += ' x="%d"'                     % self.x
         s += ' y="%d"'                     % self.y
@@ -2032,15 +2033,15 @@
         return s
 
-    ##########################################################################
-    def cbin( self, mapping, verbose, expected, vspace ):  # C binary for Task
+    ############################################################################
+    def cbin( self, mapping, verbose, expected, vspace ):  # C binary for Thread
 
         if ( verbose ):
-            print '*** cbin for task %s in vspace %s' \
+            print '*** cbin for thread %s in vspace %s' \
                      % (self.name, vspace.name)
 
         # check index
         if (self.index != expected):
-            print '[genmap error] in Task.cbin()'
-            print '    task global index = %d / expected = %d' \
+            print '[genmap error] in Thread.cbin()'
+            print '    thread global index = %d / expected = %d' \
                         %(self.index,expected)
             sys.exit(1)
@@ -2055,6 +2056,6 @@
 
         if ( vseg_stack_id == 0xFFFFFFFF ):
-            print '[genmap error] in Task.cbin()'
-            print '    stackname %s not found for task %s in vspace %s' \
+            print '[genmap error] in Thread.cbin()'
+            print '    stackname %s not found for thread %s in vspace %s' \
                   % ( self.stackname, self.name, vspace.name )
             sys.exit(1)
@@ -2069,14 +2070,14 @@
 
             if ( vseg_heap_id == 0xFFFFFFFF ):
-                print '[genmap error] in Task.cbin()'
-                print '    heapname %s not found for task %s in vspace %s' \
+                print '[genmap error] in Thread.cbin()'
+                print '    heapname %s not found for thread %s in vspace %s' \
                       % ( self.heapname, self.name, vspace.name )
                 sys.exit(1)
 
         byte_stream = bytearray()
-        byte_stream += mapping.str2bytes(32,self.name)     # task name in vspace
+        byte_stream += mapping.str2bytes(32,self.name)     # thread name in vspace
         byte_stream += mapping.int2bytes(4, cluster_id)    # cluster global index
         byte_stream += mapping.int2bytes(4, self.p)        # processor local index 
-        byte_stream += mapping.int2bytes(4, self.trdid)    # thread index in vspace
+        byte_stream += mapping.int2bytes(4, self.is_main)  # main if non zero
         byte_stream += mapping.int2bytes(4, vseg_stack_id) # stack vseg local index
         byte_stream += mapping.int2bytes(4, vseg_heap_id)  # heap vseg local index
@@ -2087,5 +2088,5 @@
             print 'clusterid  = %d' %  cluster_id
             print 'lpid       = %d' %  self.p
-            print 'trdid      = %d' %  self.trdid
+            print 'is_main    = %d' %  self.is_main
             print 'stackid    = %d' %  vseg_stack_id
             print 'heapid     = %d' %  vseg_heap_id
