summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/isa_desc16
-rw-r--r--sim/sim_events.cc4
-rw-r--r--sim/sim_events.hh2
-rw-r--r--sim/universe.cc8
4 files changed, 24 insertions, 6 deletions
diff --git a/arch/alpha/isa_desc b/arch/alpha/isa_desc
index 75f765029..09fb4a50a 100644
--- a/arch/alpha/isa_desc
+++ b/arch/alpha/isa_desc
@@ -2425,9 +2425,21 @@ decode OPCODE default Unknown::unknown() {
if (!xc->misspeculating())
Annotate::EndInterval(xc);
}}, No_OpClass);
- 0x20: m5exit({{
+ 0x20: m5exit_old({{
if (!xc->misspeculating())
- SimExit("m5_exit instruction encountered");
+ SimExit(curTick, "m5_exit_old instruction encountered");
+ }}, No_OpClass);
+ 0x21: m5exit({{
+ if (!xc->misspeculating()) {
+ Tick when = curTick;
+ Tick delay = xc->regs.intRegFile[16];
+ if (delay != 0) {
+ delay *= ticksPerUS;
+ delay /= 1000;
+ when += delay;
+ }
+ SimExit(when, "m5_exit instruction encountered");
+ }
}}, No_OpClass);
0x30: initparam({{ Ra = xc->cpu->system->init_param; }});
0x40: resetstats({{
diff --git a/sim/sim_events.cc b/sim/sim_events.cc
index 5f24de516..165bab2bf 100644
--- a/sim/sim_events.cc
+++ b/sim/sim_events.cc
@@ -64,9 +64,9 @@ SimExitEvent::description()
}
void
-SimExit(const char *message)
+SimExit(Tick when, const char *message)
{
- static SimExitEvent event(message);
+ static SimExitEvent event(when, message);
}
//
diff --git a/sim/sim_events.hh b/sim/sim_events.hh
index 0029a8404..bca978ce1 100644
--- a/sim/sim_events.hh
+++ b/sim/sim_events.hh
@@ -66,7 +66,7 @@ class SimExitEvent : public Event
virtual const char *description();
};
-void SimExit(const char *message);
+void SimExit(Tick when, const char *message);
//
// Event class to terminate simulation after 'n' related events have
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<Tick> 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);
}