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