[536] | 1 | #!/usr/bin/env python |
---|
| 2 | |
---|
| 3 | import sys |
---|
| 4 | import dsx |
---|
| 5 | from tsarch import TSArch |
---|
| 6 | from dsx.mapper.mapper import Mapper |
---|
| 7 | from dsx import * |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | if len(sys.argv) < 4 or sys.argv[1] == '' or sys.argv[2] == '': |
---|
| 12 | print "Usage: ", sys.argv[0], "<nb_clusters_x> <nb_clusters_y> <memspace_size>" |
---|
| 13 | exit() |
---|
| 14 | |
---|
| 15 | cluster_x = int(sys.argv[1]) |
---|
| 16 | cluster_y = int(sys.argv[2]) |
---|
| 17 | memspace_size = int(sys.argv[3]) |
---|
| 18 | |
---|
| 19 | nb_procs = 4 |
---|
| 20 | nb_total_procs = nb_procs * cluster_x * cluster_y |
---|
| 21 | |
---|
| 22 | hd = TSArch(cluster_x = cluster_x, cluster_y = cluster_y, nb_proc = nb_procs, nb_tty = 4) |
---|
| 23 | |
---|
| 24 | test_llsc = TaskModel( |
---|
| 25 | 'test_llsc_main', |
---|
| 26 | ports = { |
---|
| 27 | 'table': MemspacePort(), |
---|
| 28 | 'barrier': BarrierPort(), |
---|
| 29 | }, |
---|
| 30 | impls = [ |
---|
| 31 | SwTask('test_llsc_main_func', |
---|
| 32 | stack_size = 2048, |
---|
| 33 | sources = ['test_llsc_main.c', 'functions.c'], |
---|
| 34 | headers = ['functions.h'], |
---|
| 35 | defines = []) |
---|
| 36 | ], |
---|
| 37 | uses = ['tty'] |
---|
| 38 | ) |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | test_llsc_no_tty = TaskModel( |
---|
| 42 | 'test_llsc_no_tty', |
---|
| 43 | ports = { |
---|
| 44 | 'table': MemspacePort(), |
---|
| 45 | 'barrier': BarrierPort(), |
---|
| 46 | 'id' : ConstPort(), |
---|
| 47 | }, |
---|
| 48 | impls = [ |
---|
| 49 | SwTask('test_llsc_no_tty_func', |
---|
| 50 | stack_size = 2048, |
---|
| 51 | sources = ['test_llsc_no_tty.c', 'functions.c'], |
---|
| 52 | headers = ['functions.h'], |
---|
| 53 | defines = []) |
---|
| 54 | ], |
---|
| 55 | ) |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | barrier = Barrier('barrier') |
---|
| 59 | memspace = Memspace('memspace', memspace_size) |
---|
| 60 | |
---|
| 61 | tasks = () |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | tasks += Task('task_llsc_main', 'test_llsc_main', |
---|
| 65 | { |
---|
| 66 | 'table' : memspace, |
---|
| 67 | 'barrier' : barrier, |
---|
| 68 | }, |
---|
| 69 | defines = {} ), |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | for i in range(1, nb_total_procs): |
---|
| 73 | tasks += Task('task_llsc_no_tty_%d' % i, 'test_llsc_no_tty', |
---|
| 74 | { |
---|
| 75 | 'table' : memspace, |
---|
| 76 | 'barrier' : barrier, |
---|
| 77 | 'id' : i, |
---|
| 78 | }, |
---|
| 79 | defines = {} ), |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | tcg = dsx.Tcg('test_llsc', *tasks) |
---|
| 85 | |
---|
| 86 | mpr = Mapper(hd ,tcg) |
---|
| 87 | |
---|
| 88 | mpr.map('task_llsc_main', cluster = 0, proc = 0, stack = "PSEG_RAM_0") |
---|
| 89 | |
---|
| 90 | for i in range(1, nb_total_procs): |
---|
| 91 | #print "cluster = %d - proc = %d" % (int(i) / 4, i % 4) |
---|
| 92 | mpr.map('task_llsc_no_tty_%d' % i, cluster = int(i) / 4, proc = int(i) % 4, stack = "PSEG_RAM_%d" % (int(i) / 4)) |
---|
| 93 | |
---|
| 94 | for const in tcg.nodesOfType('const'): |
---|
| 95 | mpr.map(const, pseg = 'PSEG_RAM_0') |
---|
| 96 | |
---|
| 97 | mpr.map('memspace', pseg = "PSEG_RAM_0") |
---|
| 98 | mpr.map('barrier', pseg = "PSEG_RAM_0") |
---|
| 99 | |
---|
| 100 | mpr.map(tcg, code = 'PSEG_RAM_0', data = 'PSEG_RAM_0', ptab = "PSEG_RAM_0") |
---|
| 101 | mpr.map('system', boot = 'PSEG_ROM', kernel = 'PSEG_RAM_0', scheduler = True) |
---|
| 102 | |
---|
| 103 | mpr.generate(dsx.Giet(outdir = '.', vaddr_replicated_peri_inc = 0x100000)) |
---|
| 104 | |
---|