diff options
author | Ali Saidi <saidi@eecs.umich.edu> | 2004-08-10 13:32:15 -0400 |
---|---|---|
committer | Ali Saidi <saidi@eecs.umich.edu> | 2004-08-10 13:32:15 -0400 |
commit | abcd11d36f90174f1c8c5b7bff013809572e1a10 (patch) | |
tree | 4818bbe5adb505d5c4995bbdde7a741d871582c0 /sim/main.cc | |
parent | 6ee18e46163c0342c93f9a879c575e5cafe32b96 (diff) | |
parent | 00270ba3a7cd2e9e33df79b3adcc355a6ee3fb40 (diff) | |
download | gem5-abcd11d36f90174f1c8c5b7bff013809572e1a10.tar.xz |
Merge zizzer:/bk/m5 into zeep.eecs.umich.edu:/z/saidi/work/m5
--HG--
extra : convert_revision : 006842b706c7d972f6722b2767c82c6761c447b2
Diffstat (limited to 'sim/main.cc')
-rw-r--r-- | sim/main.cc | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/sim/main.cc b/sim/main.cc index 54c74fd1a..2a0427303 100644 --- a/sim/main.cc +++ b/sim/main.cc @@ -56,6 +56,7 @@ #include "sim/stat_control.hh" #include "sim/stats.hh" #include "sim/universe.hh" +#include "sim/pyconfig/pyconfig.hh" using namespace std; @@ -340,15 +341,35 @@ main(int argc, char **argv) else { // no '-', treat as config file name - // If we haven't loaded default.ini yet, and we want to, - // now is the time. Can't do it sooner because we need to - // look for '-n', can't do it later since we want - // default.ini loaded first (so that any other settings - // override it). - handleDefaultIni(loadDefaultIni, cppArgs); + // make STL string out of file name + string filename(arg_str); - if (!simConfigDB.loadCPP(arg_str, cppArgs)) { - cprintf("Error processing file %s\n", arg_str); + int ext_loc = filename.rfind("."); + + string ext = + (ext_loc != string::npos) ? filename.substr(ext_loc) : ""; + + if (ext == ".ini") { + // If we haven't loaded default.ini yet, and we want to, + // now is the time. Can't do it sooner because we need to + // look for '-n', can't do it later since we want + // default.ini loaded first (so that any other settings + // override it). + handleDefaultIni(loadDefaultIni, cppArgs); + + if (!simConfigDB.loadCPP(filename, cppArgs)) { + cprintf("Error processing file %s\n", filename); + exit(1); + } + } else if (ext == ".py") { + if (!loadPythonConfig(filename, &simConfigDB)) { + cprintf("Error processing file %s\n", filename); + exit(1); + } + } + else { + cprintf("Config file name '%s' must end in '.py' or '.ini'.\n", + filename); exit(1); } } |