Changeset 407
- Timestamp:
- Sep 12, 2014, 4:34:19 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/sort/sort.py
r335 r407 10 10 # This file describes the mapping of the multi-threaded "sort" 11 11 # application on a multi_clusters, multi-processors architecture. 12 # This include both the mapping of virtual segments on the clusters, 12 # This include both the mapping of virtual segments on the clusters, 13 13 # and the mapping of tasks on processors. 14 14 # This mapping uses 5 platform parameters, (obtained from the "mapping" argument) … … 34 34 code_base = 0x10000000 35 35 code_size = 0x00010000 # 64 Kbytes 36 36 37 37 data_base = 0x20000000 38 38 data_size = 0x00010000 # 64 Kbytes … … 41 41 ptab_size = 0x00040000 # 256 Kbytes 42 42 43 stack_base = 0x40000000 43 stack_base = 0x40000000 44 44 stack_size = 0x00010000 # 64 Kbytes 45 45 46 heap_base = 0x50000000 46 heap_base = 0x50000000 47 47 heap_size = 0x00010000 # 64 Kbytes 48 48 49 args_base = 0x60000000 49 args_base = 0x60000000 50 50 args_size = 0x00000004 # 4 bytes 51 51 52 52 # create Vspace 53 53 vspace = mapping.addVspace( name = 'sort', startname = 'sort_data' ) 54 54 55 55 # non replicated vsegs in cluster[0,0] 56 mapping.addVseg( vspace, 'sort_code', code_base , code_size, 'CXWU', vtype = 'ELF', 56 mapping.addVseg( vspace, 'sort_code', code_base , code_size, 'CXWU', vtype = 'ELF', 57 57 x = 0, y = 0, pseg = 'RAM', binpath = 'build/sort/sort.elf' ) 58 58 … … 60 60 x = 0, y = 0, pseg = 'RAM', binpath = 'build/sort/sort.elf' ) 61 61 62 mapping.addVseg( vspace, 'sort_ptab', ptab_base , ptab_size, 'C_WU', vtype = 'PTAB',63 x = 0, y = 0, pseg = 'RAM', align = 13 )64 65 62 mapping.addVseg( vspace, 'sort_args', args_base , args_size, 'C_WU', vtype = 'CONST', 66 63 x = 0, y = 0, pseg = 'RAM', init = ntasks ) 67 64 68 # distributed vsegs: one stack per processor/task, one heap per cluster 69 for x_rep in xrange (x_size): 70 for y_rep in xrange (y_size): 71 cluster_offset = ((x_rep << y_width) + y_rep) << 20 # 1 Mbytes per cluster 72 mapping.addVseg( vspace, 'sort_heap_%d_%d' % (x_rep, y_rep), 73 heap_base + cluster_offset, heap_size, 'C_WU', 74 vtype = 'BUFFER', x = x_rep, y = y_rep, pseg = 'RAM' ) 75 76 for p in xrange( procs_max ): 77 proc_offset = cluster_offset + (p << 18) # 256 Kbytes per proc 78 mapping.addVseg( vspace, 'sort_stack_%d_%d_%d' % (x_rep, y_rep, p), 79 stack_base + proc_offset, stack_size, 'C_WU', 80 vtype = 'BUFFER', x = x_rep, y = y_rep, pseg = 'RAM' ) 81 65 # distributed vsegs: one stack per task, one ptab and heap per cluster 66 for c in mapping.clusters: 67 x, y = c.x, c.y 68 cluster_offset = ((x << y_width) + y) << 20 # 1 Mbytes per cluster 69 mapping.addVseg( vspace, 'sort_heap_%d_%d' % (x, y), 70 heap_base + cluster_offset, heap_size, 'C_WU', 71 vtype = 'BUFFER', x = x, y = y, pseg = 'RAM' ) 72 73 mapping.addVseg( vspace, 'sort_ptab_%d_%d' % (x, y), 74 ptab_base + cluster_offset, ptab_size, 'C_WU', 75 vtype = 'PTAB', x = x, y = y, pseg = 'RAM', align = 13 ) 76 77 for p in c.procs: 78 l = p.lpid 79 proc_offset = cluster_offset + (l << 18) # 256 Kbytes per proc 80 mapping.addVseg( vspace, 'sort_stack_%d_%d_%d' % (x, y, l), 81 stack_base + proc_offset, stack_size, 'C_WU', 82 vtype = 'BUFFER', x = x, y = y, pseg = 'RAM' ) 83 82 84 # distributed tasks / one task per processor 83 for x in xrange (x_size): 84 for y in xrange (y_size): 85 for p in xrange( procs_max ): 86 87 trdid = (((x * y_size) + y) * procs_max) + p 88 mapping.addTask( vspace, 'sort_%d_%d_%d' % (x,y,p), trdid, x, y, p, 89 'sort_stack_%d_%d_%d' % (x,y,p), 90 'sort_heap_%d_%d' % (x,y), 0 ) 85 trdid = 0 86 for c in mapping.clusters: 87 x, y = c.x, c.y 88 for p in c.procs: 89 l = p.lpid 90 mapping.addTask( vspace, 'sort_%d_%d_%d' % (x, y, l), trdid, x, y, l, 91 'sort_stack_%d_%d_%d' % (x, y, l), 92 'sort_heap_%d_%d' % (x, y), 0 ) 93 trdid += 1 91 94 92 95 # extend mapping name … … 95 98 return vspace # useful for test 96 99 97 ################################ test ################################################### ###100 ################################ test ################################################### 98 101 99 102 if __name__ == '__main__': 100 103 101 104 vspace = sort( Mapping( 'test', 2, 2, 4 ) ) 102 105 print vspace.xml()
Note: See TracChangeset
for help on using the changeset viewer.