SimObject.py (8664:42052d5bb793) SimObject.py (8669:f02f8c38f6a1)
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;

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

900 if hasattr(self, 'type'):
901 d.type = self.type
902 if hasattr(self, 'cxx_class'):
903 d.cxx_class = self.cxx_class
904
905 for param in sorted(self._params.keys()):
906 value = self._values.get(param)
907 try:
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;

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

900 if hasattr(self, 'type'):
901 d.type = self.type
902 if hasattr(self, 'cxx_class'):
903 d.cxx_class = self.cxx_class
904
905 for param in sorted(self._params.keys()):
906 value = self._values.get(param)
907 try:
908 d[param] = self._values[param].value
908 # Use native type for those supported by JSON and
909 # strings for everything else. skipkeys=True seems
910 # to not work as well as one would hope
911 if type(self._values[param].value) in \
912 [str, unicode, int, long, float, bool, None]:
913 d[param] = self._values[param].value
914 else:
915 d[param] = str(self._values[param])
916
909 except AttributeError:
910 pass
911
912 for n in sorted(self._children.keys()):
913 d[self._children[n].get_name()] = self._children[n].get_config_as_dict()
914
915 for port_name in sorted(self._ports.keys()):
916 port = self._port_refs.get(port_name, None)

--- 201 unchanged lines hidden ---
917 except AttributeError:
918 pass
919
920 for n in sorted(self._children.keys()):
921 d[self._children[n].get_name()] = self._children[n].get_config_as_dict()
922
923 for port_name in sorted(self._ports.keys()):
924 port = self._port_refs.get(port_name, None)

--- 201 unchanged lines hidden ---