| | 1 | = Mapping Description = |
| | 2 | |
| | 3 | In this section we will see how one can describe the mapping of the different soft object in DSX-VM. |
| | 4 | |
| | 5 | == Mapper object == |
| | 6 | |
| | 7 | This python object must be initialized first. It has the following arguments : |
| | 8 | {{{ |
| | 9 | Mapper(hard, tcg1, tcg2 ...) |
| | 10 | }}} |
| | 11 | * the first argument is a python description of the hardware (see [https://www-asim.lip6.fr/trac/dsx/wiki/DsxvmHardware]). |
| | 12 | * the rest of arguments is either one or more ''tcg'' objects of applications. |
| | 13 | |
| | 14 | == The mapping == |
| | 15 | |
| | 16 | Once we declared the Mapper object we can use the ''''map'''' methode to map the different soft object. |
| | 17 | The arguments of the ''''map'''' function depend on the type of object to be mapped: |
| | 18 | |
| | 19 | * For soft resources (mwmr channel, barriers, locks): |
| | 20 | {{{ |
| | 21 | mapper.map(soft_object, pseg = physical_segment_to_map_into) |
| | 22 | }}} |
| | 23 | |
| | 24 | * For task objects : |
| | 25 | * If we map the task on a processor : |
| | 26 | {{{ |
| | 27 | mapper.map(soft_object, cluster = cluster_number, proc = proc_number, stack = physical_segment_to_map_into) |
| | 28 | }}} |
| | 29 | * If we map the task on a coprocessor : |
| | 30 | {{{ |
| | 31 | m.map(task, coprocessor = coproc) |
| | 32 | }}} |
| | 33 | |
| | 34 | * For the Tcg objects : |
| | 35 | {{{ |
| | 36 | m.map(tcg, code = physical_segment_to_map_into, data = physical_segment_to_map_into, ptab = physical_segment_to_map_into) |
| | 37 | }}} |
| | 38 | |
| | 39 | * For the Kernel (GIET-VM) objects: |
| | 40 | {{{ |
| | 41 | m.map('system', boot = physical_segment_to_map_into, kernel = physical_segment_to_map_into) |
| | 42 | }}} |
| | 43 | |
| | 44 | The meaning of the arguments is : |
| | 45 | - soft_object : this is the only mandatory argument, it can either be the name of the object or the object itself |
| | 46 | - physical_segment_to_map_into : the the physical segment(RAM/ROM objects) on which the mapping is done |
| | 47 | |
| | 48 | == Example == |
| | 49 | We will see the mapping of the a Hello world application. |
| | 50 | |
| | 51 | * The Hardware description : |
| | 52 | {{{ |
| | 53 | #!/usr/bin/env python |
| | 54 | |
| | 55 | from dsx.hard.hard import * |
| | 56 | |
| | 57 | |
| | 58 | def AlmoArch(nb_proc = 4, nb_tty = 2, timer_pbase = 0x91000000, icu_pbase = 0x9F000000): |
| | 59 | |
| | 60 | cluster_x = 1 |
| | 61 | cluster_y = 1 |
| | 62 | nb_clusters = cluster_x * cluster_y |
| | 63 | hd = Hardware(cluster_x, cluster_y, nb_proc) |
| | 64 | |
| | 65 | ####### peripherals ######## |
| | 66 | hd.add(Tty('tty', pbase = 0x90000000, channel_size = 16, nb_channel = nb_tty)) |
| | 67 | |
| | 68 | for cl in range(nb_clusters): |
| | 69 | hd.add(Timer('timer%d'%cl, pbase = timer_pbase + (cl * hd.cluster_span), channel_size = 16, nb_channel = nb_proc)) |
| | 70 | hd.add(Icu ('icu%d'%cl , pbase = icu_pbase + (cl * hd.cluster_span) , channel_size = 32, nb_channel = nb_proc)) |
| | 71 | |
| | 72 | |
| | 73 | ######## irqs ######## |
| | 74 | for i in xrange(nb_proc): |
| | 75 | hd.add(Irq(proc_id = i , cluster_id = 0, icu_irq_id = i, peri = Timer , channel_id = i )) |
| | 76 | |
| | 77 | |
| | 78 | ##### mwmr_coproc ###### |
| | 79 | hd.add(MwmrCoprocTaskWrapper("tg_coproc" , pbase = 0x94000000, channel_size = 32, sc_name = 'TgCoproc')) |
| | 80 | hd.add(MwmrCoprocTaskWrapper("ramdac_coproc", pbase = 0x95000000, channel_size = 32, sc_name = 'RamdacCoproc')) |
| | 81 | |
| | 82 | ######## Mems ######## |
| | 83 | hd.add(ROM("PSEG_ROM", pbase = 0xbfc00000, size = 0x00010000)) |
| | 84 | hd.add(RAM("PSEG_RAU", pbase = 0x00000000, size = 0x01000000)) |
| | 85 | hd.add(RAM("PSEG_RAK", pbase = 0x80000000, size = 0x00100000)) |
| | 86 | |
| | 87 | return hd |
| | 88 | |
| | 89 | }}} |
| | 90 | |
| | 91 | * The TCG description : |
| | 92 | {{{ |
| | 93 | #!/usr/bin/env python |
| | 94 | |
| | 95 | import dsx |
| | 96 | |
| | 97 | |
| | 98 | tcg = dsx.Tcg("hello", dsx.Task('main', 'hello'), ) |
| | 99 | }}} |
| | 100 | |
| | 101 | * The mapping description : |
| | 102 | {{{ |
| | 103 | #!/usr/bin/env python |
| | 104 | |
| | 105 | import dsx |
| | 106 | |
| | 107 | from almo import AlmoArch |
| | 108 | from app import tcg |
| | 109 | from dsx.mapper.mapper import Mapper |
| | 110 | |
| | 111 | |
| | 112 | hd = AlmoArch(nb_tty = 2) |
| | 113 | |
| | 114 | mpr = Mapper(hd, tcg) |
| | 115 | |
| | 116 | |
| | 117 | mpr.map('main', cluster = 0, proc = 0, stack = 'PSEG_RAU') |
| | 118 | mpr.map('hello', code = 'PSEG_RAU', data = 'PSEG_RAU', ptab = 'PSEG_RAU') |
| | 119 | mpr.map('system' , boot = 'PSEG_ROM', kernel = 'PSEG_RAK') |
| | 120 | |
| | 121 | mpr.generate(dsx.Giet(outdir = 'plateform', debug = True)) |
| | 122 | }}} |
| | 123 | |
| | 124 | More examples can be found in the ''examples'' directory in DSX-VM. |