diff options
-rw-r--r-- | python/m5/config.py | 14 | ||||
-rwxr-xr-x | test/genini.py | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/python/m5/config.py b/python/m5/config.py index 74988109b..2db2164fc 100644 --- a/python/m5/config.py +++ b/python/m5/config.py @@ -177,7 +177,7 @@ class Proxy(object): # support multiplying proxies by constants def __mul__(self, other): - if not isinstance(other, int): + if not isinstance(other, (int, float)): raise TypeError, "Proxy multiplier must be integer" if self._multiplier == None: self._multiplier = other @@ -186,13 +186,19 @@ class Proxy(object): self._multiplier *= other return self + __rmul__ = __mul__ + def _mulcheck(self, result): if self._multiplier == None: return result if not isinstance(result, int): - raise TypeError, "Proxy with multiplier resolves to " \ - "non-integer value" - return result * self._multiplier + # this was an error, but for now we'll assume if it's not + # an int it must be a Frequency (yuk) + result = Frequency._convert(result) + # assuming we're dealing with a frequency here, turn it into + # a string and give it a 't' suffix so the Frequency._convert + # doesn't choke on it later. + return ("%d" % int(round((result * self._multiplier)))) + 't' def unproxy(self, base, ptype): obj = base diff --git a/test/genini.py b/test/genini.py index b8eda5d46..d04f049ea 100755 --- a/test/genini.py +++ b/test/genini.py @@ -44,7 +44,7 @@ try: offset = arg.find('=') if offset == -1: name = arg - value = '1' + value = 'True' else: name = arg[:offset] value = arg[offset+1:] |