changeset 9923a5ab8c13 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=9923a5ab8c13
description:
        sim: Fatal if a clocked object is set to have a clock of 0

        This patch adds a check to the clocked object constructor to ensure it
        is not configured to have a clock period of 0.

diffstat:

 src/mem/cache/base.cc     |  4 ----
 src/sim/clocked_object.hh |  7 ++++++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r 4099669b4b3d -r 9923a5ab8c13 src/mem/cache/base.cc
--- a/src/mem/cache/base.cc     Mon Jan 07 13:05:39 2013 -0500
+++ b/src/mem/cache/base.cc     Mon Jan 07 13:05:39 2013 -0500
@@ -81,10 +81,6 @@
       addrRanges(p->addr_ranges.begin(), p->addr_ranges.end()),
       system(p->system)
 {
-    // ensure the clock is not running at an unreasonable clock speed
-    if (clock == 1)
-        panic("Cache %s has a cycle time of 1 tick. Specify a clock.\n",
-              name());
 }
 
 void
diff -r 4099669b4b3d -r 9923a5ab8c13 src/sim/clocked_object.hh
--- a/src/sim/clocked_object.hh Mon Jan 07 13:05:39 2013 -0500
+++ b/src/sim/clocked_object.hh Mon Jan 07 13:05:39 2013 -0500
@@ -46,6 +46,7 @@
 #define __SIM_CLOCKED_OBJECT_HH__
 
 #include "base/intmath.hh"
+#include "base/misc.hh"
 #include "params/ClockedObject.hh"
 #include "sim/core.hh"
 #include "sim/sim_object.hh"
@@ -113,7 +114,11 @@
      */
     ClockedObject(const ClockedObjectParams* p) :
         SimObject(p), tick(0), cycle(0), clock(p->clock)
-    { }
+    {
+        if (clock == 0) {
+            fatal("%s has a clock period of zero\n", name());
+        }
+    }
 
     /**
      * Virtual destructor due to inheritance.
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to