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