Index: soft/giet_vm/giet_python/mapping.py
===================================================================
--- soft/giet_vm/giet_python/mapping.py	(revision 341)
+++ soft/giet_vm/giet_python/mapping.py	(revision 348)
@@ -335,14 +335,15 @@
     ############################    add one (or several) global vseg into mapping 
     def addGlobal( self, 
-                   name,                # vseg name
-                   vbase,               # virtual base address
-                   size,                # vobj length (bytes)
-                   mode,                # CXWU flags
-                   vtype,               # vobj type
-                   x,                   # destination x coordinate
-                   y,                   # destination y coordinate
-                   pseg,                # destination pseg name
-                   identity   = False,  # identity mapping required if true
-                   binpath    = '' ):   # pathname for binary code
+                   name,                  # vseg name
+                   vbase,                 # virtual base address
+                   size,                  # vobj length (bytes)
+                   mode,                  # CXWU flags
+                   vtype,                 # vobj type
+                   x,                     # destination x coordinate
+                   y,                     # destination y coordinate
+                   pseg,                  # destination pseg name
+                   identity = False,      # identity mapping required if true
+                   binpath  = '',         # pathname for binary code
+                   local    = False ):    # non shared vseg when true 
 
         assert mode in VSEGMODES
@@ -355,5 +356,7 @@
 
         # add one vseg into mapping
-        vseg = Vseg( name, vbase, mode, x, y, pseg, identity )
+        vseg = Vseg( name, vbase, mode, x, y, pseg, 
+                     identity = identity, local = local )
+
         self.globs.append( vseg )
         self.total_globals += 1
@@ -393,7 +396,8 @@
                  y,                     # destination y coordinate
                  pseg,                  # destination pseg name
-                 binpath = '',          # pathname for binary code
-                 align   = 0,           # alignment required
-                 init    = 0 ):         # initial value
+                 binpath    = '',       # pathname for binary code
+                 align      = 0,        # alignment required
+                 init       = 0,        # initial value
+                 local = False ):       # non shared when true
 
         assert mode in VSEGMODES
@@ -404,5 +408,5 @@
 
         # add one vseg into mapping
-        vseg = Vseg( name, vbase, mode, x, y, pseg )
+        vseg = Vseg( name, vbase, mode, x, y, pseg, local = local )
         vspace.vsegs.append( vseg )
         vseg.index = self.total_vsegs
@@ -478,5 +482,5 @@
                 byte_stream.append( '\0' )
         else:
-            print 'error in str2bytes() string %s too long' % s
+            print '[genmap error] in str2bytes() : string %s too long' % s
             sys.exit(1)
 
@@ -700,4 +704,5 @@
         kernel_init_found    = False
         for vseg in self.globs:
+
             if ( vseg.name == 'seg_boot_code' ):
                 boot_code_vbase      = vseg.vbase 
@@ -732,25 +737,25 @@
         # check if all required vsegs have been found
         if ( boot_code_found      == False ): 
-             print 'error in giet_vsegs() : seg_boot_code vseg missing'
+             print '[genmap error] in giet_vsegs() : seg_boot_code vseg missing'
              sys.exit()
 
         if ( boot_data_found      == False ): 
-             print 'error in giet_vsegs() : seg_boot_data vseg missing'
+             print '[genmap error] in giet_vsegs() : seg_boot_data vseg missing'
              sys.exit()
 
         if ( kernel_data_found    == False ): 
-             print 'error in giet_vsegs() : seg_kernel_data vseg missing'
+             print '[genmap error] in giet_vsegs() : seg_kernel_data vseg missing'
              sys.exit()
 
         if ( kernel_uncdata_found == False ):
-             print 'error in giet_vsegs() : seg_kernel_uncdata vseg missing'
+             print '[genmap error] in giet_vsegs() : seg_kernel_uncdata vseg missing'
              sys.exit()
 
         if ( kernel_code_found    == False ):
-             print 'error in giet_vsegs() : seg_kernel_data vseg missing'
+             print '[genmap error] in giet_vsegs() : seg_kernel_code vseg missing'
              sys.exit()
 
         if ( kernel_init_found    == False ):
-             print 'error in giet_vsegs() : seg_kernel_init vseg missing'
+             print '[genmap error] in giet_vsegs() : seg_kernel_init vseg missing'
              sys.exit()
 
@@ -1002,5 +1007,5 @@
                 boot_mapping_base       = vseg.vbase 
                 boot_mapping_size       = vseg.vobjs[0].length
-                boot_mapping_ident      = vseg.ident
+                boot_mapping_identity   = vseg.identity
                 boot_mapping_found      = True
 
@@ -1008,5 +1013,5 @@
                 boot_code_base          = vseg.vbase 
                 boot_code_size          = vseg.vobjs[0].length
-                boot_code_ident         = vseg.ident
+                boot_code_identity      = vseg.identity
                 boot_code_found         = True
 
@@ -1014,5 +1019,5 @@
                 boot_data_base          = vseg.vbase 
                 boot_data_size          = vseg.vobjs[0].length
-                boot_data_ident         = vseg.ident
+                boot_data_identity      = vseg.identity
                 boot_data_found         = True
 
@@ -1020,5 +1025,5 @@
                 boot_buffer_base        = vseg.vbase 
                 boot_buffer_size        = vseg.vobjs[0].length
-                boot_buffer_ident       = vseg.ident
+                boot_buffer_identity    = vseg.identity
                 boot_buffer_found       = True
 
@@ -1026,26 +1031,26 @@
                 boot_stack_base         = vseg.vbase 
                 boot_stack_size         = vseg.vobjs[0].length
-                boot_stack_ident        = vseg.ident
+                boot_stack_identity     = vseg.identity
                 boot_stack_found        = True
 
         # check that BOOT vsegs are found and identity mapping
-        if ( (boot_mapping_found == False) or (boot_mapping_ident == False) ):
-             print 'error in hard_config() : seg_boot_mapping missing or not ident'
+        if ( (boot_mapping_found == False) or (boot_mapping_identity == False) ):
+             print '[genmap error] in hard_config() : seg_boot_mapping missing or not ident'
              sys.exit()
 
-        if ( (boot_code_found == False) or (boot_code_ident == False) ): 
-             print 'error in hard_config() : seg_boot_code missing or not ident'
+        if ( (boot_code_found == False) or (boot_code_identity == False) ): 
+             print '[genmap error] in hard_config() : seg_boot_code missing or not ident'
              sys.exit()
 
-        if ( (boot_data_found == False) or (boot_data_ident == False) ): 
-             print 'error in hard_config() : seg_boot_data missing or not ident'
+        if ( (boot_data_found == False) or (boot_data_identity == False) ): 
+             print '[genmap error] in hard_config() : seg_boot_data missing or not ident'
              sys.exit()
 
-        if ( (boot_buffer_found == False) or (boot_buffer_ident == False) ): 
-             print 'error in hard_config() : seg_boot_buffer missing or not ident'
+        if ( (boot_buffer_found == False) or (boot_buffer_identity == False) ): 
+             print '[genmap error] in hard_config() : seg_boot_buffer missing or not ident'
              sys.exit()
 
-        if ( (boot_stack_found == False) or (boot_stack_ident == False) ):
-             print 'error in giet_vsegs() : seg_boot_stack missing or not ident'
+        if ( (boot_stack_found == False) or (boot_stack_identity == False) ):
+             print '[genmap error] in giet_vsegs() : seg_boot_stack missing or not ident'
              sys.exit()
 
@@ -1285,5 +1290,5 @@
 
             if ( (found_xcu == False) and (found_pic == False) and (len(cluster.periphs) > 0) ):
-                print 'error in netbsd_dts() : No XCU/PIC in cluster(%d,%d)' % (cluster.x, cluster.y)
+                print '[genmap error] in netbsd_dts() : No XCU/PIC in cluster(%d,%d)' % (cluster.x, cluster.y)
                 sys.exit(1)    
              
@@ -1312,5 +1317,5 @@
                                 hwi_id = irq.srcid
                         if ( hwi_id == 0xFFFFFFFF ):
-                            print 'error in netbsd.dts() ISR_DMA channel %d not found' % channel
+                            print '[genmap error] in netbsd.dts() ISR_DMA channel %d not found' % channel
                             sys.exit(1)
 
@@ -1333,5 +1338,5 @@
                         if ( irq.isrtype == 'ISR_MMC' ): irq_in = irq.srcid
                     if ( irq_in == 0xFFFFFFFF ):
-                        print 'error in netbsd.dts() ISR_MMC not found'
+                        print '[genmap error] in netbsd.dts() ISR_MMC not found'
                         sys.exit(1)
 
@@ -1363,5 +1368,5 @@
                             if ( irq.isrtype == 'ISR_BDV' ): irq_in = irq.srcid
                         if ( irq_in == 0xFFFFFFFF ):
-                            print 'error in netbsd.dts() ISR_BDV not found'
+                            print '[genmap error] in netbsd.dts() ISR_BDV not found'
                             sys.exit(1)
 
@@ -1373,5 +1378,5 @@
 
                     elif ( periph.subtype == 'HBA' ):
-                        print 'error in netbsd_dts() : HBA peripheral not supported by NetBSD'
+                        print '[genmap error] in netbsd_dts() : HBA peripheral not supported by NetBSD'
                         sys.exit(1)
 
@@ -1383,5 +1388,5 @@
                             if ( irq.isrtype == 'ISR_SPI' ): irq_in = irq.srcid
                         if ( irq_in == 0xFFFFFFFF ):
-                            print 'error in netbsd.dts() ISR_SPI not found'
+                            print '[genmap error] in netbsd.dts() ISR_SPI not found'
                             sys.exit(1)
 
@@ -1424,5 +1429,5 @@
                                 hwi_id = irq.srcid
                         if ( hwi_id == 0xFFFFFFFF ):
-                            print 'error in netbsd.dts() ISR_TTY_RX channel %d not found' % channel
+                            print '[genmap error] in netbsd.dts() ISR_TTY_RX channel %d not found' % channel
                             sys.exit(1)
 
@@ -1461,5 +1466,5 @@
                                 hwi_id = irq.srcid
                         if ( hwi_id == 0xFFFFFFFF ):
-                            print 'error in netbsd.dts() ISR_NIC_RX channel %d not found' % channel
+                            print '[genmap error] in netbsd.dts() ISR_NIC_RX channel %d not found' % channel
                             sys.exit(1)
 
@@ -1477,5 +1482,5 @@
                                 hwi_id = irq.srcid
                         if ( hwi_id == 0xFFFFFFFF ):
-                            print 'error in netbsd.dts() ISR_NIC_TX channel %d not found' % channel
+                            print '[genmap error] in netbsd.dts() ISR_NIC_TX channel %d not found' % channel
                             sys.exit(1)
 
@@ -1505,5 +1510,5 @@
                                 hwi_id = irq.srcid
                         if ( hwi_id == 0xFFFFFFFF ):
-                            print 'error in netbsd.dts() ISR_CMA channel %d not found' % channel
+                            print '[genmap error] in netbsd.dts() ISR_CMA channel %d not found' % channel
                             sys.exit(1)
 
@@ -1521,5 +1526,5 @@
                 elif ( periph.ptype == 'TIM' ):  
 
-                    print 'error in netbsd_dts() : TIM peripheral not supported by NetBSD'
+                    print '[genmap error] in netbsd_dts() : TIM peripheral not supported by NetBSD'
                     sys.exit(1)
 
@@ -1527,10 +1532,10 @@
                 elif ( periph.ptype == 'MWR' ):
 
-                    print 'error in netbsd_dts() : MWR peripheral not supported by NetBSD'
+                    print '[genmap error] in netbsd_dts() : MWR peripheral not supported by NetBSD'
                     sys.exit(1)
 
                 # research ICU component
                 elif ( periph.ptype == 'ICU' ):  
-                    print 'error in netbsd_dts() : ICU peripheral not supported by NetBSD'
+                    print '[genmap error] in netbsd_dts() : ICU peripheral not supported by NetBSD'
                     sys.exit(1)
 
@@ -1714,5 +1719,5 @@
         # check index
         if (self.index != expected):
-            print 'error in Cluster.cbin() : cluster global index = %d / expected = %d' \
+            print '[genmap error] in Cluster.cbin() : cluster global index = %d / expected = %d' \
                   % (self.index, expected )
             sys.exit(1)
@@ -1799,5 +1804,5 @@
         # check index
         if (self.index != expected):
-            print 'error in Vspace.cbin() : vspace global index = %d / expected = %d' \
+            print '[genmap error] in Vspace.cbin() : vspace global index = %d / expected = %d' \
                   % (self.index, expected )
             sys.exit(1)
@@ -1809,5 +1814,5 @@
                 vobj_start_id = vseg.vobjs[0].index
         if ( vobj_start_id == 0xFFFFFFFF ):
-            print 'error in Vspace.cbin() : startname %s not found for vspace %s' \
+            print '[genmap error] in Vspace.cbin() : startname %s not found for vspace %s' \
                   % ( self.startname, self.name )
             sys.exit(1)
@@ -1908,5 +1913,5 @@
         # check index
         if (self.index != expected):
-            print 'error in Task.cbin() : task global index = %d / expected = %d' \
+            print '[genmap error] in Task.cbin() : task global index = %d / expected = %d' \
                   % (self.index, expected )
             sys.exit(1)
@@ -1921,5 +1926,5 @@
                 vobj_stack_id = vseg.vobjs[0].index 
         if ( vobj_stack_id == 0xFFFFFFFF ):
-            print 'error in Task.cbin() : stackname %s not found for task %s in vspace %s' \
+            print '[genmap error] in Task.cbin() : stackname %s not found for task %s in vspace %s' \
                   % ( self.stackname, self.name, vspace.name )
             sys.exit(1)
@@ -1931,5 +1936,5 @@
                 vobj_heap_id = vseg.vobjs[0].index
         if ( vobj_heap_id == 0xFFFFFFFF ):
-            print 'error in Task.cbin() : heapname %s not found for task %s in vspace %s' \
+            print '[genmap error] in Task.cbin() : heapname %s not found for task %s in vspace %s' \
                   % ( self.heapname, self.name, vspace.name )
             sys.exit(1)
@@ -1969,17 +1974,19 @@
                   y, 
                   psegname, 
-                  ident = False ):
+                  identity = False,
+                  local    = False ):
 
         assert mode in VSEGMODES
 
-        self.index      = 0                   # global index ( set by addVseg() )
-        self.name       = name                # vseg name
-        self.vbase      = vbase & 0xFFFFFFFF  # virtual base address in vspace 
-        self.mode       = mode                # CXWU access rights
-        self.x          = x                   # x coordinate of destination cluster 
-        self.y          = y                   # y coordinate of destination cluster
-        self.psegname   = psegname            # name of pseg in destination cluster
-        self.ident      = ident               # identity mapping required
-        self.vobjs      = []
+        self.index    = 0                   # global index ( set by addVseg() )
+        self.name     = name                # vseg name
+        self.vbase    = vbase & 0xFFFFFFFF  # virtual base address in vspace 
+        self.mode     = mode                # CXWU access rights
+        self.x        = x                   # x coordinate of destination cluster 
+        self.y        = y                   # y coordinate of destination cluster
+        self.psegname = psegname            # name of pseg in destination cluster
+        self.identity = identity            # identity mapping required
+        self.local    = local               # one copy per cluster
+        self.vobjs    = []
         return
 
@@ -1989,7 +1996,8 @@
         s =  '            <vseg name="%s" vbase="0x%x" mode="%s" x="%d" y="%d" psegname="%s"' \
              % ( self.name, self.vbase, self.mode, self.x, self.y, self.psegname )
-        if ( self.ident ):  s += ' ident="1" >\n'
-        else:               s += ' >\n'
-        for vobj in self.vobjs: s += vobj.xml()
+        if ( self.identity ): s += ' ident="1"'
+        if ( self.local ):    s += ' local="1"'
+        s += ' >\n'
+        for vobj in self.vobjs:  s += vobj.xml()
         s += '            </vseg>\n'
 
@@ -2004,5 +2012,5 @@
         # check index
         if (self.index != expected):
-            print 'error in Vseg.cbin() : vseg global index = %d / expected = %d' \
+            print '[genmap error] in Vseg.cbin() : vseg global index = %d / expected = %d' \
                   % (self.index, expected )
             sys.exit(1)
@@ -2016,5 +2024,5 @@
                 pseg_id = pseg.index
         if (pseg_id == 0xFFFFFFFF):
-            print 'error in Vseg.cbin() : psegname %s not found for vseg %s in cluster %d' \
+            print '[genmap error] in Vseg.cbin() : psegname %s not found for vseg %s in cluster %d' \
                   % ( self.psegname, self.name, cluster_id )
             sys.exit(1)
@@ -2026,5 +2034,5 @@
                 mode_id = x
         if ( mode_id == 0xFFFFFFFF ):
-            print 'error in Vseg.cbin() : undefined vseg mode %s' % self.mode
+            print '[genmap error] in Vseg.cbin() : undefined vseg mode %s' % self.mode
             sys.exit(1)
 
@@ -2043,6 +2051,7 @@
         byte_stream += mapping.int2bytes( 4,  0 )               # linked list of vsegs on same pseg
         byte_stream += mapping.int2bytes( 1,  0 )               # mapped when non zero
-        byte_stream += mapping.int2bytes( 1,  self.ident )      # identity mapping when non zero
-        byte_stream += mapping.int2bytes( 2,  0 )               # reserved (padding)
+        byte_stream += mapping.int2bytes( 1,  self.identity )   # identity mapping when non zero
+        byte_stream += mapping.int2bytes( 1,  self.local )      # non shared if non zero
+        byte_stream += mapping.int2bytes( 1,  0 )               # reserved (padding)
 
         if ( verbose ):
@@ -2098,5 +2107,5 @@
         # check index
         if (self.index != expected):
-            print 'error in Vobj.cbin() : vobj global index = %d / expected = %d' \
+            print '[genmap error] in Vobj.cbin() : vobj global index = %d / expected = %d' \
                   % (self.index, expected )
             sys.exit(1)
@@ -2110,5 +2119,5 @@
                 vtype_int = x
         if ( vtype_int == 0xFFFFFFFF ):
-            print 'error in Vobj.cbin() : undefined vobj type %s' % self.vtype
+            print '[genmap error] in Vobj.cbin() : undefined vobj type %s' % self.vtype
             sys.exit(1)
 
@@ -2157,5 +2166,5 @@
         # check index
         if (self.index != expected):
-            print 'error in Proc.cbin() : proc global index = %d / expected = %d' \
+            print '[genmap error] in Proc.cbin() : proc global index = %d / expected = %d' \
                   % (self.index, expected )
             sys.exit(1)
@@ -2204,5 +2213,5 @@
         # check index
         if (self.index != expected):
-            print 'error in Pseg.cbin() : pseg global index = %d / expected = %d' \
+            print '[genmap error] in Pseg.cbin() : pseg global index = %d / expected = %d' \
                   % (self.index, expected )
             sys.exit(1)
@@ -2214,5 +2223,5 @@
                 segtype_int = x
         if ( segtype_int == 0xFFFFFFFF ):
-            print 'error in Pseg.cbin() : undefined segment type %s' % self.segtype
+            print '[genmap error] in Pseg.cbin() : undefined segment type %s' % self.segtype
             sys.exit(1)
 
@@ -2278,5 +2287,5 @@
         # check index
         if (self.index != expected):
-            print 'error in Periph.cbin() : periph global index = %d / expected = %d' \
+            print '[genmap error] in Periph.cbin() : periph global index = %d / expected = %d' \
                   % (self.index, expected )
             sys.exit(1)
@@ -2296,5 +2305,5 @@
             if ( self.ptype == PERIPHTYPES[x] ):  ptype_id = x
         if ( ptype_id == 0xFFFFFFFF ):
-            print 'error in Periph.cbin() : undefined peripheral type %s' % self.ptype
+            print '[genmap error] in Periph.cbin() : undefined peripheral type %s' % self.ptype
             sys.exit(1)
 
@@ -2355,5 +2364,5 @@
         # check index
         if (self.index != expected):
-            print 'error in Irq.cbin() : irq global index = %d / expected = %d' \
+            print '[genmap error] in Irq.cbin() : irq global index = %d / expected = %d' \
                   % (self.index, expected )
             sys.exit(1)
@@ -2365,5 +2374,5 @@
                 irqtype_id = x
         if ( irqtype_id == 0xFFFFFFFF ):
-            print 'error in Irq.cbin() : undefined irqtype %s' % self.irqtype
+            print '[genmap error] in Irq.cbin() : undefined irqtype %s' % self.irqtype
             sys.exit(1)
 
@@ -2374,5 +2383,5 @@
                 isrtype_id = x
         if ( isrtype_id == 0xFFFFFFFF ):
-            print 'error in Irq.cbin() : undefined isrtype %s' % self.isrtype
+            print '[genmap error] in Irq.cbin() : undefined isrtype %s' % self.isrtype
             sys.exit(1)
 
@@ -2408,5 +2417,5 @@
     def xml( self ):    # xml for Coproc  
 
-        print 'error in Coproc.xml() : not defined yet'
+        print '[genmap error] in Coproc.xml() : not defined yet'
         sys.exit(1)
 
@@ -2421,5 +2430,5 @@
         # check index
         if (self.index != expected):
-            print 'error in Coproc.cbin() : coproc global index = %d / expected = %d' \
+            print '[genmap error] in Coproc.cbin() : coproc global index = %d / expected = %d' \
                   % (self.index, expected )
             sys.exit(1)
@@ -2463,5 +2472,5 @@
     def xml( self ):    # xml for Cpport
 
-        print 'error in Cpport.xml() : not defined yet'
+        print '[genmap error] in Cpport.xml() : not defined yet'
         sys.exit(1)
 
@@ -2476,5 +2485,5 @@
         # check index
         if ( self.index != expected ):
-            print 'error in Cpport.cbin() : port global index = %d / expected = %d' \
+            print '[genmap error] in Cpport.cbin() : port global index = %d / expected = %d' \
                   % ( self.index, expected )
             sys.exit(1)
@@ -2492,5 +2501,5 @@
                 vspace_id = vspace.index
         if (vspace_id == 0xFFFFFFFF):
-            print 'error in Cpport.cbin() : vspace name %s not found' \
+            print '[genmap error] in Cpport.cbin() : vspace name %s not found' \
                   % ( self.vspacename )
             sys.exit(1)
@@ -2503,5 +2512,5 @@
                     mwmr_id = vobj.index
         if (mwmr_id == 0xFFFFFFFF):
-            print 'error in Cpport.cbin() : mwmr vobj name %s not found in vspace %s' \
+            print '[genmap error] in Cpport.cbin() : mwmr vobj name %s not found in vspace %s' \
                   % ( self.mwmrname, self.vspacename )
             sys.exit(1)
