Changeset 937 for trunk/platforms


Ignore:
Timestamp:
Feb 1, 2015, 5:06:41 PM (9 years ago)
Author:
alain
Message:

Reducing the number of external TTY terminals to 8, in both the top.cpp and arch.py files.

Location:
trunk/platforms/tsar_generic_leti
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/platforms/tsar_generic_leti/arch.py

    r870 r937  
    1111#  This file contains a mapping generator for the "tsar_generic_leti" platform.
    1212#  This includes both the hardware architecture (clusters, processors,
    13 #  peripherals, physical space segmentation) and the mapping of all kernel
    14 #  objects (global vsegs).
    15 #
    16 #  The "constructor" parameters are:
    17 #  - x_size         : number of clusters in a row
    18 #  - y_size         : number of clusters in a column
    19 #  - nb_procs       : number of processors per cluster
     13#  peripherals, physical space segmentation) and the mapping of all boot
     14#  and kernel objects (global vsegs).
     15#
     16#  The x_size & y_size parameters define the total number of clusters.
     17#  The upper row (y = y_size-1) does not contain processors or memory.
     18#
     19#  It does not use the IOB component:
     20#  The external peripherals are located in cluster[x_size-1][y_size-1].
     21#
     22#  It does not use an external ROM, as the preloader code is (pre)loaded
     23#  at address 0x0, in the physical memory of cluster[0][0].
     24#
     25#  It can use an - optional - RAMDISK located in cluster[0][0].
     26#
     27#  The others hardware parameters are:
    2028#  - fbf_width      : frame_buffer width = frame_buffer heigth
    21 #
    22 #  The "hidden" parameters (defined below) are:
    2329#  - nb_ttys        : number of TTY channels
    2430#  - nb_nics        : number of NIC channels
    25 #  - x_io           : cluster_io x coordinate
    26 #  - y_io           : cluster_io y coordinate
    27 #  - x_width        : number of bits for x coordinate
    28 #  - y_width        : number of bits for y coordinate
    29 #  - paddr_width    : number of bits for physical address
     31#  - nb_cmas        : number of CMA channels
    3032#  - irq_per_proc   : number of input IRQs per processor
    31 #  - use_ramdisk    : use a ramdisk when True
     33#  - use_ramdisk    : use a RAMDISK when True
    3234#  - peri_increment : address increment for replicated peripherals
    3335#
    34 # Regarding physical memory allocation, there is one allocator per cluster:
    35 # - We use only one big physical page (2 Mbytes) for the five boot vsegs,
    36 #   allocated in cluster[0,0], identity mapping.
    37 # - We use one big page per cluster for the kernel vsegs.
    38 #   The kernel_code, kernel_init and kernel_ptab can be replicated in all clusters.
    39 #   The kernel_data and kernel_uncdata shared vsegs are only mapped in cluster[0,0].
    40 # - We use 8 small physical pages (4 Kbytes) per cluster for the schedulers.
    41 # - We use one big page for each external peripheral in IO cluster,
    42 # - We use one small page per cluster for each internal peripheral.
    43 ###################################################################################
     36#  Regarding the boot and kernel vsegs mapping :
     37#  - We use one big physical page (2 Mbytes) for the preloader and the four
     38#    boot vsegs, all allocated in cluster[0,0].
     39#  - We use the 16 next big pages in cluster[0][0] to implement the RAMDISK.
     40#  - We use one big page per cluster for the replicated kernel code vsegs.
     41#  - We use one big page in cluster[0][0] for the kernel data vseg.
     42#  - We use one big page per cluster for the distributed kernel heap vsegs.
     43#  - We use one big page per cluster for the distributed ptab vsegs.
     44#  - We use small physical pages (4 Kbytes) per cluster for the schedulers.
     45#  - We use one big page for each external peripheral in IO cluster,
     46#  - We use one small page per cluster for each internal peripheral.
     47###############################################################################
    4448
    4549########################
    4650def arch( x_size    = 2,
    4751          y_size    = 2,
    48           nb_procs  = 2,
     52          nb_procs  = 4,
     53          nb_ttys   = 1,
    4954          fbf_width = 128 ):
    5055
    5156    ### define architecture constants
    5257
    53     nb_ttys         = 1
    54     nb_nics         = 2
    55     x_io            = 0
    56     y_io            = 0
     58    nb_nics         = 1
     59    nb_cmas         = 2
     60    x_io            = x_size - 1
     61    y_io            = y_size - 1
    5762    x_width         = 4
    5863    y_width         = 4
     
    6065    paddr_width     = 40
    6166    irq_per_proc    = 4
    62     use_ramdisk     = True
    63     peri_increment  = 0x10000    # distributed peripherals vbase address increment
    64     sched_increment = 0x10000    # distributed schedulers vbase address increment
    65     ptab_increment  = 0x200000   # distributed page tables vbase address increment
    66     reset_address   = 0x00000000
     67    use_ramdisk     = False
     68    peri_increment  = 0x10000     # distributed peripherals vbase increment
     69    reset_address   = 0x00000000  # wired preloader pbase address
    6770
    6871    ### parameters checking
     
    7073    assert( nb_procs <= (1 << p_width) )
    7174
    72     assert( (x_size >= 1) and (x_size <= 16) )
    73 
    74     assert( (y_size >= 1) and (y_size <= 16) )
    75 
    76     assert( nb_ttys == 1 )
    77 
    78     assert( ((x_io == 0) and (y_io == 0)) or
    79             ((x_io == x_size-1) and (y_io == y_size-1)) )
    80 
    81     platform_name  = 'tsar_leti_%d_%d_%d' % ( x_size, y_size, nb_procs )
    82 
    83     ### define physical segments
    84     ### These segments are replicated in all clusters
    85 
    86     ram_base = 0x0000000000
     75    assert( x_size <= (1 << x_width) )
     76
     77    assert( y_size <= (1 << y_width) )
     78
     79    ### define type and name
     80
     81    platform_type  = 'tsar_leti'
     82    platform_name  = '%s_%d_%d_%d' % (platform_type, x_size, y_size, nb_procs )
     83
     84    ### define physical segments replicated in all clusters
     85    ### the base address is extended by the cluster_xy (8 bits)
     86
     87    ram_base = 0x00000000
    8788    ram_size = 0x4000000                   # 64 Mbytes
    8889
    89     xcu_base = 0x00F0000000
     90    xcu_base = 0xF0000000
    9091    xcu_size = 0x1000                      # 4 Kbytes
    9192
    92     mmc_base = 0x00E0000000
     93    mmc_base = 0xF1000000
    9394    mmc_size = 0x1000                      # 4 Kbytes
    9495
     
    9697    ## These segments are only defined in cluster_io
    9798
    98     offset_io = ((x_io << y_width) + y_io) << (paddr_width - x_width - y_width)
    99 
    100     bdv_base  = 0x00F2000000 + offset_io
     99    cluster_xy = ((x_io << y_width) + y_io) << (paddr_width - x_width - y_width)
     100
     101    bdv_base  = 0xF2000000 + cluster_xy
    101102    bdv_size  = 0x1000                     # 4kbytes
    102103
    103     tty_base  = 0x00F4000000 + offset_io
     104    tty_base  = 0xF4000000 + cluster_xy
    104105    tty_size  = 0x4000                     # 16 Kbytes
    105106
    106     nic_base  = 0x00F7000000 + offset_io
     107    nic_base  = 0xF7000000 + cluster_xy
    107108    nic_size  = 0x80000                    # 512 kbytes
    108109
    109     cma_base  = 0x00F8000000 + offset_io
     110    cma_base  = 0xF8000000 + cluster_xy
    110111    cma_size  = 0x1000 * 2 * nb_nics       # 4 kbytes * 2 * nb_nics
    111112
    112     fbf_base  = 0x00F3000000 + offset_io
     113    pic_base  = 0xF9000000 + cluster_xy
     114    pic_size  = 0x1000                     # 4 Kbytes
     115
     116    fbf_base  = 0xF3000000 + cluster_xy
    113117    fbf_size  = fbf_width * fbf_width      # fbf_width * fbf_width bytes
    114118
    115     pic_base  = 0x00F9000000 + offset_io
    116     pic_size  = 0x1000                     # 4 Kbytes
    117 
    118     rdk_base  = 0x02000000
    119     rdk_size  = 0x02000000                 # 32 Mbytes
    120119
    121120    ### define preloader & bootloader vsegs base addresses and sizes
     
    133132
    134133    boot_data_vbase      = 0x000D0000      # ident
    135     boot_data_size       = 0x00080000      # 512 Kbytes
    136 
    137     boot_stack_vbase     = 0x00150000      # ident
    138     boot_stack_size      = 0x00050000      # 320 Kbytes
     134    boot_data_size       = 0x000C0000      # 768 Kbytes
     135
     136    boot_stack_vbase     = 0x00190000      # ident
     137    boot_stack_size      = 0x00070000      # 448 Kbytes
     138
     139    ### define ramdisk vseg / must be identity mapping in cluster[0][0]
     140    ### occupies 15 BPP after the boot 
     141    ramdisk_vbase        = 0x00200000
     142    ramdisk_size         = 0x02000000      # 32 Mbytes
    139143
    140144    ### define kernel vsegs base addresses and sizes
    141     ### code, init, ptab & sched vsegs are replicated in all clusters.
     145    ### code, init, ptab, heap & sched vsegs are replicated in all clusters.
    142146    ### data & uncdata vsegs are only mapped in cluster[0][0].
    143     ### - We pack code, init, data vsegs in the same BIG page.
    144     ### - We use another BIG page for the ptab vseg.
    145     ### - We use 2*nb_procs SMALL pages for the sched vseg.
    146     ### - we use one SMALL page for uncdata
    147     ### => kernel cost is 2 BPPs and (2*n + 1) SPPs per cluster.
    148147
    149148    kernel_code_vbase    = 0x80000000
    150     kernel_code_size     = 0x00080000      # 512 Kbytes per cluster
    151 
    152     kernel_init_vbase    = 0x80080000
    153     kernel_init_size     = 0x00080000      # 512 Kbytes per cluster
    154 
    155     kernel_data_vbase    = 0x80100000
    156     kernel_data_size     = 0x00100000      # 1 Mbytes in cluster[0][0]
    157 
    158     kernel_uncdata_vbase = 0x80200000
    159     kernel_uncdata_size  = 0x00001000      # 4 Kbytes
    160 
    161     kernel_sched_vbase   = 0x80400000            # distributed in all clusters
    162     kernel_sched_size    = 0x00002000 * nb_procs # 8 kbytes per processor
    163 
    164     kernel_ptab_vbase    = 0xC0000000
     149    kernel_code_size     = 0x00100000      # 1 Mbytes per cluster
     150
     151    kernel_init_vbase    = 0x80100000
     152    kernel_init_size     = 0x00100000      # 1 Mbytes per cluster
     153
     154    kernel_data_vbase    = 0x90000000
     155    kernel_data_size     = 0x00200000      # 2 Mbytes in cluster[0][0]
     156
     157    kernel_uncdata_vbase = 0x90200000
     158    kernel_uncdata_size  = 0x00001000      # 4 Kbytes in cluster[0][0]
     159
     160    kernel_ptab_vbase    = 0xE0000000
    165161    kernel_ptab_size     = 0x00200000      # 2 Mbytes per cluster
    166162
     163    kernel_heap_vbase    = 0xD0000000
     164    kernel_heap_size     = 0x00200000      # 2 Mbytes per cluster
     165
     166    kernel_sched_vbase   = 0xA0000000
     167    kernel_sched_size    = 0x00002000 * nb_procs # 8 kbytes per proc per cluster
     168
     169    #####################
    167170    ### create mapping
     171    #####################
    168172
    169173    mapping = Mapping( name           = platform_name,
     174                       p_type         = platform_type,
    170175                       x_size         = x_size,
    171176                       y_size         = y_size,
     
    185190                       ram_size       = ram_size )
    186191
    187     ###  external peripherals (accessible in cluster[0,0] only for this mapping)
    188 
    189     bdv = mapping.addPeriph( 'BDV', base = bdv_base, size = bdv_size, ptype = 'IOC', subtype = 'BDV' )
    190 
    191     tty = mapping.addPeriph( 'TTY', base = tty_base, size = tty_size, ptype = 'TTY', channels = nb_ttys )
    192 
    193     if x_io != 0 or y_io != 0:
    194         nic = mapping.addPeriph( 'NIC', base = nic_base, size = nic_size, ptype = 'NIC', channels = nb_nics )
    195         cma = mapping.addPeriph( 'CMA', base = cma_base, size = cma_size, ptype = 'CMA', channels = 2*nb_nics )
    196         fbf = mapping.addPeriph( 'FBF', base = fbf_base, size = fbf_size, ptype = 'FBF', arg = fbf_width )
    197         pic = mapping.addPeriph( 'PIC', base = pic_base, size = pic_size, ptype = 'PIC', channels = 32 )
    198 
    199         mapping.addIrq( pic, index = 0 , isrtype = 'ISR_NIC_RX', channel = 0 )
    200         mapping.addIrq( pic, index = 1 , isrtype = 'ISR_NIC_RX', channel = 1 )
    201         mapping.addIrq( pic, index = 2 , isrtype = 'ISR_NIC_TX', channel = 0 )
    202         mapping.addIrq( pic, index = 3 , isrtype = 'ISR_NIC_TX', channel = 1 )
    203         mapping.addIrq( pic, index = 4 , isrtype = 'ISR_CMA'   , channel = 0 )
    204         mapping.addIrq( pic, index = 5 , isrtype = 'ISR_CMA'   , channel = 1 )
    205         mapping.addIrq( pic, index = 6 , isrtype = 'ISR_CMA'   , channel = 2 )
    206         mapping.addIrq( pic, index = 7 , isrtype = 'ISR_CMA'   , channel = 3 )
    207         mapping.addIrq( pic, index = 8 , isrtype = 'ISR_BDV'   , channel = 0 )
    208         mapping.addIrq( pic, index = 16, isrtype = 'ISR_TTY_RX', channel = 0 )
    209 
    210         mapping.addGlobal( 'seg_nic', nic_base, nic_size, '__W_',
    211                            vtype = 'PERI', x = 0, y = 0, pseg = 'NIC',
    212                            local = False, big = True )
    213 
    214         mapping.addGlobal( 'seg_cma', cma_base, cma_size, '__W_',
    215                            vtype = 'PERI', x = 0, y = 0, pseg = 'CMA',
    216                            local = False, big = True )
    217 
    218         mapping.addGlobal( 'seg_fbf', fbf_base, fbf_size, '__W_',
    219                            vtype = 'PERI', x = 0, y = 0, pseg = 'FBF',
    220                            local = False, big = True )
    221 
    222         mapping.addGlobal( 'seg_pic', pic_base, pic_size, '__W_',
    223                            vtype = 'PERI', x = 0, y = 0, pseg = 'PIC',
    224                            local = False, big = True )
    225 
    226     ### hardware components replicated in all clusters
     192    ###########################
     193    ### Hardware Description
     194    ###########################
    227195
    228196    for x in xrange( x_size ):
     
    230198            cluster_xy = (x << y_width) + y;
    231199            offset     = cluster_xy << (paddr_width - x_width - y_width)
    232 
    233             ram = mapping.addRam( 'RAM', base = ram_base + offset, size = ram_size )
    234 
    235             mmc = mapping.addPeriph( 'MMC', base = mmc_base + offset, size = mmc_size,
    236                                      ptype = 'MMC' )
    237 
    238             xcu = mapping.addPeriph( 'XCU', base = xcu_base + offset, size = xcu_size,
    239                                      ptype = 'XCU', channels = nb_procs * irq_per_proc, arg = 16 )
    240 
    241             # IRQs replicated in all clusters
    242             mapping.addIrq( xcu, index = 8, isrtype = 'ISR_MMC' )
    243 
    244             # IRQ in IO cluster (0,0)
    245             if x == 0 and y == 0:
    246                 mapping.addIrq( xcu, index = 9 , isrtype = 'ISR_BDV'    )
    247                 mapping.addIrq( xcu, index = 10, isrtype = 'ISR_TTY_RX' )
    248 
    249             # processors
    250             for p in xrange ( nb_procs ):
    251                 mapping.addProc( x, y, p )
    252 
    253     ### global vsegs for preloader & boot_loader
     200 
     201            ### components replicated in all clusters but the upper row
     202            if ( y < (y_size - 1) ):
     203
     204                ram = mapping.addRam( 'RAM', base = ram_base + offset,
     205                                      size = ram_size )
     206
     207                mmc = mapping.addPeriph( 'MMC', base = mmc_base + offset,
     208                                         size = mmc_size, ptype = 'MMC' )
     209
     210                xcu = mapping.addPeriph( 'XCU', base = xcu_base + offset,
     211                                         size = xcu_size, ptype = 'XCU',
     212                                         channels = nb_procs * irq_per_proc, arg = 16 )
     213
     214                mapping.addIrq( xcu, index = 8, isrtype = 'ISR_MMC' )
     215
     216                for p in xrange ( nb_procs ):
     217                    mapping.addProc( x, y, p )
     218
     219            ###  external peripherals in cluster_io
     220            if ( (x==x_io) and (y==y_io) ):
     221
     222                bdv = mapping.addPeriph( 'BDV', base = bdv_base, size = bdv_size,
     223                                         ptype = 'IOC', subtype = 'BDV' )
     224
     225                tty = mapping.addPeriph( 'TTY', base = tty_base, size = tty_size,
     226                                         ptype = 'TTY', channels = nb_ttys )
     227
     228                nic = mapping.addPeriph( 'NIC', base = nic_base, size = nic_size,
     229                                         ptype = 'NIC', channels = nb_nics )
     230
     231                cma = mapping.addPeriph( 'CMA', base = cma_base, size = cma_size,
     232                                         ptype = 'CMA', channels = nb_cmas )
     233
     234                fbf = mapping.addPeriph( 'FBF', base = fbf_base, size = fbf_size,
     235                                         ptype = 'FBF', arg = fbf_width )
     236
     237                pic = mapping.addPeriph( 'PIC', base = pic_base, size = pic_size,
     238                                         ptype = 'PIC', channels = 32 )
     239
     240                mapping.addIrq( pic, index = 0 , isrtype = 'ISR_NIC_RX', channel = 0 )
     241                mapping.addIrq( pic, index = 1 , isrtype = 'ISR_NIC_RX', channel = 1 )
     242
     243                mapping.addIrq( pic, index = 2 , isrtype = 'ISR_NIC_TX', channel = 0 )
     244                mapping.addIrq( pic, index = 3 , isrtype = 'ISR_NIC_TX', channel = 1 )
     245
     246                mapping.addIrq( pic, index = 4 , isrtype = 'ISR_CMA'   , channel = 0 )
     247                mapping.addIrq( pic, index = 5 , isrtype = 'ISR_CMA'   , channel = 1 )
     248                mapping.addIrq( pic, index = 6 , isrtype = 'ISR_CMA'   , channel = 2 )
     249                mapping.addIrq( pic, index = 7 , isrtype = 'ISR_CMA'   , channel = 3 )
     250
     251                mapping.addIrq( pic, index = 8 , isrtype = 'ISR_BDV'   , channel = 0 )
     252
     253                mapping.addIrq( pic, index = 16, isrtype = 'ISR_TTY_RX', channel = 0 )
     254                mapping.addIrq( pic, index = 17, isrtype = 'ISR_TTY_RX', channel = 1 )
     255                mapping.addIrq( pic, index = 18, isrtype = 'ISR_TTY_RX', channel = 2 )
     256                mapping.addIrq( pic, index = 19, isrtype = 'ISR_TTY_RX', channel = 3 )
     257                mapping.addIrq( pic, index = 20, isrtype = 'ISR_TTY_RX', channel = 4 )
     258                mapping.addIrq( pic, index = 21, isrtype = 'ISR_TTY_RX', channel = 5 )
     259                mapping.addIrq( pic, index = 22, isrtype = 'ISR_TTY_RX', channel = 6 )
     260                mapping.addIrq( pic, index = 23, isrtype = 'ISR_TTY_RX', channel = 7 )
     261
     262    ###################################
     263    ### boot & kernel vsegs mapping
     264    ###################################
     265
     266    ### global vsegs for preloader & boot_loader are mapped in cluster[0][0]
    254267    ### we want to pack those 5 vsegs in the same big page
    255268    ### => same flags CXW_ / identity mapping / non local / big page
     
    275288                       identity = True, local = False, big = True )
    276289
     290    ### global vseg for RAM-DISK in cluster[0][0]
     291    ### identity mapping / non local / big pages
     292    if use_ramdisk:
     293
     294        mapping.addGlobal( 'seg_ramdisk', ramdisk_vbase, ramdisk_size,
     295                           'C_W_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM',
     296                           identity = True, local = True, big = True )
     297
    277298    ### global vsegs kernel_code, kernel_init : local / big page
    278     ### replicated in all clusters with the same name (same vbase)
    279     for x in xrange( x_size ):
    280         for y in xrange( y_size ):
    281             mapping.addGlobal( 'seg_kernel_code', kernel_code_vbase, kernel_code_size,
     299    ### replicated in all clusters containing processors
     300    ### same content => same name / same vbase
     301    for x in xrange( x_size ):
     302        for y in xrange( y_size - 1 ):
     303
     304            mapping.addGlobal( 'seg_kernel_code',
     305                               kernel_code_vbase, kernel_code_size,
    282306                               'CXW_', vtype = 'ELF', x = x, y = y, pseg = 'RAM',
    283307                               binpath = 'build/kernel/kernel.elf',
    284308                               local = True, big = True )
    285309
    286             mapping.addGlobal( 'seg_kernel_init', kernel_init_vbase, kernel_init_size,
     310            mapping.addGlobal( 'seg_kernel_init',
     311                               kernel_init_vbase, kernel_init_size,
    287312                               'CXW_', vtype = 'ELF', x = x, y = y, pseg = 'RAM',
    288313                               binpath = 'build/kernel/kernel.elf',
     
    291316    ### global vseg kernel_data: non local / big page
    292317    ### Only mapped in cluster[0][0]
    293     mapping.addGlobal( 'seg_kernel_data', kernel_data_vbase, kernel_data_size,
    294                        'CXW_', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM',
    295                        binpath = 'build/kernel/kernel.elf',
     318    mapping.addGlobal( 'seg_kernel_data',
     319                       kernel_data_vbase, kernel_data_size,
     320                       'C_W_', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM',
     321                       binpath = 'build/kernel/kernel.elf',
    296322                       local = False, big = True )
    297323
    298324    ### global vseg kernel_uncdata: non local / small page
    299325    ### Only mapped in cluster[0][0]
    300     mapping.addGlobal( 'seg_kernel_uncdata', kernel_uncdata_vbase, kernel_uncdata_size,
     326    mapping.addGlobal( 'seg_kernel_uncdata',
     327                        kernel_uncdata_vbase, kernel_uncdata_size,
    301328                       '__W_', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM',
    302                        binpath = 'build/kernel/kernel.elf',
     329                       binpath = 'build/kernel/kernel.elf', 
    303330                       local = False, big = False )
    304331
    305     for x in xrange( x_size ):
    306         for y in xrange( y_size ):
    307             cluster_xy = (x << y_width) + y;
    308 
    309             ### Global vsegs kernel_ptab_x_y: non local / big pages
    310             ### replicated in all clusters with name indexed by (x,y)
    311             ### as vbase address is incremented by (cluster_xy * vseg_increment)
    312             offset = cluster_xy * ptab_increment
    313             mapping.addGlobal( 'seg_kernel_ptab_%d_%d' %(x,y), kernel_ptab_vbase + offset, kernel_ptab_size,
     332    ### Global vsegs kernel_ptab_x_y: non local / big page
     333    ### replicated in all clusters containing processors
     334    ### different content => name & vbase indexed by (x,y)
     335    for x in xrange( x_size ):
     336        for y in xrange( y_size - 1 ):
     337            offset = ((x << y_width) + y) * kernel_ptab_size
     338
     339            mapping.addGlobal( 'seg_kernel_ptab_%d_%d' %(x,y),
     340                              kernel_ptab_vbase + offset, kernel_ptab_size,
    314341                               'CXW_', vtype = 'PTAB', x = x, y = y, pseg = 'RAM',
    315342                               local = False, big = True )
    316343
    317             ### global vsegs kernel_sched : non local / small pages
    318             ### allocated in all clusters with name indexed by (x,y)
    319             ### as vbase address is incremented by (cluster_xy * vseg_increment)
    320             offset = cluster_xy * sched_increment
    321             mapping.addGlobal( 'seg_kernel_sched_%d_%d' %(x,y), kernel_sched_vbase + offset, kernel_sched_size,
     344    ### global vsegs kernel_sched : non local / small pages
     345    ### allocated in all clusters containing processors
     346    ### different content => name & vbase indexed by (x,y)
     347    for x in xrange( x_size ):
     348        for y in xrange( y_size - 1 ):
     349            offset = ((x << y_width) + y) * kernel_ptab_size
     350
     351            mapping.addGlobal( 'seg_kernel_sched_%d_%d' %(x,y),
     352                               kernel_sched_vbase + offset , kernel_sched_size,
    322353                               'C_W_', vtype = 'SCHED', x = x, y = y, pseg = 'RAM',
    323354                               local = False, big = False )
    324355
    325     ### global vseg for ram disk
    326     if use_ramdisk:
    327         mapping.addGlobal( 'seg_rdk', rdk_base, rdk_size, '__W_',
    328                            vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM',
    329                            identity = True, local = False, big = True )
     356    ### global vsegs kernel_heap_x_y : non local / big pages
     357    ### distributed in all clusters containing processors
     358    ### different content => name & vbase indexed by (x,y)
     359    for x in xrange( x_size ):
     360        for y in xrange( y_size - 1 ):
     361            offset = ((x << y_width) + y) * kernel_heap_size
     362
     363            mapping.addGlobal( 'seg_kernel_heap_%d_%d' %(x,y),
     364                               kernel_heap_vbase + offset , kernel_heap_size,
     365                               'C_W_', vtype = 'HEAP', x = x , y = y , pseg = 'RAM',
     366                               local = False, big = True )
    330367
    331368    ### global vsegs for external peripherals: non local / big page
    332     mapping.addGlobal( 'seg_bdv', bdv_base, bdv_size, '__W_',
    333                        vtype = 'PERI', x = 0, y = 0, pseg = 'BDV',
    334                        local = False, big = True )
    335 
    336     mapping.addGlobal( 'seg_tty', tty_base, tty_size, '__W_',
    337                        vtype = 'PERI', x = 0, y = 0, pseg = 'TTY',
     369    ### only mapped in cluster_io
     370    mapping.addGlobal( 'seg_bdv',
     371                       bdv_base, bdv_size,
     372                       '__W_', vtype = 'PERI', x = x_io, y = y_io, pseg = 'BDV',
     373                       local = False, big = True )
     374
     375    mapping.addGlobal( 'seg_tty',
     376                       tty_base, tty_size,
     377                       '__W_', vtype = 'PERI', x = x_io, y = y_io, pseg = 'TTY',
     378                       local = False, big = True )
     379
     380    mapping.addGlobal( 'seg_nic',
     381                       nic_base, nic_size,
     382                       '__W_', vtype = 'PERI', x = x_io, y = y_io, pseg = 'NIC',
     383                       local = False, big = True )
     384
     385    mapping.addGlobal( 'seg_cma',
     386                       cma_base, cma_size,
     387                       '__W_', vtype = 'PERI', x = x_io, y = y_io, pseg = 'CMA',
     388                       local = False, big = True )
     389
     390    mapping.addGlobal( 'seg_fbf',
     391                       fbf_base, fbf_size,
     392                       '__W_', vtype = 'PERI', x = x_io, y = y_io, pseg = 'FBF',
     393                       local = False, big = True )
     394
     395    mapping.addGlobal( 'seg_pic',
     396                       pic_base, pic_size,
     397                       '__W_', vtype = 'PERI', x = x_io, y = y_io, pseg = 'PIC',
    338398                       local = False, big = True )
    339399
    340400    ### global vsegs for internal peripherals : non local / small pages
    341     ### allocated in all clusters with name indexed by (x,y)
    342     ### as vbase address is incremented by (cluster_xy * vseg_increment)
    343     for x in xrange( x_size ):
    344         for y in xrange( y_size ):
     401    ### allocated in all clusters containing processors
     402    ### name and vbase indexed by (x,y)
     403    for x in xrange( x_size ):
     404        for y in xrange( y_size - 1 ):
    345405            offset = ((x << y_width) + y) * peri_increment
    346406
    347             mapping.addGlobal( 'seg_xcu_%d_%d' %(x,y), xcu_base + offset, xcu_size,
     407            mapping.addGlobal( 'seg_xcu_%d_%d' %(x,y),
     408                               xcu_base + offset, xcu_size,
    348409                               '__W_', vtype = 'PERI' , x = x , y = y , pseg = 'XCU',
    349410                               local = False, big = False )
    350411
    351             mapping.addGlobal( 'seg_mmc_%d_%d' %(x,y), mmc_base + offset, mmc_size,
     412            mapping.addGlobal( 'seg_mmc_%d_%d' %(x,y),
     413                               mmc_base + offset, mmc_size,
    352414                               '__W_', vtype = 'PERI' , x = x , y = y , pseg = 'MMC',
    353415                               local = False, big = False )
    354416
    355     ### return mapping ###
    356 
    357417    return mapping
    358418
    359 ################################# platform test #######################################################
     419########################## platform test #############################################
    360420
    361421if __name__ == '__main__':
  • trunk/platforms/tsar_generic_leti/top.cpp

    r897 r937  
    33// Author: Alain Greiner
    44// Copyright: UPMC/LIP6
    5 // Date : february 2014
     5// Date : february 2013 / updated january 2015
    66// This program is released under the GNU public license
    77/////////////////////////////////////////////////////////////////////////
     
    1313// (this is defined in the tsar_xbar_cluster).
    1414//
    15 // It does not use an external ROM, as the boot code is (pre)loaded
    16 // in cluster (0,0) memory at address 0x0.
     15// The main hardware parameters are the mesh size (X_SIZE & Y_SIZE),
     16// and the number of processors per cluster (NB_PROCS_MAX).
     17// The NB_PROCS_MAX parameter cannot be larger than 4.
     18//
     19// All external peripherals are located in cluster[X_SIZE-1][Y_SIZE-1],
     20// and are connected to an IO bus (implemented as a vci_local_crossbar):
     21// - one disk controller
     22// - one multi-channel ethernet controller
     23// - one multi-channel chained buffer dma controller
     24// - one multi-channel tty controller
     25// - one frame buffer controller
     26// - one iopic controller
     27// This IO bus is directly connected to the north ports of the CMD/RSP
     28// routers in cluster[X_SIZE-1][y_SIZE-2] through VCI/DSPIN wrappers.
     29// All other clusters in the upper row are empty: no processors,
     30// no ram, no routers.
     31// The X_SIZE parameter must be larger than 0, but no larger than 16.
     32// The Y_SIZE parameter must be larger than 1, but no larger than 16.
     33//
     34// We don't use an external ROM, as the boot code is (pre)loaded
     35// in RAM in cluster[0][0] at address 0x0.
     36//
     37// An optional RAMDISK of 32 Mbytes can be used in RAM of cluster[0][0].
    1738//
    1839// The physical address space is 40 bits.
    1940// The 8 address MSB bits define the cluster index.
    2041//
    21 // The main hardware parameters are the mesh size (X_SIZE & Y_SIZE),
    22 // and the number of processors per cluster (NB_PROCS_MAX).
    23 // The number of clusters cannot be larger than 128.
    24 // The number of processors per cluster cannot be larger than 4.
    25 //
    26 // Each cluster contains:
    27 // - 5 dspin_local_crossbar (local interconnect)
    28 // - 5 dspin_router (global interconnect)
    29 // - up to 4 vci_cc_vcache wrapping a MIPS32 processor
     42// Besides the processors, each cluster contains:
     43// - 5 L1/L2 DSPIN routers implementing 5 separated NOCs
    3044// - 1 vci_mem_cache
    3145// - 1 vci_xicu
    32 // - 1 vci_simple_ram (to model the L3 cache).
     46// - 1 vci_simple_ram (to emulate the L3 cache).
    3347//
    3448// Each processor receives 4 consecutive IRQ lines from the local XICU.
     
    3650// In all clusters, the MEMC IRQ line (signaling a late write error)
    3751// is connected to XICU HWI[8]
    38 // The cluster (0,0) contains two "backup" peripherals:
    39 // - one block device controller, whose IRQ is connected to XICU HWI[9].
    40 // - one single channel TTY controller, whose IRQ is connected to XICU HWI[10].
    41 //
    42 // The cluster internal architecture is defined in file tsar_leti_cluster,
    43 // that must be considered as an extension of this top.cpp file.
    44 //
    45 // Besides the hardware components in clusters, "external" peripherals
    46 // are connected to an external IO bus (implemented as a vci_local_crossbar):
    47 // - one disk controller
    48 // - one multi-channel ethernet controller
    49 // - one multi-channel chained buffer dma controller
    50 // - one multi-channel tty controller
    51 // - one frame buffer controller
    52 // - one 32 channels iopic controller
    5352//
    5453// This IOBUS is connected to the north  port of the DIR_CMD
     
    6362// - IOPIC HWI[23:16]   connected to IRQ_TTY_RX[7:0]]
    6463// - IOPIC HWI[31:24]   connected to IRQ_TTY_TX[7:0]]
     64//
     65// The cluster internal architecture is defined in file tsar_leti_cluster,
     66// that must be considered as an extension of this top.cpp file.
    6567////////////////////////////////////////////////////////////////////////////
    6668// The following parameters must be defined in the hard_config.h file :
     
    7375// - NB_TTY_CHANNELS  : number of TTY channels in I/O cluster (8 max)
    7476// - NB_NIC_CHANNELS  : number of NIC channels in I/O cluster (2 max)
     77// - FBUF_X_SIZE      : number of pixels per line for frame buffer
     78// - FBUF_Y_SIZE      : number of lines for frame buffer
    7579//
    7680// Some other hardware parameters are not used when compiling the OS,
    7781// and are only defined in this top.cpp file:
    7882// - XRAM_LATENCY     : external ram latency
    79 // - MEMC_WAYS        : L2 cache number of ways
    80 // - MEMC_SETS        : L2 cache number of sets
    8183// - L1_IWAYS         : L1 cache instruction number of ways
    8284// - L1_ISETS         : L1 cache instruction number of sets
    8385// - L1_DWAYS         : L1 cache data number of ways
    8486// - L1_DSETS         : L1 cache data number of sets
    85 // - FBUF_X_SIZE      : width of frame buffer (pixels)
    86 // - FBUF_Y_SIZE      : heigth of frame buffer (lines)
    87 // - BDEV_IMAGE_NAME  : file pathname for block device
    88 // - NIC_RX_NAME      : file pathname for NIC received packets
    89 // - NIC_TX_NAME      : file pathname for NIC transmited packets
    90 // - NIC_MAC4         : MAC address
    91 // - NIC_MAC2         : MAC address
     87// - BDEV_IMAGE_NAME  : pathname for block device disk image
    9288/////////////////////////////////////////////////////////////////////////
    9389// General policy for 40 bits physical address decoding:
     
    168164
    169165
    170 /////////////////////////////////////////////////////////////////////////////////////////
     166///////////////////////////////////////////////////////////////////////////////////////
    171167//    Secondary Hardware Parameters
    172 /////////////////////////////////////////////////////////////////////////////////////////
    173 
    174 #define MAX_TTY_CHANNELS      8
    175 #define MAX_CMA_CHANNELS      4
    176 #define MAX_NIC_CHANNELS      2
     168///////////////////////////////////////////////////////////////////////////////////////
     169
     170#define XMAX                  X_SIZE         // actual number of columns in 2D mesh
     171#define YMAX                  (Y_SIZE - 1)   // actual number of rows in 2D mesh
    177172
    178173#define XRAM_LATENCY          0
     
    187182#define L1_DSETS              64
    188183
    189 #define NIC_MAC4              0XBABEF00D
    190 #define NIC_MAC2              0xBEEF
    191 #define NIC_RX_NAME           "/dev/null"
    192 #define NIC_TX_NAME           "/dev/null"
     184#define BDEV_IMAGE_NAME       "../../../giet_vm/hdd/virt_hdd.dmg"
     185
     186#define ROM_SOFT_NAME         "../../softs/tsar_boot/preloader.elf"
    193187
    194188#define NORTH                 0
     
    230224   using namespace soclib::common;
    231225
    232    uint32_t ncycles           = 0xFFFFFFFF; // max simulated cycles
    233    size_t   threads           = 1;          // simulator's threads number
    234    bool     trace_ok          = false;      // trace activated
    235    uint32_t trace_from        = 0;          // trace start cycle
    236    bool     trace_proc_ok     = false;      // detailed proc trace activated
    237    size_t   trace_memc_ok     = false;      // detailed memc trace activated
    238    size_t   trace_memc_id     = 0;          // index of memc to be traced
    239    size_t   trace_proc_id     = 0;          // index of proc to be traced
    240    uint32_t frozen_cycles     = MAX_FROZEN_CYCLES;
    241    char     soft_name[256]    = "soft.elf";
    242    char     disk_name[256]    = "disk.img";
     226   uint32_t ncycles           = 0xFFFFFFFF;         // max simulated cycles
     227   size_t   threads           = 1;                  // simulator's threads number
     228   bool     trace_ok          = false;              // trace activated
     229   uint32_t trace_from        = 0;                  // trace start cycle
     230   bool     trace_proc_ok     = false;              // detailed proc trace activated
     231   size_t   trace_memc_ok     = false;              // detailed memc trace activated
     232   size_t   trace_memc_id     = 0;                  // index of memc to be traced
     233   size_t   trace_proc_id     = 0;                  // index of proc to be traced
     234   char     soft_name[256]    = ROM_SOFT_NAME;      // pathname for ROM binary code
     235   char     disk_name[256]    = BDEV_IMAGE_NAME;    // pathname for DISK image
     236   uint32_t frozen_cycles     = MAX_FROZEN_CYCLES;  // for debug
    243237   struct   timeval t1,t2;
    244238   uint64_t ms1,ms2;
     
    265259            size_t y = trace_memc_id & ((1<<Y_WIDTH)-1);
    266260
    267             assert( (x < X_SIZE) and (y < (Y_SIZE)) and
     261            assert( (x < XMAX) and (y < (YMAX)) and
    268262                  "MEMCID parameter refers a not valid memory cache");
    269263         }
     
    277271            size_t l          = trace_proc_id & ((1<<P_WIDTH)-1) ;
    278272
    279             assert( (x < X_SIZE) and (y < Y_SIZE) and (l < NB_PROCS_MAX) and
     273            assert( (x < XMAX) and (y < YMAX) and (l < NB_PROCS_MAX) and
    280274                  "PROCID parameter refers a not valid processor");
    281275         }
    282          else if ((strcmp(argv[n], "-SOFT") == 0) && ((n + 1) < argc))
     276         else if ((strcmp(argv[n], "-ROM") == 0) && ((n + 1) < argc))
    283277         {
    284278            strcpy(soft_name, argv[n + 1]);
     
    302296            std::cout << "   The order is not important." << std::endl;
    303297            std::cout << "   Accepted arguments are :" << std::endl << std::endl;
    304             std::cout << "     -NCYCLES number_of_simulated_cycles" << std::endl;
    305             std::cout << "     -DEBUG debug_start_cycle" << std::endl;
    306             std::cout << "     -SOFT path to soft" << std::endl;
    307             std::cout << "     -DISK path to disk image" << std::endl;
    308             std::cout << "     -THREADS simulator's threads number" << std::endl;
    309             std::cout << "     -FROZEN max_number_of_lines" << std::endl;
    310             std::cout << "     -PERIOD number_of_cycles between trace" << std::endl;
    311             std::cout << "     -MEMCID index_memc_to_be_traced" << std::endl;
    312             std::cout << "     -PROCID index_proc_to_be_traced" << std::endl;
     298            std::cout << "     - NCYCLES number_of_simulated_cycles" << std::endl;
     299            std::cout << "     - DEBUG debug_start_cycle" << std::endl;
     300            std::cout << "     - ROM path to ROM image" << std::endl;
     301            std::cout << "     - DISK path to disk image" << std::endl;
     302            std::cout << "     - THREADS simulator's threads number" << std::endl;
     303            std::cout << "     - FROZEN max_number_of_lines" << std::endl;
     304            std::cout << "     - PERIOD number_of_cycles between trace" << std::endl;
     305            std::cout << "     - MEMCID index_memc_to_be_traced" << std::endl;
     306            std::cout << "     - PROCID index_proc_to_be_traced" << std::endl;
    313307            exit(0);
    314308         }
     
    317311
    318312    // checking hardware parameters
    319     assert( ((X_SIZE==1) or (X_SIZE==2) or (X_SIZE==4) or (X_SIZE==8) or
    320              (X_SIZE==16)) and
     313    assert( ((X_SIZE <= 16) and (X_SIZE > 0)) and
    321314            "Illegal X_SIZE parameter" );
    322315
    323     assert( ((Y_SIZE==1) or (Y_SIZE==2) or (Y_SIZE==4) or (Y_SIZE==8)) and
     316    assert( ((Y_SIZE <= 16) and (Y_SIZE > 1)) and
    324317            "Illegal Y_SIZE parameter" );
    325318
     
    330323            "Illegal NB_PROCS_MAX parameter" );
    331324
    332     assert( (NB_CMA_CHANNELS <= MAX_CMA_CHANNELS) and
     325    assert( (NB_CMA_CHANNELS <= 4) and
    333326            "The NB_CMA_CHANNELS parameter cannot be larger than 4" );
    334327
    335     assert( (NB_TTY_CHANNELS <= MAX_TTY_CHANNELS) and
    336             "The NB_TTY_CHANNELS parameter cannot be larger than 8" );
    337 
    338     assert( (NB_NIC_CHANNELS <= MAX_NIC_CHANNELS) and
     328    assert( (NB_TTY_CHANNELS <= 8) and
     329            "The NB_TTY_CHANNELS parameter cannot be larger than 16" );
     330
     331    assert( (NB_NIC_CHANNELS <= 2) and
    339332            "The NB_NIC_CHANNELS parameter cannot be larger than 2" );
    340333
     
    343336
    344337    assert( (X_WIDTH == 4) and (Y_WIDTH == 4) and
    345             "ERROR: you must have X_WIDTH == Y_WIDTH == 4");
     338            "You must have X_WIDTH == Y_WIDTH == 4");
    346339
    347340    std::cout << std::endl;
    348341
    349     std::cout << " - X_SIZE           = " << X_SIZE << std::endl;
    350     std::cout << " - Y_SIZE           = " << Y_SIZE << std::endl;
     342    std::cout << " - XMAX           = " << XMAX << std::endl;
     343    std::cout << " - YMAX           = " << YMAX << std::endl;
    351344    std::cout << " - NB_PROCS_MAX     = " << NB_PROCS_MAX <<  std::endl;
    352     std::cout << " - NB_DMA_CHANNELS  = " << NB_DMA_CHANNELS <<  std::endl;
    353345    std::cout << " - NB_TTY_CHANNELS  = " << NB_TTY_CHANNELS <<  std::endl;
    354346    std::cout << " - NB_NIC_CHANNELS  = " << NB_NIC_CHANNELS <<  std::endl;
     347    std::cout << " - NB_CMA_CHANNELS  = " << NB_CMA_CHANNELS <<  std::endl;
    355348    std::cout << " - MEMC_WAYS        = " << MEMC_WAYS << std::endl;
    356349    std::cout << " - MEMC_SETS        = " << MEMC_SETS << std::endl;
     
    405398
    406399   // replicated segments
    407    for (size_t x = 0; x < X_SIZE; x++)
     400   for (size_t x = 0; x < XMAX; x++)
    408401   {
    409       for (size_t y = 0; y < (Y_SIZE) ; y++)
     402      for (size_t y = 0; y < (YMAX) ; y++)
    410403      {
    411404         sc_uint<vci_address_width> offset;
     
    436429               IntTab(cluster(0,0),BDEV_TGTID), false));
    437430
    438    // segments for peripherals in cluster_io (X_SIZE-1,Y_SIZE)
     431   // segments for peripherals in cluster_io (XMAX-1,YMAX)
    439432   sc_uint<vci_address_width> offset;
    440    offset = ((sc_uint<vci_address_width>)cluster(X_SIZE-1,Y_SIZE)) << 32;
     433   offset = ((sc_uint<vci_address_width>)cluster(XMAX-1,YMAX)) << 32;
    441434
    442435   maptabd.add(Segment("seg_mtty", SEG_TTY_BASE + offset, SEG_TTY_SIZE,
    443                IntTab(cluster(X_SIZE-1, Y_SIZE),MTTY_TGTID), false));
     436               IntTab(cluster(XMAX-1, YMAX),MTTY_TGTID), false));
    444437
    445438   maptabd.add(Segment("seg_fbuf", SEG_FBF_BASE + offset, SEG_FBF_SIZE,
    446                IntTab(cluster(X_SIZE-1, Y_SIZE),FBUF_TGTID), false));
     439               IntTab(cluster(XMAX-1, YMAX),FBUF_TGTID), false));
    447440
    448441   maptabd.add(Segment("seg_bdev", SEG_IOC_BASE + offset, SEG_IOC_SIZE,
    449                IntTab(cluster(X_SIZE-1, Y_SIZE),BDEV_TGTID), false));
     442               IntTab(cluster(XMAX-1, YMAX),BDEV_TGTID), false));
    450443
    451444   maptabd.add(Segment("seg_mnic", SEG_NIC_BASE + offset, SEG_NIC_SIZE,
    452                IntTab(cluster(X_SIZE-1, Y_SIZE),MNIC_TGTID), false));
     445               IntTab(cluster(XMAX-1, YMAX),MNIC_TGTID), false));
    453446
    454447   maptabd.add(Segment("seg_cdma", SEG_CMA_BASE + offset, SEG_CMA_SIZE,
    455                IntTab(cluster(X_SIZE-1, Y_SIZE),CDMA_TGTID), false));
     448               IntTab(cluster(XMAX-1, YMAX),CDMA_TGTID), false));
    456449
    457450   maptabd.add(Segment("seg_iopi", SEG_PIC_BASE + offset, SEG_PIC_SIZE,
    458                IntTab(cluster(X_SIZE-1, Y_SIZE),IOPI_TGTID), false));
     451               IntTab(cluster(XMAX-1, YMAX),IOPI_TGTID), false));
    459452
    460453   std::cout << maptabd << std::endl;
     
    469462                         0x00FF000000ULL);
    470463
    471     for (size_t x = 0; x < X_SIZE; x++)
    472     {
    473         for (size_t y = 0; y < (Y_SIZE) ; y++)
     464    for (size_t x = 0; x < XMAX; x++)
     465    {
     466        for (size_t y = 0; y < (YMAX) ; y++)
    474467        {
    475468            sc_uint<vci_address_width> offset;
     
    498491    sc_signal<bool>                   signal_irq_mnic_tx[NB_NIC_CHANNELS];
    499492    sc_signal<bool>                   signal_irq_mtty_rx[NB_TTY_CHANNELS];
    500 //  sc_signal<bool>                   signal_irq_mtty_tx[NB_TTY_CHANNELS];
    501493    sc_signal<bool>                   signal_irq_cdma[NB_CMA_CHANNELS];
    502494    sc_signal<bool>                   signal_irq_false;
     
    504496   // Horizontal inter-clusters DSPIN signals
    505497   DspinSignals<dspin_cmd_width>** signal_dspin_h_cmd_inc =
    506       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cmd_inc", X_SIZE-1, Y_SIZE);
     498      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cmd_inc", XMAX-1, YMAX);
    507499   DspinSignals<dspin_cmd_width>** signal_dspin_h_cmd_dec =
    508       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cmd_dec", X_SIZE-1, Y_SIZE);
     500      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cmd_dec", XMAX-1, YMAX);
    509501
    510502   DspinSignals<dspin_rsp_width>** signal_dspin_h_rsp_inc =
    511       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_h_rsp_inc", X_SIZE-1, Y_SIZE);
     503      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_h_rsp_inc", XMAX-1, YMAX);
    512504   DspinSignals<dspin_rsp_width>** signal_dspin_h_rsp_dec =
    513       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_h_rsp_dec", X_SIZE-1, Y_SIZE);
     505      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_h_rsp_dec", XMAX-1, YMAX);
    514506
    515507   DspinSignals<dspin_cmd_width>** signal_dspin_h_m2p_inc =
    516       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_m2p_inc", X_SIZE-1, Y_SIZE);
     508      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_m2p_inc", XMAX-1, YMAX);
    517509   DspinSignals<dspin_cmd_width>** signal_dspin_h_m2p_dec =
    518       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_m2p_dec", X_SIZE-1, Y_SIZE);
     510      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_m2p_dec", XMAX-1, YMAX);
    519511
    520512   DspinSignals<dspin_rsp_width>** signal_dspin_h_p2m_inc =
    521       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_h_p2m_inc", X_SIZE-1, Y_SIZE);
     513      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_h_p2m_inc", XMAX-1, YMAX);
    522514   DspinSignals<dspin_rsp_width>** signal_dspin_h_p2m_dec =
    523       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_h_p2m_dec", X_SIZE-1, Y_SIZE);
     515      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_h_p2m_dec", XMAX-1, YMAX);
    524516
    525517   DspinSignals<dspin_cmd_width>** signal_dspin_h_cla_inc =
    526       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cla_inc", X_SIZE-1, Y_SIZE);
     518      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cla_inc", XMAX-1, YMAX);
    527519   DspinSignals<dspin_cmd_width>** signal_dspin_h_cla_dec =
    528       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cla_dec", X_SIZE-1, Y_SIZE);
     520      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cla_dec", XMAX-1, YMAX);
    529521
    530522   // Vertical inter-clusters DSPIN signals
    531523   DspinSignals<dspin_cmd_width>** signal_dspin_v_cmd_inc =
    532       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cmd_inc", X_SIZE, Y_SIZE-1);
     524      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cmd_inc", XMAX, YMAX-1);
    533525   DspinSignals<dspin_cmd_width>** signal_dspin_v_cmd_dec =
    534       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cmd_dec", X_SIZE, Y_SIZE-1);
     526      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cmd_dec", XMAX, YMAX-1);
    535527
    536528   DspinSignals<dspin_rsp_width>** signal_dspin_v_rsp_inc =
    537       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_v_rsp_inc", X_SIZE, Y_SIZE-1);
     529      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_v_rsp_inc", XMAX, YMAX-1);
    538530   DspinSignals<dspin_rsp_width>** signal_dspin_v_rsp_dec =
    539       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_v_rsp_dec", X_SIZE, Y_SIZE-1);
     531      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_v_rsp_dec", XMAX, YMAX-1);
    540532
    541533   DspinSignals<dspin_cmd_width>** signal_dspin_v_m2p_inc =
    542       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_m2p_inc", X_SIZE, Y_SIZE-1);
     534      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_m2p_inc", XMAX, YMAX-1);
    543535   DspinSignals<dspin_cmd_width>** signal_dspin_v_m2p_dec =
    544       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_m2p_dec", X_SIZE, Y_SIZE-1);
     536      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_m2p_dec", XMAX, YMAX-1);
    545537
    546538   DspinSignals<dspin_rsp_width>** signal_dspin_v_p2m_inc =
    547       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_v_p2m_inc", X_SIZE, Y_SIZE-1);
     539      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_v_p2m_inc", XMAX, YMAX-1);
    548540   DspinSignals<dspin_rsp_width>** signal_dspin_v_p2m_dec =
    549       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_v_p2m_dec", X_SIZE, Y_SIZE-1);
     541      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_v_p2m_dec", XMAX, YMAX-1);
    550542
    551543   DspinSignals<dspin_cmd_width>** signal_dspin_v_cla_inc =
    552       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cla_inc", X_SIZE, Y_SIZE-1);
     544      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cla_inc", XMAX, YMAX-1);
    553545   DspinSignals<dspin_cmd_width>** signal_dspin_v_cla_dec =
    554       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cla_dec", X_SIZE, Y_SIZE-1);
     546      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cla_dec", XMAX, YMAX-1);
    555547
    556548   // Mesh boundaries DSPIN signals (Most of those signals are not used...)
    557549   DspinSignals<dspin_cmd_width>*** signal_dspin_bound_cmd_in =
    558       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_cmd_in" , X_SIZE, Y_SIZE, 4);
     550      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_cmd_in" , XMAX, YMAX, 4);
    559551   DspinSignals<dspin_cmd_width>*** signal_dspin_bound_cmd_out =
    560       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_cmd_out", X_SIZE, Y_SIZE, 4);
     552      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_cmd_out", XMAX, YMAX, 4);
    561553
    562554   DspinSignals<dspin_rsp_width>*** signal_dspin_bound_rsp_in =
    563       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_bound_rsp_in" , X_SIZE, Y_SIZE, 4);
     555      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_bound_rsp_in" , XMAX, YMAX, 4);
    564556   DspinSignals<dspin_rsp_width>*** signal_dspin_bound_rsp_out =
    565       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_bound_rsp_out", X_SIZE, Y_SIZE, 4);
     557      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_bound_rsp_out", XMAX, YMAX, 4);
    566558
    567559   DspinSignals<dspin_cmd_width>*** signal_dspin_bound_m2p_in =
    568       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_m2p_in" , X_SIZE, Y_SIZE, 4);
     560      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_m2p_in" , XMAX, YMAX, 4);
    569561   DspinSignals<dspin_cmd_width>*** signal_dspin_bound_m2p_out =
    570       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_m2p_out", X_SIZE, Y_SIZE, 4);
     562      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_m2p_out", XMAX, YMAX, 4);
    571563
    572564   DspinSignals<dspin_rsp_width>*** signal_dspin_bound_p2m_in =
    573       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_bound_p2m_in" , X_SIZE, Y_SIZE, 4);
     565      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_bound_p2m_in" , XMAX, YMAX, 4);
    574566   DspinSignals<dspin_rsp_width>*** signal_dspin_bound_p2m_out =
    575       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_bound_p2m_out", X_SIZE, Y_SIZE, 4);
     567      alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_bound_p2m_out", XMAX, YMAX, 4);
    576568
    577569   DspinSignals<dspin_cmd_width>*** signal_dspin_bound_cla_in =
    578       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_cla_in" , X_SIZE, Y_SIZE, 4);
     570      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_cla_in" , XMAX, YMAX, 4);
    579571   DspinSignals<dspin_cmd_width>*** signal_dspin_bound_cla_out =
    580       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_cla_out", X_SIZE, Y_SIZE, 4);
     572      alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_cla_out", XMAX, YMAX, 4);
    581573
    582574   // VCI signals for iobus and peripherals
     
    611603   soclib::common::Loader loader( soft_name );
    612604#endif
     605
    613606   loader.memory_default(0xAA);
    614 
    615    ///////////////////////////
    616    //  processor iss
    617    ///////////////////////////
    618607
    619608   typedef soclib::common::GdbServer<soclib::common::Mips32ElIss> proc_iss;
     
    621610
    622611   //////////////////////////////////////////////////////////////
    623    // mesh construction: only (X_SIZE) * (Y_SIZE) clusters
     612   // mesh construction: XMAX * YMAX clusters
    624613   //////////////////////////////////////////////////////////////
    625614
     
    627616                   dspin_rsp_width,
    628617                   vci_param_int,
    629                    vci_param_ext>*          clusters[X_SIZE][Y_SIZE];
     618                   vci_param_ext>*          clusters[XMAX][YMAX];
    630619
    631620#if USE_OPENMP
     
    634623#pragma omp for
    635624#endif
    636         for (size_t i = 0; i  < (X_SIZE * (Y_SIZE)); i++)
     625        for (size_t i = 0; i  < (XMAX * YMAX); i++)
    637626        {
    638             size_t x = i / (Y_SIZE);
    639             size_t y = i % (Y_SIZE);
     627            size_t x = i / (YMAX);
     628            size_t y = i % (YMAX);
    640629
    641630#if USE_OPENMP
     
    697686#endif
    698687
    699 
    700688#if USE_PIC
     689
    701690    //////////////////////////////////////////////////////////////////
    702     // IO bus and external peripherals in cluster[X_SIZE-1,Y_SIZE]
     691    // IO bus and external peripherals in cluster[X_SIZE-1][Y_SIZE-1]
    703692    // - 6 local targets    : FBF, TTY, CMA, NIC, PIC, IOC
    704693    // - 3 local initiators : IOC, CMA, PIC
     
    714703    std::cout << std::endl;
    715704
    716     size_t cluster_io = cluster(X_SIZE-1, Y_SIZE);
     705    size_t cluster_io = cluster(XMAX-1, YMAX);
    717706
    718707    //////////// vci_local_crossbar
     
    752741                maptabd,
    753742                NB_NIC_CHANNELS,
    754                 NIC_MAC4,
    755                 NIC_MAC2,
    756                 NIC_RX_NAME,
    757                 NIC_TX_NAME );
     743                0,                // default MAC_4 address
     744                0,                // default MAC_2 address
     745                1 );              // NIC_MODE_SYNTHESIS
    758746
    759747    ///////////// vci_chbuf_dma
     
    764752                IntTab(cluster_io, CDMA_SRCID),
    765753                IntTab(cluster_io, CDMA_TGTID),
    766                 64,                          // burst size
     754                64,                               // burst size
    767755                NB_CMA_CHANNELS );
    768756
     
    795783    VciDspinTargetWrapper<vci_param_int, dspin_cmd_width, dspin_rsp_width>*
    796784    wt_iobus = new VciDspinTargetWrapper<vci_param_int, dspin_cmd_width, dspin_rsp_width>(
    797                 "wt_bdev",
     785                "wt_iobus",
    798786                vci_srcid_width );
    799787
    800788    VciDspinInitiatorWrapper<vci_param_int, dspin_cmd_width, dspin_rsp_width>*
    801789    wi_iobus = new VciDspinInitiatorWrapper<vci_param_int, dspin_cmd_width, dspin_rsp_width>(
    802                 "wi_bdev",
     790                "wi_iobus",
    803791                vci_srcid_width );
    804792
    805793    ///////////////////////////////////////////////////////////////
    806     //     Net-list
     794    //     IObus  Net-list
    807795    ///////////////////////////////////////////////////////////////
    808796
     
    887875    // NB_NIC_CHANNELS <= 2
    888876    // NB_CMA_CHANNELS <= 4
    889     // NB_TTY_CHANNELS <= 8
     877    // NB_TTY_CHANNELS <= 16
    890878    iopic->p_clk                       (signal_clk);
    891879    iopic->p_resetn                    (signal_resetn);
     
    903891       else if(i < 16)                 iopic->p_hwi[i] (signal_irq_false);
    904892       else if(i < 16+NB_TTY_CHANNELS) iopic->p_hwi[i] (signal_irq_mtty_rx[i-16]);
    905        else if(i < 24)                 iopic->p_hwi[i] (signal_irq_false);
    906        else if(i < 24+NB_TTY_CHANNELS) iopic->p_hwi[i] (signal_irq_false);
    907 //     else if(i < 24+NB_TTY_CHANNELS) iopic->p_hwi[i] (signal_irq_mtty_tx[i-24]);
    908893       else                            iopic->p_hwi[i] (signal_irq_false);
    909894    }
     
    915900    wi_iobus->p_resetn                 (signal_resetn);
    916901    wi_iobus->p_vci                    (signal_vci_cmd_to_noc);
    917     wi_iobus->p_dspin_cmd              (signal_dspin_bound_cmd_in[X_SIZE-1][Y_SIZE-1][NORTH]);
    918     wi_iobus->p_dspin_rsp              (signal_dspin_bound_rsp_out[X_SIZE-1][Y_SIZE-1][NORTH]);
     902    wi_iobus->p_dspin_cmd              (signal_dspin_bound_cmd_in[XMAX-1][YMAX-1][NORTH]);
     903    wi_iobus->p_dspin_rsp              (signal_dspin_bound_rsp_out[XMAX-1][YMAX-1][NORTH]);
    919904
    920905    // vci/dspin wrappers
     
    922907    wt_iobus->p_resetn                 (signal_resetn);
    923908    wt_iobus->p_vci                    (signal_vci_cmd_from_noc);
    924     wt_iobus->p_dspin_cmd              (signal_dspin_bound_cmd_out[X_SIZE-1][Y_SIZE-1][NORTH]);
    925     wt_iobus->p_dspin_rsp              (signal_dspin_bound_rsp_in[X_SIZE-1][Y_SIZE-1][NORTH]);
    926 
    927 #endif // USE_PIC
     909    wt_iobus->p_dspin_cmd              (signal_dspin_bound_cmd_out[XMAX-1][YMAX-1][NORTH]);
     910    wt_iobus->p_dspin_rsp              (signal_dspin_bound_rsp_in[XMAX-1][YMAX-1][NORTH]);
     911
     912#endif  // USE_PIC
    928913
    929914    // Clock & RESET for clusters
    930     for (size_t x = 0; x < (X_SIZE); x++)
    931     {
    932         for (size_t y = 0; y < (Y_SIZE); y++)
     915    for (size_t x = 0; x < (XMAX); x++)
     916    {
     917        for (size_t y = 0; y < (YMAX); y++)
    933918        {
    934919            clusters[x][y]->p_clk                    (signal_clk);
     
    938923
    939924    // Inter Clusters horizontal connections
    940     if (X_SIZE > 1)
    941     {
    942         for (size_t x = 0; x < (X_SIZE-1); x++)
     925    if (XMAX > 1)
     926    {
     927        for (size_t x = 0; x < (XMAX-1); x++)
    943928        {
    944             for (size_t y = 0; y < (Y_SIZE); y++)
     929            for (size_t y = 0; y < (YMAX); y++)
    945930            {
    946931                clusters[x][y]->p_cmd_out[EAST]      (signal_dspin_h_cmd_inc[x][y]);
     
    974959
    975960    // Inter Clusters vertical connections
    976     if (Y_SIZE > 1)
    977     {
    978         for (size_t y = 0; y < (Y_SIZE-1); y++)
     961    if (YMAX > 1)
     962    {
     963        for (size_t y = 0; y < (YMAX-1); y++)
    979964        {
    980             for (size_t x = 0; x < X_SIZE; x++)
     965            for (size_t x = 0; x < XMAX; x++)
    981966            {
    982967                clusters[x][y]->p_cmd_out[NORTH]     (signal_dspin_v_cmd_inc[x][y]);
     
    1010995
    1011996    // East & West boundary cluster connections
    1012     for (size_t y = 0; y < (Y_SIZE); y++)
     997    for (size_t y = 0; y < (YMAX); y++)
    1013998    {
    1014999        clusters[0][y]->p_cmd_in[WEST]           (signal_dspin_bound_cmd_in[0][y][WEST]);
    10151000        clusters[0][y]->p_cmd_out[WEST]          (signal_dspin_bound_cmd_out[0][y][WEST]);
    1016         clusters[X_SIZE-1][y]->p_cmd_in[EAST]    (signal_dspin_bound_cmd_in[X_SIZE-1][y][EAST]);
    1017         clusters[X_SIZE-1][y]->p_cmd_out[EAST]   (signal_dspin_bound_cmd_out[X_SIZE-1][y][EAST]);
     1001        clusters[XMAX-1][y]->p_cmd_in[EAST]    (signal_dspin_bound_cmd_in[XMAX-1][y][EAST]);
     1002        clusters[XMAX-1][y]->p_cmd_out[EAST]   (signal_dspin_bound_cmd_out[XMAX-1][y][EAST]);
    10181003
    10191004        clusters[0][y]->p_rsp_in[WEST]           (signal_dspin_bound_rsp_in[0][y][WEST]);
    10201005        clusters[0][y]->p_rsp_out[WEST]          (signal_dspin_bound_rsp_out[0][y][WEST]);
    1021         clusters[X_SIZE-1][y]->p_rsp_in[EAST]    (signal_dspin_bound_rsp_in[X_SIZE-1][y][EAST]);
    1022         clusters[X_SIZE-1][y]->p_rsp_out[EAST]   (signal_dspin_bound_rsp_out[X_SIZE-1][y][EAST]);
     1006        clusters[XMAX-1][y]->p_rsp_in[EAST]    (signal_dspin_bound_rsp_in[XMAX-1][y][EAST]);
     1007        clusters[XMAX-1][y]->p_rsp_out[EAST]   (signal_dspin_bound_rsp_out[XMAX-1][y][EAST]);
    10231008
    10241009        clusters[0][y]->p_m2p_in[WEST]           (signal_dspin_bound_m2p_in[0][y][WEST]);
    10251010        clusters[0][y]->p_m2p_out[WEST]          (signal_dspin_bound_m2p_out[0][y][WEST]);
    1026         clusters[X_SIZE-1][y]->p_m2p_in[EAST]    (signal_dspin_bound_m2p_in[X_SIZE-1][y][EAST]);
    1027         clusters[X_SIZE-1][y]->p_m2p_out[EAST]   (signal_dspin_bound_m2p_out[X_SIZE-1][y][EAST]);
     1011        clusters[XMAX-1][y]->p_m2p_in[EAST]    (signal_dspin_bound_m2p_in[XMAX-1][y][EAST]);
     1012        clusters[XMAX-1][y]->p_m2p_out[EAST]   (signal_dspin_bound_m2p_out[XMAX-1][y][EAST]);
    10281013
    10291014        clusters[0][y]->p_p2m_in[WEST]           (signal_dspin_bound_p2m_in[0][y][WEST]);
    10301015        clusters[0][y]->p_p2m_out[WEST]          (signal_dspin_bound_p2m_out[0][y][WEST]);
    1031         clusters[X_SIZE-1][y]->p_p2m_in[EAST]    (signal_dspin_bound_p2m_in[X_SIZE-1][y][EAST]);
    1032         clusters[X_SIZE-1][y]->p_p2m_out[EAST]   (signal_dspin_bound_p2m_out[X_SIZE-1][y][EAST]);
     1016        clusters[XMAX-1][y]->p_p2m_in[EAST]    (signal_dspin_bound_p2m_in[XMAX-1][y][EAST]);
     1017        clusters[XMAX-1][y]->p_p2m_out[EAST]   (signal_dspin_bound_p2m_out[XMAX-1][y][EAST]);
    10331018
    10341019        clusters[0][y]->p_cla_in[WEST]           (signal_dspin_bound_cla_in[0][y][WEST]);
    10351020        clusters[0][y]->p_cla_out[WEST]          (signal_dspin_bound_cla_out[0][y][WEST]);
    1036         clusters[X_SIZE-1][y]->p_cla_in[EAST]    (signal_dspin_bound_cla_in[X_SIZE-1][y][EAST]);
    1037         clusters[X_SIZE-1][y]->p_cla_out[EAST]   (signal_dspin_bound_cla_out[X_SIZE-1][y][EAST]);
     1021        clusters[XMAX-1][y]->p_cla_in[EAST]    (signal_dspin_bound_cla_in[XMAX-1][y][EAST]);
     1022        clusters[XMAX-1][y]->p_cla_out[EAST]   (signal_dspin_bound_cla_out[XMAX-1][y][EAST]);
    10381023    }
    10391024
     
    10411026
    10421027    // North & South boundary clusters connections
    1043     for (size_t x = 0; x < X_SIZE; x++)
     1028    for (size_t x = 0; x < XMAX; x++)
    10441029    {
    10451030        clusters[x][0]->p_cmd_in[SOUTH]          (signal_dspin_bound_cmd_in[x][0][SOUTH]);
    10461031        clusters[x][0]->p_cmd_out[SOUTH]         (signal_dspin_bound_cmd_out[x][0][SOUTH]);
    1047         clusters[x][Y_SIZE-1]->p_cmd_in[NORTH]   (signal_dspin_bound_cmd_in[x][Y_SIZE-1][NORTH]);
    1048         clusters[x][Y_SIZE-1]->p_cmd_out[NORTH]  (signal_dspin_bound_cmd_out[x][Y_SIZE-1][NORTH]);
     1032        clusters[x][YMAX-1]->p_cmd_in[NORTH]   (signal_dspin_bound_cmd_in[x][YMAX-1][NORTH]);
     1033        clusters[x][YMAX-1]->p_cmd_out[NORTH]  (signal_dspin_bound_cmd_out[x][YMAX-1][NORTH]);
    10491034
    10501035        clusters[x][0]->p_rsp_in[SOUTH]          (signal_dspin_bound_rsp_in[x][0][SOUTH]);
    10511036        clusters[x][0]->p_rsp_out[SOUTH]         (signal_dspin_bound_rsp_out[x][0][SOUTH]);
    1052         clusters[x][Y_SIZE-1]->p_rsp_in[NORTH]   (signal_dspin_bound_rsp_in[x][Y_SIZE-1][NORTH]);
    1053         clusters[x][Y_SIZE-1]->p_rsp_out[NORTH]  (signal_dspin_bound_rsp_out[x][Y_SIZE-1][NORTH]);
     1037        clusters[x][YMAX-1]->p_rsp_in[NORTH]   (signal_dspin_bound_rsp_in[x][YMAX-1][NORTH]);
     1038        clusters[x][YMAX-1]->p_rsp_out[NORTH]  (signal_dspin_bound_rsp_out[x][YMAX-1][NORTH]);
    10541039
    10551040        clusters[x][0]->p_m2p_in[SOUTH]          (signal_dspin_bound_m2p_in[x][0][SOUTH]);
    10561041        clusters[x][0]->p_m2p_out[SOUTH]         (signal_dspin_bound_m2p_out[x][0][SOUTH]);
    1057         clusters[x][Y_SIZE-1]->p_m2p_in[NORTH]   (signal_dspin_bound_m2p_in[x][Y_SIZE-1][NORTH]);
    1058         clusters[x][Y_SIZE-1]->p_m2p_out[NORTH]  (signal_dspin_bound_m2p_out[x][Y_SIZE-1][NORTH]);
     1042        clusters[x][YMAX-1]->p_m2p_in[NORTH]   (signal_dspin_bound_m2p_in[x][YMAX-1][NORTH]);
     1043        clusters[x][YMAX-1]->p_m2p_out[NORTH]  (signal_dspin_bound_m2p_out[x][YMAX-1][NORTH]);
    10591044
    10601045        clusters[x][0]->p_p2m_in[SOUTH]          (signal_dspin_bound_p2m_in[x][0][SOUTH]);
    10611046        clusters[x][0]->p_p2m_out[SOUTH]         (signal_dspin_bound_p2m_out[x][0][SOUTH]);
    1062         clusters[x][Y_SIZE-1]->p_p2m_in[NORTH]   (signal_dspin_bound_p2m_in[x][Y_SIZE-1][NORTH]);
    1063         clusters[x][Y_SIZE-1]->p_p2m_out[NORTH]  (signal_dspin_bound_p2m_out[x][Y_SIZE-1][NORTH]);
     1047        clusters[x][YMAX-1]->p_p2m_in[NORTH]   (signal_dspin_bound_p2m_in[x][YMAX-1][NORTH]);
     1048        clusters[x][YMAX-1]->p_p2m_out[NORTH]  (signal_dspin_bound_p2m_out[x][YMAX-1][NORTH]);
    10641049
    10651050        clusters[x][0]->p_cla_in[SOUTH]          (signal_dspin_bound_cla_in[x][0][SOUTH]);
    10661051        clusters[x][0]->p_cla_out[SOUTH]         (signal_dspin_bound_cla_out[x][0][SOUTH]);
    1067         clusters[x][Y_SIZE-1]->p_cla_in[NORTH]   (signal_dspin_bound_cla_in[x][Y_SIZE-1][NORTH]);
    1068         clusters[x][Y_SIZE-1]->p_cla_out[NORTH]  (signal_dspin_bound_cla_out[x][Y_SIZE-1][NORTH]);
     1052        clusters[x][YMAX-1]->p_cla_in[NORTH]   (signal_dspin_bound_cla_in[x][YMAX-1][NORTH]);
     1053        clusters[x][YMAX-1]->p_cla_out[NORTH]  (signal_dspin_bound_cla_out[x][YMAX-1][NORTH]);
    10691054    }
    10701055
     
    10831068    // set network boundaries signals default values
    10841069    // for all boundary clusters but the IO cluster
    1085     for (size_t x = 0; x < X_SIZE ; x++)
    1086     {
    1087         for (size_t y = 0; y < Y_SIZE ; y++)
     1070    for (size_t x = 0; x < XMAX ; x++)
     1071    {
     1072        for (size_t y = 0; y < YMAX ; y++)
    10881073        {
    10891074            for (size_t face = 0; face < 4; face++)
    10901075            {
    1091                 if ( (x != X_SIZE-1) or (y != Y_SIZE-1) or (face != NORTH) )
     1076                if ( (x != XMAX-1) or (y != YMAX-1) or (face != NORTH) )
    10921077                {
    10931078                    signal_dspin_bound_cmd_in [x][y][face].write = false;
     
    11211106
    11221107#if USE_PIC == 0
    1123     signal_dspin_bound_cmd_in[X_SIZE-1][Y_SIZE-1][NORTH].write = false;
    1124     signal_dspin_bound_rsp_out[X_SIZE-1][Y_SIZE-1][NORTH].read = true;
    1125     signal_dspin_bound_cmd_out[X_SIZE-1][Y_SIZE-1][NORTH].read = true;
    1126     signal_dspin_bound_rsp_in[X_SIZE-1][Y_SIZE-1][NORTH].write = false;
     1108    signal_dspin_bound_cmd_in[XMAX-1][YMAX-1][NORTH].write = false;
     1109    signal_dspin_bound_rsp_out[XMAX-1][YMAX-1][NORTH].read = true;
     1110    signal_dspin_bound_cmd_out[XMAX-1][YMAX-1][NORTH].read = true;
     1111    signal_dspin_bound_rsp_in[XMAX-1][YMAX-1][NORTH].write = false;
    11271112#endif
    11281113
     
    11411126    }
    11421127
    1143 #if USE_PIC
    1144     // variable used for IRQ trace
    1145     bool prev_irq_bdev = false;
    1146     bool prev_irq_mtty_rx[8];
    1147     bool prev_irq_proc[16][16][4];
    1148 
    1149     for( size_t x = 0 ; x<8  ; x++ ) prev_irq_mtty_rx[x] = false;
    1150 
    1151     for( size_t x = 0 ; x<16 ; x++ )
    1152     for( size_t y = 0 ; y<16 ; y++ )
    1153     for( size_t i = 0 ; i<4  ; i++ ) prev_irq_proc[x][y][i] = false;
    1154 #endif
    1155 
     1128    // simulation loop
    11561129    for (uint64_t n = 1; n < ncycles && !stop_called; n++)
    11571130    {
    1158         // Monitor a specific address for L1 & L2 caches
     1131        // Monitor a specific address for L1 cache
    11591132        // clusters[0][0]->proc[0]->cache_monitor(0x110002C078ULL);
    1160         // clusters[1][1]->memc->cache_monitor(0x110002c078ULL);
     1133
     1134        // Monitor a specific address for L2 cache
     1135        // clusters[1][1]->memc->cache_monitor(0x200000F000ULL);
     1136
     1137        // Monitor a specific address for one XRAM
     1138        // clusters[0][0]->xram->start_monitor( 0x200000F00ULL , 64);
    11611139
    11621140        // stats display
     
    11861164        {
    11871165            std::cout << "****************** cycle " << std::dec << n ;
    1188             std::cout << " ************************************************" << std::endl;
     1166            std::cout << " ********************************************" << std::endl;
    11891167
    11901168            size_t l = 0;
     
    12071185                clusters[x][y]->xicu->print_trace(0);
    12081186                clusters[x][y]->signal_vci_tgt_xicu.print_trace(xicu_signame.str());
     1187               
     1188                if ( clusters[x][y]->signal_proc_irq[0] )
     1189                   std::cout << "### IRQ_PROC_" << x << "_" << y << "_0" << std::endl;
     1190                if ( clusters[x][y]->signal_proc_irq[4] )
     1191                   std::cout << "### IRQ_PROC_" << x << "_" << y << "_1" << std::endl;
     1192                if ( clusters[x][y]->signal_proc_irq[8] )
     1193                   std::cout << "### IRQ_PROC_" << x << "_" << y << "_2" << std::endl;
     1194                if ( clusters[x][y]->signal_proc_irq[12] )
     1195                   std::cout << "### IRQ_PROC_" << x << "_" << y << "_3" << std::endl;
    12091196            }
    12101197
     
    12571244            signal_vci_tgt_iopi.print_trace("[SIG]IOPI_TGT");
    12581245            signal_vci_ini_iopi.print_trace("[SIG]IOPI_INI");
     1246
     1247            // trace external interrupts
     1248            if (signal_irq_bdev)   std::cout << "### IRQ_BDEV" << std::endl;
    12591249#else
    12601250            clusters[0][0]->bdev->print_trace();
     
    12631253#endif
    12641254
    1265             // trace internal tty
    1266             // clusters[0][0]->mtty->print_trace();
    1267             // clusters[0][0]->signal_vci_tgt_mtty.print_trace("[SIG]MTTY");
    1268 
    12691255        }  // end trace
    1270 
    1271 #if 0
    1272 #if USE_PIC
    1273         // trace BDV interrupts events
    1274         if ( signal_irq_bdev.read() != prev_irq_bdev )
    1275         {
    1276            prev_irq_bdev = signal_irq_bdev.read();
    1277            std::cout << std::dec << "@@@ IRQ_BDEV = " << signal_irq_bdev.read()
    1278               << " at cycle " << n << std::endl;
    1279         }
    1280 
    1281         // trace TTY interrupts events
    1282         for ( size_t x = 0 ; x < 8 ; x++ )
    1283         {
    1284            if ( signal_irq_mtty_rx[x].read() != prev_irq_mtty_rx[x] )
    1285            {
    1286               prev_irq_mtty_rx[x] = signal_irq_mtty_rx[x].read();
    1287               std::cout << std::dec << "@@@ IRQ_MTTY["<<x<<"] = "
    1288                  << signal_irq_mtty_rx[x].read()
    1289                  << " at cycle " << n << std::endl;
    1290            }
    1291         }
    1292         // trace VCI transactions on IOPIC and XCU(0,0)
    1293         signal_vci_tgt_iopi.print_trace("@@@ IOPI_TGT");
    1294         signal_vci_ini_iopi.print_trace("@@@ IOPI_INI");
    1295 #endif
    1296 
    1297         // trace processor interrupts events
    1298         for ( size_t x = 0 ; x < X_SIZE ; x++ )
    1299            for ( size_t y = 0 ; y < Y_SIZE ; y++ )
    1300               for ( size_t i = 0 ; i < NB_PROCS_MAX ; i++ )
    1301               {
    1302                  if ( clusters[x][y]->signal_proc_irq[i] != prev_irq_proc[x][y][i] )
    1303                  {
    1304                     prev_irq_proc[x][y][i] = clusters[x][y]->signal_proc_irq[i];
    1305                     std::cout << std::dec << "@@@ IRQ_PROC["<<x<<","<<y<<","<<i<<"] = "
    1306                        << clusters[x][y]->signal_proc_irq[i]
    1307                        << " at cycle " << n << std::endl;
    1308                  }
    1309               }
    1310 
    1311         clusters[0][0]->signal_vci_tgt_xicu.print_trace("@@@ XCU_0_0");
    1312 #endif
    13131256
    13141257        sc_start(sc_core::sc_time(1, SC_NS));
Note: See TracChangeset for help on using the changeset viewer.