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