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