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