Ignore:
Timestamp:
Feb 14, 2015, 5:09:27 PM (9 years ago)
Author:
alain
Message:

Remove the vobj object from the mapping_info.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_python/mapping.py

    r497 r512  
    33import sys
    44
    5 ##########################################################################################
     5########################################################################################
    66#   file   : giet_mapping.py
    77#   date   : april 2014
    88#   author : Alain Greiner
    9 ##########################################################################################
     9########################################################################################
    1010#  This file contains the classes required to define a mapping for the GIET_VM.
    1111# - A 'Mapping' contains a set of 'Cluster'   (hardware architecture)
    12 #                        a set of 'Vseg'      (kernel virtual segments mapping)
    13 #                        a set of 'Vspace'    (several user applications).
    14 # - A 'Cluster' contains a set of 'Pseg'      (all physical segments in cluster)
     12#                        a set of 'Vseg'      (kernel virtual segments, called globals)
     13#                        a set of 'Vspace'    (one or several user applications).
     14# - A 'Cluster' contains a set of 'Pseg'      (physical segments in cluster)
    1515#                        a set of 'Proc'      (processors in cluster)
    1616#                        a set of 'Periph'    (peripherals in cluster)
    1717#                        a set of 'Coproc'    (coprocessors in cluster)
    18 # - A 'Vspace' contains  a set of 'Vseg'      (user virtual segments mapping)
    19 #                        a set of 'Task'      (user tasks mapping)
    20 # - A 'Vseg'   contains  a set of 'Vobj'
     18# - A 'Vspace' contains  a set of 'Vseg'      (user virtual segments)
     19#                        a set of 'Task'      (user parallel tasks)
    2120# - A 'Periph' contains  a set of 'Irq'       (only for XCU and PIC types )
    2221# - A 'Coproc' contains  a set of 'Cpports'   (one port per MWMR channel)
    23 ##########################################################################################
     22########################################################################################
    2423# Implementation Note
    25 # The various objects used to describe a mapping are distributed in the PYTHON structure:
     24# The objects used to describe a mapping are distributed in the PYTHON structure:
    2625# For example the psegs set is split in several subsets (one subset per cluster),
    2726# or the tasks set is split in several subsets (one subset per vspace), etc...
    2827# In the C binary data structure used by the giet_vm, all objects of same type
    2928# are stored in a linear array (one single array for all psegs for example).
    30 # For all objects, we compute and store in the  PYTHON object itsel a "global index"
     29# For all objects, we compute and store in the  PYTHON object itself a "global index"
    3130# corresponding to the index in this global array, and this index can be used as
    3231# a pseudo-pointer to identify a specific object of a given type.
    33 ##########################################################################################
    34 
    35 ##########################################################################################
     32########################################################################################
     33
     34########################################################################################
    3635# Various constants
    37 ##########################################################################################
     36########################################################################################
    3837
    3938PADDR_WIDTH       = 40            # number of bits for physical address
     
    4746MAPPING_SIGNATURE = 0xDACE2014    # Magic number indicating a valid C binary struture
    4847
    49 ##########################################################################################
     48########################################################################################
    5049# These global lists must be consistent with enums in mapping_info.h or irq_handler.
    51 ##########################################################################################
     50########################################################################################
    5251PERIPHTYPES =    [
    5352                  'CMA',
     
    9796                 ]
    9897
    99 VOBJTYPES =      [
     98VSEGTYPES =      [
    10099                  'ELF',
    101100                  'BLOB',
    102101                  'PTAB',
    103102                  'PERI',
    104                   'MWMR',
    105                   'LOCK',
     103                  'MWMR',      # deprecated
     104                  'LOCK',      # deprecated
    106105                  'BUFFER',
    107                   'BARRIER',
    108                   'CONST',
    109                   'MEMSPACE',
    110                   'SCHED',
     106                  'BARRIER',   # deprecated
     107                  'CONST',     # deprecated
     108                  'MEMSPACE',  # deprecated
     109                  'SCHED',     
    111110                  'HEAP',
    112111                 ]
     
    142141                 ]
    143142
    144 ##########################################################################################
     143#######################################################################################
    145144class Mapping( object ):
    146 ##########################################################################################
     145#######################################################################################
    147146    def __init__( self,
    148147                  name,                            # mapping name
     
    152151                  x_width        = X_WIDTH,        # number of bits encoding x coordinate
    153152                  y_width        = Y_WIDTH,        # number of bits encoding y coordinate
    154                   p_width        = P_WIDTH,        # number of bits encoding local proc_id
     153                  p_width        = P_WIDTH,        # number of bits encoding lpid
    155154                  paddr_width    = PADDR_WIDTH,    # number of bits for physical address
    156                   coherence      = 1,              # hardware cache coherence when non-zero
     155                  coherence      = 1,              # hardware cache coherence if non-zero
    157156                  irq_per_proc   = 1,              # number or IRQs from XCU to processor
    158157                  use_ramdisk    = False,          # use ramdisk when true
     
    192191        self.total_psegs    = 0
    193192        self.total_vsegs    = 0
    194         self.total_vobjs    = 0
    195193        self.total_tasks    = 0
    196194        self.total_procs    = 0
     
    241239        return pseg
    242240
    243     ##############################   add a peripheral and the associated pseg in a cluster
     241    ##########################   add a peripheral and the associated pseg in a cluster
    244242    def addPeriph( self,
    245243                   name,               # associated pseg name
     
    350348                 direction,            # direction (TO_COPROC / FROM_COPROC)
    351349                 vspacename,           # name of vspace using the coproc
    352                  mwmrname ):           # name of the vobj defining the MWMR channel
     350                 mwmrname ):           # name of the vseg containing the MWMR channel
    353351
    354352        assert direction in CP_PORT_DIRS
     
    366364                   name,               # vseg name
    367365                   vbase,              # virtual base address
    368                    size,               # vobj length (bytes)
     366                   length,             # vseg length (bytes)
    369367                   mode,               # CXWU flags
    370                    vtype,              # vobj type
     368                   vtype,              # vseg type
    371369                   x,                  # destination x coordinate
    372370                   y,                  # destination y coordinate
    373371                   pseg,               # destination pseg name
    374372                   identity = False,   # identity mapping required if true
    375                    binpath  = '',      # pathname for binary code if required
    376                    align    = 0,       # alignment required
    377373                   local    = False,   # only mapped in local PTAB if true
    378                    big      = False ): # to be mapped in a big physical page
    379 
    380         assert mode in VSEGMODES
    381 
    382         assert vtype in VOBJTYPES
    383 
    384         assert (x < self.x_size) and (y < self.y_size)
     374                   big      = False,   # to be mapped in a big physical page
     375                   binpath  = '' ):    # pathname for binary code if required
    385376
    386377        # two global vsegs must not overlap if they have different names
    387378        for prev in self.globs:
    388             prev_vbase = prev.vbase
    389             prev_size = prev.vobjs[0].length
    390 
    391             if ( ((prev_vbase + prev_size) > vbase ) and
    392                  ((vbase + size) > prev_vbase) and
     379            if ( ((prev.vbase + prev.length) > vbase ) and
     380                 ((vbase + length) > prev.vbase) and
    393381                 (prev.name != name) ):
    394                 print '[genmap error] in addGlobal() : %s overlap %s' % (name, prev.name)
    395                 print ' %s : base = %x / size = %x' %( name, vbase, size )
    396                 print ' %s : base = %x / size = %x' %( prev.name, prev_vbase, prev_size )
     382                print '[genmap error] in addGlobal()'
     383                print '    global vseg %s overlap %s' % (name, prev.name)
     384                print '    %s : base = %x / size = %x' %( name, vbase, size )
     385                print '    %s : base = %x / size = %x' %( prev.name, prev.vbase, prev.size )
    397386                sys.exit(1)
    398387
    399388        # add one vseg into mapping
    400         vseg = Vseg( name, vbase, mode, x, y, pseg,
    401                      identity = identity, local = local, big = big )
     389        vseg = Vseg( name, vbase, length, mode, vtype, x, y, pseg,
     390                     identity = identity, local = local, big = big, binpath = binpath )
    402391
    403392        self.globs.append( vseg )
     
    406395        self.total_vsegs += 1
    407396
    408         # add one vobj into mapping
    409         vobj = Vobj( name, size, vtype, binpath, 0, 0 )
    410         vseg.vobjs.append( vobj )
    411         vobj.index = self.total_vobjs
    412         self.total_vobjs += 1
    413 
    414397        return
    415398
     
    417400    def addVspace( self,
    418401                   name,                # vspace name
    419                    startname ):         # name of vobj containing start_vector
     402                   startname ):         # name of vseg containing start_vector
    420403
    421404        # add one vspace into mapping
     
    427410        return vspace
    428411
    429     #################################   add a private vseg and a vobj in a vspace
     412    #################################   add a private vseg in a vspace
    430413    def addVseg( self,
    431414                 vspace,                # vspace containing the vseg
    432415                 name,                  # vseg name
    433416                 vbase,                 # virtual base address
    434                  size,                  # vobj length (bytes)
     417                 length,                # vseg length (bytes)
    435418                 mode,                  # CXWU flags
    436                  vtype,                 # vobj type
     419                 vtype,                 # vseg type
    437420                 x,                     # destination x coordinate
    438421                 y,                     # destination y coordinate
    439422                 pseg,                  # destination pseg name
    440                  binpath    = '',       # pathname for binary code
    441                  align      = 0,        # alignment required
    442                  init       = 0,        # initial value
    443423                 local    = False,      # only mapped in local PTAB if true
    444                  big      = False ):    # to be mapped in a big physical page
     424                 big      = False,      # to be mapped in a big physical page
     425                 binpath  = '' ):       # pathname for binary code
    445426
    446427        assert mode in VSEGMODES
    447428
    448         assert vtype in VOBJTYPES
     429        assert vtype in VSEGTYPES
    449430
    450431        assert (x < self.x_size) and (y < self.y_size)
    451432
    452433        # add one vseg into mapping
    453         vseg = Vseg( name, vbase, mode, x, y, pseg, local = local, big = big )
     434        vseg = Vseg( name, vbase, length, mode, vtype, x, y, pseg,
     435                     identity = False, local = local, big = big, binpath = binpath )
    454436        vspace.vsegs.append( vseg )
    455437        vseg.index = self.total_vsegs
    456438        self.total_vsegs += 1
    457439
    458         # add one vobj into mapping
    459         vobj = Vobj( name, size, vtype, binpath, align, init )
    460         vseg.vobjs.append( vobj )
    461         vobj.index = self.total_vobjs
    462         self.total_vobjs += 1
    463 
    464440        return vseg
    465 
    466     ################################    add a vobj in a private vseg
    467     def addVobj( self,
    468                  vseg,                  # vseg containing vobj
    469                  name,                  # vobj name
    470                  size,                  # vobj length (bytes)
    471                  vtype,                 # vobj type
    472                  binpath = '',          # pathname to binary
    473                  align   = 0,           # alignment constraint
    474                  init    = 0 ):         # initial value
    475 
    476         assert vtype in VOBJTYPES
    477 
    478         # add one vobj into mapping
    479         vobj = Vobj( name, size, vtype, binpath, align, init )
    480         vseg.vobjs.append( vobj )
    481         vobj.index = self.total_vobjs
    482         self.total_vobjs += 1
    483 
    484         return vobj
    485441
    486442    ################################    add a task in a vspace
     
    492448                 y,                     # destination y coordinate
    493449                 lpid,                  # destination processor local index
    494                  stackname,             # name of vobj containing stack
    495                  heapname,              # name of vobj containing heap
     450                 stackname,             # name of vseg containing stack
     451                 heapname,              # name of vseg containing heap
    496452                 startid ):             # index in start_vector
    497453
     
    518474                byte_stream.append( '\0' )
    519475        else:
    520             print '[genmap error] in str2bytes() : string %s too long' % s
     476            print '[genmap error] in str2bytes()'
     477            print '    string %s too long' % s
    521478            sys.exit(1)
    522479
     
    532489        return byte_stream
    533490
    534     ####################################################################################
     491    ################
    535492    def xml( self ):    # compute string for map.xml file generation
    536493
     
    568525        return s
    569526
    570     #####################################################################################
     527    ##########################
    571528    def cbin( self, verbose ):     # C binary structure for map.bin file generation
    572529
     
    587544        byte_stream += self.int2bytes(4,  self.total_psegs)
    588545        byte_stream += self.int2bytes(4,  self.total_vsegs)
    589         byte_stream += self.int2bytes(4,  self.total_vobjs)
    590546        byte_stream += self.int2bytes(4,  self.total_tasks)
    591547        byte_stream += self.int2bytes(4,  self.total_procs)
     
    611567            print 'total_psegs   = %d' % self.total_psegs
    612568            print 'total_vsegs   = %d' % self.total_vsegs
    613             print 'total_vobjs   = %d' % self.total_vobjs
    614569            print 'total_tasks   = %d' % self.total_tasks
    615570            print 'total_procs   = %d' % self.total_procs
     
    657612        if ( verbose ): print '\n'
    658613
    659         # vobjs array
    660         index = 0
    661         for vseg in self.globs:
    662             for vobj in vseg.vobjs:
    663                 byte_stream += vobj.cbin( self, verbose, index )
    664                 index += 1
    665         for vspace in self.vspaces:
    666             for vseg in vspace.vsegs:
    667                 for vobj in vseg.vobjs:
    668                     byte_stream += vobj.cbin( self, verbose, index )
    669                     index += 1
    670 
    671         if ( verbose ): print '\n'
    672 
    673614        # tasks array
    674615        index = 0
     
    743684            if ( vseg.name == 'seg_boot_code' ):
    744685                boot_code_vbase      = vseg.vbase
    745                 boot_code_size       = vseg.vobjs[0].length
     686                boot_code_size       = vseg.length
    746687                boot_code_found      = True
    747688
    748689            if ( vseg.name == 'seg_boot_data' ):
    749690                boot_data_vbase      = vseg.vbase
    750                 boot_data_size       = vseg.vobjs[0].length
     691                boot_data_size       = vseg.length
    751692                boot_data_found      = True
    752 
    753             if ( vseg.name == 'seg_kernel_uncdata' ):
    754                 kernel_uncdata_vbase = vseg.vbase
    755                 kernel_uncdata_size  = vseg.vobjs[0].length
    756                 kernel_uncdata_found = True
    757693
    758694            if ( vseg.name == 'seg_kernel_data' ):
    759695                kernel_data_vbase    = vseg.vbase
    760                 kernel_data_size     = vseg.vobjs[0].length
     696                kernel_data_size     = vseg.length
    761697                kernel_data_found    = True
    762698
    763699            if ( vseg.name == 'seg_kernel_code' ):
    764700                kernel_code_vbase    = vseg.vbase
    765                 kernel_code_size     = vseg.vobjs[0].length
     701                kernel_code_size     = vseg.length
    766702                kernel_code_found    = True
    767703
    768704            if ( vseg.name == 'seg_kernel_init' ):
    769705                kernel_init_vbase    = vseg.vbase
    770                 kernel_init_size     = vseg.vobjs[0].length
     706                kernel_init_size     = vseg.length
    771707                kernel_init_found    = True
    772708
    773709        # check if all required vsegs have been found
    774710        if ( boot_code_found      == False ):
    775              print '[genmap error] in giet_vsegs() : seg_boot_code vseg missing'
     711             print '[genmap error] in giet_vsegs()'
     712             print '    seg_boot_code vseg missing'
    776713             sys.exit()
    777714
    778715        if ( boot_data_found      == False ):
    779              print '[genmap error] in giet_vsegs() : seg_boot_data vseg missing'
     716             print '[genmap error] in giet_vsegs()'
     717             print '    seg_boot_data vseg missing'
    780718             sys.exit()
    781719
    782720        if ( kernel_data_found    == False ):
    783              print '[genmap error] in giet_vsegs() : seg_kernel_data vseg missing'
     721             print '[genmap error] in giet_vsegs()'
     722             print '    seg_kernel_data vseg missing'
    784723             sys.exit()
    785724
    786         if ( kernel_uncdata_found == False ):
    787              print '[genmap error] in giet_vsegs() : seg_kernel_uncdata vseg missing'
     725        if ( kernel_code_found    == False ):
     726             print '[genmap error] in giet_vsegs()'
     727             print '    seg_kernel_code vseg missing'
    788728             sys.exit()
    789729
    790         if ( kernel_code_found    == False ):
    791              print '[genmap error] in giet_vsegs() : seg_kernel_code vseg missing'
    792              sys.exit()
    793 
    794730        if ( kernel_init_found    == False ):
    795              print '[genmap error] in giet_vsegs() : seg_kernel_init vseg missing'
     731             print '[genmap error] in giet_vsegs()'
     732             print '    seg_kernel_init vseg missing'
    796733             sys.exit()
    797734
     
    811748        s += 'kernel_data_vbase    = 0x%x;\n'   % kernel_data_vbase
    812749        s += 'kernel_data_size     = 0x%x;\n'   % kernel_data_size
    813         s += '\n'
    814         s += 'kernel_uncdata_vbase = 0x%x;\n'   % kernel_uncdata_vbase
    815         s += 'kernel_uncdata_size  = 0x%x;\n'   % kernel_uncdata_size
    816750        s += '\n'
    817751        s += 'kernel_init_vbase    = 0x%x;\n'   % kernel_init_vbase
     
    1044978            if ( vseg.name == 'seg_boot_mapping' ):
    1045979                boot_mapping_base       = vseg.vbase
    1046                 boot_mapping_size       = vseg.vobjs[0].length
     980                boot_mapping_size       = vseg.length
    1047981                boot_mapping_identity   = vseg.identity
    1048982                boot_mapping_found      = True
     
    1050984            if ( vseg.name == 'seg_boot_code' ):
    1051985                boot_code_base          = vseg.vbase
    1052                 boot_code_size          = vseg.vobjs[0].length
     986                boot_code_size          = vseg.length
    1053987                boot_code_identity      = vseg.identity
    1054988                boot_code_found         = True
     
    1056990            if ( vseg.name == 'seg_boot_data' ):
    1057991                boot_data_base          = vseg.vbase
    1058                 boot_data_size          = vseg.vobjs[0].length
     992                boot_data_size          = vseg.length
    1059993                boot_data_identity      = vseg.identity
    1060994                boot_data_found         = True
     
    1062996            if ( vseg.name == 'seg_boot_stack' ):
    1063997                boot_stack_base         = vseg.vbase
    1064                 boot_stack_size         = vseg.vobjs[0].length
     998                boot_stack_size         = vseg.length
    1065999                boot_stack_identity     = vseg.identity
    10661000                boot_stack_found        = True
     
    10681002        # check that BOOT vsegs are found and identity mapping
    10691003        if ( (boot_mapping_found == False) or (boot_mapping_identity == False) ):
    1070              print '[genmap error] in hard_config() : seg_boot_mapping missing or not ident'
     1004             print '[genmap error] in hard_config()'
     1005             print '    seg_boot_mapping missing or not identity mapping'
    10711006             sys.exit()
    10721007
    10731008        if ( (boot_code_found == False) or (boot_code_identity == False) ):
    1074              print '[genmap error] in hard_config() : seg_boot_code missing or not ident'
     1009             print '[genmap error] in hard_config()'
     1010             print '    seg_boot_code missing or not identity mapping'
    10751011             sys.exit()
    10761012
    10771013        if ( (boot_data_found == False) or (boot_data_identity == False) ):
    1078              print '[genmap error] in hard_config() : seg_boot_data missing or not ident'
     1014             print '[genmap error] in hard_config()'
     1015             print '    seg_boot_data missing or not identity mapping'
    10791016             sys.exit()
    10801017
    10811018        if ( (boot_stack_found == False) or (boot_stack_identity == False) ):
    1082              print '[genmap error] in giet_vsegs() : seg_boot_stack missing or not ident'
     1019             print '[genmap error] in giet_vsegs()'
     1020             print '    seg_boot_stask missing or not identity mapping'
    10831021             sys.exit()
    10841022
     
    10921030                if ( vseg.name == 'seg_ramdisk' ):
    10931031                    seg_rdk_base  = vseg.vbase
    1094                     seg_rdk_size  = vseg.vobjs[0].length
     1032                    seg_rdk_size  = vseg.length
    10951033                    seg_rdk_found = True
    10961034
     
    13011239                    s += '    interrupt-controller;\n'
    13021240                    s += '    #interrupt-cells = <1>;\n'
    1303                     s += '    clocks = <&freq>;\n'         # the XCU component contains a timer
     1241                    s += '    clocks = <&freq>;\n'         # XCU contains a timer
    13041242                    s += '    reg = <0x%x  0x%x  0x%x>;\n' % (msb, lsb, size)
    13051243                    s += '  };\n\n'
     
    13191257
    13201258            # we need one interrupt controler in any cluster containing peripherals
    1321             if ( (found_xcu == False) and (found_pic == False) and (len(cluster.periphs) > 0) ):
    1322                 print '[genmap error] in linux_dts() : No XCU/PIC in cluster(%d,%d)' % (x,y)
     1259            if ( (found_xcu == False) and
     1260                 (found_pic == False) and
     1261                 (len(cluster.periphs) > 0) ):
     1262                print '[genmap error] in linux_dts()'
     1263                print '    No XCU/PIC in cluster(%d,%d)' % (x,y)
    13231264                sys.exit(1)
    13241265
     
    13381279                    hwi_id = 0xFFFFFFFF
    13391280                    for irq in irq_ctrl.irqs:
    1340                         if ( (irq.isrtype == 'ISR_TTY_RX') and (irq.channel == 0) ): hwi_id = irq.srcid
     1281                        if ( (irq.isrtype == 'ISR_TTY_RX') and (irq.channel == 0) ):
     1282                            hwi_id = irq.srcid
     1283
    13411284                    if ( hwi_id == 0xFFFFFFFF ):
    1342                         print '[genmap error] in linux.dts() IRQ_TTY_RX not found'
     1285                        print '[genmap error] in linux.dts()'
     1286                        print '    IRQ_TTY_RX not found'
    13431287                        sys.exit(1)
    13441288
     
    13591303                        for irq in irq_ctrl.irqs:
    13601304                            if ( irq.isrtype == 'ISR_BDV' ): hwi_id = irq.srcid
     1305
    13611306                        if ( hwi_id == 0xFFFFFFFF ):
    1362                             print '[genmap error] in linux.dts() ISR_BDV not found'
     1307                            print '[genmap error] in linux.dts()'
     1308                            print '    ISR_BDV not found'
    13631309                            sys.exit(1)
    13641310
     
    13721318                    elif ( periph.subtype == 'HBA' ):
    13731319
    1374                         print '[genmap error] in linux_dts() : HBA peripheral not supported by LINUX'
     1320                        print '[genmap error] in linux_dts()'
     1321                        print '    HBA peripheral not supported by LINUX'
    13751322                        sys.exit(1)
    13761323
    13771324                    elif ( periph.subtype == 'SPI' ):
    13781325
    1379                         print '[genmap error] in linux_dts() : SPI peripheral not supported by LINUX'
     1326                        print '[genmap error] in linux_dts()'
     1327                        print '    SPI peripheral not supported by LINUX'
    13801328                        sys.exit(1)
    13811329
     
    13861334                # other peripherals
    13871335                else:
    1388                     type = periph.ptype
    1389                     print '[genmap warning] in linux_dts() : %s peripheral not supported by LINUX' % (type)
     1336                    print '[genmap warning] in linux_dts()'
     1337                    print '    %s peripheral not supported by LINUX' % (periph.ptype)
    13901338
    13911339        # clocks
     
    15081456            # at least one interrupt controller
    15091457            if ( (found_xcu == False) and (found_pic == False) and (len(cluster.periphs) > 0) ):
    1510                 print '[genmap error] in netbsd_dts() : No XCU/PIC in cluster(%d,%d)' % (x,y)
     1458                print '[genmap error] in netbsd_dts()'
     1459                print '    No XCU/PIC in cluster(%d,%d)' % (x,y)
    15111460                sys.exit(1)
    15121461
     
    15341483                            if ( (irq.isrtype == 'ISR_DMA') and (irq.channel == channel) ):
    15351484                                hwi_id = irq.srcid
     1485
    15361486                        if ( hwi_id == 0xFFFFFFFF ):
    1537                             print '[genmap error] in netbsd.dts() ISR_DMA channel %d not found' % channel
     1487                            print '[genmap error] in netbsd.dts()'
     1488                            print '    ISR_DMA channel %d not found' % channel
    15381489                            sys.exit(1)
    15391490
     
    15551506                    for irq in xcu.irqs:
    15561507                        if ( irq.isrtype == 'ISR_MMC' ): irq_in = irq.srcid
     1508
    15571509                    if ( irq_in == 0xFFFFFFFF ):
    1558                         print '[genmap error] in netbsd.dts() ISR_MMC not found'
     1510                        print '[genmap error] in netbsd.dts()'
     1511                        print '    ISR_MMC not found'
    15591512                        sys.exit(1)
    15601513
     
    15861539                            if ( irq.isrtype == 'ISR_BDV' ): irq_in = irq.srcid
    15871540                        if ( irq_in == 0xFFFFFFFF ):
    1588                             print '[genmap error] in netbsd.dts() ISR_BDV not found'
     1541                            print '[genmap error] in netbsd.dts()'
     1542                            print '    ISR_BDV not found'
    15891543                            sys.exit(1)
    15901544
     
    15961550
    15971551                    elif ( periph.subtype == 'HBA' ):
    1598                         print '[genmap error] in netbsd_dts() : HBA peripheral not supported by NetBSD'
     1552                        print '[genmap error] in netbsd_dts()'
     1553                        print '    HBA peripheral not supported by NetBSD'
    15991554                        sys.exit(1)
    16001555
     
    16061561                            if ( irq.isrtype == 'ISR_SPI' ): irq_in = irq.srcid
    16071562                        if ( irq_in == 0xFFFFFFFF ):
    1608                             print '[genmap error] in netbsd.dts() ISR_SPI not found'
     1563                            print '[genmap error] in netbsd.dts()'
     1564                            print '    ISR_SPI not found'
    16091565                            sys.exit(1)
    16101566
     
    16471603                                hwi_id = irq.srcid
    16481604                        if ( hwi_id == 0xFFFFFFFF ):
    1649                             print '[genmap error] in netbsd.dts() ISR_TTY_RX channel %d not found' % channel
     1605                            print '[genmap error] in netbsd.dts()'
     1606                            print '    ISR_TTY_RX channel %d not found' % channel
    16501607                            sys.exit(1)
    16511608
     
    16841641                                hwi_id = irq.srcid
    16851642                        if ( hwi_id == 0xFFFFFFFF ):
    1686                             print '[genmap error] in netbsd.dts() ISR_NIC_RX channel %d not found' % channel
     1643                            print '[genmap error] in netbsd.dts()'
     1644                            print '    ISR_NIC_RX channel %d not found' % channel
    16871645                            sys.exit(1)
    16881646
     
    17001658                                hwi_id = irq.srcid
    17011659                        if ( hwi_id == 0xFFFFFFFF ):
    1702                             print '[genmap error] in netbsd.dts() ISR_NIC_TX channel %d not found' % channel
     1660                            print '[genmap error] in netbsd.dts()'
     1661                            print '    ISR_NIC_TX channel %d not found' % channel
    17031662                            sys.exit(1)
    17041663
     
    17271686                            if ( (irq.isrtype == 'ISR_CMA') and (irq.channel == channel) ):
    17281687                                hwi_id = irq.srcid
     1688
    17291689                        if ( hwi_id == 0xFFFFFFFF ):
    1730                             print '[genmap error] in netbsd.dts() ISR_CMA channel %d not found' % channel
     1690                            print '[genmap error] in netbsd.dts()'
     1691                            print '    ISR_CMA channel %d not found' % channel
    17311692                            sys.exit(1)
    17321693
     
    17441705                elif ( periph.ptype == 'TIM' ):
    17451706
    1746                     print '[genmap error] in netbsd_dts() : TIM peripheral not supported by NetBSD'
     1707                    print '[genmap error] in netbsd_dts()'
     1708                    print '    TIM peripheral not supported by NetBSD'
    17471709                    sys.exit(1)
    17481710
     
    17501712                elif ( periph.ptype == 'MWR' ):
    17511713
    1752                     print '[genmap error] in netbsd_dts() : MWR peripheral not supported by NetBSD'
     1714                    print '[genmap error] in netbsd_dts()'
     1715                    print '    MWR peripheral not supported by NetBSD'
    17531716                    sys.exit(1)
    17541717
     
    19351898        # check index
    19361899        if (self.index != expected):
    1937             print '[genmap error] in Cluster.cbin() : cluster global index = %d / expected = %d' \
    1938                   % (self.index, expected )
     1900            print '[genmap error] in Cluster.cbin()'
     1901            print '    cluster global index = %d / expected = %d' % (self.index,expected)
    19391902            sys.exit(1)
    19401903
     
    19641927
    19651928        byte_stream = bytearray()
    1966         byte_stream += mapping.int2bytes( 4 , self.x )                 # x coordinate
    1967         byte_stream += mapping.int2bytes( 4 , self.y )                 # x coordinate
    1968         byte_stream += mapping.int2bytes( 4 , len( self.psegs ) )      # number of psegs in cluster
    1969         byte_stream += mapping.int2bytes( 4 , pseg_id )                # first pseg global index
    1970         byte_stream += mapping.int2bytes( 4 , len( self.procs ) )      # number of procs in cluster
    1971         byte_stream += mapping.int2bytes( 4 , proc_id )                # first proc global index
    1972         byte_stream += mapping.int2bytes( 4 , len( self.coprocs ) )    # number of coprocs in cluster
    1973         byte_stream += mapping.int2bytes( 4 , coproc_id )              # first coproc global index
    1974         byte_stream += mapping.int2bytes( 4 , len( self.periphs ) )    # number of periphs in cluster
    1975         byte_stream += mapping.int2bytes( 4 , periph_id )              # first periph global index
     1929        byte_stream += mapping.int2bytes( 4 , self.x )              # x coordinate
     1930        byte_stream += mapping.int2bytes( 4 , self.y )              # x coordinate
     1931        byte_stream += mapping.int2bytes( 4 , len( self.psegs ) )   # number psegs in cluster
     1932        byte_stream += mapping.int2bytes( 4 , pseg_id )             # first pseg global index
     1933        byte_stream += mapping.int2bytes( 4 , len( self.procs ) )   # number procs in cluster
     1934        byte_stream += mapping.int2bytes( 4 , proc_id )             # first proc global index
     1935        byte_stream += mapping.int2bytes( 4 , len( self.coprocs ) ) # number coprocs in cluster
     1936        byte_stream += mapping.int2bytes( 4 , coproc_id )           # first coproc global index
     1937        byte_stream += mapping.int2bytes( 4 , len( self.periphs ) ) # number periphs in cluster
     1938        byte_stream += mapping.int2bytes( 4 , periph_id )           # first periph global index
    19761939
    19771940        if ( verbose ):
     
    19871950        return byte_stream
    19881951
    1989 ###########################################################################################
     1952########################################################################################
    19901953class Vspace( object ):
    1991 ###########################################################################################
     1954########################################################################################
    19921955    def __init__( self,
    19931956                  name,
     
    19961959        self.index     = 0              # global index ( set by addVspace() )
    19971960        self.name      = name           # vspace name
    1998         self.startname = startname      # name of vobj containing the start_vector
     1961        self.startname = startname      # name of vseg containing the start_vector
    19991962        self.vsegs     = []
    20001963        self.tasks     = []
     
    20201983        # check index
    20211984        if (self.index != expected):
    2022             print '[genmap error] in Vspace.cbin() : vspace global index = %d / expected = %d' \
    2023                   % (self.index, expected )
     1985            print '[genmap error] in Vspace.cbin()'
     1986            print '    vspace global index = %d / expected = %d' %(self.index,expected)
    20241987            sys.exit(1)
    20251988
    2026         # compute global index for vobj containing start_vector
    2027         vobj_start_id = 0xFFFFFFFF
     1989        # compute global index for vseg containing start_vector
     1990        vseg_start_id = 0xFFFFFFFF
    20281991        for vseg in self.vsegs:
    2029             if ( vseg.vobjs[0].name == self.startname ):
    2030                 vobj_start_id = vseg.vobjs[0].index
    2031         if ( vobj_start_id == 0xFFFFFFFF ):
    2032             print '[genmap error] in Vspace.cbin() : startname %s not found for vspace %s' \
    2033                   % ( self.startname, self.name )
     1992            if ( vseg.name == self.startname ): vseg_start_id = vseg.index
     1993
     1994        if ( vseg_start_id == 0xFFFFFFFF ):
     1995            print '[genmap error] in Vspace.cbin()'
     1996            print '    startname %s not found for vspace %s' %(self.startname,self.name)
    20341997            sys.exit(1)
    20351998
    2036         # compute first vseg, vobj, task global index
     1999        # compute first vseg and first task global index
    20372000        first_vseg_id = self.vsegs[0].index
    2038         first_vobj_id = self.vsegs[0].vobjs[0].index
    20392001        first_task_id = self.tasks[0].index
    20402002
    2041         # compute number of vobjs, tasks, vsegs
     2003        # compute number of tasks and number of vsegs
    20422004        nb_vsegs = len( self.vsegs )
    20432005        nb_tasks = len( self.tasks )
    2044         nb_vobjs = 0
    2045         for vseg in self.vsegs:
    2046             nb_vobjs += len( vseg.vobjs )
    20472006
    20482007        byte_stream = bytearray()
    20492008        byte_stream += mapping.str2bytes( 32, self.name )         # vspace name
    2050         byte_stream += mapping.int2bytes( 4,  vobj_start_id )     # vobj start_vector
     2009        byte_stream += mapping.int2bytes( 4,  vseg_start_id )     # vseg start_vector
    20512010        byte_stream += mapping.int2bytes( 4,  nb_vsegs )          # number of vsegs
    2052         byte_stream += mapping.int2bytes( 4,  nb_vobjs )          # number of vobjs
    20532011        byte_stream += mapping.int2bytes( 4,  nb_tasks )          # number of tasks
    20542012        byte_stream += mapping.int2bytes( 4,  first_vseg_id )     # first vseg global index
    2055         byte_stream += mapping.int2bytes( 4,  first_vobj_id )     # first vobj global index
    20562013        byte_stream += mapping.int2bytes( 4,  first_task_id )     # first task global index
    20572014
    20582015        if ( verbose ):
    2059             print 'start_id   = %d' %  vobj_start_id
     2016            print 'start_id   = %d' %  vseg_start_id
    20602017            print 'nb_vsegs   = %d' %  nb_vsegs
    2061             print 'nb_vobjs   = %d' %  nb_vobjs
    20622018            print 'nb_tasks   = %d' %  nb_tasks
    20632019            print 'vseg_id    = %d' %  first_vseg_id
    2064             print 'vobj_id    = %d' %  first_vobj_id
    20652020            print 'task_id    = %d' %  first_task_id
    20662021
    20672022        return byte_stream
    20682023
    2069 ###########################################################################################
     2024########################################################################################
    20702025class Task( object ):
    2071 ###########################################################################################
     2026########################################################################################
    20722027    def __init__( self,
    20732028                  name,
     
    20862041        self.y         = y             # cluster y coordinate
    20872042        self.p         = p             # processor local index
    2088         self.stackname = stackname     # name of vobj containing the stack
    2089         self.heapname  = heapname      # name of vobj containing the heap
     2043        self.stackname = stackname     # name of vseg containing the stack
     2044        self.heapname  = heapname      # name of vseg containing the heap
    20902045        self.startid   = startid       # index in start_vector
    20912046        return
     
    20992054        s += ' y="%d"'                     % self.y
    21002055        s += ' p="%d"'                     % self.p
     2056        s += '\n                 '
    21012057        s += ' stackname="%s"'             % self.stackname
    21022058        s += ' heapname="%s"'              % self.heapname
     
    21142070        # check index
    21152071        if (self.index != expected):
    2116             print '[genmap error] in Task.cbin() : task global index = %d / expected = %d' \
    2117                   % (self.index, expected )
     2072            print '[genmap error] in Task.cbin()'
     2073            print '    task global index = %d / expected = %d' %(self.index,expected)
    21182074            sys.exit(1)
    21192075
     
    21212077        cluster_id = (self.x * mapping.y_size) + self.y
    21222078
    2123         # compute vobj local index for stack
    2124         vobj_stack_id = 0xFFFFFFFF
     2079        # compute vseg index for stack
     2080        vseg_stack_id = 0xFFFFFFFF
    21252081        for vseg in vspace.vsegs:
    2126             if ( vseg.vobjs[0].name == self.stackname ):
    2127                 vobj_stack_id = vseg.vobjs[0].index
    2128         if ( vobj_stack_id == 0xFFFFFFFF ):
    2129             print '[genmap error] in Task.cbin() : stackname %s not found for task %s in vspace %s' \
     2082            if ( vseg.name == self.stackname ): vseg_stack_id = vseg.index
     2083
     2084        if ( vseg_stack_id == 0xFFFFFFFF ):
     2085            print '[genmap error] in Task.cbin()'
     2086            print '    stackname %s not found for task %s in vspace %s' \
    21302087                  % ( self.stackname, self.name, vspace.name )
    21312088            sys.exit(1)
    21322089
    2133         # compute vobj local index for heap
     2090        # compute vseg index for heap
    21342091        if ( self.heapname == '' ):
    2135             vobj_heap_id = 0
     2092            vseg_heap_id = 0
    21362093        else:
    2137             vobj_heap_id = 0xFFFFFFFF
     2094            vseg_heap_id = 0xFFFFFFFF
    21382095            for vseg in vspace.vsegs:
    2139                 if ( vseg.vobjs[0].name == self.heapname ):
    2140                     vobj_heap_id = vseg.vobjs[0].index
    2141             if ( vobj_heap_id == 0xFFFFFFFF ):
    2142                 print '[genmap error] in Task.cbin() : heapname %s not found for task %s in vspace %s' \
     2096                if ( vseg.name == self.heapname ): vseg_heap_id = vseg.index
     2097
     2098            if ( vseg_heap_id == 0xFFFFFFFF ):
     2099                print '[genmap error] in Task.cbin()'
     2100                print '    heapname %s not found for task %s in vspace %s' \
    21432101                      % ( self.heapname, self.name, vspace.name )
    21442102                sys.exit(1)
     
    21472105        byte_stream += mapping.str2bytes( 32, self.name )       # task name in vspace
    21482106        byte_stream += mapping.int2bytes( 4,  cluster_id )      # cluster global index
    2149         byte_stream += mapping.int2bytes( 4,  self.p )          # processor local index in cluster
     2107        byte_stream += mapping.int2bytes( 4,  self.p )          # processor local index
    21502108        byte_stream += mapping.int2bytes( 4,  self.trdid )      # thread local index in vspace
    2151         byte_stream += mapping.int2bytes( 4,  vobj_stack_id )   # stack vobj local index
    2152         byte_stream += mapping.int2bytes( 4,  vobj_heap_id )    # heap vobj local index
     2109        byte_stream += mapping.int2bytes( 4,  vseg_stack_id )   # stack vseg local index
     2110        byte_stream += mapping.int2bytes( 4,  vseg_heap_id )    # heap vseg local index
    21532111        byte_stream += mapping.int2bytes( 4,  self.startid )    # index in start vector
    21542112
     
    21572115            print 'lpid       = %d' %  self.p
    21582116            print 'trdid      = %d' %  self.trdid
    2159             print 'stackid    = %d' %  vobj_stack_id
    2160             print 'heapid     = %d' %  vobj_heap_id
     2117            print 'stackid    = %d' %  vseg_stack_id
     2118            print 'heapid     = %d' %  vseg_heap_id
    21612119            print 'startid    = %d' %  self.startid
    21622120
    21632121        return byte_stream
    21642122
    2165 ###########################################################################################
     2123########################################################################################
    21662124class Vseg( object ):
    2167 ###########################################################################################
     2125########################################################################################
    21682126    def __init__( self,
    21692127                  name,
    21702128                  vbase,
     2129                  length,
    21712130                  mode,
     2131                  vtype,
    21722132                  x,
    21732133                  y,
    2174                   psegname,
     2134                  pseg,
    21752135                  identity = False,
    21762136                  local    = False,
    2177                   big      = False ):
     2137                  big      = False,
     2138                  binpath  = '' ):
     2139
     2140        assert (vbase & 0xFFFFFFFF) == vbase
     2141
     2142        assert (length & 0xFFFFFFFF) == length
    21782143
    21792144        assert mode in VSEGMODES
    21802145
     2146        assert vtype in VSEGTYPES
     2147
     2148        assert (vtype != 'ELF') or (binpath != '')
     2149
    21812150        self.index    = 0                   # global index ( set by addVseg() )
    2182         self.name     = name                # vseg name
    2183         self.vbase    = vbase & 0xFFFFFFFF  # virtual base address in vspace
     2151        self.name     = name                # vseg name (unique in vspace)
     2152        self.vbase    = vbase               # virtual base address in vspace
     2153        self.length   = length              # vseg length (bytes)
     2154        self.vtype    = vtype               # vseg type (defined in VSEGTYPES)
    21842155        self.mode     = mode                # CXWU access rights
    21852156        self.x        = x                   # x coordinate of destination cluster
    21862157        self.y        = y                   # y coordinate of destination cluster
    2187         self.psegname = psegname            # name of pseg in destination cluster
     2158        self.psegname = pseg                # name of pseg in destination cluster
    21882159        self.identity = identity            # identity mapping required
    21892160        self.local    = local               # only mapped in local PTAB when true
    21902161        self.big      = big                 # to be mapped in a big physical page
    2191         self.vobjs    = []
     2162        self.binpath  = binpath             # path name for binary file (ELF or BLOB)
     2163
    21922164        return
    21932165
     
    21952167    def xml( self ):  # xml for one vseg
    21962168
    2197         s =  '            <vseg name="%s" vbase="0x%x" mode="%s" x="%d" y="%d" psegname="%s"' \
    2198              % ( self.name, self.vbase, self.mode, self.x, self.y, self.psegname )
    2199         if ( self.identity ): s += ' ident="1"'
    2200         if ( self.local ):    s += ' local="1"'
    2201         if ( self.big ):      s += ' big="1"'
    2202         s += ' >\n'
    2203         for vobj in self.vobjs:  s += vobj.xml()
    2204         s += '            </vseg>\n'
     2169        s =  '            <vseg name="%s"' %(self.name)
     2170        s += ' vbase="0x%x"'               %(self.vbase)
     2171        s += ' length="0x%x"'              %(self.length)
     2172        s += ' type="%s"'                  %(self.vtype)
     2173        s += ' mode="%s"'                  %(self.mode)
     2174        s += '\n                 '
     2175        s += ' x="%d"'                     %(self.x)
     2176        s += ' y="%d"'                     %(self.y)
     2177        s += ' psegname="%s"'              %(self.psegname)
     2178        if ( self.identity ):       s += ' ident="1"'
     2179        if ( self.local ):          s += ' local="1"'
     2180        if ( self.big ):            s += ' big="1"'
     2181        if ( self.binpath != '' ):  s += ' binpath="%s"' %(self.binpath)
     2182        s += ' />\n'
    22052183
    22062184        return s
     
    22142192        # check index
    22152193        if (self.index != expected):
    2216             print '[genmap error] in Vseg.cbin() : vseg global index = %d / expected = %d' \
     2194            print '[genmap error] in Vseg.cbin()'
     2195            print '    vseg global index = %d / expected = %d' \
    22172196                  % (self.index, expected )
    22182197            sys.exit(1)
     
    22262205                pseg_id = pseg.index
    22272206        if (pseg_id == 0xFFFFFFFF):
    2228             print '[genmap error] in Vseg.cbin() : psegname %s not found for vseg %s in cluster %d' \
     2207            print '[genmap error] in Vseg.cbin() : '
     2208            print '    psegname %s not found for vseg %s in cluster %d' \
    22292209                  % ( self.psegname, self.name, cluster_id )
    22302210            sys.exit(1)
     
    22362216                mode_id = x
    22372217        if ( mode_id == 0xFFFFFFFF ):
    2238             print '[genmap error] in Vseg.cbin() : undefined vseg mode %s' % self.mode
     2218            print '[genmap error] in Vseg.cbin() : '
     2219            print '    undefined vseg mode %s' % self.mode
    22392220            sys.exit(1)
    22402221
    2241         # compute vobj_id
    2242         vobj_id = self.vobjs[0].index
     2222        # compute numerical value for vtype
     2223        vtype_id = 0xFFFFFFFF
     2224        for x in xrange( len(VSEGTYPES) ):
     2225            if ( self.vtype == VSEGTYPES[x] ):
     2226                vtype_id = x
     2227        if ( vtype_id == 0xFFFFFFFF ):
     2228            print '[genmap error] in Vseg.cbin()'
     2229            print '    undefined vseg type %s' % self.vtype
     2230            sys.exit(1)
    22432231
    22442232        byte_stream = bytearray()
    22452233        byte_stream += mapping.str2bytes( 32, self.name )       # vseg name
     2234        byte_stream += mapping.str2bytes( 64, self.binpath )    # binpath
    22462235        byte_stream += mapping.int2bytes( 4,  self.vbase )      # virtual base address
    22472236        byte_stream += mapping.int2bytes( 8,  0 )               # physical base address
    2248         byte_stream += mapping.int2bytes( 4,  0 )               # vseg size (bytes)
    2249         byte_stream += mapping.int2bytes( 4,  pseg_id )         # physical segment global index
     2237        byte_stream += mapping.int2bytes( 4,  self.length )     # vseg size (bytes)
     2238        byte_stream += mapping.int2bytes( 4,  pseg_id )         # pseg global index
    22502239        byte_stream += mapping.int2bytes( 4,  mode_id )         # CXWU flags
    2251         byte_stream += mapping.int2bytes( 4,  len(self.vobjs) ) # number of vobjs in vseg
    2252         byte_stream += mapping.int2bytes( 4,  vobj_id )         # first vobj global index
    2253         byte_stream += mapping.int2bytes( 4,  0 )               # linked list of vsegs on pseg
     2240        byte_stream += mapping.int2bytes( 4,  vtype_id )        # vseg type
    22542241        byte_stream += mapping.int2bytes( 1,  0 )               # mapped when non zero
    2255         byte_stream += mapping.int2bytes( 1,  self.identity )   # identity mapping if non zero
     2242        byte_stream += mapping.int2bytes( 1,  self.identity )   # identity mapping
    22562243        byte_stream += mapping.int2bytes( 1,  self.local )      # only mapped in local PTAB
    2257         byte_stream += mapping.int2bytes( 1,  self.big )        # to be mapped in big physical page
    2258 
    2259         if ( verbose ):
    2260             print 'vbase      = %x' %  self.vbase
    2261             print 'pseg_id    = %d' %  pseg_id
    2262             print 'mode       = %s' %  self.mode
    2263             print 'nb_vobjs   = %d' %  len(self.vobjs)
    2264             print 'vobj_id    = %d' %  vobj_id
    2265 
    2266         return byte_stream
    2267 
    2268 ###########################################################################################
    2269 class Vobj( object ):
    2270 ###########################################################################################
    2271     def __init__( self,
    2272                   name,
    2273                   length,
    2274                   vtype,
    2275                   binpath = '',
    2276                   align   = 0,
    2277                   init    = 0 ):
    2278 
    2279         assert vtype in ['ELF','BLOB','PTAB','PERI','MWMR','LOCK', \
    2280                          'BUFFER','BARRIER','CONST','MEMSPACE','SCHED','HEAP']
    2281 
    2282         assert (vtype != 'ELF') or (binpath != '')
    2283 
    2284         self.index    = 0        # global index ( set by addVobj() )
    2285         self.name     = name     # vobj name (unique in vspace)
    2286         self.vtype    = vtype    # vobj type (defined in mapping_info.h)
    2287         self.length   = length   # vobj size (bytes)
    2288         self.binpath  = binpath  # pathname for (ELF type)
    2289         self.align    = align    # required alignment (logarithm of 2)
    2290         self.init     = init     # initialisation value (for BARRIER or MWMR types)
    2291 
    2292         return
    2293 
    2294     ################
    2295     def xml( self ):  # xml for a vobj
    2296 
    2297         s = '            <vobj name="%s" type="%s" length="0x%x"' \
    2298                            % ( self.name, self.vtype, self.length )
    2299         if (self.binpath != ''):   s += ' binpath="%s"' % (self.binpath)
    2300         if (self.align   != 0 ):   s += ' align="%d"' % (self.align)
    2301         if (self.init    != 0 ):   s += ' init="%d"' % (self.init)
    2302         s += ' />\n'
    2303 
    2304         return s
    2305 
    2306     #############################################
    2307     def cbin( self, mapping, verbose, expected ):    # C binary structure for Vobj
    2308 
    2309         # check index
    2310         if (self.index != expected):
    2311             print '[genmap error] in Vobj.cbin() : vobj global index = %d / expected = %d' \
    2312                   % (self.index, expected )
    2313             sys.exit(1)
    2314         elif ( verbose ):
    2315             print '*** cbin for vobj[%d] %s' % (self.index, self.name)
    2316 
    2317         # compute numerical value for vtype
    2318         vtype_int = 0xFFFFFFFF
    2319         for x in xrange( len(VOBJTYPES) ):
    2320             if ( self.vtype == VOBJTYPES[x] ):
    2321                 vtype_int = x
    2322         if ( vtype_int == 0xFFFFFFFF ):
    2323             print '[genmap error] in Vobj.cbin() : undefined vobj type %s' % self.vtype
    2324             sys.exit(1)
    2325 
    2326         byte_stream = bytearray()
    2327         byte_stream += mapping.str2bytes( 32, self.name )       # vobj name
    2328         byte_stream += mapping.str2bytes( 64, self.binpath )    # pathname for .elf file
    2329         byte_stream += mapping.int2bytes( 4 , vtype_int )       # vobj type
    2330         byte_stream += mapping.int2bytes( 4 , self.length )     # vobj size
    2331         byte_stream += mapping.int2bytes( 4 , self.align )      # required alignment
    2332         byte_stream += mapping.int2bytes( 4 , 0 )               # virtual base address
    2333         byte_stream += mapping.int2bytes( 4 , self.init )       # init value
     2244        byte_stream += mapping.int2bytes( 1,  self.big )        # to be mapped in BPP
    23342245
    23352246        if ( verbose ):
    23362247            print 'binpath    = %s' %  self.binpath
    2337             print 'type       = %s' %  self.vtype
     2248            print 'vbase      = %x' %  self.vbase
     2249            print 'pbase      = 0'
    23382250            print 'length     = %x' %  self.length
     2251            print 'pseg_id    = %d' %  pseg_id
     2252            print 'mode       = %d' %  mode_id
     2253            print 'type       = %d' %  vtype_id
     2254            print 'mapped     = 0'
     2255            print 'ident      = %d' %  self.identity
     2256            print 'local      = %d' %  self.local
     2257            print 'big        = %d' %  self.big
    23392258
    23402259        return byte_stream
    23412260
    2342 ###########################################################################################
     2261######################################################################################
    23432262class Processor ( object ):
    2344 ###########################################################################################
     2263######################################################################################
    23452264    def __init__( self,
    23462265                  x,
     
    23672286        # check index
    23682287        if (self.index != expected):
    2369             print '[genmap error] in Proc.cbin() : proc global index = %d / expected = %d' \
    2370                   % (self.index, expected )
     2288            print '[genmap error] in Proc.cbin()'
     2289            print '    proc global index = %d / expected = %d' % (self.index,expected)
    23712290            sys.exit(1)
    23722291
     
    23762295        return byte_stream
    23772296
    2378 ###########################################################################################
     2297######################################################################################
    23792298class Pseg ( object ):
    2380 ###########################################################################################
     2299######################################################################################
    23812300    def __init__( self,
    23822301                  name,
     
    24142333        # check index
    24152334        if (self.index != expected):
    2416             print '[genmap error] in Pseg.cbin() : pseg global index = %d / expected = %d' \
    2417                   % (self.index, expected )
     2335            print '[genmap error] in Pseg.cbin()'
     2336            print '    pseg global index = %d / expected = %d' % (self.index,expected)
    24182337            sys.exit(1)
    24192338
     
    24212340        segtype_int = 0xFFFFFFFF
    24222341        for x in xrange( len(PSEGTYPES) ):
    2423             if ( self.segtype == PSEGTYPES[x] ):
    2424                 segtype_int = x
     2342            if ( self.segtype == PSEGTYPES[x] ): segtype_int = x
     2343
    24252344        if ( segtype_int == 0xFFFFFFFF ):
    2426             print '[genmap error] in Pseg.cbin() : undefined segment type %s' % self.segtype
     2345            print '[genmap error] in Pseg.cbin()'
     2346            print '    undefined segment type %s' % self.segtype
    24272347            sys.exit(1)
    24282348
     
    24422362        return byte_stream
    24432363
    2444 ###########################################################################################
     2364######################################################################################
    24452365class Periph ( object ):
    2446 ###########################################################################################
     2366######################################################################################
    24472367    def __init__( self,
    24482368                  pseg,               # associated pseg
     
    24882408        # check index
    24892409        if (self.index != expected):
    2490             print '[genmap error] in Periph.cbin() : periph global index = %d / expected = %d' \
    2491                   % (self.index, expected )
     2410            print '[genmap error] in Periph.cbin()'
     2411            print '    periph global index = %d / expected = %d' % (self.index,expected)
    24922412            sys.exit(1)
    24932413
     
    25052425        for x in xrange( len(PERIPHTYPES) ):
    25062426            if ( self.ptype == PERIPHTYPES[x] ):  ptype_id = x
     2427
    25072428        if ( ptype_id == 0xFFFFFFFF ):
    2508             print '[genmap error] in Periph.cbin() : undefined peripheral type %s' % self.ptype
     2429            print '[genmap error] in Periph.cbin()'
     2430            print '    undefined peripheral type %s' % self.ptype
    25092431            sys.exit(1)
    25102432
     
    25312453        return byte_stream
    25322454
    2533 ###########################################################################################
     2455######################################################################################
    25342456class Irq ( object ):
    2535 ###########################################################################################
     2457######################################################################################
    25362458    def __init__( self,
    25372459                  irqtype,         # input IRQ type : HWI / WTI / PTI (for XCU only)
     
    25652487        # check index
    25662488        if (self.index != expected):
    2567             print '[genmap error] in Irq.cbin() : irq global index = %d / expected = %d' \
    2568                   % (self.index, expected )
     2489            print '[genmap error] in Irq.cbin()'
     2490            print '    irq global index = %d / expected = %d' % (self.index,expected)
    25692491            sys.exit(1)
    25702492
     
    25722494        irqtype_id = 0xFFFFFFFF
    25732495        for x in xrange( len(IRQTYPES) ):
    2574             if ( self.irqtype == IRQTYPES[x] ):
    2575                 irqtype_id = x
     2496            if ( self.irqtype == IRQTYPES[x] ): irqtype_id = x
     2497
    25762498        if ( irqtype_id == 0xFFFFFFFF ):
    2577             print '[genmap error] in Irq.cbin() : undefined irqtype %s' % self.irqtype
     2499            print '[genmap error] in Irq.cbin()'
     2500            print '    undefined irqtype %s' % self.irqtype
    25782501            sys.exit(1)
    25792502
     
    25812504        isrtype_id = 0xFFFFFFFF
    25822505        for x in xrange( len(ISRTYPES) ):
    2583             if ( self.isrtype == ISRTYPES[x] ):
    2584                 isrtype_id = x
     2506            if ( self.isrtype == ISRTYPES[x] ): isrtype_id = x
     2507
    25852508        if ( isrtype_id == 0xFFFFFFFF ):
    2586             print '[genmap error] in Irq.cbin() : undefined isrtype %s' % self.isrtype
     2509            print '[genmap error] in Irq.cbin()'
     2510            print '    undefined isrtype %s' % self.isrtype
    25872511            sys.exit(1)
    25882512
     
    26032527        return byte_stream
    26042528
    2605 ###########################################################################################
     2529######################################################################################
    26062530class Coproc ( object ):
    2607 ###########################################################################################
     2531######################################################################################
    26082532    def __init__( self,
    26092533                  pseg ):           # associated pseg
     
    26312555        # check index
    26322556        if (self.index != expected):
    2633             print '[genmap error] in Coproc.cbin() : coproc global index = %d / expected = %d' \
    2634                   % (self.index, expected )
     2557            print '[genmap error] in Coproc.cbin()'
     2558            print '    coproc global index = %d / expected = %d' % (self.index,expected)
    26352559            sys.exit(1)
    26362560
     
    26552579        return byte_stream
    26562580
    2657 ###########################################################################################
     2581######################################################################################
    26582582class Cpport ( object ):
    2659 ###########################################################################################
     2583######################################################################################
    26602584    def __init__( self,
    26612585                  direction,
     
    26662590        self.direction  = direction   # TO_COPROC / FROM_COPROC
    26672591        self.vspacename = vspacename  # name of vspace containing mwmr channel
    2668         self.mwmrname   = mwmrname    # name of vobj defining mwmr channel
     2592        self.mwmrname   = mwmrname    # name of vseg defining mwmr channel
    26692593
    26702594        return
     
    26862610        # check index
    26872611        if ( self.index != expected ):
    2688             print '[genmap error] in Cpport.cbin() : port global index = %d / expected = %d' \
    2689                   % ( self.index, expected )
     2612            print '[genmap error] in Cpport.cbin()'
     2613            print '    port global index = %d / expected = %d' % (self.index,expected)
    26902614            sys.exit(1)
    26912615
     
    26992623        vspace_id = 0xFFFFFFFF
    27002624        for vspace in mapping.vspaces:
    2701             if ( self.vspacename == vspace.name ):
    2702                 vspace_id = vspace.index
     2625            if ( self.vspacename == vspace.name ): vspace_id = vspace.index
     2626
    27032627        if (vspace_id == 0xFFFFFFFF):
    2704             print '[genmap error] in Cpport.cbin() : vspace name %s not found' \
    2705                   % ( self.vspacename )
     2628            print '[genmap error] in Cpport.cbin()'
     2629            print '    vspace name %s not found'  % ( self.vspacename )
    27062630            sys.exit(1)
    27072631
    2708         # compute mwmr global index
     2632        # compute mwmr vseg global index
    27092633        mwmr_id = 0xFFFFFFFF
    27102634        for vseg in mapping.vspace[vspace_id].vsegs:
    2711             for vobj in vseg.vobjs:
    2712                 if (self.mwmrname == vobj.name):
    2713                     mwmr_id = vobj.index
     2635                if (self.mwmrname == vseg.name): mwmr_id = vseg.index
     2636
    27142637        if (mwmr_id == 0xFFFFFFFF):
    2715             print '[genmap error] in Cpport.cbin() : mwmr vobj name %s not found in vspace %s' \
     2638            print '[genmap error] in Cpport.cbin()'
     2639            print '    mwmr vseg name %s not found in vspace %s' \
    27162640                  % ( self.mwmrname, self.vspacename )
    27172641            sys.exit(1)
     
    27202644        byte_stream += mapping.int2bytes( 4 , dir_int )         # pseg global index
    27212645        byte_stream += mapping.int2bytes( 4 , vspace_id )       # vspace global index
    2722         byte_stream += mapping.int2bytes( 4 , mwmr_id )         # mwmr vobj global index
     2646        byte_stream += mapping.int2bytes( 4 , mwmr_id )         # mwmr vseg global index
    27232647
    27242648        if ( verbose ):
Note: See TracChangeset for help on using the changeset viewer.