summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Nash <benash@umich.edu>2005-06-23 16:27:17 -0400
committerBenjamin Nash <benash@umich.edu>2005-06-23 16:27:17 -0400
commit0460a78829c000f033d703bb814ca39a835014a0 (patch)
treeb3a9f74af1d4a33559f21c5b5ed11a3052911b6c
parente8bcecd0a04638e9d9e6306cbe515c40e9ba0817 (diff)
parentcad549d7aaefece708495842f2be5e6532a27bb7 (diff)
downloadgem5-0460a78829c000f033d703bb814ca39a835014a0.tar.xz
Merge m5read@m5.eecs.umich.edu:/bk/m5
into zed.eecs.umich.edu:/z/benash/bk/m5 --HG-- extra : convert_revision : a0a8fea7224913ef106dc733182abd938feab64d
-rw-r--r--SConscript4
-rw-r--r--base/str.cc23
-rw-r--r--dev/ns_gige.cc7
-rw-r--r--python/m5/config.py19
-rw-r--r--python/m5/objects/Root.py3
-rw-r--r--sim/root.cc27
-rw-r--r--sim/sim_events.cc82
-rw-r--r--sim/sim_events.hh29
-rw-r--r--test/tokentest.cc64
9 files changed, 122 insertions, 136 deletions
diff --git a/SConscript b/SConscript
index 508b76375..7b309fbfe 100644
--- a/SConscript
+++ b/SConscript
@@ -122,6 +122,8 @@ base_sources = Split('''
cpu/trace/reader/ibm_reader.cc
cpu/trace/reader/itx_reader.cc
cpu/trace/reader/m5_reader.cc
+ cpu/trace/opt_cpu.cc
+ cpu/trace/trace_cpu.cc
encumbered/cpu/full/bpred.cc
encumbered/cpu/full/commit.cc
@@ -322,8 +324,6 @@ syscall_emulation_sources = Split('''
arch/alpha/alpha_linux_process.cc
arch/alpha/alpha_tru64_process.cc
cpu/memtest/memtest.cc
- cpu/trace/opt_cpu.cc
- cpu/trace/trace_cpu.cc
encumbered/eio/eio.cc
encumbered/eio/exolex.cc
encumbered/eio/libexo.cc
diff --git a/base/str.cc b/base/str.cc
index 3a11bb17d..15f44dad2 100644
--- a/base/str.cc
+++ b/base/str.cc
@@ -26,11 +26,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <iostream>
-
-#include <string.h>
#include <ctype.h>
+#include <cstring>
+#include <iostream>
#include <string>
#include <vector>
@@ -75,15 +74,17 @@ tokenize(vector<string>& v, const string &s, char token, bool ignore)
string::size_type first = 0;
string::size_type last = s.find_first_of(token);
- if (ignore) {
- if (last == first) {
- while (last == first)
- last = s.find_first_of(token, ++first);
+ if (s.empty())
+ return;
- if (last == string::npos) {
- v.push_back(s);
- return;
- }
+ if (ignore && last == first) {
+ while (last == first)
+ last = s.find_first_of(token, ++first);
+
+ if (last == string::npos) {
+ if (first != s.size())
+ v.push_back(s.substr(first));
+ return;
}
}
diff --git a/dev/ns_gige.cc b/dev/ns_gige.cc
index 28c25dc35..108f2616c 100644
--- a/dev/ns_gige.cc
+++ b/dev/ns_gige.cc
@@ -473,8 +473,9 @@ NSGigE::regStats()
coalescedTxDesc = totalTxDesc / postedInterrupts;
coalescedRxOrn = totalRxOrn / postedInterrupts;
- coalescedTotal = (totalSwi + totalRxIdle + totalRxOk + totalRxDesc + totalTxOk
- + totalTxIdle + totalTxDesc + totalRxOrn) / postedInterrupts;
+ coalescedTotal = (totalSwi + totalRxIdle + totalRxOk + totalRxDesc +
+ totalTxOk + totalTxIdle + totalTxDesc +
+ totalRxOrn) / postedInterrupts;
txBandwidth = txBytes * Stats::constant(8) / simSeconds;
rxBandwidth = rxBytes * Stats::constant(8) / simSeconds;
@@ -1956,7 +1957,6 @@ NSGigE::txKick()
if (txKickTick > curTick) {
DPRINTF(EthernetSM, "transmit kick exiting, can't run till %d\n",
txKickTick);
-
return;
}
@@ -2293,7 +2293,6 @@ NSGigE::recvPacket(PacketPtr packet)
if (!rxEnable) {
DPRINTF(Ethernet, "receive disabled...packet dropped\n");
- debug_break();
interface->recvDone();
return true;
}
diff --git a/python/m5/config.py b/python/m5/config.py
index 091df3662..754b18525 100644
--- a/python/m5/config.py
+++ b/python/m5/config.py
@@ -421,14 +421,14 @@ class SimObject(object):
print '[' + self.path() + ']' # .ini section header
if hasattr(self, 'type') and not isinstance(self, ParamContext):
- print 'type =', self.type
+ print 'type=%s' % self.type
child_names = self._children.keys()
child_names.sort()
np_child_names = [c for c in child_names \
if not isinstance(self._children[c], ParamContext)]
if len(np_child_names):
- print 'children =', ' '.join(np_child_names)
+ print 'children=%s' % ' '.join(np_child_names)
param_names = self._params.keys()
param_names.sort()
@@ -444,7 +444,7 @@ class SimObject(object):
(param, self.path())
raise
setattr(self, param, value)
- print param, '=', self._values[param].ini_str()
+ print '%s=%s' % (param, self._values[param].ini_str())
print # blank line between objects
@@ -921,6 +921,9 @@ class UdpPort(CheckedInt): size = 16; unsigned = True
class Percent(CheckedInt): min = 0; max = 100
+class Float(ParamValue, float):
+ pass
+
class MemorySize(CheckedInt):
size = 64
unsigned = True
@@ -1024,6 +1027,14 @@ class NullSimObject(object):
def ini_str(self):
return 'Null'
+ def unproxy(self,base):
+ return self
+
+ def set_path(self, parent, name):
+ pass
+ def __str__(self):
+ return 'Null'
+
# The only instance you'll ever need...
Null = NULL = NullSimObject()
@@ -1262,7 +1273,7 @@ def instantiate(root):
# short to avoid polluting other namespaces.
__all__ = ['SimObject', 'ParamContext', 'Param', 'VectorParam',
'Parent', 'Self',
- 'Enum', 'Bool', 'String',
+ 'Enum', 'Bool', 'String', 'Float',
'Int', 'Unsigned', 'Int8', 'UInt8', 'Int16', 'UInt16',
'Int32', 'UInt32', 'Int64', 'UInt64',
'Counter', 'Addr', 'Tick', 'Percent',
diff --git a/python/m5/objects/Root.py b/python/m5/objects/Root.py
index 79e3721fc..a5aaadd8c 100644
--- a/python/m5/objects/Root.py
+++ b/python/m5/objects/Root.py
@@ -7,6 +7,9 @@ from Trace import Trace
class Root(SimObject):
type = 'Root'
clock = Param.RootClock('200MHz', "tick frequency")
+ max_time = Param.Latency('0ns', "maximum simulation time (0 = infinite)")
+ progress_interval = Param.Latency('0ns',
+ "print a progress message at a regular interval (0 = never)")
output_file = Param.String('cout', "file to dump simulator output to")
checkpoint = Param.String('', "checkpoint file to load")
# hier = Param.HierParams(HierParams(do_data = False, do_events = True),
diff --git a/sim/root.cc b/sim/root.cc
index fcfde20d1..17438cf2c 100644
--- a/sim/root.cc
+++ b/sim/root.cc
@@ -36,6 +36,7 @@
#include "base/output.hh"
#include "sim/builder.hh"
#include "sim/host.hh"
+#include "sim/sim_events.hh"
#include "sim/sim_object.hh"
#include "sim/root.hh"
@@ -79,13 +80,33 @@ Tick ps;
// Dummy Object
class Root : public SimObject
{
+ private:
+ Tick max_time;
+ Tick progress_interval;
+
public:
- Root(const std::string &name) : SimObject(name) {}
+ Root(const std::string &name, Tick maxtime, Tick pi)
+ : SimObject(name), max_time(maxtime), progress_interval(pi)
+ {}
+
+ virtual void startup();
};
+void
+Root::startup()
+{
+ if (max_time != 0)
+ new SimExitEvent(curTick + max_time, "reached maximum cycle count");
+
+ if (progress_interval != 0)
+ new ProgressEvent(&mainEventQueue, progress_interval);
+}
+
BEGIN_DECLARE_SIM_OBJECT_PARAMS(Root)
Param<Tick> clock;
+ Param<Tick> max_time;
+ Param<Tick> progress_interval;
Param<string> output_file;
END_DECLARE_SIM_OBJECT_PARAMS(Root)
@@ -93,6 +114,8 @@ END_DECLARE_SIM_OBJECT_PARAMS(Root)
BEGIN_INIT_SIM_OBJECT_PARAMS(Root)
INIT_PARAM(clock, "tick frequency"),
+ INIT_PARAM(max_time, "maximum simulation time"),
+ INIT_PARAM(progress_interval, "print a progress message"),
INIT_PARAM(output_file, "file to dump simulator output to")
END_INIT_SIM_OBJECT_PARAMS(Root)
@@ -106,7 +129,7 @@ CREATE_SIM_OBJECT(Root)
created = true;
outputStream = simout.find(output_file);
- Root *root = new Root(getInstanceName());
+ Root *root = new Root(getInstanceName(), max_time, progress_interval);
using namespace Clock;
Frequency = clock;
diff --git a/sim/sim_events.cc b/sim/sim_events.cc
index 55bb3c305..c2bdca9df 100644
--- a/sim/sim_events.cc
+++ b/sim/sim_events.cc
@@ -129,60 +129,6 @@ CheckSwapEvent::description()
return "check swap";
}
-
-///////////////////////////////////////////////////
-//
-// Simulation termination parameters
-//
-///////////////////////////////////////////////////
-
-class TermParamContext : public ParamContext
-{
- public:
- TermParamContext(const string &_iniSection)
- : ParamContext(_iniSection) {}
- void checkParams();
-};
-
-TermParamContext simTerminationParams("max");
-
-Param<Tick> max_cycle(&simTerminationParams, "cycle",
- "maximum number of cycles to execute");
-
-void
-TermParamContext::checkParams()
-{
- // if a max cycle count was specified, put a termination event on
- // the event queue at that point
- if (max_cycle.isValid())
- new SimExitEvent(max_cycle, "reached maximum cycle count");
-}
-
-//
-// Progress event: print out cycle every so often so we know we're
-// making forward progress.
-//
-class ProgressEvent : public Event
-{
- protected:
- Tick interval;
-
- public:
- ProgressEvent(EventQueue *q, Tick interval);
-
- void process(); // process event
- virtual const char *description();
-};
-
-//
-// constructor: schedule at specified time
-//
-ProgressEvent::ProgressEvent(EventQueue *q, Tick _interval)
- : Event(q), interval(_interval)
-{
- schedule(curTick + interval);
-}
-
//
// handle progress event: print message and reschedule
//
@@ -200,31 +146,3 @@ ProgressEvent::description()
{
return "progress message";
}
-
-/////////
-//
-// Periodic progress message support: print out a message every n
-// cycles so we know we're making forward progress.
-//
-/////////
-
-// Parameter space for execution address tracing options. Derive
-// from ParamContext so we can override checkParams() function.
-struct ProgressParamContext : public ParamContext
-{
- ProgressParamContext(const string &_iniSection)
- : ParamContext(_iniSection) {}
- void startup();
-};
-
-ProgressParamContext progessMessageParams("progress");
-
-Param<Tick> progress_interval(&progessMessageParams, "cycle",
- "cycle interval for progress messages");
-
-void
-ProgressParamContext::startup()
-{
- if (progress_interval.isValid())
- new ProgressEvent(&mainEventQueue, progress_interval);
-}
diff --git a/sim/sim_events.hh b/sim/sim_events.hh
index 091d4db61..c93914457 100644
--- a/sim/sim_events.hh
+++ b/sim/sim_events.hh
@@ -26,8 +26,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __SIM_EVENTS_HH__
-#define __SIM_EVENTS_HH__
+#ifndef __SIM_SIM_EVENTS_HH__
+#define __SIM_SIM_EVENTS_HH__
#include "sim/eventq.hh"
@@ -87,7 +87,7 @@ class CountedExitEvent : public Event
};
//
-// Event to cause a statistics dump
+// Event to check swap usage
//
class CheckSwapEvent : public Event
{
@@ -97,11 +97,30 @@ class CheckSwapEvent : public Event
public:
CheckSwapEvent(EventQueue *q, int ival)
: Event(q), interval(ival)
- { schedule(interval); }
+ { schedule(curTick + interval); }
void process(); // process event
virtual const char *description();
};
-#endif // __SIM_EVENTS_HH__
+//
+// Progress event: print out cycle every so often so we know we're
+// making forward progress.
+//
+class ProgressEvent : public Event
+{
+ protected:
+ Tick interval;
+
+ public:
+ ProgressEvent(EventQueue *q, Tick ival)
+ : Event(q), interval(ival)
+ { schedule(curTick + interval); }
+
+ void process(); // process event
+
+ virtual const char *description();
+};
+
+#endif // __SIM_SIM_EVENTS_HH__
diff --git a/test/tokentest.cc b/test/tokentest.cc
index cd2182141..7f27d58fe 100644
--- a/test/tokentest.cc
+++ b/test/tokentest.cc
@@ -26,7 +26,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <iostream.h>
+#include <iostream>
#include <string>
#include <vector>
@@ -35,35 +35,47 @@
int
main(int argc, char *argv[])
{
- if (argc != 3) {
- cout << "Usage: " << argv[0] << " <string> <token>\n";
- exit(1);
- }
+ using namespace std;
- int i;
- string test = argv[1];
- vector<string> tokens1;
- vector<string> tokens2;
- char token = argv[2][0];
+ if (argc != 3) {
+ cout << "Usage: " << argv[0] << " <string> <token>\n";
+ exit(1);
+ }
- cout << "string = \"" << test << "\", token = \'" << token << "\'\n";
- cout << "testing without ignore\n";
- tokenize(tokens1, test, token, false);
+ int i;
+ string test = argv[1];
+ vector<string> tokens1;
+ vector<string> tokens2;
+ char token = argv[2][0];
- if (tokens1.size()) {
- for (i = 0; i < tokens1.size() - 1; i++)
- cout << tokens1[i] << "(" << tokens1[i].size() << "), ";
- cout << tokens1[i] << "(" << tokens1[i].size() << ")\n";
- }
+ cout << "string = \"" << test << "\", token = \'" << token << "\'\n";
+ cout << "testing without ignore\n";
+ tokenize(tokens1, test, token, false);
- cout << "testing with ignore\n";
- tokenize(tokens2, test, token, true);
+ if (tokens1.size()) {
+ int size = tokens1.size();
+ cout << "size = " << size << "\n";
+ for (i = 0; i < size; i++) {
+ cout << "'" << tokens1[i] << "' (" << tokens1[i].size()
+ << ")" << ((i == size - 1) ? "\n" : ", ");
+ }
+ } else {
+ cout << "no tokens" << endl;
+ }
- if (tokens2.size()) {
- for (i = 0; i < tokens2.size() - 1; i++)
- cout << tokens2[i] << "(" << tokens2[i].size() << "), ";
- cout << tokens2[i] << "(" << tokens2[i].size() << ")\n";
- }
+ cout << "testing with ignore\n";
+ tokenize(tokens2, test, token, true);
- return 0;
+ if (tokens2.size()) {
+ int size = tokens2.size();
+ cout << "size = " << size << "\n";
+ for (i = 0; i < size; i++) {
+ cout << "'" << tokens2[i] << "' (" << tokens2[i].size()
+ << ")" << ((i == size - 1) ? "\n" : ", ");
+ }
+ } else {
+ cout << "no tokens" << endl;
+ }
+
+ return 0;
}