SimObject.py (7675:2221ec64132f) SimObject.py (7677:c6e283904437)
1# Copyright (c) 2004-2006 The Regents of The University of Michigan
2# Copyright (c) 2010 Advanced Micro Devices, Inc.
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 87 unchanged lines hidden (view full) ---

96
97# dict to look up SimObjects based on path
98instanceDict = {}
99
100def default_cxx_predecls(cls, code):
101 code('#include "params/$cls.hh"')
102
103def default_swig_predecls(cls, code):
1# Copyright (c) 2004-2006 The Regents of The University of Michigan
2# Copyright (c) 2010 Advanced Micro Devices, Inc.
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 87 unchanged lines hidden (view full) ---

96
97# dict to look up SimObjects based on path
98instanceDict = {}
99
100def default_cxx_predecls(cls, code):
101 code('#include "params/$cls.hh"')
102
103def default_swig_predecls(cls, code):
104 code('%import "params/$cls.i"')
104 code('%import "python/m5/internal/param_$cls.i"')
105
106def default_swig_objdecls(cls, code):
107 class_path = cls.cxx_class.split('::')
108 classname = class_path[-1]
109 namespaces = class_path[:-1]
110
111 for ns in namespaces:
112 code('namespace $ns {')

--- 337 unchanged lines hidden (view full) ---

450 ptypes = [p.ptype for p in params]
451
452 # get all predeclarations
453 for param in params:
454 param.swig_predecls(code)
455 code()
456
457 if cls._base:
105
106def default_swig_objdecls(cls, code):
107 class_path = cls.cxx_class.split('::')
108 classname = class_path[-1]
109 namespaces = class_path[:-1]
110
111 for ns in namespaces:
112 code('namespace $ns {')

--- 337 unchanged lines hidden (view full) ---

450 ptypes = [p.ptype for p in params]
451
452 # get all predeclarations
453 for param in params:
454 param.swig_predecls(code)
455 code()
456
457 if cls._base:
458 code('%import "params/${{cls._base.type}}.i"')
458 code('%import "python/m5/internal/param_${{cls._base.type}}.i"')
459 code()
460
461 for ptype in ptypes:
462 if issubclass(ptype, Enum):
463 code('%import "enums/${{ptype.__name__}}.hh"')
464 code()
465
466 code('%import "params/${cls}_type.hh"')

--- 308 unchanged lines hidden (view full) ---

775 print >>ini_file, '%s=%s' % (port_name, port.ini_str())
776
777 print >>ini_file # blank line between objects
778
779 def getCCParams(self):
780 if self._ccParams:
781 return self._ccParams
782
459 code()
460
461 for ptype in ptypes:
462 if issubclass(ptype, Enum):
463 code('%import "enums/${{ptype.__name__}}.hh"')
464 code()
465
466 code('%import "params/${cls}_type.hh"')

--- 308 unchanged lines hidden (view full) ---

775 print >>ini_file, '%s=%s' % (port_name, port.ini_str())
776
777 print >>ini_file # blank line between objects
778
779 def getCCParams(self):
780 if self._ccParams:
781 return self._ccParams
782
783 cc_params_struct = getattr(m5.objects.params, '%sParams' % self.type)
783 cc_params_struct = getattr(m5.internal.params, '%sParams' % self.type)
784 cc_params = cc_params_struct()
785 cc_params.pyobj = self
786 cc_params.name = str(self)
787
788 param_names = self._params.keys()
789 param_names.sort()
790 for param in param_names:
791 value = self._values.get(param)

--- 180 unchanged lines hidden ---
784 cc_params = cc_params_struct()
785 cc_params.pyobj = self
786 cc_params.name = str(self)
787
788 param_names = self._params.keys()
789 param_names.sort()
790 for param in param_names:
791 value = self._values.get(param)

--- 180 unchanged lines hidden ---