params: small cleanup to param description internals
This commit is contained in:
parent
e9288b2cd3
commit
30d5d95b6a
2 changed files with 6 additions and 7 deletions
|
@ -489,12 +489,7 @@ for name,simobj in sorted(sim_objects.iteritems()):
|
|||
# Generate any parameter header files needed
|
||||
params_i_files = []
|
||||
for name,param in all_params.iteritems():
|
||||
if isinstance(param, m5.params.VectorParamDesc):
|
||||
ext = 'vptype'
|
||||
else:
|
||||
ext = 'ptype'
|
||||
|
||||
i_file = File('params/%s_%s.i' % (name, ext))
|
||||
i_file = File('params/%s_%s.i' % (name, param.file_ext))
|
||||
params_i_files.append(i_file)
|
||||
env.Command(i_file, Value(name), createSwigParam)
|
||||
env.Depends(i_file, depends)
|
||||
|
|
|
@ -93,6 +93,8 @@ class ParamValue(object):
|
|||
|
||||
# Regular parameter description.
|
||||
class ParamDesc(object):
|
||||
file_ext = 'ptype'
|
||||
|
||||
def __init__(self, ptype_str, ptype, *args, **kwargs):
|
||||
self.ptype_str = ptype_str
|
||||
# remember ptype only if it is provided
|
||||
|
@ -127,7 +129,7 @@ class ParamDesc(object):
|
|||
def __getattr__(self, attr):
|
||||
if attr == 'ptype':
|
||||
ptype = SimObject.allClasses[self.ptype_str]
|
||||
assert issubclass(ptype, SimObject.SimObject)
|
||||
assert isSimObjectClass(ptype)
|
||||
self.ptype = ptype
|
||||
return ptype
|
||||
|
||||
|
@ -182,6 +184,8 @@ class SimObjVector(VectorParamValue):
|
|||
v.print_ini(ini_file)
|
||||
|
||||
class VectorParamDesc(ParamDesc):
|
||||
file_ext = 'vptype'
|
||||
|
||||
# Convert assigned value to appropriate type. If the RHS is not a
|
||||
# list or tuple, it generates a single-element list.
|
||||
def convert(self, value):
|
||||
|
|
Loading…
Reference in a new issue