SimObject.py (11787:af41594e9b3c) SimObject.py (11802:be62996c95d1)
1# Copyright (c) 2012 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

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

651 return cls.__name__
652
653 # See ParamValue.cxx_predecls for description.
654 def cxx_predecls(cls, code):
655 code('#include "params/$cls.hh"')
656
657 # See ParamValue.swig_predecls for description.
658 def swig_predecls(cls, code):
1# Copyright (c) 2012 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

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

651 return cls.__name__
652
653 # See ParamValue.cxx_predecls for description.
654 def cxx_predecls(cls, code):
655 code('#include "params/$cls.hh"')
656
657 # See ParamValue.swig_predecls for description.
658 def swig_predecls(cls, code):
659 code('%import "python/m5/internal/param_$cls.i"')
659 code('%import "python/_m5/param_$cls.i"')
660
661 # Hook for exporting additional C++ methods to Python via SWIG.
662 # Default is none, override using @classmethod in class definition.
663 def export_methods(cls, code):
664 pass
665
666 # Generate the code needed as a prerequisite for the C++ methods
667 # exported via export_methods() to be processed by SWIG.

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

681
682 # The 'local' attribute restricts us to the params declared in
683 # the object itself, not including inherited params (which
684 # will also be inherited from the base class's param struct
685 # here). Sort the params based on their key
686 params = map(lambda (k, v): v, sorted(cls._params.local.items()))
687 ports = cls._ports.local
688
660
661 # Hook for exporting additional C++ methods to Python via SWIG.
662 # Default is none, override using @classmethod in class definition.
663 def export_methods(cls, code):
664 pass
665
666 # Generate the code needed as a prerequisite for the C++ methods
667 # exported via export_methods() to be processed by SWIG.

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

681
682 # The 'local' attribute restricts us to the params declared in
683 # the object itself, not including inherited params (which
684 # will also be inherited from the base class's param struct
685 # here). Sort the params based on their key
686 params = map(lambda (k, v): v, sorted(cls._params.local.items()))
687 ports = cls._ports.local
688
689 code('%module(package="m5.internal") param_$cls')
689 code('%module(package="_m5") param_$cls')
690 code()
691 code('%{')
692 code('#include "sim/sim_object.hh"')
693 code('#include "params/$cls.hh"')
694 for param in params:
695 param.cxx_predecls(code)
696 code('#include "${{cls.cxx_header}}"')
697 code('''\

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

711 code()
712
713 for param in params:
714 param.swig_predecls(code)
715 cls.export_method_swig_predecls(code)
716
717 code()
718 if cls._base:
690 code()
691 code('%{')
692 code('#include "sim/sim_object.hh"')
693 code('#include "params/$cls.hh"')
694 for param in params:
695 param.cxx_predecls(code)
696 code('#include "${{cls.cxx_header}}"')
697 code('''\

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

711 code()
712
713 for param in params:
714 param.swig_predecls(code)
715 cls.export_method_swig_predecls(code)
716
717 code()
718 if cls._base:
719 code('%import "python/m5/internal/param_${{cls._base}}.i"')
719 code('%import "python/_m5/param_${{cls._base}}.i"')
720 code()
721
722 for ns in namespaces:
723 code('namespace $ns {')
724
725 if namespaces:
726 code('// avoid name conflicts')
727 sep_string = '_COLONS_'

--- 793 unchanged lines hidden ---
720 code()
721
722 for ns in namespaces:
723 code('namespace $ns {')
724
725 if namespaces:
726 code('// avoid name conflicts')
727 sep_string = '_COLONS_'

--- 793 unchanged lines hidden ---