Changeset 820 for trunk/platforms/tsar_generic_leti
- Timestamp:
- Sep 29, 2014, 4:33:17 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/platforms/tsar_generic_leti/arch.py
r819 r820 18 18 # - y_size : number of clusters in a column 19 19 # - nb_procs : number of processors per cluster 20 # - fbf_width : frame_buffer width = frame_buffer heigth 20 21 # 21 22 # The "hidden" parameters (defined below) are: 22 23 # - nb_ttys : number of TTY channels 23 24 # - nb_nics : number of NIC channels 24 # - fbf_width : frame_buffer width = frame_buffer heigth25 25 # - x_io : cluster_io x coordinate 26 26 # - y_io : cluster_io y coordinate … … 31 31 # - use_ramdisk : use a ramdisk when True 32 32 # - peri_increment : address increment for replicated peripherals 33 ############################################################################### 33 # 34 # Regarding physical memory allocation, there is one allocator per cluster: 35 # - We use only one big physical page (2 Mbytes) for the five boot vsegs, 36 # allocated in cluster[0,0], identity mapping. 37 # - We use one big page per cluster for the kernel vsegs. 38 # The kernel_code, kernel_init and kernel_ptab can be replicated in all clusters. 39 # The kernel_data and kernel_uncdata shared vsegs are only mapped in cluster[0,0]. 40 # - We use 8 small physical pages (4 Kbytes) per cluster for the schedulers. 41 # - We use one big page for each external peripheral in IO cluster, 42 # - We use one small page per cluster for each internal peripheral. 43 ################################################################################### 34 44 35 45 ######################## 36 def arch( x_size 37 y_size 38 nb_procs = 2,39 fbf_width 46 def arch( x_size = 2, 47 y_size = 2, 48 nb_procs = 2, 49 fbf_width = 128 ): 40 50 41 51 ### define architecture constants 42 52 43 nb_ttys = 1 44 nb_nics = 2 45 x_io = 0 46 y_io = 0 47 x_width = 4 48 y_width = 4 49 p_width = 4 50 paddr_width = 40 51 irq_per_proc = 4 52 use_ramdisk = True 53 peri_increment = 0x10000 # distributed peripherals vbase address increment 54 sched_increment = 0x10000 # distributed schedulers vbase address increment 55 ptab_increment = 0x200000 # distributed page tables vbase address increment 56 reset_address = 0x00000000 57 distributed_ptabs = False 53 nb_ttys = 1 54 nb_nics = 2 55 x_io = 0 56 y_io = 0 57 x_width = 4 58 y_width = 4 59 p_width = 4 60 paddr_width = 40 61 irq_per_proc = 4 62 use_ramdisk = True 63 peri_increment = 0x10000 # distributed peripherals vbase address increment 64 sched_increment = 0x10000 # distributed schedulers vbase address increment 65 ptab_increment = 0x200000 # distributed page tables vbase address increment 66 reset_address = 0x00000000 58 67 59 68 ### parameters checking … … 75 84 76 85 ### define physical segments 86 ### These segments are replicated in all clusters 77 87 78 88 ram_base = 0x0000000000 … … 85 95 mmc_size = 0x1000 # 4 Kbytes 86 96 97 ### define physical segments for external peripherals 98 ## These segments are only defined in cluster_io 99 87 100 offset_io = ((x_io << y_width) + y_io) << (paddr_width - x_width - y_width) 88 101 … … 109 122 110 123 ### define preloader & bootloader vsegs base addresses and sizes 111 ### we want to pack these 5 vsegs in the same big page 112 124 ### We want to pack these 5 vsegs in the same big page 125 ### => boot cost is one BPP in cluster[0][0] 126 127 '__W_', vtype = 'PERI' , x = x , y = y , pseg = 128 'XCU', 113 129 preloader_vbase = 0x00000000 # ident 114 130 preloader_size = 0x00010000 # 64 Kbytes … … 127 143 128 144 ### define kernel vsegs base addresses and sizes 129 ### we want to pack code, init and data vsegs in one big page 130 ### we want to map the ptab vseg in one big page per cluster 131 ### we want to map the sched vseg in small pages 132 145 ### code, init, ptab & sched vsegs are replicated in all clusters. 146 ### data & uncdata vsegs are only mapped in cluster[0][0]. 147 ### - We pack code, init, data vsegs in the same BIG page. 148 ### - We use another BIG page for the ptab vseg. 149 ### - We use 2*nb_procs SMALL pages for the sched vseg. 150 ### - we use one SMALL page for uncdata 151 ### => kernel cost is 2 BPPs and (2*n + 1) SPPs per cluster. 152 133 153 kernel_code_vbase = 0x80000000 134 154 kernel_code_size = 0x00080000 # 512 Kbytes per cluster … … 138 158 139 159 kernel_data_vbase = 0x80100000 140 kernel_data_size = 0x00100000 # 1 Mbytes in cluster [0,0]160 kernel_data_size = 0x00100000 # 1 Mbytes in cluster[0][0] 141 161 142 162 kernel_ptab_vbase = 0xB0000000 … … 146 166 kernel_uncdata_size = 0x00001000 # 4 Kbytes 147 167 148 kernel_sched_vbase = 0xA0000000 149 kernel_sched_size = 0x00002000 * nb_procs 168 kernel_sched_vbase = 0xA0000000 # distributed in all clusters 169 kernel_sched_size = 0x00002000 * nb_procs # 8 kbytes per processor 150 170 151 171 ### create mapping … … 171 191 ### external peripherals (accessible in cluster[0,0] only for this mapping) 172 192 173 bdv = mapping.addPeriph( 'BDV', base = bdv_base, size = bdv_size, 174 ptype = 'IOC', subtype = 'BDV' ) 175 176 tty = mapping.addPeriph( 'TTY', base = tty_base, size = tty_size, 177 ptype = 'TTY', channels = nb_ttys ) 178 179 nic = mapping.addPeriph( 'NIC', base = nic_base, size = nic_size, 180 ptype = 'NIC', channels = nb_nics ) 181 182 cma = mapping.addPeriph( 'CMA', base = cma_base, size = cma_size, 183 ptype = 'CMA', channels = 2*nb_nics ) 184 185 fbf = mapping.addPeriph( 'FBF', base = fbf_base, size = fbf_size, 186 ptype = 'FBF', arg = fbf_width ) 187 188 pic = mapping.addPeriph( 'PIC', base = pic_base, size = pic_size, 189 ptype = 'PIC', channels = 32 ) 193 bdv = mapping.addPeriph( 'BDV', base = bdv_base, size = bdv_size, ptype = 'IOC', subtype = 'BDV' ) 194 195 tty = mapping.addPeriph( 'TTY', base = tty_base, size = tty_size, ptype = 'TTY', channels = nb_ttys ) 196 197 nic = mapping.addPeriph( 'NIC', base = nic_base, size = nic_size, ptype = 'NIC', channels = nb_nics ) 198 199 cma = mapping.addPeriph( 'CMA', base = cma_base, size = cma_size, ptype = 'CMA', channels = 2*nb_nics ) 200 201 fbf = mapping.addPeriph( 'FBF', base = fbf_base, size = fbf_size, ptype = 'FBF', arg = fbf_width ) 202 203 pic = mapping.addPeriph( 'PIC', base = pic_base, size = pic_size, ptype = 'PIC', channels = 32 ) 190 204 191 205 mapping.addIrq( pic, index = 0 , isrtype = 'ISR_NIC_RX', channel = 0 ) … … 207 221 offset = cluster_xy << (paddr_width - x_width - y_width) 208 222 209 ram = mapping.addRam( 'RAM', base = ram_base + offset, 210 size = ram_size ) 211 212 mmc = mapping.addPeriph( 'MMC', base = mmc_base + offset, 213 size = mmc_size, ptype = 'MMC' ) 214 215 xcu = mapping.addPeriph( 'XCU', base = xcu_base + offset, 216 size = xcu_size, ptype = 'XCU', 217 channels = nb_procs * irq_per_proc, 218 arg = 16 ) 223 ram = mapping.addRam( 'RAM', base = ram_base + offset, size = ram_size ) 224 225 mmc = mapping.addPeriph( 'MMC', base = mmc_base + offset, size = mmc_size, 226 ptype = 'MMC' ) 227 228 xcu = mapping.addPeriph( 'XCU', base = xcu_base + offset, size = xcu_size, 229 ptype = 'XCU', channels = nb_procs * irq_per_proc, arg = 16 ) 219 230 220 231 # IRQs replicated in all clusters … … 230 241 mapping.addProc( x, y, p ) 231 242 232 ### global vseg for preloader 243 ### global vsegs for preloader & boot_loader 244 ### we want to pack those 5 vsegs in the same big page 245 ### => same flags CXW_ / identity mapping / non local / big page 246 247 mapping.addGlobal( 'seg_preloader', preloader_vbase, preloader_size, 248 'CXW_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', 249 identity = True, local = False, big = True ) 250 251 mapping.addGlobal( 'seg_boot_mapping', boot_mapping_vbase, boot_mapping_size, 252 'CXW_', vtype = 'BLOB' , x = 0, y = 0, pseg = 'RAM', 253 identity = True, local = False, big = True ) 254 255 mapping.addGlobal( 'seg_boot_code', boot_code_vbase, boot_code_size, 256 'CXW_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', 257 identity = True, local = False, big = True ) 258 259 mapping.addGlobal( 'seg_boot_data', boot_data_vbase, boot_data_size, 260 'CXW_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', 261 identity = True, local = False, big = True ) 262 263 mapping.addGlobal( 'seg_boot_stack', boot_stack_vbase, boot_stack_size, 264 'CXW_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', 265 identity = True, local = False, big = True ) 266 267 ### global vsegs kernel_code, kernel_init : local / big page 268 ### replicated in all clusters with the same name (same vbase) 269 for x in xrange( x_size ): 270 for y in xrange( y_size ): 271 cluster_xy = (x << y_width) + y; 272 273 mapping.addGlobal( 'seg_kernel_code', kernel_code_vbase, kernel_code_size, 274 'CXW_', vtype = 'ELF', x = x, y = y, pseg = 'RAM', 275 binpath = 'build/kernel/kernel.elf', 276 local = True, big = True ) 277 278 mapping.addGlobal( 'seg_kernel_init', kernel_init_vbase, kernel_init_size, 279 'CXW_', vtype = 'ELF', x = x, y = y, pseg = 'RAM', 280 binpath = 'build/kernel/kernel.elf', 281 local = True, big = True ) 282 283 ### global vseg kernel_data: non local / big page 284 ### Only mapped in cluster[0][0] 285 mapping.addGlobal( 'seg_kernel_data', kernel_data_vbase, kernel_data_size, 286 'C_W_', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', 287 binpath = 'build/kernel/kernel.elf', local = False ) 288 289 ### global vseg kernel_uncdata: non local / small page 290 ### Only mapped in cluster[0][0] 291 mapping.addGlobal( 'seg_kernel_uncdata', kernel_uncdata_vbase, kernel_uncdata_size, 292 '__W_', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', 293 binpath = 'build/kernel/kernel.elf', local = False ) 294 295 for x in xrange( x_size ): 296 for y in xrange( y_size ): 297 cluster_xy = (x << y_width) + y; 298 299 ### Global vsegs kernel_ptab_x_y: non local / big pages 300 ### replicated in all clusters with name indexed by (x,y) 301 ### as vbase address is incremented by (cluster_xy * vseg_increment) 302 offset = cluster_xy * ptab_increment 303 mapping.addGlobal( 'seg_kernel_ptab_%d_%d' %(x,y), kernel_ptab_vbase + offset, kernel_ptab_size, 304 'CXW_', vtype = 'PTAB', x = x, y = y, pseg = 'RAM', 305 local = False, big = True ) 306 307 ### global vsegs kernel_sched : non local / small pages 308 ### allocated in all clusters with name indexed by (x,y) 309 ### as vbase address is incremented by (cluster_xy * vseg_increment) 310 offset = cluster_xy * sched_increment 311 mapping.addGlobal( 'seg_kernel_sched_%d_%d' %(x,y), kernel_sched_vbase + offset , kernel_sched_size, 312 'C_W_', vtype = 'SCHED', x = x, y = y, pseg = 'RAM', 313 local = False, big = False ) 233 314 234 315 ### global vseg for ram disk 235 236 316 if use_ramdisk: 237 317 mapping.addGlobal( 'seg_rdk', rdk_base, rdk_size, '__W_', 238 318 vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', 239 identity = True ) 240 241 ### global vsegs for external peripherals / identity mapping 242 319 identity = True, local = False, big = True ) 320 321 ### global vsegs for external peripherals: non local / big page 243 322 mapping.addGlobal( 'seg_bdv', bdv_base, bdv_size, '__W_', 244 323 vtype = 'PERI', x = 0, y = 0, pseg = 'BDV', 245 identity= True )324 local = False, big = True ) 246 325 247 326 mapping.addGlobal( 'seg_tty', tty_base, tty_size, '__W_', 248 327 vtype = 'PERI', x = 0, y = 0, pseg = 'TTY', 249 identity= True )328 local = False, big = True ) 250 329 251 330 mapping.addGlobal( 'seg_nic', nic_base, nic_size, '__W_', 252 331 vtype = 'PERI', x = 0, y = 0, pseg = 'NIC', 253 identity= True )332 local = False, big = True ) 254 333 255 334 mapping.addGlobal( 'seg_cma', cma_base, cma_size, '__W_', 256 335 vtype = 'PERI', x = 0, y = 0, pseg = 'CMA', 257 identity= True )336 local = False, big = True ) 258 337 259 338 mapping.addGlobal( 'seg_fbf', fbf_base, fbf_size, '__W_', 260 339 vtype = 'PERI', x = 0, y = 0, pseg = 'FBF', 261 identity= True )340 local = False, big = True ) 262 341 263 342 mapping.addGlobal( 'seg_pic', pic_base, pic_size, '__W_', 264 343 vtype = 'PERI', x = 0, y = 0, pseg = 'PIC', 265 identity= True )266 267 ### global vsegs for internal peripherals , and for schedulers268 ### name is indexed by (x,y) / vbase address is incremented by (cluster_xy * peri_increment)269 344 local = False, big = True ) 345 346 ### global vsegs for internal peripherals : non local / small pages 347 ### allocated in all clusters with name indexed by (x,y) 348 ### as vbase address is incremented by (cluster_xy * vseg_increment) 270 349 for x in xrange( x_size ): 271 350 for y in xrange( y_size ): 272 cluster_xy = (x << y_width) + y; 273 offset = cluster_xy * peri_increment 351 offset = ((x << y_width) + y) * peri_increment 274 352 275 353 mapping.addGlobal( 'seg_xcu_%d_%d' %(x,y), xcu_base + offset, xcu_size, 276 '__W_', vtype = 'PERI' , x = x , y = y , pseg = 'XCU' ) 354 '__W_', vtype = 'PERI' , x = x , y = y , pseg = 'XCU', 355 local = False, big = False ) 277 356 278 357 mapping.addGlobal( 'seg_mmc_%d_%d' %(x,y), mmc_base + offset, mmc_size, 279 '__W_', vtype = 'PERI' , x = x , y = y , pseg = 'MMC' ) 280 281 mapping.addGlobal( 'seg_sched_%d_%d' %(x,y), kernel_sched_vbase + offset, kernel_sched_size, 282 'C_W_', vtype = 'SCHED', x = x , y = y , pseg = 'RAM' ) 283 284 ### global vsegs for preloader and boot_loader 285 ### identity mapping / non local / big page 286 287 mapping.addGlobal( 'seg_preloader', preloader_vbase, preloader_size, 288 'CXW_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', 289 identity = True, local = False, big = True ) 290 291 mapping.addGlobal( 'seg_boot_mapping', boot_mapping_vbase, boot_mapping_size, 292 'CXW_', vtype = 'BLOB' , x = 0, y = 0, pseg = 'RAM', 293 identity = True, local = False, big = True ) 294 295 mapping.addGlobal( 'seg_boot_code', boot_code_vbase, boot_code_size, 296 'CXW_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', 297 identity = True, local = False, big = True ) 298 299 mapping.addGlobal( 'seg_boot_data', boot_data_vbase, boot_data_size, 300 'CXW_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', 301 identity = True, local = False, big = True ) 302 303 mapping.addGlobal( 'seg_boot_stack', boot_stack_vbase, boot_stack_size, 304 'CXW_', vtype = 'BUFFER', x = 0, y = 0, pseg = 'RAM', 305 identity = True, local = False, big = True ) 306 307 ### global vsegs kernel_code, kernel_init 308 for x in xrange( x_size ): 309 for y in xrange( y_size ): 310 cluster_xy = (x << y_width) + y; 311 312 mapping.addGlobal( 'seg_kernel_code', kernel_code_vbase, kernel_code_size, 313 'CXW_', vtype = 'ELF', x = x , y = y , pseg = 'RAM', 314 binpath = 'build/kernel/kernel.elf', 315 local = True, big = True ) 316 317 mapping.addGlobal( 'seg_kernel_init', kernel_init_vbase, kernel_init_size, 318 'CXW_', vtype = 'ELF', x = x , y = y , pseg = 'RAM', 319 binpath = 'build/kernel/kernel.elf', 320 local = True, big = True ) 321 322 323 324 mapping.addGlobal( 'seg_kernel_data', kernel_data_vbase, kernel_data_size, 325 'C_W_', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', 326 binpath = 'build/kernel/kernel.elf', local = False ) 327 328 mapping.addGlobal( 'seg_kernel_uncdata', kernel_uncdata_vbase, kernel_uncdata_size, 329 '__W_', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', 330 binpath = 'build/kernel/kernel.elf', local = False ) 358 '__W_', vtype = 'PERI' , x = x , y = y , pseg = 'MMC', 359 local = False, big = False ) 331 360 332 361 ### return mapping ###
Note: See TracChangeset
for help on using the changeset viewer.