| [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 | |
|---|
| [708] | 21 | # define thread placement |
|---|
| 22 | x = 0 |
|---|
| 23 | y = 0 |
|---|
| [724] | 24 | p = 0 |
|---|
| [708] | 25 | |
|---|
| [444] | 26 | # define vsegs base & size |
|---|
| 27 | code_base = 0x10000000 |
|---|
| 28 | code_size = 0x00010000 # 64 Kbytes |
|---|
| 29 | |
|---|
| 30 | data_base = 0x20000000 |
|---|
| [574] | 31 | data_size = 0x00040000 # 256 Kbytes |
|---|
| [444] | 32 | |
|---|
| 33 | stack_base = 0x40000000 |
|---|
| 34 | stack_size = 0x00200000 # 2 Mbytes |
|---|
| 35 | |
|---|
| 36 | heap_base = 0x60000000 |
|---|
| 37 | heap_size = 0x00001000 # 4 Kbytes |
|---|
| 38 | |
|---|
| 39 | # create vspace |
|---|
| [644] | 40 | vspace = mapping.addVspace( name = 'display', startname = 'disp_data', active = False ) |
|---|
| [444] | 41 | |
|---|
| 42 | # data vseg |
|---|
| 43 | mapping.addVseg( vspace, 'disp_data', data_base , data_size, |
|---|
| 44 | 'C_WU', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', |
|---|
| [610] | 45 | binpath = 'bin/display/appli.elf', |
|---|
| [444] | 46 | local = False ) |
|---|
| 47 | |
|---|
| 48 | # code vseg |
|---|
| 49 | mapping.addVseg( vspace, 'disp_code', code_base , code_size, |
|---|
| 50 | 'CXWU', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM', |
|---|
| [610] | 51 | binpath = 'bin/display/appli.elf', |
|---|
| [444] | 52 | local = False ) |
|---|
| 53 | |
|---|
| 54 | # stack vseg |
|---|
| 55 | mapping.addVseg( vspace, 'disp_stack', stack_base, stack_size, |
|---|
| 56 | 'C_WU', vtype = 'BUFFER', x = 0 , y = 0 , pseg = 'RAM', |
|---|
| 57 | local = False, big = True ) |
|---|
| 58 | |
|---|
| 59 | # heap vseg (unused) |
|---|
| 60 | mapping.addVseg( vspace, 'disp_heap', heap_base, heap_size, |
|---|
| 61 | 'C_WU', vtype = 'BUFFER', x = 0 , y = 0 , pseg = 'RAM', |
|---|
| 62 | local = False ) |
|---|
| 63 | |
|---|
| 64 | # task |
|---|
| [708] | 65 | mapping.addThread( vspace, 'display', |
|---|
| 66 | True, # is_main |
|---|
| 67 | x, y, p, |
|---|
| 68 | 'disp_stack', |
|---|
| 69 | 'disp_heap', |
|---|
| 70 | 0 ) # startid |
|---|
| [444] | 71 | |
|---|
| 72 | # extend mapping name |
|---|
| 73 | mapping.name += '_display' |
|---|
| 74 | |
|---|
| 75 | return vspace # useful for test |
|---|
| 76 | |
|---|
| 77 | ################################ test ###################################################### |
|---|
| 78 | |
|---|
| 79 | if __name__ == '__main__': |
|---|
| 80 | |
|---|
| [589] | 81 | vspace = extend( Mapping( 'test', 2, 2, 4 ) ) |
|---|
| [444] | 82 | print vspace.xml() |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | # Local Variables: |
|---|
| 86 | # tab-width: 4; |
|---|
| 87 | # c-basic-offset: 4; |
|---|
| 88 | # c-file-offsets:((innamespace . 0)(inline-open . 0)); |
|---|
| 89 | # indent-tabs-mode: nil; |
|---|
| 90 | # End: |
|---|
| 91 | # |
|---|
| 92 | # vim: filetype=python:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
|---|
| 93 | |
|---|