summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2007-04-12 08:37:55 -0700
committerNathan Binkert <binkertn@umich.edu>2007-04-12 08:37:55 -0700
commite04208f046237c74a2350d98a74a2fdc0ad838fa (patch)
treece6c14d19e03324de65ffeb83a8907b1a803d309 /src
parentfa2a93a236f42d5b70061f3f8b2b65457eb5f836 (diff)
downloadgem5-e04208f046237c74a2350d98a74a2fdc0ad838fa.tar.xz
Fix NextEthernetAddr.
unproxy() needs to return a new object otherwise all instances will use the same value. This fix is more or less unique to NextEthernetAddr because its use of the proxy stuff is a bit different than everything else. --HG-- extra : convert_revision : 2ce452e37d00b9ba76b6abfaec0ad2e0073920d7
Diffstat (limited to 'src')
-rw-r--r--src/python/m5/params.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index 9892df97c..da7ddd65e 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -51,6 +51,7 @@ import sys
import time
import convert
+import proxy
import ticks
from util import *
@@ -477,12 +478,13 @@ def IncEthernetAddr(addr, val = 1):
assert(bytes[0] <= 255)
return ':'.join(map(lambda x: '%02x' % x, bytes))
-class NextEthernetAddr(object):
- addr = "00:90:00:00:00:01"
+_NextEthernetAddr = "00:90:00:00:00:01"
+def NextEthernetAddr():
+ global _NextEthernetAddr
- def __init__(self, inc = 1):
- self.value = NextEthernetAddr.addr
- NextEthernetAddr.addr = IncEthernetAddr(NextEthernetAddr.addr, inc)
+ value = _NextEthernetAddr
+ _NextEthernetAddr = IncEthernetAddr(_NextEthernetAddr, 1)
+ return value
class EthernetAddr(ParamValue):
cxx_type = 'Net::EthAddr'
@@ -508,17 +510,11 @@ class EthernetAddr(ParamValue):
def unproxy(self, base):
if self.value == NextEthernetAddr:
- self.addr = self.value().value
+ return EthernetAddr(self.value())
return self
- def __str__(self):
- if self.value == NextEthernetAddr:
- if hasattr(self, 'addr'):
- return self.addr
- else:
- return "NextEthernetAddr (unresolved)"
- else:
- return self.value
+ def ini_str(self):
+ return self.value
time_formats = [ "%a %b %d %H:%M:%S %Z %Y",
"%a %b %d %H:%M:%S %Z %Y",
@@ -1028,6 +1024,5 @@ __all__ = ['Param', 'VectorParam',
# see comment on imports at end of __init__.py.
from SimObject import isSimObject, isSimObjectSequence, isSimObjectClass
-import proxy
import objects
import internal