summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cpu/cpuevent.hh18
-rw-r--r--src/cpu/o3/commit_impl.hh2
-rw-r--r--src/dev/alpha/tsunami_io.cc11
-rw-r--r--src/dev/alpha/tsunami_io.hh5
-rw-r--r--src/python/m5/main.py3
-rw-r--r--src/python/m5/objects/BaseCPU.py3
-rw-r--r--src/python/m5/objects/Tsunami.py4
-rw-r--r--src/python/m5/params.py52
8 files changed, 72 insertions, 26 deletions
diff --git a/src/cpu/cpuevent.hh b/src/cpu/cpuevent.hh
index 3339f8252..c973621c0 100644
--- a/src/cpu/cpuevent.hh
+++ b/src/cpu/cpuevent.hh
@@ -36,12 +36,14 @@
class ThreadContext;
-/** This class creates a global list of events that need a pointer to a
- * thread context. When a switchover takes place the events can be migrated
- * to the new thread context, otherwise you could have a wake timer interrupt
- * go off on a switched out cpu or other unfortunate events. This object MUST be
- * dynamically allocated to avoid it being deleted after a cpu switch happens.
- * */
+/**
+ * This class creates a global list of events that need a pointer to a
+ * thread context. When a switchover takes place the events can be
+ * migrated to the new thread context, otherwise you could have a wake
+ * timer interrupt go off on a switched out cpu or other unfortunate
+ * events. This object MUST be dynamically allocated to avoid it being
+ * deleted after a cpu switch happens.
+ */
class CpuEvent : public Event
{
protected:
@@ -78,8 +80,8 @@ class CpuEventWrapper : public CpuEvent
T *object;
public:
- CpuEventWrapper(T *obj, ThreadContext *_tc, EventQueue *q = &mainEventQueue,
- Priority p = Default_Pri)
+ CpuEventWrapper(T *obj, ThreadContext *_tc,
+ EventQueue *q = &mainEventQueue, Priority p = Default_Pri)
: CpuEvent(q, _tc, p), object(obj)
{ }
void process() { (object->*F)(tc); }
diff --git a/src/cpu/o3/commit_impl.hh b/src/cpu/o3/commit_impl.hh
index c3c4983c5..96f094926 100644
--- a/src/cpu/o3/commit_impl.hh
+++ b/src/cpu/o3/commit_impl.hh
@@ -998,7 +998,7 @@ DefaultCommit<Impl>::commitHead(DynInstPtr &head_inst, unsigned inst_num)
{
DPRINTF(Commit, "Waiting for all stores to writeback.\n");
return false;
- } else if (inst_num > 0) {
+ } else if (inst_num > 0 || iewStage->hasStoresToWB()) {
DPRINTF(Commit, "Waiting to become head of commit.\n");
return false;
}
diff --git a/src/dev/alpha/tsunami_io.cc b/src/dev/alpha/tsunami_io.cc
index 8430856ef..38986b77e 100644
--- a/src/dev/alpha/tsunami_io.cc
+++ b/src/dev/alpha/tsunami_io.cc
@@ -57,17 +57,13 @@ using namespace std;
//Should this be AlphaISA?
using namespace TheISA;
-TsunamiIO::RTC::RTC(const string &name, Tsunami* t, Tick i)
- : _name(name), event(t, i), addr(0)
+TsunamiIO::RTC::RTC(const string &n, Tsunami* tsunami, time_t t, Tick i)
+ : _name(n), event(tsunami, i), addr(0)
{
memset(clock_data, 0, sizeof(clock_data));
stat_regA = RTCA_32768HZ | RTCA_1024HZ;
stat_regB = RTCB_PRDC_IE |RTCB_BIN | RTCB_24HR;
-}
-void
-TsunamiIO::RTC::set_time(time_t t)
-{
struct tm tm;
gmtime_r(&t, &tm);
@@ -428,7 +424,7 @@ TsunamiIO::PITimer::Counter::CounterEvent::description()
TsunamiIO::TsunamiIO(Params *p)
: BasicPioDevice(p), tsunami(p->tsunami), pitimer(p->name + "pitimer"),
- rtc(p->name + ".rtc", p->tsunami, p->frequency)
+ rtc(p->name + ".rtc", p->tsunami, p->init_time, p->frequency)
{
pioSize = 0x100;
@@ -436,7 +432,6 @@ TsunamiIO::TsunamiIO(Params *p)
tsunami->io = this;
timerData = 0;
- rtc.set_time(p->init_time == 0 ? time(NULL) : p->init_time);
picr = 0;
picInterrupting = false;
}
diff --git a/src/dev/alpha/tsunami_io.hh b/src/dev/alpha/tsunami_io.hh
index 54acefc25..b0c368eb8 100644
--- a/src/dev/alpha/tsunami_io.hh
+++ b/src/dev/alpha/tsunami_io.hh
@@ -110,10 +110,7 @@ class TsunamiIO : public BasicPioDevice
uint8_t stat_regB;
public:
- RTC(const std::string &name, Tsunami* t, Tick i);
-
- /** Set the initial RTC time/date */
- void set_time(time_t t);
+ RTC(const std::string &name, Tsunami* tsunami, time_t t, Tick i);
/** RTC address port: write address of RTC RAM data to access */
void writeAddr(const uint8_t data);
diff --git a/src/python/m5/main.py b/src/python/m5/main.py
index 114c668a6..5df6d03cf 100644
--- a/src/python/m5/main.py
+++ b/src/python/m5/main.py
@@ -304,7 +304,8 @@ def main():
sys.argv = arguments
sys.path = [ os.path.dirname(sys.argv[0]) ] + sys.path
- scope = { '__file__' : sys.argv[0] }
+ scope = { '__file__' : sys.argv[0],
+ '__name__' : '__m5_main__' }
# we want readline if we're doing anything interactive
if options.interactive or options.pdb:
diff --git a/src/python/m5/objects/BaseCPU.py b/src/python/m5/objects/BaseCPU.py
index 8037c90af..67a28a61e 100644
--- a/src/python/m5/objects/BaseCPU.py
+++ b/src/python/m5/objects/BaseCPU.py
@@ -41,7 +41,8 @@ class BaseCPU(SimObject):
"terminate when all threads have reached this load count")
max_loads_any_thread = Param.Counter(0,
"terminate when any thread reaches this load count")
- progress_interval = Param.Tick(0, "interval to print out the progress message")
+ progress_interval = Param.Tick(0,
+ "interval to print out the progress message")
defer_registration = Param.Bool(False,
"defer registration with system (for sampling)")
diff --git a/src/python/m5/objects/Tsunami.py b/src/python/m5/objects/Tsunami.py
index ac9020b47..18a776a7f 100644
--- a/src/python/m5/objects/Tsunami.py
+++ b/src/python/m5/objects/Tsunami.py
@@ -13,8 +13,8 @@ class TsunamiCChip(BasicPioDevice):
class TsunamiIO(BasicPioDevice):
type = 'TsunamiIO'
- time = Param.UInt64(1136073600,
- "System time to use (0 for actual time, default is 1/1/06)")
+ time = Param.Time('01/01/2009',
+ "System time to use ('Now' for actual time)")
tsunami = Param.Tsunami(Parent.any, "Tsunami")
frequency = Param.Frequency('1024Hz', "frequency of interrupts")
diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index d83d5f73f..d570804d8 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -44,7 +44,12 @@
#
#####################################################################
-import sys, inspect, copy
+import copy
+import datetime
+import inspect
+import sys
+import time
+
import convert
from util import *
@@ -513,6 +518,50 @@ class EthernetAddr(ParamValue):
else:
return self.value
+def parse_time(value):
+ strings = [ "%a %b %d %H:%M:%S %Z %Y",
+ "%a %b %d %H:%M:%S %Z %Y",
+ "%Y/%m/%d %H:%M:%S",
+ "%Y/%m/%d %H:%M",
+ "%Y/%m/%d",
+ "%m/%d/%Y %H:%M:%S",
+ "%m/%d/%Y %H:%M",
+ "%m/%d/%Y",
+ "%m/%d/%y %H:%M:%S",
+ "%m/%d/%y %H:%M",
+ "%m/%d/%y"]
+
+ for string in strings:
+ try:
+ return time.strptime(value, string)
+ except ValueError:
+ pass
+
+ raise ValueError, "Could not parse '%s' as a time" % value
+
+class Time(ParamValue):
+ cxx_type = 'time_t'
+ def __init__(self, value):
+ if isinstance(value, time.struct_time):
+ self.value = time.mktime(value)
+ elif isinstance(value, int):
+ self.value = value
+ elif isinstance(value, str):
+ if value in ('Now', 'Today'):
+ self.value = time.time()
+ else:
+ self.value = time.mktime(parse_time(value))
+ elif isinstance(value, (datetime.datetime, datetime.date)):
+ self.value = time.mktime(value.timetuple())
+ else:
+ raise ValueError, "Could not parse '%s' as a time" % value
+
+ def __str__(self):
+ return str(int(self.value))
+
+ def ini_str(self):
+ return str(int(self.value))
+
# Enumerated types are a little more complex. The user specifies the
# type as Enum(foo) where foo is either a list or dictionary of
# alternatives (typically strings, but not necessarily so). (In the
@@ -973,6 +1022,7 @@ __all__ = ['Param', 'VectorParam',
'NetworkBandwidth', 'MemoryBandwidth',
'Range', 'AddrRange', 'TickRange',
'MaxAddr', 'MaxTick', 'AllMemory',
+ 'Time',
'NextEthernetAddr', 'NULL',
'Port', 'VectorPort']