summaryrefslogtreecommitdiff
path: root/src/python/m5/convert.py
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2007-03-06 11:13:43 -0800
committerNathan Binkert <binkertn@umich.edu>2007-03-06 11:13:43 -0800
commitd55b25cde6d2c072885a2c468d209fb18d6628e6 (patch)
tree391c4e66a69818a95037a5f2adccb2e8e0c84648 /src/python/m5/convert.py
parentf800fddcea850822efee031b9b904280639da4c6 (diff)
downloadgem5-d55b25cde6d2c072885a2c468d209fb18d6628e6.tar.xz
Move all of the parameters of the Root SimObject so they are
directly configured by python. Move stuff from root.(cc|hh) to core.(cc|hh) since it really belogs there now. In the process, simplify how ticks are used in the python code. --HG-- extra : convert_revision : cf82ee1ea20f9343924f30bacc2a38d4edee8df3
Diffstat (limited to 'src/python/m5/convert.py')
-rw-r--r--src/python/m5/convert.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/python/m5/convert.py b/src/python/m5/convert.py
index 580a579bc..bb9e3e1f1 100644
--- a/src/python/m5/convert.py
+++ b/src/python/m5/convert.py
@@ -148,7 +148,7 @@ def toLatency(value):
raise ValueError, "cannot convert '%s' to latency" % value
-def toClockPeriod(value):
+def anyToLatency(value):
"""result is a clock period"""
if not isinstance(value, str):
@@ -170,6 +170,27 @@ def toClockPeriod(value):
raise ValueError, "cannot convert '%s' to clock period" % value
+def anyToFrequency(value):
+ """result is a clock period"""
+
+ if not isinstance(value, str):
+ raise TypeError, "wrong type '%s' should be str" % type(value)
+
+ try:
+ val = toFrequency(value)
+ return val
+ except ValueError:
+ pass
+
+ try:
+ val = toLatency(value)
+ if val != 0:
+ val = 1 / val
+ return val
+ except ValueError:
+ pass
+
+ raise ValueError, "cannot convert '%s' to clock period" % value
def toNetworkBandwidth(value):
if not isinstance(value, str):