| 1 | #!/usr/bin/env python | 
|---|
| 2 |  | 
|---|
| 3 | from math import log, ceil | 
|---|
| 4 | from mapping import * | 
|---|
| 5 |  | 
|---|
| 6 | ################################################################################## | 
|---|
| 7 | #   file   : arch.py  (for the tsar_generic_iob architecture) | 
|---|
| 8 | #   date   : may 2014 | 
|---|
| 9 | #   author : Alain Greiner | 
|---|
| 10 | ################################################################################## | 
|---|
| 11 | #  This file contains a mapping generator for the "tsar_generic_iob" platform. | 
|---|
| 12 | #  This includes both the hardware architecture (clusters, processors, peripherals, | 
|---|
| 13 | #  physical space segmentation) and the mapping of all boot and kernel objects | 
|---|
| 14 | #  (global vsegs). | 
|---|
| 15 | # | 
|---|
| 16 | #  This platform includes 6 external peripherals, accessible through an IOB | 
|---|
| 17 | #  components located in cluster [0,0] or in cluster [x_size-1, y_size-1]. | 
|---|
| 18 | #  Available peripherals are: TTY, BDV, FBF, ROM, NIC, CMA, PIC. | 
|---|
| 19 | # | 
|---|
| 20 | #  All clusters contain (nb_procs) processors, one L2 cache, one XCU, and | 
|---|
| 21 | #  one DMA controller. | 
|---|
| 22 | # | 
|---|
| 23 | #  The "constructor" parameters are: | 
|---|
| 24 | #  - x_size         : number of clusters in a row | 
|---|
| 25 | #  - y_size         : number of clusters in a column | 
|---|
| 26 | #  - nb_procs       : number of processors per cluster | 
|---|
| 27 | #  - nb_ttys        : number of TTY channels | 
|---|
| 28 | #  - fbf_width      : frame_buffer width = frame_buffer heigth | 
|---|
| 29 | # | 
|---|
| 30 | #  The other hardware parameters are: | 
|---|
| 31 | #  - nb_nics        : number of NIC channels | 
|---|
| 32 | #  - nb_cmas        : number of CMA channels | 
|---|
| 33 | #  - x_io           : cluster_io x coordinate | 
|---|
| 34 | #  - y_io           : cluster_io y coordinate | 
|---|
| 35 | #  - x_width        : number of bits for x coordinate | 
|---|
| 36 | #  - y_width        : number of bits for y coordinate | 
|---|
| 37 | #  - paddr_width    : number of bits for physical address | 
|---|
| 38 | #  - irq_per_proc   : number of input IRQs per processor | 
|---|
| 39 | #  - use_ramdisk    : use a ramdisk when True | 
|---|
| 40 | #  - vseg_increment : address increment for replicated peripherals | 
|---|
| 41 | # | 
|---|
| 42 | #  Regarding the boot and kernel vsegs mapping : | 
|---|
| 43 | #  - We use one big physical page (2 Mbytes) for the preloader and the four | 
|---|
| 44 | #    boot vsegs, all allocated in cluster[0,0]. | 
|---|
| 45 | #  - We use one big page per cluster for the replicated kernel code vsegs. | 
|---|
| 46 | #  - We use one big page in cluster[0][0] for the kernel data vseg. | 
|---|
| 47 | #  - We use one big page per cluster for the distributed kernel heap vsegs. | 
|---|
| 48 | #  - We use one big page per cluster for the distributed ptab vsegs. | 
|---|
| 49 | #  - We use small physical pages (4 Kbytes) per cluster for the schedulers. | 
|---|
| 50 | #  - We use one big page for each external peripheral in IO cluster, | 
|---|
| 51 | #  - We use one small page per cluster for each internal peripheral. | 
|---|
| 52 | ################################################################################## | 
|---|
| 53 |  | 
|---|
| 54 | ######################## | 
|---|
| 55 | def arch( x_size    = 2, | 
|---|
| 56 | y_size    = 2, | 
|---|
| 57 | nb_procs  = 2, | 
|---|
| 58 | nb_ttys   = 1, | 
|---|
| 59 | fbf_width = 128 ): | 
|---|
| 60 |  | 
|---|
| 61 | ### define architecture constants | 
|---|
| 62 |  | 
|---|
| 63 | nb_nics         = 1 | 
|---|
| 64 | nb_cmas         = 2 | 
|---|
| 65 | x_io            = 0 | 
|---|
| 66 | y_io            = 0 | 
|---|
| 67 | x_width         = 4 | 
|---|
| 68 | y_width         = 4 | 
|---|
| 69 | p_width         = 4 | 
|---|
| 70 | paddr_width     = 40 | 
|---|
| 71 | irq_per_proc    = 4 | 
|---|
| 72 | use_ramdisk     = False | 
|---|
| 73 | peri_increment  = 0x10000    # distributed peripherals vbase address increment | 
|---|
| 74 |  | 
|---|
| 75 | ### parameters checking | 
|---|
| 76 |  | 
|---|
| 77 | assert( nb_procs <= (1 << p_width) ) | 
|---|
| 78 |  | 
|---|
| 79 | assert( (x_size == 1) or (x_size == 2) or (x_size == 4) | 
|---|
| 80 | or (x_size == 8) or (x_size == 16) ) | 
|---|
| 81 |  | 
|---|
| 82 | assert( (y_size == 1) or (y_size == 2) or (y_size == 4) | 
|---|
| 83 | or (y_size == 8) or (y_size == 16) ) | 
|---|
| 84 |  | 
|---|
| 85 | assert( (nb_ttys >= 1) and (nb_ttys <= 8) ) | 
|---|
| 86 |  | 
|---|
| 87 | assert( ((x_io == 0) and (y_io == 0)) or | 
|---|
| 88 | ((x_io == x_size-1) and (y_io == y_size-1)) ) | 
|---|
| 89 |  | 
|---|
| 90 | ### define type and name | 
|---|
| 91 |  | 
|---|
| 92 | platform_type  = 'tsar_iob' | 
|---|
| 93 | platform_name  = '%s_%d_%d_%d' % ( platform_type, x_size, y_size , nb_procs ) | 
|---|
| 94 |  | 
|---|
| 95 | ### define physical segments replicated in all clusters | 
|---|
| 96 |  | 
|---|
| 97 | ram_base = 0x0000000000 | 
|---|
| 98 | ram_size = 0x1000000                   # 16 Mbytes | 
|---|
| 99 |  | 
|---|
| 100 | xcu_base = 0x00B0000000 | 
|---|
| 101 | xcu_size = 0x1000                      # 4 Kbytes | 
|---|
| 102 |  | 
|---|
| 103 | dma_base = 0x00B1000000 | 
|---|
| 104 | dma_size = 0x1000                      # 4 Kbytes | 
|---|
| 105 |  | 
|---|
| 106 | mmc_base = 0x00B2000000 | 
|---|
| 107 | mmc_size = 0x1000                      # 4 Kbytes | 
|---|
| 108 |  | 
|---|
| 109 | ### define physical segments for external peripherals | 
|---|
| 110 | ## These segments are only defined in cluster_io | 
|---|
| 111 |  | 
|---|
| 112 | bdv_base  = 0x00B3000000 | 
|---|
| 113 | bdv_size  = 0x1000                     # 4kbytes | 
|---|
| 114 |  | 
|---|
| 115 | tty_base  = 0x00B4000000 | 
|---|
| 116 | tty_size  = 0x4000                     # 16 Kbytes | 
|---|
| 117 |  | 
|---|
| 118 | nic_base  = 0x00B5000000 | 
|---|
| 119 | nic_size  = 0x80000                    # 512 kbytes | 
|---|
| 120 |  | 
|---|
| 121 | cma_base  = 0x00B6000000 | 
|---|
| 122 | cma_size  = 0x1000 * 2 * nb_nics       # 4 kbytes * 2 * nb_nics | 
|---|
| 123 |  | 
|---|
| 124 | fbf_base  = 0x00B7000000 | 
|---|
| 125 | fbf_size  = fbf_width * fbf_width     # fbf_width * fbf_width bytes | 
|---|
| 126 |  | 
|---|
| 127 | pic_base  = 0x00B8000000 | 
|---|
| 128 | pic_size  = 0x1000                     # 4 Kbytes | 
|---|
| 129 |  | 
|---|
| 130 | iob_base  = 0x00BE000000 | 
|---|
| 131 | iob_size  = 0x1000                     # 4 bytes | 
|---|
| 132 |  | 
|---|
| 133 | rom_base  = 0x00BFC00000 | 
|---|
| 134 | rom_size  = 0x4000                     # 16 Kbytes | 
|---|
| 135 |  | 
|---|
| 136 | ### define  bootloader vsegs base addresses and sizes | 
|---|
| 137 | ### We want to pack these 4 vsegs in the same big page | 
|---|
| 138 | ### => boot cost is one BIG page in cluster[0][0] | 
|---|
| 139 |  | 
|---|
| 140 | boot_mapping_vbase   = 0x00000000           # ident | 
|---|
| 141 | boot_mapping_size    = 0x00080000           # 512 Kbytes | 
|---|
| 142 |  | 
|---|
| 143 | boot_code_vbase      = 0x00080000           # ident | 
|---|
| 144 | boot_code_size       = 0x00040000           # 256 Kbytes | 
|---|
| 145 |  | 
|---|
| 146 | boot_data_vbase      = 0x000C0000           # ident | 
|---|
| 147 | boot_data_size       = 0x000C0000           # 768 Kbytes | 
|---|
| 148 |  | 
|---|
| 149 | boot_stack_vbase     = 0x00180000           # ident | 
|---|
| 150 | boot_stack_size      = 0x00080000           # 512 Kbytes | 
|---|
| 151 |  | 
|---|
| 152 | ### define kernel vsegs base addresses and sizes | 
|---|
| 153 | ### code, init, ptab, heap & sched vsegs are replicated in all clusters. | 
|---|
| 154 | ### data & uncdata vsegs are only mapped in cluster[0][0]. | 
|---|
| 155 |  | 
|---|
| 156 | kernel_code_vbase    = 0x80000000 | 
|---|
| 157 | kernel_code_size     = 0x00100000           # 1 Mbytes per cluster | 
|---|
| 158 |  | 
|---|
| 159 | kernel_init_vbase    = 0x80100000 | 
|---|
| 160 | kernel_init_size     = 0x00100000           # 1 Mbytes per cluster | 
|---|
| 161 |  | 
|---|
| 162 | kernel_data_vbase    = 0x90000000 | 
|---|
| 163 | kernel_data_size     = 0x00200000           # 2 Mbytes in cluster[0,0] | 
|---|
| 164 |  | 
|---|
| 165 | kernel_ptab_vbase    = 0xE0000000 | 
|---|
| 166 | kernel_ptab_size     = 0x00200000           # 2 Mbytes per cluster | 
|---|
| 167 |  | 
|---|
| 168 | kernel_heap_vbase    = 0xD0000000 | 
|---|
| 169 | kernel_heap_size     = 0x00200000           # 2 Mbytes per cluster | 
|---|
| 170 |  | 
|---|
| 171 | kernel_sched_vbase   = 0xA0000000 | 
|---|
| 172 | kernel_sched_size    = 0x00002000*nb_procs  # 8 Kbytes per proc per cluster | 
|---|
| 173 |  | 
|---|
| 174 | ######################### | 
|---|
| 175 | ### create mapping | 
|---|
| 176 | ######################### | 
|---|
| 177 |  | 
|---|
| 178 | mapping = Mapping( name           = platform_name, | 
|---|
| 179 | x_size         = x_size, | 
|---|
| 180 | y_size         = y_size, | 
|---|
| 181 | nprocs         = nb_procs, | 
|---|
| 182 | x_width        = x_width, | 
|---|
| 183 | y_width        = y_width, | 
|---|
| 184 | p_width        = p_width, | 
|---|
| 185 | paddr_width    = paddr_width, | 
|---|
| 186 | coherence      = True, | 
|---|
| 187 | irq_per_proc   = irq_per_proc, | 
|---|
| 188 | use_ramdisk    = use_ramdisk, | 
|---|
| 189 | x_io           = x_io, | 
|---|
| 190 | y_io           = y_io, | 
|---|
| 191 | peri_increment = peri_increment, | 
|---|
| 192 | ram_base       = ram_base, | 
|---|
| 193 | ram_size       = ram_size ) | 
|---|
| 194 |  | 
|---|
| 195 |  | 
|---|
| 196 | ############################# | 
|---|
| 197 | ###   Hardware Components | 
|---|
| 198 | ############################# | 
|---|
| 199 |  | 
|---|
| 200 | for x in xrange( x_size ): | 
|---|
| 201 | for y in xrange( y_size ): | 
|---|
| 202 | cluster_xy = (x << y_width) + y; | 
|---|
| 203 | offset     = cluster_xy << (paddr_width - x_width - y_width) | 
|---|
| 204 |  | 
|---|
| 205 | ### components replicated in all clusters | 
|---|
| 206 | ram = mapping.addRam( 'RAM', base = ram_base + offset, | 
|---|
| 207 | size = ram_size ) | 
|---|
| 208 |  | 
|---|
| 209 | mmc = mapping.addPeriph( 'MMC', base = mmc_base + offset, | 
|---|
| 210 | size = mmc_size, ptype = 'MMC' ) | 
|---|
| 211 |  | 
|---|
| 212 | dma = mapping.addPeriph( 'DMA', base = dma_base + offset, | 
|---|
| 213 | size = dma_size, ptype = 'DMA', | 
|---|
| 214 | channels = nb_procs ) | 
|---|
| 215 |  | 
|---|
| 216 | xcu = mapping.addPeriph( 'XCU', base = xcu_base + offset, | 
|---|
| 217 | size = xcu_size, ptype = 'XCU', | 
|---|
| 218 | channels = nb_procs * irq_per_proc, arg = 32 ) | 
|---|
| 219 |  | 
|---|
| 220 | mapping.addIrq( xcu, index = 0, isrtype = 'ISR_MMC' ) | 
|---|
| 221 |  | 
|---|
| 222 | for i in xrange ( dma.channels ): | 
|---|
| 223 | mapping.addIrq( xcu, index = 1+i, isrtype = 'ISR_DMA', | 
|---|
| 224 | channel = i ) | 
|---|
| 225 |  | 
|---|
| 226 | for p in xrange ( nb_procs ): | 
|---|
| 227 | mapping.addProc( x, y, p ) | 
|---|
| 228 |  | 
|---|
| 229 | ### external peripherals in cluster_io | 
|---|
| 230 | if ( (x==x_io) and (y==y_io) ): | 
|---|
| 231 |  | 
|---|
| 232 | iob = mapping.addPeriph( 'IOB', base = iob_base + offset, size = iob_size, | 
|---|
| 233 | ptype = 'IOB' ) | 
|---|
| 234 |  | 
|---|
| 235 | bdv = mapping.addPeriph( 'BDV', base = bdv_base + offset, size = bdv_size, | 
|---|
| 236 | ptype = 'IOC', subtype = 'BDV' ) | 
|---|
| 237 |  | 
|---|
| 238 | tty = mapping.addPeriph( 'TTY', base = tty_base + offset, size = tty_size, | 
|---|
| 239 | ptype = 'TTY', channels = nb_ttys ) | 
|---|
| 240 |  | 
|---|
| 241 | nic = mapping.addPeriph( 'NIC', base = nic_base + offset, size = nic_size, | 
|---|
| 242 | ptype = 'NIC', channels = nb_nics ) | 
|---|
| 243 |  | 
|---|
| 244 | cma = mapping.addPeriph( 'CMA', base = cma_base + offset, size = cma_size, | 
|---|
| 245 | ptype = 'CMA', channels = nb_cmas ) | 
|---|
| 246 |  | 
|---|
| 247 | fbf = mapping.addPeriph( 'FBF', base = fbf_base + offset, size = fbf_size, | 
|---|
| 248 | ptype = 'FBF', arg = fbf_width ) | 
|---|
| 249 |  | 
|---|
| 250 | rom = mapping.addPeriph( 'ROM', base = rom_base + offset, size = rom_size, | 
|---|
| 251 | ptype = 'ROM' ) | 
|---|
| 252 |  | 
|---|
| 253 | pic = mapping.addPeriph( 'PIC', base = pic_base + offset, size = pic_size, | 
|---|
| 254 | ptype = 'PIC', channels = 32 ) | 
|---|
| 255 |  | 
|---|
| 256 | mapping.addIrq( pic, index = 0,  isrtype = 'ISR_NIC_RX', channel = 0 ) | 
|---|
| 257 | mapping.addIrq( pic, index = 1,  isrtype = 'ISR_NIC_RX', channel = 1 ) | 
|---|
| 258 |  | 
|---|
| 259 | mapping.addIrq( pic, index = 2,  isrtype = 'ISR_NIC_TX', channel = 0 ) | 
|---|
| 260 | mapping.addIrq( pic, index = 3,  isrtype = 'ISR_NIC_TX', channel = 1 ) | 
|---|
| 261 |  | 
|---|
| 262 | mapping.addIrq( pic, index = 4,  isrtype = 'ISR_CMA'   , channel = 0 ) | 
|---|
| 263 | mapping.addIrq( pic, index = 5,  isrtype = 'ISR_CMA'   , channel = 1 ) | 
|---|
| 264 | mapping.addIrq( pic, index = 6,  isrtype = 'ISR_CMA'   , channel = 2 ) | 
|---|
| 265 | mapping.addIrq( pic, index = 7,  isrtype = 'ISR_CMA'   , channel = 3 ) | 
|---|
| 266 |  | 
|---|
| 267 | mapping.addIrq( pic, index = 8,  isrtype = 'ISR_BDV'   , channel = 0 ) | 
|---|
| 268 |  | 
|---|
| 269 | mapping.addIrq( pic, index = 16, isrtype = 'ISR_TTY_RX', channel = 0 ) | 
|---|
| 270 | mapping.addIrq( pic, index = 17, isrtype = 'ISR_TTY_RX', channel = 1 ) | 
|---|
| 271 | mapping.addIrq( pic, index = 18, isrtype = 'ISR_TTY_RX', channel = 2 ) | 
|---|
| 272 | mapping.addIrq( pic, index = 19, isrtype = 'ISR_TTY_RX', channel = 3 ) | 
|---|
| 273 | mapping.addIrq( pic, index = 20, isrtype = 'ISR_TTY_RX', channel = 4 ) | 
|---|
| 274 | mapping.addIrq( pic, index = 21, isrtype = 'ISR_TTY_RX', channel = 5 ) | 
|---|
| 275 | mapping.addIrq( pic, index = 22, isrtype = 'ISR_TTY_RX', channel = 6 ) | 
|---|
| 276 | mapping.addIrq( pic, index = 23, isrtype = 'ISR_TTY_RX', channel = 7 ) | 
|---|
| 277 |  | 
|---|
| 278 |  | 
|---|
| 279 | #################################### | 
|---|
| 280 | ###   Boot & Kernel vsegs mapping | 
|---|
| 281 | #################################### | 
|---|
| 282 |  | 
|---|
| 283 | ### global vsegs for boot_loader | 
|---|
| 284 | ### we want to pack those 4 vsegs in the same big page | 
|---|
| 285 | ### => same flags CXW_ / identity mapping / non local / big page | 
|---|
| 286 |  | 
|---|
| 287 | mapping.addGlobal( 'seg_boot_mapping', boot_mapping_vbase, boot_mapping_size, | 
|---|
| 288 | 'CXW_', vtype = 'BLOB'  , x = 0, y = 0, pseg = 'RAM', | 
|---|
| 289 | identity = True , local = False, big = True ) | 
|---|
| 290 |  | 
|---|
| 291 | mapping.addGlobal( 'seg_boot_code', boot_code_vbase, boot_code_size, | 
|---|
| 292 | 'CXW_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', | 
|---|
| 293 | identity = True , local = False, big = True ) | 
|---|
| 294 |  | 
|---|
| 295 | mapping.addGlobal( 'seg_boot_data', boot_data_vbase, boot_data_size, | 
|---|
| 296 | 'CXW_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', | 
|---|
| 297 | identity = True , local = False, big = True ) | 
|---|
| 298 |  | 
|---|
| 299 | mapping.addGlobal( 'seg_boot_stack', boot_stack_vbase, boot_stack_size, | 
|---|
| 300 | 'CXW_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', | 
|---|
| 301 | identity = True , local = False, big = True ) | 
|---|
| 302 |  | 
|---|
| 303 | ### global vseg kernel_data : big / non local | 
|---|
| 304 | ### Only mapped in cluster[0][0] | 
|---|
| 305 | mapping.addGlobal( 'seg_kernel_data', kernel_data_vbase, kernel_data_size, | 
|---|
| 306 | 'CXW_', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', | 
|---|
| 307 | binpath = 'build/kernel/kernel.elf', | 
|---|
| 308 | local = False, big = True ) | 
|---|
| 309 |  | 
|---|
| 310 | ### global vsegs kernel_code, kernel_init : big / local | 
|---|
| 311 | ### replicated in all clusters with the same name & same vbase | 
|---|
| 312 | for x in xrange( x_size ): | 
|---|
| 313 | for y in xrange( y_size ): | 
|---|
| 314 | mapping.addGlobal( 'seg_kernel_code', kernel_code_vbase, kernel_code_size, | 
|---|
| 315 | 'CXW_', vtype = 'ELF', x = x , y = y , pseg = 'RAM', | 
|---|
| 316 | binpath = 'build/kernel/kernel.elf', | 
|---|
| 317 | local = True, big = True ) | 
|---|
| 318 |  | 
|---|
| 319 | mapping.addGlobal( 'seg_kernel_init', kernel_init_vbase, kernel_init_size, | 
|---|
| 320 | 'CXW_', vtype = 'ELF', x = x , y = y , pseg = 'RAM', | 
|---|
| 321 | binpath = 'build/kernel/kernel.elf', | 
|---|
| 322 | local = True, big = True ) | 
|---|
| 323 |  | 
|---|
| 324 | ### Global vsegs kernel_ptab_x_y : big / non local | 
|---|
| 325 | ### one vseg per cluster: name indexed by (x,y) | 
|---|
| 326 | for x in xrange( x_size ): | 
|---|
| 327 | for y in xrange( y_size ): | 
|---|
| 328 | offset = ((x << y_width) + y) * kernel_ptab_size | 
|---|
| 329 | base   = kernel_ptab_vbase + offset | 
|---|
| 330 | mapping.addGlobal( 'seg_kernel_ptab_%d_%d' %(x,y), base, kernel_ptab_size, | 
|---|
| 331 | 'CXW_', vtype = 'PTAB', x = x, y = y, pseg = 'RAM', | 
|---|
| 332 | local = False , big = True ) | 
|---|
| 333 |  | 
|---|
| 334 | ### global vsegs kernel_sched_x_y : small / non local | 
|---|
| 335 | ### one vseg per cluster with name indexed by (x,y) | 
|---|
| 336 | for x in xrange( x_size ): | 
|---|
| 337 | for y in xrange( y_size ): | 
|---|
| 338 | offset = ((x << y_width) + y) * kernel_sched_size | 
|---|
| 339 | mapping.addGlobal( 'seg_kernel_sched_%d_%d' %(x,y), | 
|---|
| 340 | kernel_sched_vbase + offset , kernel_sched_size, | 
|---|
| 341 | 'C_W_', vtype = 'SCHED', x = x , y = y , pseg = 'RAM', | 
|---|
| 342 | local = False, big = False ) | 
|---|
| 343 |  | 
|---|
| 344 | ### global vsegs kernel_heap_x_y : big / non local | 
|---|
| 345 | ### one vseg per cluster with name indexed by (x,y) | 
|---|
| 346 | for x in xrange( x_size ): | 
|---|
| 347 | for y in xrange( y_size ): | 
|---|
| 348 | offset = ((x << y_width) + y) * kernel_heap_size | 
|---|
| 349 | mapping.addGlobal( 'seg_kernel_heap_%d_%d' %(x,y), | 
|---|
| 350 | kernel_heap_vbase + offset , kernel_heap_size, | 
|---|
| 351 | 'C_W_', vtype = 'HEAP', x = x , y = y , pseg = 'RAM', | 
|---|
| 352 | local = False, big = True ) | 
|---|
| 353 |  | 
|---|
| 354 | ### global vsegs for external peripherals : non local / big page | 
|---|
| 355 | mapping.addGlobal( 'seg_iob', iob_base, iob_size, '__W_', | 
|---|
| 356 | vtype = 'PERI', x = 0, y = 0, pseg = 'IOB', | 
|---|
| 357 | local = False, big = True ) | 
|---|
| 358 |  | 
|---|
| 359 | mapping.addGlobal( 'seg_bdv', bdv_base, bdv_size, '__W_', | 
|---|
| 360 | vtype = 'PERI', x = 0, y = 0, pseg = 'BDV', | 
|---|
| 361 | local = False, big = True ) | 
|---|
| 362 |  | 
|---|
| 363 | mapping.addGlobal( 'seg_tty', tty_base, tty_size, '__W_', | 
|---|
| 364 | vtype = 'PERI', x = 0, y = 0, pseg = 'TTY', | 
|---|
| 365 | local = False, big = True ) | 
|---|
| 366 |  | 
|---|
| 367 | mapping.addGlobal( 'seg_nic', nic_base, nic_size, '__W_', | 
|---|
| 368 | vtype = 'PERI', x = 0, y = 0, pseg = 'NIC', | 
|---|
| 369 | local = False, big = True ) | 
|---|
| 370 |  | 
|---|
| 371 | mapping.addGlobal( 'seg_cma', cma_base, cma_size, '__W_', | 
|---|
| 372 | vtype = 'PERI', x = 0, y = 0, pseg = 'CMA', | 
|---|
| 373 | local = False, big = True ) | 
|---|
| 374 |  | 
|---|
| 375 | mapping.addGlobal( 'seg_fbf', fbf_base, fbf_size, '__W_', | 
|---|
| 376 | vtype = 'PERI', x = 0, y = 0, pseg = 'FBF', | 
|---|
| 377 | local = False, big = True ) | 
|---|
| 378 |  | 
|---|
| 379 | mapping.addGlobal( 'seg_pic', pic_base, pic_size, '__W_', | 
|---|
| 380 | vtype = 'PERI', x = 0, y = 0, pseg = 'PIC', | 
|---|
| 381 | local = False, big = True ) | 
|---|
| 382 |  | 
|---|
| 383 | mapping.addGlobal( 'seg_rom', rom_base, rom_size, 'CXW_', | 
|---|
| 384 | vtype = 'PERI', x = 0, y = 0, pseg = 'ROM', | 
|---|
| 385 | local = False, big = True ) | 
|---|
| 386 |  | 
|---|
| 387 | ### global vsegs for internal peripherals : non local / small pages | 
|---|
| 388 | ### allocated in all clusters with name indexed by (x,y) | 
|---|
| 389 | ### as vbase address is incremented by (cluster_xy * vseg_increment) | 
|---|
| 390 | for x in xrange( x_size ): | 
|---|
| 391 | for y in xrange( y_size ): | 
|---|
| 392 | offset = ((x << y_width) + y) * peri_increment | 
|---|
| 393 |  | 
|---|
| 394 | mapping.addGlobal( 'seg_xcu_%d_%d' %(x,y), xcu_base + offset, xcu_size, | 
|---|
| 395 | '__W_', vtype = 'PERI' , x = x , y = y , pseg = 'XCU', | 
|---|
| 396 | local = False, big = False ) | 
|---|
| 397 |  | 
|---|
| 398 | mapping.addGlobal( 'seg_dma_%d_%d' %(x,y), dma_base + offset, dma_size, | 
|---|
| 399 | '__W_', vtype = 'PERI' , x = x , y = y , pseg = 'DMA', | 
|---|
| 400 | local = False, big = False ) | 
|---|
| 401 |  | 
|---|
| 402 | mapping.addGlobal( 'seg_mmc_%d_%d' %(x,y), mmc_base + offset, mmc_size, | 
|---|
| 403 | '__W_', vtype = 'PERI' , x = x , y = y , pseg = 'MMC', | 
|---|
| 404 | local = False, big = False ) | 
|---|
| 405 |  | 
|---|
| 406 | return mapping | 
|---|
| 407 |  | 
|---|
| 408 | ################################# platform test #################################### | 
|---|
| 409 |  | 
|---|
| 410 | if __name__ == '__main__': | 
|---|
| 411 |  | 
|---|
| 412 | mapping = arch( x_size    = 2, | 
|---|
| 413 | y_size    = 2, | 
|---|
| 414 | nb_procs  = 2 ) | 
|---|
| 415 |  | 
|---|
| 416 | #   print mapping.netbsd_dts() | 
|---|
| 417 |  | 
|---|
| 418 | print mapping.xml() | 
|---|
| 419 |  | 
|---|
| 420 | #   print mapping.giet_vsegs() | 
|---|
| 421 |  | 
|---|
| 422 |  | 
|---|
| 423 | # Local Variables: | 
|---|
| 424 | # tab-width: 4; | 
|---|
| 425 | # c-basic-offset: 4; | 
|---|
| 426 | # c-file-offsets:((innamespace . 0)(inline-open . 0)); | 
|---|
| 427 | # indent-tabs-mode: nil; | 
|---|
| 428 | # End: | 
|---|
| 429 | # | 
|---|
| 430 | # vim: filetype=python:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 | 
|---|
| 431 |  | 
|---|