[589] | 1 | #!/usr/bin/env python |
---|
| 2 | |
---|
| 3 | from mapping import * |
---|
| 4 | |
---|
| 5 | ###################################################################################### |
---|
| 6 | # file : shell.py |
---|
| 7 | # date : july 2015 |
---|
| 8 | # author : Alain Greiner |
---|
| 9 | ####################################################################################### |
---|
[712] | 10 | # This file describes the mapping of the single thread "shell" application. |
---|
| 11 | # It is mapped on processor[xmap][ymap][pmap] of the target |
---|
| 12 | # multi-clusters, multi-processors architecture. |
---|
[589] | 13 | #################################################################################### |
---|
| 14 | |
---|
| 15 | ###################### |
---|
| 16 | def extend( mapping ): |
---|
| 17 | |
---|
[712] | 18 | # define mapping |
---|
| 19 | xmap = mapping.x_size - 1 |
---|
| 20 | ymap = mapping.y_size - 1 |
---|
| 21 | pmap = mapping.nprocs - 1 |
---|
[589] | 22 | |
---|
| 23 | # define vsegs base & size |
---|
| 24 | code_base = 0x10000000 |
---|
| 25 | code_size = 0x00010000 # 64 Kbytes |
---|
| 26 | |
---|
| 27 | data_base = 0x20000000 |
---|
| 28 | data_size = 0x00080000 # 512 Kbytes |
---|
| 29 | |
---|
| 30 | stack_base = 0x40000000 |
---|
| 31 | stack_size = 0x00200000 # 2 Mbytes |
---|
| 32 | |
---|
| 33 | heap_base = 0x60000000 |
---|
| 34 | heap_size = 0x00001000 # 4 Kbytes |
---|
| 35 | |
---|
| 36 | # create vspace |
---|
[643] | 37 | vspace = mapping.addVspace( name = 'shell', startname = 'shell_data' , active = True ) |
---|
[589] | 38 | |
---|
| 39 | # data vseg |
---|
| 40 | mapping.addVseg( vspace, 'shell_data', data_base , data_size, |
---|
[712] | 41 | 'C_WU', vtype = 'ELF', x = xmap, y = ymap, pseg = 'RAM', |
---|
[610] | 42 | binpath = 'bin/shell/appli.elf', |
---|
[589] | 43 | local = False ) |
---|
| 44 | |
---|
| 45 | # code vseg |
---|
| 46 | mapping.addVseg( vspace, 'shell_code', code_base , code_size, |
---|
[712] | 47 | 'CXWU', vtype = 'ELF', x = xmap, y = ymap, pseg = 'RAM', |
---|
[610] | 48 | binpath = 'bin/shell/appli.elf', |
---|
[589] | 49 | local = False ) |
---|
| 50 | |
---|
| 51 | # stack vseg |
---|
| 52 | mapping.addVseg( vspace, 'shell_stack', stack_base, stack_size, |
---|
[712] | 53 | 'C_WU', vtype = 'BUFFER', x = xmap , y = ymap , pseg = 'RAM', |
---|
[589] | 54 | local = False, big = True ) |
---|
| 55 | |
---|
| 56 | # heap vseg (unused) |
---|
| 57 | mapping.addVseg( vspace, 'shell_heap', heap_base, heap_size, |
---|
[712] | 58 | 'C_WU', vtype = 'BUFFER', x = xmap , y = ymap , pseg = 'RAM', |
---|
[589] | 59 | local = False ) |
---|
| 60 | |
---|
| 61 | # task |
---|
[712] | 62 | mapping.addThread( vspace, |
---|
| 63 | 'shell', |
---|
| 64 | True, # is_main |
---|
| 65 | xmap, ymap, pmap, |
---|
| 66 | 'shell_stack', |
---|
| 67 | 'shell_heap', |
---|
| 68 | 0 ) # startid |
---|
[589] | 69 | |
---|
| 70 | # extend mapping name |
---|
| 71 | mapping.name += '_shell' |
---|
| 72 | |
---|
| 73 | return vspace # useful for test |
---|
| 74 | |
---|
| 75 | ################################ test ###################################################### |
---|
| 76 | |
---|
| 77 | if __name__ == '__main__': |
---|
| 78 | |
---|
| 79 | vspace = extend( Mapping( 'test', 2, 2, 4 ) ) |
---|
| 80 | print vspace.xml() |
---|
| 81 | |
---|
| 82 | |
---|
| 83 | # Local Variables: |
---|
| 84 | # tab-width: 4; |
---|
| 85 | # c-basic-offset: 4; |
---|
| 86 | # c-file-offsets:((innamespace . 0)(inline-open . 0)); |
---|
| 87 | # indent-tabs-mode: nil; |
---|
| 88 | # End: |
---|
| 89 | # |
---|
| 90 | # vim: filetype=python:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
| 91 | |
---|