SimObject.py (12563:8d59ed22ae79) | SimObject.py (12742:a48daf1c7e56) |
---|---|
1# Copyright (c) 2017 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 --- 393 unchanged lines hidden (view full) --- 402class MetaSimObject(type): 403 # Attributes that can be set only at initialization time 404 init_keywords = { 405 'abstract' : bool, 406 'cxx_class' : str, 407 'cxx_type' : str, 408 'cxx_header' : str, 409 'type' : str, | 1# Copyright (c) 2017 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 --- 393 unchanged lines hidden (view full) --- 402class MetaSimObject(type): 403 # Attributes that can be set only at initialization time 404 init_keywords = { 405 'abstract' : bool, 406 'cxx_class' : str, 407 'cxx_type' : str, 408 'cxx_header' : str, 409 'type' : str, |
410 'cxx_bases' : list, | 410 'cxx_extra_bases' : list, |
411 'cxx_exports' : list, 412 'cxx_param_exports' : list, 413 } 414 # Attributes that can be set any time 415 keywords = { 'check' : FunctionType } 416 417 # __new__ is called before __init__, and is where the statements 418 # in the body of the class definition get loaded into the class's --- 17 unchanged lines hidden (view full) --- 436 437 if public_value(key, val): 438 cls_dict[key] = val 439 else: 440 # must be a param/port setting 441 value_dict[key] = val 442 if 'abstract' not in value_dict: 443 value_dict['abstract'] = False | 411 'cxx_exports' : list, 412 'cxx_param_exports' : list, 413 } 414 # Attributes that can be set any time 415 keywords = { 'check' : FunctionType } 416 417 # __new__ is called before __init__, and is where the statements 418 # in the body of the class definition get loaded into the class's --- 17 unchanged lines hidden (view full) --- 436 437 if public_value(key, val): 438 cls_dict[key] = val 439 else: 440 # must be a param/port setting 441 value_dict[key] = val 442 if 'abstract' not in value_dict: 443 value_dict['abstract'] = False |
444 if 'cxx_bases' not in value_dict: 445 value_dict['cxx_bases'] = [] | 444 if 'cxx_extra_bases' not in value_dict: 445 value_dict['cxx_extra_bases'] = [] |
446 if 'cxx_exports' not in value_dict: 447 value_dict['cxx_exports'] = cxx_exports 448 else: 449 value_dict['cxx_exports'] += cxx_exports 450 if 'cxx_param_exports' not in value_dict: 451 value_dict['cxx_param_exports'] = [] 452 cls_dict['_value_dict'] = value_dict 453 cls = super(MetaSimObject, mcls).__new__(mcls, name, bases, cls_dict) --- 275 unchanged lines hidden (view full) --- 729 ] 730 for exp in param_exports: 731 exp.export(code, "%sParams" % cls) 732 733 code(';') 734 code() 735 code.dedent() 736 | 446 if 'cxx_exports' not in value_dict: 447 value_dict['cxx_exports'] = cxx_exports 448 else: 449 value_dict['cxx_exports'] += cxx_exports 450 if 'cxx_param_exports' not in value_dict: 451 value_dict['cxx_param_exports'] = [] 452 cls_dict['_value_dict'] = value_dict 453 cls = super(MetaSimObject, mcls).__new__(mcls, name, bases, cls_dict) --- 275 unchanged lines hidden (view full) --- 729 ] 730 for exp in param_exports: 731 exp.export(code, "%sParams" % cls) 732 733 code(';') 734 code() 735 code.dedent() 736 |
737 bases = [ cls._base.cxx_class ] + cls.cxx_bases if cls._base else \ 738 cls.cxx_bases | 737 bases = [ cls._base.cxx_class ] + cls.cxx_extra_bases if \ 738 cls._base else cls.cxx_extra_bases |
739 if bases: 740 base_str = ", ".join(bases) 741 code('py::class_<${{cls.cxx_class}}, ${base_str}, ' \ 742 'std::unique_ptr<${{cls.cxx_class}}, py::nodelete>>(' \ 743 'm, "${py_class_name}")') 744 else: 745 code('py::class_<${{cls.cxx_class}}, ' \ 746 'std::unique_ptr<${{cls.cxx_class}}, py::nodelete>>(' \ --- 181 unchanged lines hidden (view full) --- 928class SimObject(object): 929 # Specify metaclass. Any class inheriting from SimObject will 930 # get this metaclass. 931 __metaclass__ = MetaSimObject 932 type = 'SimObject' 933 abstract = True 934 935 cxx_header = "sim/sim_object.hh" | 739 if bases: 740 base_str = ", ".join(bases) 741 code('py::class_<${{cls.cxx_class}}, ${base_str}, ' \ 742 'std::unique_ptr<${{cls.cxx_class}}, py::nodelete>>(' \ 743 'm, "${py_class_name}")') 744 else: 745 code('py::class_<${{cls.cxx_class}}, ' \ 746 'std::unique_ptr<${{cls.cxx_class}}, py::nodelete>>(' \ --- 181 unchanged lines hidden (view full) --- 928class SimObject(object): 929 # Specify metaclass. Any class inheriting from SimObject will 930 # get this metaclass. 931 __metaclass__ = MetaSimObject 932 type = 'SimObject' 933 abstract = True 934 935 cxx_header = "sim/sim_object.hh" |
936 cxx_bases = [ "Drainable", "Serializable" ] | 936 cxx_extra_bases = [ "Drainable", "Serializable" ] |
937 eventq_index = Param.UInt32(Parent.eventq_index, "Event Queue Index") 938 939 cxx_exports = [ 940 PyBindMethod("init"), 941 PyBindMethod("initState"), 942 PyBindMethod("memInvalidate"), 943 PyBindMethod("memWriteback"), 944 PyBindMethod("regStats"), --- 638 unchanged lines hidden --- | 937 eventq_index = Param.UInt32(Parent.eventq_index, "Event Queue Index") 938 939 cxx_exports = [ 940 PyBindMethod("init"), 941 PyBindMethod("initState"), 942 PyBindMethod("memInvalidate"), 943 PyBindMethod("memWriteback"), 944 PyBindMethod("regStats"), --- 638 unchanged lines hidden --- |