Added Float class
Fixed printing so the tokenizer in m5 doesn't get confused Expanded NullSimObject so it could be used as an element in a VectorParam --HG-- extra : convert_revision : 661b1916967d663ab7aee891f15f7ca190deeba6
This commit is contained in:
parent
91f5736fd3
commit
cad549d7aa
|
@ -421,14 +421,14 @@ class SimObject(object):
|
||||||
print '[' + self.path() + ']' # .ini section header
|
print '[' + self.path() + ']' # .ini section header
|
||||||
|
|
||||||
if hasattr(self, 'type') and not isinstance(self, ParamContext):
|
if hasattr(self, 'type') and not isinstance(self, ParamContext):
|
||||||
print 'type =', self.type
|
print 'type=%s' % self.type
|
||||||
|
|
||||||
child_names = self._children.keys()
|
child_names = self._children.keys()
|
||||||
child_names.sort()
|
child_names.sort()
|
||||||
np_child_names = [c for c in child_names \
|
np_child_names = [c for c in child_names \
|
||||||
if not isinstance(self._children[c], ParamContext)]
|
if not isinstance(self._children[c], ParamContext)]
|
||||||
if len(np_child_names):
|
if len(np_child_names):
|
||||||
print 'children =', ' '.join(np_child_names)
|
print 'children=%s' % ' '.join(np_child_names)
|
||||||
|
|
||||||
param_names = self._params.keys()
|
param_names = self._params.keys()
|
||||||
param_names.sort()
|
param_names.sort()
|
||||||
|
@ -444,7 +444,7 @@ class SimObject(object):
|
||||||
(param, self.path())
|
(param, self.path())
|
||||||
raise
|
raise
|
||||||
setattr(self, param, value)
|
setattr(self, param, value)
|
||||||
print param, '=', self._values[param].ini_str()
|
print '%s=%s' % (param, self._values[param].ini_str())
|
||||||
|
|
||||||
print # blank line between objects
|
print # blank line between objects
|
||||||
|
|
||||||
|
@ -921,6 +921,9 @@ class UdpPort(CheckedInt): size = 16; unsigned = True
|
||||||
|
|
||||||
class Percent(CheckedInt): min = 0; max = 100
|
class Percent(CheckedInt): min = 0; max = 100
|
||||||
|
|
||||||
|
class Float(ParamValue, float):
|
||||||
|
pass
|
||||||
|
|
||||||
class MemorySize(CheckedInt):
|
class MemorySize(CheckedInt):
|
||||||
size = 64
|
size = 64
|
||||||
unsigned = True
|
unsigned = True
|
||||||
|
@ -1024,6 +1027,14 @@ class NullSimObject(object):
|
||||||
def ini_str(self):
|
def ini_str(self):
|
||||||
return 'Null'
|
return 'Null'
|
||||||
|
|
||||||
|
def unproxy(self,base):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def set_path(self, parent, name):
|
||||||
|
pass
|
||||||
|
def __str__(self):
|
||||||
|
return 'Null'
|
||||||
|
|
||||||
# The only instance you'll ever need...
|
# The only instance you'll ever need...
|
||||||
Null = NULL = NullSimObject()
|
Null = NULL = NullSimObject()
|
||||||
|
|
||||||
|
@ -1262,7 +1273,7 @@ def instantiate(root):
|
||||||
# short to avoid polluting other namespaces.
|
# short to avoid polluting other namespaces.
|
||||||
__all__ = ['SimObject', 'ParamContext', 'Param', 'VectorParam',
|
__all__ = ['SimObject', 'ParamContext', 'Param', 'VectorParam',
|
||||||
'Parent', 'Self',
|
'Parent', 'Self',
|
||||||
'Enum', 'Bool', 'String',
|
'Enum', 'Bool', 'String', 'Float',
|
||||||
'Int', 'Unsigned', 'Int8', 'UInt8', 'Int16', 'UInt16',
|
'Int', 'Unsigned', 'Int8', 'UInt8', 'Int16', 'UInt16',
|
||||||
'Int32', 'UInt32', 'Int64', 'UInt64',
|
'Int32', 'UInt32', 'Int64', 'UInt64',
|
||||||
'Counter', 'Addr', 'Tick', 'Percent',
|
'Counter', 'Addr', 'Tick', 'Percent',
|
||||||
|
|
Loading…
Reference in a new issue