source: branches/reconfiguration/platforms/tsar_generic_iob/scripts/run.py @ 775

Last change on this file since 775 was 775, checked in by cfuguet, 8 years ago

reconfiguration/tsar_generic_iob: introducing faultyprocs python module

  • This module generates the fault_config.h file for faulty processor simulation.
  • Using this module from the run.py module to generate the fault_config.h file with several configurations
  • Property svn:executable set to *
File size: 2.3 KB
Line 
1#!/usr/bin/python
2# @date   25 August, 2014
3# @author cfuguet <cesar.fuguet-tortolero@lip6.fr>
4
5import sys
6import os
7import subprocess
8import arch
9import faultyprocs
10
11# define constants
12configs = []
13configs.append([2 ,2 ])
14configs.append([4 ,4 ])
15configs.append([8 ,8 ])
16configs.append([16,16])
17
18faultylist = [[(0,0,1), (0,1,1), (1,0,1), (1,0,2), (1,0,3), (1,1,1), (1,1,3)]]
19
20nprocs = 4
21
22assert len(sys.argv) > 1, "Introduce platform base directory path"
23
24# goto platform base directory
25os.chdir(sys.argv[1])
26
27# repeat while configurations is not empty
28for faulty in faultylist:
29    for x,y in configs:
30        confdir = os.getcwd() + "conf/config_{}c/".format(x*y)
31
32        # 1. generate configuration and ouput directories
33        try:
34            os.makedirs(confdir + "config", 0755)
35        except OSError:
36            pass # directory already exists => do nothing
37
38        # 2. generate hard_config.h and fault_config.h files
39        arch.main( x = x, y = y, p = nprocs,
40                   hard_path = confdir + "config/hard_config.h",
41                   xml_path = confdir + "config/map.xml" )
42        faultyprocs.generate(faulty, confdir + "config/fault_config.h")
43
44        # 3. compile simulator executable
45        if os.path.exists("hard_config.h"): os.unlink("hard_config.h")
46        os.symlink(confdir + "config/hard_config.h", "hard_config.h")
47        subprocess.call("make")
48
49        # 4. compile distributed boot executable
50        dst = confdir + "config/boot_config.h"
51        if not os.path.exists(dst):
52            os.symlink(os.getcwd() + "/soft/config/boot_config.h", dst)
53        subprocess.call(["make",
54            "-C", "soft",
55            "CONFDIR=" + confdir
56            ])
57
58        # 5. execute simulator
59        os.environ["DISTRIBUTED_BOOT"] = "1"
60        os.environ["SOCLIB_TTY"] = "FILES"
61        with open(confdir + "log", "w") as log_file:
62            subprocess.call(["./simul.x",
63                "-SOFT"   , "soft/build/soft.elf",
64                "-DISK"   , "/dev/null",
65                "-NCYCLES", "10000000"],
66                stdout=log_file,
67                stderr=log_file,
68                )
69
70        # 6. move simulation terminal output into the target config dir
71        os.rename("term0", confdir + "term")
72
73        # end for each config
74    #end for each faulty
75
76# vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
Note: See TracBrowser for help on using the repository browser.