From 7eb0fb8b6ebffcb39b61964d4c7387455c262aae Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Mon, 7 Jan 2013 13:05:41 -0500 Subject: cpu: Check that the memory system is in the correct mode This patch adds checks to all CPU models to make sure that the memory system is in the correct mode at startup and when resuming after a drain. Previously, we only checked that the memory system was in the right mode when resuming. This is inadequate since this is a configuration error that should be detected at startup as well as when resuming. Additionally, since the check was done using an assert, it wasn't performed when NDEBUG was set (e.g., the fast target). --- src/cpu/simple/timing.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/cpu/simple/timing.cc') diff --git a/src/cpu/simple/timing.cc b/src/cpu/simple/timing.cc index 41764302d..d3959c895 100644 --- a/src/cpu/simple/timing.cc +++ b/src/cpu/simple/timing.cc @@ -66,6 +66,12 @@ TimingSimpleCPU::init() { BaseCPU::init(); + if (!params()->defer_registration && + system->getMemoryMode() != Enums::timing) { + fatal("The timing CPU requires the memory system to be in " + "'timing' mode.\n"); + } + // Initialise the ThreadContext's memory proxies tcBase()->initMemProxies(tcBase()); @@ -140,7 +146,10 @@ TimingSimpleCPU::drainResume() { DPRINTF(SimpleCPU, "Resume\n"); if (_status != SwitchedOut && _status != Idle) { - assert(system->getMemoryMode() == Enums::timing); + if (system->getMemoryMode() != Enums::timing) { + fatal("The timing CPU requires the memory system to be in " + "'timing' mode.\n"); + } if (fetchEvent.scheduled()) deschedule(fetchEvent); -- cgit v1.2.3