diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2007-03-06 20:58:44 +0000 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2007-03-06 20:58:44 +0000 |
commit | 44f91bb4443ed55a8e75096f1a821fd7605b7771 (patch) | |
tree | 39ffcc423e52760b67a9b7984fe2d652f56e8c92 /src/python/m5/convert.py | |
parent | 05c86ec0d7662ccefc5690a4445fcf2976d16622 (diff) | |
parent | 329db76e47c825d4ecbe0f5251dbcfaf2ec09516 (diff) | |
download | gem5-44f91bb4443ed55a8e75096f1a821fd7605b7771.tar.xz |
Merge zizzer.eecs.umich.edu:/bk/newmem
into ahchoo.blinky.homelinux.org:/home/gblack/m5/newmem-x86
--HG--
extra : convert_revision : 0822fbcc377781b53d2de9ba40ab9d985ccbc039
Diffstat (limited to 'src/python/m5/convert.py')
-rw-r--r-- | src/python/m5/convert.py | 23 |
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): |