Last change
on this file since 775 was
775,
checked in by cfuguet, 9 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
|
File size:
839 bytes
|
Rev | Line | |
---|
[775] | 1 | #!/usr/bin/python |
---|
| 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 | for x, y, l in faulty: |
---|
| 16 | content.append(" ({} << 6) | ({} << 2) | {},\n".format(x, y, l)) |
---|
| 17 | |
---|
| 18 | content.append( "};\n" |
---|
| 19 | "#endif\n") |
---|
| 20 | |
---|
| 21 | with open(outpath, "w") as outfile: |
---|
| 22 | outfile.writelines(content) |
---|
| 23 | |
---|
| 24 | if __name__ == "__main__": |
---|
| 25 | faulty = [ (0,0,1), (0,1,1), (1,0,1), (1,0,2), (1,0,3), (1,1,1), (1,1,3)] |
---|
| 26 | generate(faulty, "fault.gen.h") |
---|
| 27 | |
---|
| 28 | # vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab |
---|
Note: See
TracBrowser
for help on using the repository browser.