From c7d6745b073982782eb05ca523b53e1c7fe784da Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 2 Nov 2003 02:07:31 -0500 Subject: deprecate the m5exit instruction and rename it to m5exit_old Implement a new m5exit instruction with an optional delay arch/alpha/isa_desc: move m5exit to m5exit old. The old version of the instruction is now deprecated Implement the new exit instruction with the optional delay sim/sim_events.cc: sim/sim_events.hh: Make SimExit take a cycle sim/universe.cc: provide ticksPerMS, ticksPerUS, and ticksPerNS so we don't have to do math during the cycle --HG-- extra : convert_revision : e2ed47a2e5cfcd57c82086c6fcb4a28bf801c214 --- sim/universe.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sim/universe.cc') diff --git a/sim/universe.cc b/sim/universe.cc index 8274d84ca..4cfcdc563 100644 --- a/sim/universe.cc +++ b/sim/universe.cc @@ -38,6 +38,9 @@ using namespace std; Tick curTick = 0; Tick ticksPerSecond; +Tick ticksPerMS; +Tick ticksPerUS; +Tick ticksPerNS; class UniverseParamContext : public ParamContext { @@ -49,10 +52,13 @@ class UniverseParamContext : public ParamContext UniverseParamContext universe("Universe"); Param universe_freq(&universe, "frequency", "tick frequency", - 200000000); + 200000000); void UniverseParamContext::checkParams() { ticksPerSecond = universe_freq; + ticksPerMS = universe_freq / 1000; + ticksPerUS = universe_freq / (1000 * 1000); + ticksPerNS = universe_freq / (1000 * 1000 * 1000); } -- cgit v1.2.3 From 667cbb6690b1f4af68ab7dad8caed8cdf107a090 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Sun, 2 Nov 2003 18:02:58 -0500 Subject: Implement more m5 pseduo opcodes: resetstats dumpstats dumpresetstats m5checkpoint Lots of cleanup of serialization and stats dumping/resetting to work with these new instructions arch/alpha/isa_desc: Implement more m5 pseduo opcodes: resetstats dumpstats dumpresetstats m5checkpoint All of these functions take two optional parameters, the first is a delay, and the second is a period. The delay tells the simulator to wait the specified number of nanoseconds before triggering the event, the period tells the simulator to repeat the event with a specified frequency base/statistics.cc: base/statistics.hh: regReset RegResetCallback dev/disk_image.cc: serializeFilename -> CheckpointFile() sim/debug.cc: Move this debugging statement to sim_stats.cc sim/eventq.cc: Don't AutoDelete an event if it is scheduled since the process() function could potentially schedule the event again. sim/main.cc: DumpStatsEvent is now Statistics::SetupEvent(Dump, curTick) sim/serialize.cc: Change the serialize event so that it's possible to cause the event to repeat. Also make the priority such that the event happens just before the simulator would exit if both events were scheduled for the same cycle. get rid of the serializeFilename variable and provide a CheckpointFile() function. This function takes a basename that is set in the configuration, and appends the current cycle to the name so that multiple checkpoints can be dumped from the same simulation. Also, don't exit the simulation when a checkpoint file is dumped. sim/serialize.hh: serializeFilename -> CheckpointFile() SetupCheckpoint function to tell the simulator to prepare to checkpoint at a certain time with a certain period sim/sim_events.cc: DumpStatsEvent stuff gets move to sim_stats.(cc|hh) The context stuff gets moved into the already existing stats context in stat_context.cc sim/sim_events.hh: DumpStatsEvent stuff gets move to sim_stats.(cc|hh) sim/universe.cc: Provide some simple functions for converting times into ticks. These use floating point math to get as close as possible to the real values. Multipliers are set up ahead of time --HG-- extra : convert_revision : d06ef26a9237529a1e5060cb1ac2dcc04d4ec252 --- sim/universe.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'sim/universe.cc') diff --git a/sim/universe.cc b/sim/universe.cc index 4cfcdc563..b75b1f78a 100644 --- a/sim/universe.cc +++ b/sim/universe.cc @@ -38,9 +38,9 @@ using namespace std; Tick curTick = 0; Tick ticksPerSecond; -Tick ticksPerMS; -Tick ticksPerUS; -Tick ticksPerNS; +double __ticksPerMS; +double __ticksPerUS; +double __ticksPerNS; class UniverseParamContext : public ParamContext { @@ -58,7 +58,8 @@ void UniverseParamContext::checkParams() { ticksPerSecond = universe_freq; - ticksPerMS = universe_freq / 1000; - ticksPerUS = universe_freq / (1000 * 1000); - ticksPerNS = universe_freq / (1000 * 1000 * 1000); + double freq = double(ticksPerSecond); + __ticksPerMS = freq / 1.0e3; + __ticksPerUS = freq / 1.0e6; + __ticksPerNS = freq / 1.0e9; } -- cgit v1.2.3