- Timestamp:
- Sep 29, 2014, 12:30:18 PM (10 years ago)
- Location:
- trunk/platforms/tsar_generic_iob
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/platforms/tsar_generic_iob/arch.py
r802 r817 1 #!/usr/bin/env python2 1 3 2 from math import log, ceil … … 20 19 # - y_size : number of clusters in a column 21 20 # - nb_procs : number of processors per cluster 21 # - fbf_width : frame_buffer width = frame_buffer heigth 22 22 # 23 23 # The "hidden" parameters (defined below) are: 24 24 # - nb_ttys : number of TTY channels 25 25 # - nb_nics : number of NIC channels 26 # - fbf_width : frame_buffer width = frame_buffer heigth27 26 # - x_io : cluster_io x coordinate 28 27 # - y_io : cluster_io y coordinate … … 32 31 # - irq_per_proc : number of input IRQs per processor 33 32 # - use_ramdisk : use a ramdisk when True 34 # - peri_increment : address increment for replicated peripherals 35 #################################################################################### 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 ################################################################################### 36 45 37 46 ######################## 38 47 def arch( x_size = 2, 39 48 y_size = 2, 40 nb_procs = 2 ): 49 nb_procs = 2, 50 fbf_width = 128 ): 41 51 42 52 ### define architecture constants 43 53 44 nb_ttys 45 nb_nics = 246 fbf_width = 12847 x_io= 048 y_io = 049 x_width= 450 y_width= 451 p _width = int(ceil(log(nb_procs, 2)))52 paddr_width = 4053 irq_per_proc = 454 use_ramdisk = False55 peri_increment = 0x1000056 distributed_ptabs = True54 nb_ttys = 1 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 57 67 58 68 ### parameters checking … … 71 81 ((x_io == x_size-1) and (y_io == y_size-1)) ) 72 82 73 platform_name = 'tsar_iob_%d_%d_%d' % ( x_size, y_size, nb_procs ) 74 75 ### define physical segments 83 platform_name = 'tsar_iob_%d_%d_%d_%d' % ( x_size, y_size, nb_procs, fbf_width ) 84 85 ### define replicated physical segments 86 ### These segments are replicated in all clusters 76 87 77 88 ram_base = 0x0000000000 … … 82 93 83 94 dma_base = 0x00B1000000 84 dma_size = 0x1000 * nb_procs # 4 Kbytes * nb_procs95 dma_size = 0x1000 # 4 Kbytes 85 96 86 97 mmc_base = 0x00B2000000 87 98 mmc_size = 0x1000 # 4 Kbytes 88 99 100 ### define physical segments for external peripherals 101 ## These segments are only defined in cluster_io 102 89 103 offset_io = ((x_io << y_width) + y_io) << (paddr_width - x_width - y_width) 90 104 … … 108 122 109 123 iob_base = 0x00BE000000 + offset_io 110 iob_size = 0x1000 # 4 kbytes124 iob_size = 0x1000 # 4 bytes 111 125 112 126 rom_base = 0x00BFC00000 + offset_io … … 114 128 115 129 ### define bootloader vsegs base addresses and sizes 130 ### We want to pack these 4 vsegs in the same big page 131 ### => boot cost is one BPP in cluster[0][0] 116 132 117 133 boot_mapping_vbase = 0x00000000 # ident … … 128 144 129 145 ### define kernel vsegs base addresses and sizes 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. 130 153 131 154 kernel_code_vbase = 0x80000000 132 kernel_code_size = 0x00020000 # 128 Kbytes 133 134 kernel_data_vbase = 0x80020000 135 kernel_data_size = 0x00020000 # 128 Kbytes 136 137 kernel_uncdata_vbase = 0x80040000 138 kernel_uncdata_size = 0x00010000 # 64 Kbytes 139 140 kernel_init_vbase = 0x80050000 141 kernel_init_size = 0x00010000 # 64 Kbytes 142 143 kernel_sched_vbase = 0xF0000000 # distributed in all clusters 144 kernel_sched_size = 0x2000 * nb_procs # 8 kbytes per processor 155 kernel_code_size = 0x00080000 # 512 Kbytes per cluster 156 157 kernel_init_vbase = 0x80080000 158 kernel_init_size = 0x00080000 # 512 Kbytes per cluster 159 160 kernel_data_vbase = 0x80100000 161 kernel_data_size = 0x00100000 # 1 Mbytes in cluster[0][0] 162 163 kernel_ptab_vbase = 0xE0000000 164 kernel_ptab_size = 0x00200000 # 2 Mbytes per cluster 165 166 kernel_uncdata_vbase = 0x90000000 167 kernel_uncdata_size = 0x00001000 # 4 Kbytes 168 169 kernel_sched_vbase = 0xA0000000 170 kernel_sched_size = 0x00002000*nb_procs # 8 Kbytes per proc per cluster 145 171 146 172 ### create mapping 147 173 148 mapping = Mapping( name = platform_name, 149 x_size = x_size, 150 y_size = y_size, 151 procs_max = nb_procs,152 x_width = x_width, 153 y_width = y_width, 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, 154 180 p_width = p_width, 155 paddr_width = paddr_width, 156 coherence = True, 157 irq_per_proc = irq_per_proc, 158 use_ramdisk = use_ramdisk, 159 x_io = x_io, 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, 160 186 y_io = y_io, 161 187 peri_increment = peri_increment, … … 226 252 mapping.addProc( x, y, p ) 227 253 228 ### global vsegs for boot_loader / identity mapping 254 ### global vsegs for boot_loader 255 ### we want to pack those 4 vsegs in the same big page 256 ### => same flags CXW_ / identity mapping / non local / big page 229 257 230 258 mapping.addGlobal( 'seg_boot_mapping', boot_mapping_vbase, boot_mapping_size, 231 'C _W_', vtype = 'BLOB' , x = 0, y = 0, pseg = 'RAM',232 identity = True )259 'CXW_', vtype = 'BLOB' , x = 0, y = 0, pseg = 'RAM', 260 identity = True , local = False, big = True ) 233 261 234 262 mapping.addGlobal( 'seg_boot_code', boot_code_vbase, boot_code_size, 235 263 'CXW_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', 236 identity = True )264 identity = True , local = False, big = True ) 237 265 238 266 mapping.addGlobal( 'seg_boot_data', boot_data_vbase, boot_data_size, 239 'C _W_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM',240 identity = True )267 'CXW_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', 268 identity = True , local = False, big = True ) 241 269 242 270 mapping.addGlobal( 'seg_boot_stack', boot_stack_vbase, boot_stack_size, 243 'C_W_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', 244 identity = True ) 245 246 ### the code global vsegs for kernel can be replicated in all clusters 247 ### if the page tables are distributed in all clusters. 248 249 if distributed_ptabs: 250 for x in xrange( x_size ): 251 for y in xrange( y_size ): 252 cluster_xy = (x << y_width) + y; 253 254 mapping.addGlobal( 'seg_kernel_code', kernel_code_vbase, kernel_code_size, 255 'CXW_', vtype = 'ELF', x = x , y = y , pseg = 'RAM', 256 binpath = 'build/kernel/kernel.elf', local = True ) 257 258 mapping.addGlobal( 'seg_kernel_init', kernel_init_vbase, kernel_init_size, 259 'CXW_', vtype = 'ELF', x = x , y = y , pseg = 'RAM', 260 binpath = 'build/kernel/kernel.elf', local = True ) 261 else: 262 mapping.addGlobal( 'seg_kernel_code', kernel_code_vbase, kernel_code_size, 263 'CXW_', vtype = 'ELF', x = 0 , y = 0 , pseg = 'RAM', 264 binpath = 'build/kernel/kernel.elf', local = False ) 265 266 mapping.addGlobal( 'seg_kernel_init', kernel_init_vbase, kernel_init_size, 267 'CXW_', vtype = 'ELF', x = 0 , y = 0 , pseg = 'RAM', 268 binpath = 'build/kernel/kernel.elf', local = False ) 269 270 ### shared global vsegs for kernel 271 272 mapping.addGlobal( 'seg_kernel_data', kernel_data_vbase, kernel_data_size, 273 'C_W_', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', 274 binpath = 'build/kernel/kernel.elf', local = False ) 275 271 'CXW_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', 272 identity = True , local = False, big = True ) 273 274 ### global vsegs kernel_code, kernel_init : local / big page 275 ### replicated in all clusters with the same name (same vbase) 276 for x in xrange( x_size ): 277 for y in xrange( y_size ): 278 mapping.addGlobal( 'seg_kernel_code', kernel_code_vbase, kernel_code_size, 279 'CXW_', vtype = 'ELF', x = x , y = y , pseg = 'RAM', 280 binpath = 'build/kernel/kernel.elf', 281 local = True, big = True ) 282 283 mapping.addGlobal( 'seg_kernel_init', kernel_init_vbase, kernel_init_size, 284 'CXW_', vtype = 'ELF', x = x , y = y , pseg = 'RAM', 285 binpath = 'build/kernel/kernel.elf', 286 local = True, big = True ) 287 288 ### global vseg kernel_data: non local / big page 289 ### Only mapped in cluster[0][0] 290 mapping.addGlobal( 'seg_kernel_data', kernel_data_vbase, kernel_data_size, 291 'CXW_', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', 292 binpath = 'build/kernel/kernel.elf', 293 local = False, big = True ) 294 295 ### global vseg kernel_uncdata: non local / small page 296 ### Only mapped in cluster[0][0] 276 297 mapping.addGlobal( 'seg_kernel_uncdata', kernel_uncdata_vbase, kernel_uncdata_size, 277 '__W_', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', 278 binpath = 'build/kernel/kernel.elf', local = False ) 279 280 ### global vsegs for external peripherals / identity mapping 281 298 '__W_', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', 299 binpath = 'build/kernel/kernel.elf', 300 local = False, big = False ) 301 302 ### Global vsegs kernel_ptab_x_y: non local / big pages 303 ### replicated in all clusters with name indexed by (x,y) 304 ### as vbase address is incremented by (cluster_xy * vseg_increment) 305 for x in xrange( x_size ): 306 for y in xrange( y_size ): 307 offset = ((x << y_width) + y) * ptab_increment 308 mapping.addGlobal( 'seg_kernel_ptab_%d_%d' %(x,y), kernel_ptab_vbase + offset , kernel_ptab_size, 309 'CXW_', vtype = 'PTAB', x = x, y = y, pseg = 'RAM', 310 local = False , big = True ) 311 312 ### global vsegs kernel_sched : non local / small pages 313 ### allocated in all clusters with name indexed by (x,y) 314 ### as vbase address is incremented by (cluster_xy * vseg_increment) 315 for x in xrange( x_size ): 316 for y in xrange( y_size ): 317 offset = ((x << y_width) + y) * sched_increment 318 mapping.addGlobal( 'seg_kernel_sched_%d_%d' %(x,y), kernel_sched_vbase + offset , kernel_sched_size, 319 'C_W_', vtype = 'SCHED', x = x , y = y , pseg = 'RAM', 320 local = False, big = False ) 321 322 ### global vsegs for external peripherals : non local / big page 282 323 mapping.addGlobal( 'seg_iob', iob_base, iob_size, '__W_', 283 324 vtype = 'PERI', x = 0, y = 0, pseg = 'IOB', 284 identity= True )325 local = False, big = True ) 285 326 286 327 mapping.addGlobal( 'seg_bdv', bdv_base, bdv_size, '__W_', 287 328 vtype = 'PERI', x = 0, y = 0, pseg = 'BDV', 288 identity= True )329 local = False, big = True ) 289 330 290 331 mapping.addGlobal( 'seg_tty', tty_base, tty_size, '__W_', 291 332 vtype = 'PERI', x = 0, y = 0, pseg = 'TTY', 292 identity= True )333 local = False, big = True ) 293 334 294 335 mapping.addGlobal( 'seg_nic', nic_base, nic_size, '__W_', 295 336 vtype = 'PERI', x = 0, y = 0, pseg = 'NIC', 296 identity= True )337 local = False, big = True ) 297 338 298 339 mapping.addGlobal( 'seg_cma', cma_base, cma_size, '__W_', 299 340 vtype = 'PERI', x = 0, y = 0, pseg = 'CMA', 300 identity= True )341 local = False, big = True ) 301 342 302 343 mapping.addGlobal( 'seg_fbf', fbf_base, fbf_size, '__W_', 303 344 vtype = 'PERI', x = 0, y = 0, pseg = 'FBF', 304 identity= True )345 local = False, big = True ) 305 346 306 347 mapping.addGlobal( 'seg_pic', pic_base, pic_size, '__W_', 307 348 vtype = 'PERI', x = 0, y = 0, pseg = 'PIC', 308 identity= True )349 local = False, big = True ) 309 350 310 351 mapping.addGlobal( 'seg_rom', rom_base, rom_size, 'CXW_', 311 352 vtype = 'PERI', x = 0, y = 0, pseg = 'ROM', 312 identity= True )313 314 ### global vsegs for internal peripherals , and for schedulers315 ### name is indexed by (x,y) / vbase address is incremented by (cluster_xy * peri_increment)316 353 local = False, big = True ) 354 355 ### global vsegs for internal peripherals : non local / small pages 356 ### allocated in all clusters with name indexed by (x,y) 357 ### as vbase address is incremented by (cluster_xy * vseg_increment) 317 358 for x in xrange( x_size ): 318 359 for y in xrange( y_size ): 319 cluster_xy = (x << y_width) + y; 320 offset = cluster_xy * peri_increment 360 offset = ((x << y_width) + y) * peri_increment 321 361 322 362 mapping.addGlobal( 'seg_xcu_%d_%d' %(x,y), xcu_base + offset, xcu_size, 323 '__W_', vtype = 'PERI' , x = x , y = y , pseg = 'XCU' ) 363 '__W_', vtype = 'PERI' , x = x , y = y , pseg = 'XCU', 364 local = False, big = False ) 324 365 325 366 mapping.addGlobal( 'seg_dma_%d_%d' %(x,y), dma_base + offset, dma_size, 326 '__W_', vtype = 'PERI' , x = x , y = y , pseg = 'DMA' ) 367 '__W_', vtype = 'PERI' , x = x , y = y , pseg = 'DMA', 368 local = False, big = False ) 327 369 328 370 mapping.addGlobal( 'seg_mmc_%d_%d' %(x,y), mmc_base + offset, mmc_size, 329 '__W_', vtype = 'PERI' , x = x , y = y , pseg = 'MMC' ) 330 331 mapping.addGlobal( 'seg_sched_%d_%d' %(x,y), kernel_sched_vbase + offset, kernel_sched_size, 332 'C_W_', vtype = 'SCHED', x = x , y = y , pseg = 'RAM' ) 371 '__W_', vtype = 'PERI' , x = x , y = y , pseg = 'MMC', 372 local = False, big = False ) 333 373 334 374 ### return mapping ### -
trunk/platforms/tsar_generic_iob/top.cpp
r802 r817 1418 1418 uint64_t ms2 = (uint64_t) t2.tv_sec * 1000ULL + 1419 1419 (uint64_t) t2.tv_usec / 1000; 1420 std::cerr << "### cycle = " << n1420 std::cerr << "### cycle = " << std::dec << n 1421 1421 << " / frequency = " 1422 1422 << (double) 1000000 / (double) (ms2 - ms1) << "Khz" … … 1427 1427 1428 1428 // Monitor a specific address for one L1 cache 1429 // clusters[ 1][1]->proc[0]->cache_monitor(0x50090ULL);1429 // clusters[0][0]->proc[0]->cache_monitor(0xC0180ULL); 1430 1430 1431 1431 // Monitor a specific address for one L2 cache 1432 // clusters[0][0]->memc->cache_monitor( 0x 1c4924LL, true ); // single word1432 // clusters[0][0]->memc->cache_monitor( 0xC0100ULL, true ); // single word 1433 1433 1434 1434 // Monitor a specific address for one XRAM 1435 // clusters[0][0]->xram->start_monitor( 0x E1900ULL , 64);1435 // clusters[0][0]->xram->start_monitor( 0xC0100ULL , 4); 1436 1436 1437 1437 if ( debug_ok and (n > debug_from) )
Note: See TracChangeset
for help on using the changeset viewer.