Add the pentium 4 configuration. Add some command line options
to M5 to support the python configuration stuff. sim/main.cc: Make the -I option update the include path for phython as well as cpp Make the -P option pass a raw python string to the interpreter Make the -E option add strings to the environment Break up the various steps of python processing to accomidate multiple files and the various new options test/genini.py: Make this executable --HG-- extra : convert_revision : 6acc50d2e4367c5ceaee013db987c8a1db924df3
This commit is contained in:
parent
3ece6ab029
commit
a5df4b5c32
40
sim/main.cc
40
sim/main.cc
|
@ -44,6 +44,7 @@
|
||||||
#include "base/misc.hh"
|
#include "base/misc.hh"
|
||||||
#include "base/pollevent.hh"
|
#include "base/pollevent.hh"
|
||||||
#include "base/statistics.hh"
|
#include "base/statistics.hh"
|
||||||
|
#include "base/str.hh"
|
||||||
#include "base/time.hh"
|
#include "base/time.hh"
|
||||||
#include "cpu/base_cpu.hh"
|
#include "cpu/base_cpu.hh"
|
||||||
#include "cpu/full_cpu/smt.hh"
|
#include "cpu/full_cpu/smt.hh"
|
||||||
|
@ -243,6 +244,8 @@ main(int argc, char **argv)
|
||||||
// -u to override.
|
// -u to override.
|
||||||
bool quitOnUnreferenced = true;
|
bool quitOnUnreferenced = true;
|
||||||
|
|
||||||
|
bool python_initialized = false;
|
||||||
|
|
||||||
// Parse command-line options.
|
// Parse command-line options.
|
||||||
// Since most of the complex options are handled through the
|
// Since most of the complex options are handled through the
|
||||||
// config database, we don't mess with getopts, and just parse
|
// config database, we don't mess with getopts, and just parse
|
||||||
|
@ -283,7 +286,6 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
case 'U':
|
case 'U':
|
||||||
case 'I':
|
|
||||||
// cpp options: record & pass to cpp. Note that these
|
// cpp options: record & pass to cpp. Note that these
|
||||||
// cannot have spaces, i.e., '-Dname=val' is OK, but
|
// cannot have spaces, i.e., '-Dname=val' is OK, but
|
||||||
// '-D name=val' is not. I don't consider this a
|
// '-D name=val' is not. I don't consider this a
|
||||||
|
@ -293,6 +295,30 @@ main(int argc, char **argv)
|
||||||
cppArgs.push_back(arg_str);
|
cppArgs.push_back(arg_str);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'I': {
|
||||||
|
// We push -I as an argument to cpp
|
||||||
|
cppArgs.push_back(arg_str);
|
||||||
|
|
||||||
|
string arg = arg_str + 2;
|
||||||
|
eat_white(arg);
|
||||||
|
|
||||||
|
// Send this as the python path
|
||||||
|
addPythonPath(arg);
|
||||||
|
} break;
|
||||||
|
|
||||||
|
case 'P':
|
||||||
|
if (!python_initialized) {
|
||||||
|
initPythonConfig();
|
||||||
|
python_initialized = true;
|
||||||
|
}
|
||||||
|
writePythonString(arg_str + 2);
|
||||||
|
writePythonString("\n");
|
||||||
|
|
||||||
|
case 'E':
|
||||||
|
if (putenv(arg_str + 2) == -1)
|
||||||
|
panic("putenv: %s\n", strerror(errno));
|
||||||
|
break;
|
||||||
|
|
||||||
case '-':
|
case '-':
|
||||||
// command-line configuration parameter:
|
// command-line configuration parameter:
|
||||||
// '--<section>:<parameter>=<value>'
|
// '--<section>:<parameter>=<value>'
|
||||||
|
@ -329,10 +355,11 @@ main(int argc, char **argv)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
} else if (ext == ".py" || ext == ".mpy") {
|
} else if (ext == ".py" || ext == ".mpy") {
|
||||||
if (!loadPythonConfig(filename, &simConfigDB)) {
|
if (!python_initialized) {
|
||||||
cprintf("Error processing file %s\n", filename);
|
initPythonConfig();
|
||||||
exit(1);
|
python_initialized = true;
|
||||||
}
|
}
|
||||||
|
loadPythonConfig(filename);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cprintf("Config file name '%s' must end in '.py' or '.ini'.\n",
|
cprintf("Config file name '%s' must end in '.py' or '.ini'.\n",
|
||||||
|
@ -342,6 +369,11 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (python_initialized && finishPythonConfig(simConfigDB)) {
|
||||||
|
cprintf("Error processing python code\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
// The configuration database is now complete; start processing it.
|
// The configuration database is now complete; start processing it.
|
||||||
|
|
||||||
// Parse and check all non-config-hierarchy parameters.
|
// Parse and check all non-config-hierarchy parameters.
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
# Copyright (c) 2005 The Regents of The University of Michigan
|
# Copyright (c) 2005 The Regents of The University of Michigan
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue