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