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