Index: soft/giet_vm/giet_python/mapping.py
===================================================================
--- soft/giet_vm/giet_python/mapping.py	(revision 406)
+++ soft/giet_vm/giet_python/mapping.py	(revision 411)
@@ -23,5 +23,5 @@
 ##########################################################################################
 # Implementation Note
-# As described above, the various objects are distributed in the PYTHON structure:
+# The various 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...
@@ -33,7 +33,21 @@
 ##########################################################################################
 
-######################################################################################
-# These global lists must be consistent with enums in mapping_info.h or irq_handler.h
-######################################################################################
+##########################################################################################
+# Various constants 
+##########################################################################################
+
+PADDR_WIDTH       = 40            # number of bits for physical address
+X_WIDTH           = 4             # number of bits encoding x coordinate
+Y_WIDTH           = 4             # number of bits encoding y coordinate
+P_WIDTH           = 4             # number of bits encoding local proc_id
+VPN_ANTI_MASK     = 0x00000FFF    # mask virtual address to get offset in a small page 
+BPN_MASK          = 0xFFE00000    # mask virtual address to get the BPN (big page)
+PERI_INCREMENT    = 0x10000       # virtual address increment for replicated global vsegs
+RESET_ADDRESS     = 0xBFC00000    # Processor wired boot_address
+MAPPING_SIGNATURE = 0xDACE2014    # Magic number indicating a valid C binary struture
+
+##########################################################################################
+# These global lists must be consistent with enums in mapping_info.h or irq_handler.
+##########################################################################################
 PERIPHTYPES =    [
                   'CMA',
@@ -131,25 +145,27 @@
 ##########################################################################################
     def __init__( self,
-                  name,                          # mapping name
-                  x_size,                        # number of clusters in a row
-                  y_size,                        # number of clusters in a column
-                  procs_max = 2,                 # max number of processors per cluster
-                  x_width = 4,                   # number of bits encoding x coordinate
-                  y_width = 4,                   # number of bits encoding y coordinate
-                  p_width = 2,                   # number of bits encoding local proc id
-                  paddr_width = 40,              # number of bits for physical address
-                  coherence = 1,                 # hardware cache coherence when non-zero
-                  irq_per_proc = 1,              # number or IRQs from XCU to processor
-                  use_ramdisk = False,           # use ramdisk when true
-                  x_io = 0,                      # cluster_io x coordinate
-                  y_io = 0,                      # cluster_io y coordinate
-                  peri_increment = 0x10000,      # address increment for globals
-                  reset_address  = 0xBFC00000,   # Processor wired boot_address
-                  ram_base       = 0,            # RAM physical base address in cluster[0,0]
-                  ram_size       = 0 ):          # RAM size in each cluster (bytes)
-
-        assert (procs_max <= (1 << p_width))
-
-        self.signature      = 0xDACE2014
+                  name,                            # mapping name 
+                  x_size,                          # number of clusters in a row
+                  y_size,                          # number of clusters in a column
+                  nprocs,                       # max number of processors per cluster
+                  x_width        = X_WIDTH,        # number of bits encoding x coordinate
+                  y_width        = Y_WIDTH,        # number of bits encoding y coordinate
+                  p_width        = P_WIDTH,        # number of bits encoding local proc_id
+                  paddr_width    = PADDR_WIDTH,    # number of bits for physical address
+                  coherence      = 1,              # hardware cache coherence when non-zero
+                  irq_per_proc   = 1,              # number or IRQs from XCU to processor 
+                  use_ramdisk    = False,          # use ramdisk when true
+                  x_io           = 0,              # cluster_io x coordinate
+                  y_io           = 0,              # cluster_io y coordinate
+                  peri_increment = PERI_INCREMENT, # address increment for globals
+                  reset_address  = RESET_ADDRESS,  # Processor wired boot_address
+                  ram_base       = 0,              # RAM physical base in cluster[0,0]
+                  ram_size       = 0 ):            # RAM size in each cluster (bytes)
+
+        assert ( x_size <= (1<<X_WIDTH) )
+        assert ( y_size <= (1<<Y_WIDTH) )
+        assert ( nprocs <= (1<<P_WIDTH) )
+
+        self.signature      = MAPPING_SIGNATURE
         self.name           = name
         self.paddr_width    = paddr_width
@@ -157,5 +173,5 @@
         self.x_size         = x_size
         self.y_size         = y_size
-        self.procs_max      = procs_max
+        self.nprocs      = nprocs
         self.x_width        = x_width
         self.y_width        = y_width
@@ -170,5 +186,4 @@
         self.ram_size       = ram_size
 
-
         self.total_vspaces  = 0
         self.total_globals  = 0
@@ -201,5 +216,5 @@
                 size ):                # pseg length (bytes)
 
-        # check coordinates (obtained from the base address)
+        # computes coordinates from the base address extension
         paddr_lsb_width = self.paddr_width - self.x_width - self.y_width
         cluster_xy = base >> paddr_lsb_width
@@ -207,5 +222,5 @@
         y = cluster_xy & ((1 << self.y_width) - 1)
 
-        assert (base & 0xFFF) == 0
+        assert (base & VPN_ANTI_MASK) == 0
 
         assert (x < self.x_size) and (y < self.y_size)
@@ -242,5 +257,5 @@
         assert (x < self.x_size) and (y < self.y_size)
 
-        assert (base & 0xFFF) == 0
+        assert (base & VPN_ANTI_MASK) == 0
 
         assert ptype in PERIPHTYPES
@@ -347,17 +362,19 @@
         return port
 
-    ############################    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
-                   local    = False ):    # non shared vseg when true
+    ############################    add one 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 if required
+                   align    = 0,       # alignment required
+                   local    = False,   # only mapped in local PTAB if true
+                   big      = False ): # to be mapped in a big physical page
 
         assert mode in VSEGMODES
@@ -365,11 +382,22 @@
         assert vtype in VOBJTYPES
 
-        assert (vbase & 0xFFF) == 0
-
         assert (x < self.x_size) and (y < self.y_size)
+
+        # two global vsegs must not overlap if they have different names
+        for prev in self.globs:
+            prev_vbase = prev.vbase
+            prev_size = prev.vobjs[0].length
+
+            if ( ((prev_vbase + prev_size) > vbase ) and 
+                 ((vbase + size) > prev_vbase) and
+                 (prev.name != name) ):
+                print '[genmap error] in addGlobal() : %s overlap %s' % (name, prev.name)
+                print ' %s : base = %x / size = %x' %( name, vbase, size )
+                print ' %s : base = %x / size = %x' %( prev.name, prev_vbase, prev_size )
+                sys.exit(1)
 
         # add one vseg into mapping
         vseg = Vseg( name, vbase, mode, x, y, pseg,
-                     identity = identity, local = local )
+                     identity = identity, local = local, big = big )
 
         self.globs.append( vseg )
@@ -413,5 +441,6 @@
                  align      = 0,        # alignment required
                  init       = 0,        # initial value
-                 local = False ):       # non shared when true
+                 local    = False,      # only mapped in local PTAB if true
+                 big      = False ):    # to be mapped in a big physical page
 
         assert mode in VSEGMODES
@@ -422,5 +451,5 @@
 
         # add one vseg into mapping
-        vseg = Vseg( name, vbase, mode, x, y, pseg, local = local )
+        vseg = Vseg( name, vbase, mode, x, y, pseg, local = local, big = big )
         vspace.vsegs.append( vseg )
         vseg.index = self.total_vsegs
@@ -473,5 +502,5 @@
 
         assert (x < self.x_size) and (y < self.y_size)
-        assert lpid < self.procs_max
+        assert lpid < self.nprocs
 
         # add one task into mapping
@@ -509,6 +538,6 @@
         return byte_stream
 
-    ################
-    def xml( self ):    # xml file generation for mapping
+    ####################################################################################
+    def xml( self ):    # compute string for map.xml file generation
 
         s = '<?xml version="1.0"?>\n\n'
@@ -545,6 +574,6 @@
         return s
 
-    #########################
-    def cbin( self, verbose ):     # C binary structure generation for mapping
+    #####################################################################################
+    def cbin( self, verbose ):     # C binary structure for map.bin file generation 
 
         byte_stream = bytearray()
@@ -705,6 +734,6 @@
     # end of cbin()
 
-    #######################
-    def giet_vsegs( self ):      # compute string for giet_vsegs.ld file
+    ##################################################################################
+    def giet_vsegs( self ):      # compute string for giet_vsegs.ld file generation
                                  # required by giet_vm compilation
 
@@ -798,6 +827,7 @@
         return s
 
-    ########################
-    def hard_config( self ):     # compute string for hard_config.h file required by
+    ###################################################################################
+    def hard_config( self ):     # compute string for hard_config.h file generation,
+                                 # required by
                                  # - top.cpp compilation
                                  # - giet_vm compilation
@@ -1094,5 +1124,5 @@
         s += '#define X_IO                   %d\n'    % self.x_io
         s += '#define Y_IO                   %d\n'    % self.y_io
-        s += '#define NB_PROCS_MAX           %d\n'    % self.procs_max
+        s += '#define NB_PROCS_MAX           %d\n'    % self.nprocs
         s += '#define IRQ_PER_PROCESSOR      %d\n'    % self.irq_per_proc
         s += '#define RESET_ADDRESS          0x%x\n'  % self.reset_address
@@ -1201,5 +1231,191 @@
     # end of hard_config()
 
-    #######################
+    ################################################################################
+    def linux_dts( self ):     # compute string for linux.dts file generation
+                               # used for linux configuration  
+        # header
+        s =  '/dts-v1/;\n'
+        s += '\n'
+        s += '/{\n'
+        s += '  compatible = "tsar, %s";\n' % self.name
+        s += '  #address-cells = <2>;\n'               # physical address on 64 bits
+        s += '  #size-cells    = <1>;\n'               # segment size on 32 bits
+        s += '  model = "%s";\n' % self.name
+        s += '\n'
+
+        # linux globals arguments
+        s += '  chosen {\n'
+        s += '    linux,stdout-path = &tty;\n'
+        s += '    bootargs = "console=tty0 console=ttyVTTY0 earlyprintk";\n'
+        s += '  };\n\n'     
+
+        # cpus (for each cluster)
+        s += '  cpus {\n'
+        s += '    #address-cells = <1>;\n'
+        s += '    #size-cells    = <0>;\n'
+
+        for cluster in self.clusters:
+            for proc in cluster.procs:
+                x       = cluster.x
+                y       = cluster.y
+                l       = proc.lpid
+                proc_id = (((x << self.y_width) + y) * self.nprocs) + l
+                s += '    cpu@%d_%d_%d {\n' %(x,y,l)
+                s += '      device_type = "cpu";\n'
+                s += '      compatible = "soclib,mips32el";\n'
+                s += '      reg = <0x%x>;\n' % proc_id
+                s += '    };\n'
+                s += '\n'
+
+        s += '  };\n\n'
+
+        # devices (ram or peripheral) are grouped per cluster
+        # the "compatible" attribute links a peripheral device 
+        # to one or several drivers identified by ("major","minor")
+
+        for cluster in self.clusters:
+            x               = cluster.x
+            y               = cluster.y
+            found_xcu       = False
+            found_pic       = False
+
+            s += '  /*** cluster[%d,%d] ***/\n\n' % (x,y)
+
+            # scan all psegs to find RAM in current cluster
+            for pseg in cluster.psegs:
+                if ( pseg.segtype == 'RAM' ):
+                    msb  = pseg.base >> 32
+                    lsb  = pseg.base & 0xFFFFFFFF
+                    size = pseg.size
+
+                    s += '  ram@%d_%d: ram@%d_%d {\n' % (x,y,x,y)
+                    s += '    device_type = "memory";\n'
+                    s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
+                    s += '  };\n\n'
+
+            # scan all periphs to find XCU or PIC in current cluster
+            for periph in cluster.periphs:
+                msb     = periph.pseg.base >> 32
+                lsb     = periph.pseg.base & 0xFFFFFFFF
+                size    = periph.pseg.size
+
+                # search XCU (can be replicated)
+                if ( (periph.ptype == 'XCU') ):  
+                    found_xcu     = True
+                    xcu           = periph
+                    irq_ctrl_name = 'xcu@%d_%d' % (x,y)
+
+                    s += '  %s: %s {\n'  % (irq_ctrl_name, irq_ctrl_name)
+                    s += '    compatible = "soclib, vci_xicu", "soclib, vci_xicu_timer";\n'
+                    s += '    interrupt-controller;\n'
+                    s += '    #interrupt-cells = <1>;\n'
+                    s += '    clocks = <&freq>;\n'         # the XCU component contains a timer
+                    s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)  
+                    s += '  };\n\n'
+
+                # search PIC (non replicated)
+                if ( periph.ptype == 'PIC' ):  
+                    found_pic     = True
+                    pic           = periph
+                    irq_ctrl_name = 'pic'
+
+                    s += '  %s: %s {\n'  % (irq_ctrl_name, irq_ctrl_name)
+                    s += '    compatible = "soclib, vci_iopic";\n'
+                    s += '    interrupt-controller;\n'
+                    s += '    #interrupt-cells = <1>;\n'
+                    s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
+                    s += '  };\n\n'
+
+                # search ICU (non supported by Linux)
+                if ( periph.ptype == 'ICU' ):  
+                    print '[genmap warning] in linux_dts() : ICU peripheral not supported by LINUX'
+
+            # we need one interrupt controler in any cluster containing peripherals
+            if ( (found_xcu == False) and (found_pic == False) and (len(cluster.periphs) > 0) ):
+                print '[genmap error] in linux_dts() : No XCU/PIC in cluster(%d,%d)' % (x,y)
+                sys.exit(1)    
+
+            if ( found_pic == True ): irq_ctrl = pic
+            else:                     irq_ctrl = xcu
+             
+            # scan all periphs to find TTY and IOC in current cluster
+            for periph in cluster.periphs:
+                msb     = periph.pseg.base >> 32
+                lsb     = periph.pseg.base & 0xFFFFFFFF
+                size    = periph.pseg.size
+
+                # search TTY (non replicated)
+                if ( periph.ptype == 'TTY' ):  
+
+                    # get HWI index to XCU or PIC (only TTY channel 0 is used by Linux)
+                    hwi_id = 0xFFFFFFFF
+                    for irq in irq_ctrl.irqs:
+                        if ( (irq.isrtype == 'ISR_TTY_RX') and (irq.channel == 0) ): hwi_id = irq.srcid
+                    if ( hwi_id == 0xFFFFFFFF ):
+                        print '[genmap error] in linux.dts() IRQ_TTY_RX not found'
+                        sys.exit(1)
+
+                    s += '  tty: tty {\n'
+                    s += '    compatible = "soclib, vci_multi_tty";\n'
+                    s += '    interrupt-parent = <&%s>;\n' % (irq_ctrl_name)
+                    s += '    interrupt = <%d>;\n' % hwi_id
+                    s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
+                    s += '  };\n\n'
+
+                # search IOC (non replicated)
+                elif ( periph.ptype == 'IOC' ):  
+
+                    if ( periph.subtype == 'BDV' ):
+
+                        # get irq line index associated to bdv
+                        hwi_id = 0xFFFFFFFF
+                        for irq in irq_ctrl.irqs:
+                            if ( irq.isrtype == 'ISR_BDV' ): hwi_id = irq.srcid
+                        if ( hwi_id == 0xFFFFFFFF ):
+                            print '[genmap error] in linux.dts() ISR_BDV not found'
+                            sys.exit(1)
+
+                        s += '  bdv: bdv {\n'
+                        s += '    compatible = "soclib:vci_blockdevice";\n'
+                        s += '    interrupt-parent = <&%s>;\n' % (irq_ctrl_name)
+                        s += '    interrupt = <%d>;\n' % hwi_id
+                        s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
+                        s += '  };\n\n'
+
+                    elif ( periph.subtype == 'HBA' ):
+
+                        print '[genmap error] in linux_dts() : HBA peripheral not supported by LINUX'
+                        sys.exit(1)
+
+                    elif ( periph.subtype == 'SPI' ):
+
+                        print '[genmap error] in linux_dts() : SPI peripheral not supported by LINUX'
+                        sys.exit(1)
+
+                # other peripherals
+                else:  
+                    type = periph.ptype
+                    print '[genmap warning] in linux_dts() : %s peripheral not supported by LINUX' % (type)
+            
+        # clocks  
+        s += '  /*** clocks ***/\n\n'
+        s += '  clocks {\n'
+        s += '    freq@50MHZ: freq@50MHZ {\n'
+        s += '      #clock-cells = <0>;\n'
+        s += '      compatible = "fixed-clock";\n'
+        s += '      clock-frequency = <50000000>;\n'
+        s += '    };\n'
+        s += '  };\n\n'
+        s += '  cpuclk {\n'
+        s += '    compatible = "soclib, mips32_clksrc";\n'
+        s += '    clocks = <&freq@50MHZ>;\n'
+        s += '  };\n'
+        s += '};\n'
+
+        return s
+        # end linux_dts()
+
+
+    #############################################################################
     def netbsd_dts( self ):    # compute string for netbsd.dts file generation,
                                # used for netbsd configuration
@@ -1230,5 +1446,5 @@
         s += '  };\n'
 
-        # rams (for each cluster)
+        # physical memory banks (for each cluster)
         for cluster in self.clusters:
             for pseg in cluster.psegs:
@@ -1247,4 +1463,6 @@
         # peripherals (for each cluster)
         for cluster in self.clusters:
+            x = cluster.x
+            y = cluster.y
 
             # research XCU component
@@ -1272,7 +1490,7 @@
                             s += '    out@%d {\n' % output_id
                             s += '      device_type = "soclib:xicu:filter";\n'
-                            s += '      irq         = <&{/cpus/Mips,32@0x%x} %d>;\n' % (proc_id, itid)
+                            s += '      irq = <&{/cpus/Mips,32@0x%x} %d>;\n' % (proc_id, itid)
                             s += '      output_line = <%d>;\n' % output_id
-                            s += '      parent      = <&{/%s@0x%x}>;\n' % (periph.pseg.name, periph.pseg.base)
+                            s += '      parent = <&{/%s@0x%x}>;\n' % (periph.pseg.name, periph.pseg.base)
                             s += '    };\n'
 
@@ -1297,6 +1515,7 @@
                     s += '  };\n'
 
+            # at least one interrupt controller
             if ( (found_xcu == False) and (found_pic == False) and (len(cluster.periphs) > 0) ):
-                print '[genmap 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)' % (x,y)
                 sys.exit(1)
 
@@ -1314,6 +1533,6 @@
 
                     s += '  %s@0x%x {\n'  % (periph.pseg.name, periph.pseg.base)
-                    s += '    device_type   = "soclib:dma";\n'
-                    s += '    reg           = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
+                    s += '    device_type = "soclib:dma";\n'
+                    s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
                     s += '    channel_count = <%d>;\n' % periph.channels
 
@@ -1332,6 +1551,6 @@
                         s += '      device_type = "soclib:periph:irq";\n'
                         s += '      output_line = <%d>;\n' % channel
-                        s += '      irq         = <&{/%s}  %d>;\n' % (name, hwi_id)
-                        s += '      parent      = <&{/%s@0x%x}>;\n' % (periph.pseg.name, periph.pseg.base)
+                        s += '      irq = <&{/%s}  %d>;\n' % (name, hwi_id)
+                        s += '      parent = <&{/%s@0x%x}>;\n' % (periph.pseg.name, periph.pseg.base)
                         s += '    };\n'
 
@@ -1351,6 +1570,6 @@
                     s += '  %s@0x%x {\n'  % (periph.pseg.name, periph.pseg.base)
                     s += '    device_type = "soclib:mmc";\n'
-                    s += '    irq         = <&{/%s@0x%x}  %d>;\n' % (irq_tgt.pseg.name, irq_tgt.pseg.base, irq_in)
-                    s += '    reg         = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
+                    s += '    irq = <&{/%s@0x%x}  %d>;\n' % (irq_tgt.pseg.name, irq_tgt.pseg.base, irq_in)
+                    s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
                     s += '  };\n'
 
@@ -1358,5 +1577,5 @@
                 elif ( periph.ptype == 'FBF' ):
 
-                    s += '  %s@0x%x {\n'  % (periph.pseg.name, periph.pseg.base)
+                    s += '  %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base)
                     s += '    device_type = "soclib:framebuffer";\n'
                     s += '    mode        = <32>;\n'                    # bits par pixel
@@ -1379,8 +1598,8 @@
                             sys.exit(1)
 
-                        s += '  %s@0x%x {\n'  % (periph.pseg.name, periph.pseg.base)
+                        s += '  %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base)
                         s += '    device_type = "soclib:blockdevice";\n'
-                        s += '    irq         = <&{/%s@0x%x}  %d>;\n' % (irq_tgt.pseg.name, irq_tgt.pseg.base, irq_in)
-                        s += '    reg         = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
+                        s += '    irq = <&{/%s@0x%x} %d>;\n' % (irq_tgt.pseg.name,irq_tgt.pseg.base,irq_in)
+                        s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
                         s += '  };\n'
 
@@ -1401,6 +1620,6 @@
                         s += '  %s@0x%x {\n'  % (periph.pseg.name, periph.pseg.base)
                         s += '    device_type = "soclib:spi";\n'
-                        s += '    irq         = <&{/%s@0x%x}  %d>;\n' % (irq_tgt.pseg.name, irq_tgt.pseg.base, irq_in)
-                        s += '    reg         = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
+                        s += '    irq = <&{/%s@0x%x} %d>;\n' % (irq_tgt.pseg.name,irq_tgt.pseg.base,irq_in)
+                        s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
                         s += '  };\n'
 
@@ -1408,8 +1627,8 @@
                 elif ( periph.ptype == 'ROM' ):
 
-                    s += '  %s@0x%x {\n'  % (periph.pseg.name, periph.pseg.base)
+                    s += '  %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base)
                     s += '    device_type = "rom";\n'
-                    s += '    cached      = <1>;\n'
-                    s += '    reg         = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
+                    s += '    cached = <1>;\n'
+                    s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
                     s += '  };\n'
 
@@ -1425,8 +1644,8 @@
                 elif ( periph.ptype == 'TTY' ):
 
-                    s += '  %s@0x%x {\n'  % (periph.pseg.name, periph.pseg.base)
-                    s += '    device_type   = "soclib:tty";\n'
-                    s += '    reg           = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
+                    s += '  %s@0x%x {\n' % (periph.pseg.name, periph.pseg.base)
+                    s += '    device_type = "soclib:tty";\n'
                     s += '    channel_count = < %d >;\n' % periph.channels
+                    s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
 
                     # multi-channels : get HWI index (to XCU or PIC) for each channel
@@ -1444,6 +1663,6 @@
                         s += '      device_type = "soclib:periph:irq";\n'
                         s += '      output_line = <%d>;\n' % channel
-                        s += '      irq         = <&{/%s}  %d>;\n' % (name, hwi_id)
-                        s += '      parent      = <&{/%s@0x%x}>;\n' % (periph.pseg.name, periph.pseg.base)
+                        s += '      irq = <&{/%s}  %d>;\n' % (name, hwi_id)
+                        s += '      parent = <&{/%s@0x%x}>;\n' % (periph.pseg.name, periph.pseg.base)
                         s += '    };\n'
 
@@ -1525,6 +1744,6 @@
                         s += '      device_type = "soclib:periph:irq";\n'
                         s += '      output_line = <%d>;\n' % channel
-                        s += '      irq         = <&{/%s}  %d>;\n' % (name, hwi_id)
-                        s += '      parent      = <&{/%s@0x%x}>;\n' % (periph.pseg.name, periph.pseg.base)
+                        s += '      irq = <&{/%s}  %d>;\n' % (name, hwi_id)
+                        s += '      parent = <&{/%s@0x%x}>;\n' % (periph.pseg.name, periph.pseg.base)
                         s += '    };\n'
 
@@ -1570,5 +1789,5 @@
 
         return s
-        # end netbsd_dts( )
+        # end netbsd_dts()
 
     ###########################
@@ -1583,5 +1802,5 @@
         s += '        XMAX=%d\n'            % self.x_size
         s += '        YMAX=%d\n'            % self.y_size
-        s += '        CPU_NR=%d\n'          % self.procs_max
+        s += '        CPU_NR=%d\n'          % self.nprocs
         s += '\n'
 
@@ -1983,5 +2202,6 @@
                   psegname,
                   identity = False,
-                  local    = False ):
+                  local    = False,
+                  big      = False ):
 
         assert mode in VSEGMODES
@@ -1995,5 +2215,6 @@
         self.psegname = psegname            # name of pseg in destination cluster
         self.identity = identity            # identity mapping required
-        self.local    = local               # one copy per cluster
+        self.local    = local               # only mapped in local PTAB when true
+        self.big      = big                 # to be mapped in a big physical page
         self.vobjs    = []
         return
@@ -2006,4 +2227,5 @@
         if ( self.identity ): s += ' ident="1"'
         if ( self.local ):    s += ' local="1"'
+        if ( self.big ):      s += ' big="1"'
         s += ' >\n'
         for vobj in self.vobjs:  s += vobj.xml()
@@ -2057,9 +2279,9 @@
         byte_stream += mapping.int2bytes( 4,  len(self.vobjs) ) # number of vobjs in vseg
         byte_stream += mapping.int2bytes( 4,  vobj_id )         # first vobj global index
-        byte_stream += mapping.int2bytes( 4,  0 )               # linked list of vsegs on same pseg
+        byte_stream += mapping.int2bytes( 4,  0 )               # linked list of vsegs on pseg
         byte_stream += mapping.int2bytes( 1,  0 )               # mapped when non zero
-        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)
+        byte_stream += mapping.int2bytes( 1,  self.identity )   # identity mapping if non zero
+        byte_stream += mapping.int2bytes( 1,  self.local )      # only mapped in local PTAB 
+        byte_stream += mapping.int2bytes( 1,  self.big )        # to be mapped in big physical page
 
         if ( verbose ):
@@ -2137,5 +2359,4 @@
         byte_stream += mapping.int2bytes( 4 , self.align )      # required alignment
         byte_stream += mapping.int2bytes( 4 , 0 )               # virtual base address
-        byte_stream += mapping.int2bytes( 8 , 0 )               # physical base address
         byte_stream += mapping.int2bytes( 4 , self.init )       # init value
 
