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]) * 4 |
---|
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 | 'barrier2': BarrierPort(), |
---|
30 | }, |
---|
31 | impls = [ |
---|
32 | SwTask('test_llsc_main_func', |
---|
33 | stack_size = 2048, |
---|
34 | sources = ['test_llsc_main.c', 'functions.c'], |
---|
35 | headers = ['functions.h'], |
---|
36 | defines = []) |
---|
37 | ], |
---|
38 | uses = ['tty'] |
---|
39 | ) |
---|
40 | |
---|
41 | |
---|
42 | test_llsc_no_tty = TaskModel( |
---|
43 | 'test_llsc_no_tty', |
---|
44 | ports = { |
---|
45 | 'table': MemspacePort(), |
---|
46 | 'barrier': BarrierPort(), |
---|
47 | 'barrier2': BarrierPort(), |
---|
48 | 'id' : ConstPort(), |
---|
49 | }, |
---|
50 | impls = [ |
---|
51 | SwTask('test_llsc_no_tty_func', |
---|
52 | stack_size = 2048, |
---|
53 | sources = ['test_llsc_no_tty.c', 'functions.c'], |
---|
54 | headers = ['functions.h'], |
---|
55 | defines = []) |
---|
56 | ], |
---|
57 | ) |
---|
58 | |
---|
59 | |
---|
60 | barrier = Barrier('barrier') |
---|
61 | barrier2 = Barrier('barrier2') |
---|
62 | memspace = Memspace('memspace', memspace_size) |
---|
63 | |
---|
64 | tasks = () |
---|
65 | |
---|
66 | |
---|
67 | tasks += Task('task_llsc_main', 'test_llsc_main', |
---|
68 | { |
---|
69 | 'table' : memspace, |
---|
70 | 'barrier' : barrier, |
---|
71 | 'barrier2' : barrier2, |
---|
72 | }, |
---|
73 | defines = {} ), |
---|
74 | |
---|
75 | |
---|
76 | for i in range(1, nb_total_procs): |
---|
77 | tasks += Task('task_llsc_no_tty_%d' % i, 'test_llsc_no_tty', |
---|
78 | { |
---|
79 | 'table' : memspace, |
---|
80 | 'barrier' : barrier, |
---|
81 | 'barrier2' : barrier2, |
---|
82 | 'id' : i, |
---|
83 | }, |
---|
84 | defines = {} ), |
---|
85 | |
---|
86 | tcg = dsx.Tcg('test_llsc', *tasks) |
---|
87 | |
---|
88 | mpr = Mapper(hd, tcg) |
---|
89 | |
---|
90 | mpr.map('task_llsc_main', cluster = 0, proc = 0, stack = "PSEG_RAM_0") |
---|
91 | |
---|
92 | for i in range(1, nb_total_procs): |
---|
93 | #print "cluster = %d - proc = %d" % (int(i) / 4, i % 4) |
---|
94 | mpr.map('task_llsc_no_tty_%d' % i, cluster = int(i) / 4, proc = int(i) % 4, stack = "PSEG_RAM_%d" % (int(i) / 4)) |
---|
95 | |
---|
96 | for const in tcg.nodesOfType('const'): |
---|
97 | mpr.map(const, pseg = 'PSEG_RAM_0') |
---|
98 | |
---|
99 | |
---|
100 | mpr.map('memspace', pseg = "PSEG_RAM_0") |
---|
101 | mpr.map('barrier', pseg = "PSEG_RAM_0") |
---|
102 | mpr.map('barrier2', pseg = "PSEG_RAM_0") |
---|
103 | |
---|
104 | mpr.map(tcg, code = 'PSEG_RAM_0', data = 'PSEG_RAM_0', ptab = "PSEG_RAM_0") |
---|
105 | mpr.map('system', boot = 'PSEG_RAM_0', kernel = 'PSEG_RAM_0', scheduler = True) |
---|
106 | |
---|
107 | mpr.generate(dsx.Giet(outdir = '.', vaddr_replicated_peri_inc = 0x2000, debug = False)) |
---|
108 | |
---|