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

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

reconfiguration/tsar_generic_iob: moving all python scripts in subdirectory

  • The run.py don't use anymore the genmap tool. It uses directly the a new main function in the arch.py module to generate the hard_config.h
File size: 2.1 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
9
10# define constants
11configs = []
12configs.append([2 ,2 ])
13configs.append([4 ,4 ])
14configs.append([8 ,8 ])
15configs.append([16,16])
16
17nprocs = 4
18
19assert len(sys.argv) > 1, "Introduce platform base directory path"
20
21# goto platform base directory
22os.chdir(sys.argv[1])
23
24# repeat while configurations is not empty
25for x,y in configs:
26    confdir = os.getcwd() + "conf/config_{}c/".format(x*y)
27
28    # 1. generate configuration and ouput directories
29    try:
30        os.makedirs(confdir + "config", 0755)
31    except OSError:
32        pass # directory already exists => do nothing
33
34    # 2. generate hard_config.h and fault_config.h files
35    arch.main( x = x, y = y, p = nprocs,
36               hard_path = confdir + "config/hard_config.h",
37               xml_path = confdir + "config/map.xml" )
38
39    # 3. compile simulator executable
40    if os.path.exists("hard_config.h"): os.unlink("hard_config.h")
41    os.symlink(confdir + "config/hard_config.h", "hard_config.h")
42    subprocess.call("make")
43
44    # 4. compile distributed boot executable
45    dst = confdir + "config/boot_config.h"
46    if not os.path.exists(dst):
47        os.symlink(os.getcwd() + "/soft/config/boot_config.h", dst)
48    dst = confdir + "config/fault_config.h"
49    if not os.path.exists(dst):
50        os.symlink(os.getcwd() + "/soft/config/fault_config.h", dst)
51    subprocess.call(["make",
52        "-C", "soft",
53        "CONFDIR=" + confdir
54        ])
55
56    # 5. execute simulator
57    os.environ["DISTRIBUTED_BOOT"] = "1"
58    os.environ["SOCLIB_TTY"] = "FILES"
59    with open(confdir + "log", "w") as log_file:
60        subprocess.call(["./simul.x",
61            "-SOFT"   , "soft/build/soft.elf",
62            "-DISK"   , "/dev/null",
63            "-NCYCLES", "10000000"],
64            stdout=log_file,
65            stderr=log_file,
66            )
67
68    # 6. move simulation terminal output into the target config dir
69    os.rename("term0", confdir + "term")
70
71# end repeat
72
73# vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
Note: See TracBrowser for help on using the repository browser.