SimObject.py (8840:b62d40514d98) | SimObject.py (8848:2629f0b99e8d) |
---|---|
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 --- 908 unchanged lines hidden (view full) --- 917 d = attrdict() 918 if hasattr(self, 'type'): 919 d.type = self.type 920 if hasattr(self, 'cxx_class'): 921 d.cxx_class = self.cxx_class 922 923 for param in sorted(self._params.keys()): 924 value = self._values.get(param) | 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 --- 908 unchanged lines hidden (view full) --- 917 d = attrdict() 918 if hasattr(self, 'type'): 919 d.type = self.type 920 if hasattr(self, 'cxx_class'): 921 d.cxx_class = self.cxx_class 922 923 for param in sorted(self._params.keys()): 924 value = self._values.get(param) |
925 try: 926 # Use native type for those supported by JSON and 927 # strings for everything else. skipkeys=True seems 928 # to not work as well as one would hope 929 if type(self._values[param].value) in \ 930 [str, unicode, int, long, float, bool, None]: 931 d[param] = self._values[param].value 932 else: 933 d[param] = str(self._values[param]) | 925 if value != None: 926 try: 927 # Use native type for those supported by JSON and 928 # strings for everything else. skipkeys=True seems 929 # to not work as well as one would hope 930 if type(self._values[param].value) in \ 931 [str, unicode, int, long, float, bool, None]: 932 d[param] = self._values[param].value 933 else: 934 d[param] = str(self._values[param]) |
934 | 935 |
935 except AttributeError: 936 pass | 936 except AttributeError: 937 pass |
937 938 for n in sorted(self._children.keys()): 939 d[self._children[n].get_name()] = self._children[n].get_config_as_dict() 940 941 for port_name in sorted(self._ports.keys()): 942 port = self._port_refs.get(port_name, None) 943 if port != None: 944 # Might want to actually make this reference the object --- 200 unchanged lines hidden --- | 938 939 for n in sorted(self._children.keys()): 940 d[self._children[n].get_name()] = self._children[n].get_config_as_dict() 941 942 for port_name in sorted(self._ports.keys()): 943 port = self._port_refs.get(port_name, None) 944 if port != None: 945 # Might want to actually make this reference the object --- 200 unchanged lines hidden --- |