Last change
on this file since 1063 was
991,
checked in by cfuguet, 9 years ago
|
reconf: force the python version 2.7 in simulation scripts.
|
File size:
880 bytes
|
Line | |
---|
1 | #!/usr/bin/env python2.7 |
---|
2 | # @date 26 August, 2014 |
---|
3 | # @author cfuguet <cesar.fuguet-tortolero@lip6.fr> |
---|
4 | |
---|
5 | import sys |
---|
6 | |
---|
7 | def generate(faulty, outpath): |
---|
8 | content = [] |
---|
9 | content.append( "#ifndef FAULT_CONFIG_H\n" |
---|
10 | "#define FAULT_CONFIG_H\n" |
---|
11 | "static const int faulty_proc_ids[] =\n" |
---|
12 | "{\n" |
---|
13 | " /* X | Y | L */\n") |
---|
14 | |
---|
15 | if faulty != None: |
---|
16 | for x, y, l in faulty: |
---|
17 | content.append(" ({0} << 6) | ({1} << 2) | {2},\n".format(x, y, l)) |
---|
18 | |
---|
19 | content.append( "};\n" |
---|
20 | "#endif\n") |
---|
21 | |
---|
22 | with open(outpath, "w") as outfile: |
---|
23 | outfile.writelines(content) |
---|
24 | |
---|
25 | if __name__ == "__main__": |
---|
26 | faulty = [ (0,0,1), (0,1,1), (1,0,1), (1,0,2), (1,0,3), (1,1,1), (1,1,3)] |
---|
27 | generate(faulty, "fault.gen.h") |
---|
28 | |
---|
29 | # vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab |
---|
Note: See
TracBrowser
for help on using the repository browser.