From 11894d3b4b85160e1cc0c0a20157f89dcd3bae6c Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 19 Jun 2005 22:13:31 -0400 Subject: [PATCH 3/8] little bit of formatting clean up debugging a bit dev/ns_gige.cc: little bit of formatting don't break in the debugger if a packet is dropped when the receiver is disabled since it can realistically happen --HG-- extra : convert_revision : 364efa3eb16990db191085f5b847c3bb255a173c --- dev/ns_gige.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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; } From 48f77af4466a40213835a5ea77937680abe42dda Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Tue, 21 Jun 2005 15:42:10 -0400 Subject: [PATCH 4/8] Fix cache bug... getting a response on a writeback hit (from a trace replay). SConscript: Compile in trace-reader CPUs. --HG-- extra : convert_revision : 35b0da704e94b07a75fd89131028fbfbf31cf3a6 --- SConscript | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SConscript b/SConscript index e66763ca1..4d034927a 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 From 2c2f5f86d7658d959ff135121b77226ebefeec66 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Wed, 22 Jun 2005 07:26:02 -0400 Subject: [PATCH 5/8] Fix: opt_cpu and trace_cpu were already defined in syscall_emulation when I added them to the global list... SConscript: Remove opt_cpu and trace_cpu from syscall_emulation_sources to avoid double definition. --HG-- extra : convert_revision : b10a2e648249b1d742b881aa7580f8d1b0d6fbc1 --- SConscript | 2 -- 1 file changed, 2 deletions(-) diff --git a/SConscript b/SConscript index 4d034927a..ddca8b057 100644 --- a/SConscript +++ b/SConscript @@ -322,8 +322,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 From c95e1281fc5ecfe3f65a59fa426f16a54b2a6a50 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Wed, 22 Jun 2005 09:52:02 -0400 Subject: [PATCH 6/8] fix tokenize base/str.cc: Fix tokenize so that it doesn't behave incorrectly when there are empty strings. test/tokentest.cc: Clean up the test function so it's easier to see what's going on --HG-- extra : convert_revision : c7a3db7bc516d3575b1cc4ab7afbd0f1fbe1ec6f --- base/str.cc | 23 +++++++++-------- test/tokentest.cc | 64 ++++++++++++++++++++++++++++------------------- 2 files changed, 50 insertions(+), 37 deletions(-) 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 - -#include #include +#include +#include #include #include @@ -75,15 +74,17 @@ tokenize(vector& 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/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 +#include #include #include @@ -35,35 +35,47 @@ int main(int argc, char *argv[]) { - if (argc != 3) { - cout << "Usage: " << argv[0] << " \n"; - exit(1); - } + using namespace std; - int i; - string test = argv[1]; - vector tokens1; - vector tokens2; - char token = argv[2][0]; + if (argc != 3) { + cout << "Usage: " << argv[0] << " \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 tokens1; + vector 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; } From 91f5736fd3fe989a7d5f3db10070fdedea36e1b4 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Wed, 22 Jun 2005 09:59:13 -0400 Subject: [PATCH 7/8] Move max_time and progress_interval parameters to the Root object and get rid of the ParamContext that each used to have. python/m5/objects/Root.py: Add max_time and progress_interval to the Root object sim/root.cc: Add max_time and progress_interval to the Root object. These parameters used to be in their own contexts in sim_events.cc sim/sim_events.cc: Get rid of the ParamContext for max cycles and the progress event. Move the functionality to the Root object sim/sim_events.hh: Move ProgressEvent declaration to the header so that it can be used in other files. --HG-- extra : convert_revision : ff664b806855e8eb9201b8a25392aa53204464f0 --- python/m5/objects/Root.py | 3 ++ sim/root.cc | 27 ++++++++++++- sim/sim_events.cc | 82 --------------------------------------- sim/sim_events.hh | 29 +++++++++++--- 4 files changed, 52 insertions(+), 89 deletions(-) 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 clock; + Param max_time; + Param progress_interval; Param 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 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 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__ From cad549d7aaefece708495842f2be5e6532a27bb7 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Thu, 23 Jun 2005 01:07:04 -0700 Subject: [PATCH 8/8] Added Float class Fixed printing so the tokenizer in m5 doesn't get confused Expanded NullSimObject so it could be used as an element in a VectorParam --HG-- extra : convert_revision : 661b1916967d663ab7aee891f15f7ca190deeba6 --- python/m5/config.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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',