diff options
author | Nathan Binkert <nate@binkert.org> | 2009-09-22 15:24:16 -0700 |
---|---|---|
committer | Nathan Binkert <nate@binkert.org> | 2009-09-22 15:24:16 -0700 |
commit | 30d5d95b6a7c93ccf63ae0cfcc62d17306c31eee (patch) | |
tree | 22a684e816c9690e890fb46e5e9496b33644d8e3 /src | |
parent | e9288b2cd35863c600d7ff7bf04f4c08e055e3e0 (diff) | |
download | gem5-30d5d95b6a7c93ccf63ae0cfcc62d17306c31eee.tar.xz |
params: small cleanup to param description internals
Diffstat (limited to 'src')
-rw-r--r-- | src/SConscript | 7 | ||||
-rw-r--r-- | src/python/m5/params.py | 6 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/SConscript b/src/SConscript index 687709ac1..d3323f0a0 100644 --- a/src/SConscript +++ b/src/SConscript @@ -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) diff --git a/src/python/m5/params.py b/src/python/m5/params.py index 3a3a30014..cf64070c5 100644 --- a/src/python/m5/params.py +++ b/src/python/m5/params.py @@ -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): |