summaryrefslogtreecommitdiff
path: root/src/sim/core.cc
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-03-06 20:58:44 +0000
committerGabe Black <gblack@eecs.umich.edu>2007-03-06 20:58:44 +0000
commit44f91bb4443ed55a8e75096f1a821fd7605b7771 (patch)
tree39ffcc423e52760b67a9b7984fe2d652f56e8c92 /src/sim/core.cc
parent05c86ec0d7662ccefc5690a4445fcf2976d16622 (diff)
parent329db76e47c825d4ecbe0f5251dbcfaf2ec09516 (diff)
downloadgem5-44f91bb4443ed55a8e75096f1a821fd7605b7771.tar.xz
Merge zizzer.eecs.umich.edu:/bk/newmem
into ahchoo.blinky.homelinux.org:/home/gblack/m5/newmem-x86 --HG-- extra : convert_revision : 0822fbcc377781b53d2de9ba40ab9d985ccbc039
Diffstat (limited to 'src/sim/core.cc')
-rw-r--r--src/sim/core.cc64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/sim/core.cc b/src/sim/core.cc
index 24cc33da2..c961e9eb8 100644
--- a/src/sim/core.cc
+++ b/src/sim/core.cc
@@ -34,15 +34,78 @@
#include "base/callback.hh"
#include "base/output.hh"
+#include "sim/core.hh"
using namespace std;
+Tick curTick = 0;
+
+namespace Clock {
+/// The simulated frequency of curTick. (In ticks per second)
+Tick Frequency;
+
+namespace Float {
+double s;
+double ms;
+double us;
+double ns;
+double ps;
+
+double Hz;
+double kHz;
+double MHz;
+double GHZ;
+/* namespace Float */ }
+
+namespace Int {
+Tick s;
+Tick ms;
+Tick us;
+Tick ns;
+Tick ps;
+/* namespace Float */ }
+
+/* namespace Clock */ }
+
+void
+setClockFrequency(Tick ticksPerSecond)
+{
+ using namespace Clock;
+ Frequency = ticksPerSecond;
+ Float::s = static_cast<double>(Frequency);
+ Float::ms = Float::s / 1.0e3;
+ Float::us = Float::s / 1.0e6;
+ Float::ns = Float::s / 1.0e9;
+ Float::ps = Float::s / 1.0e12;
+
+ Float::Hz = 1.0 / Float::s;
+ Float::kHz = 1.0 / Float::ms;
+ Float::MHz = 1.0 / Float::us;
+ Float::GHZ = 1.0 / Float::ns;
+
+ Int::s = Frequency;
+ Int::ms = Int::s / 1000;
+ Int::us = Int::ms / 1000;
+ Int::ns = Int::us / 1000;
+ Int::ps = Int::ns / 1000;
+
+}
+
void
setOutputDir(const string &dir)
{
simout.setDirectory(dir);
}
+ostream *outputStream;
+ostream *configStream;
+
+void
+setOutputFile(const string &file)
+{
+ outputStream = simout.find(file);
+}
+
/**
* Queue of C++ callbacks to invoke on simulator exit.
*/
@@ -74,3 +137,4 @@ doExitCleanup()
cout.flush();
}
+