SimObject.py (5610:0e1e9c186769) | SimObject.py (5766:37b74394f2f9) |
---|---|
1# Copyright (c) 2004-2006 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 13 unchanged lines hidden (view full) --- 22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26# 27# Authors: Steve Reinhardt 28# Nathan Binkert 29 | 1# Copyright (c) 2004-2006 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 13 unchanged lines hidden (view full) --- 22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26# 27# Authors: Steve Reinhardt 28# Nathan Binkert 29 |
30import sys, types | 30import math 31import sys 32import types |
31 32import proxy 33import m5 34from util import * 35 36# These utility functions have to come first because they're 37# referenced in params.py... otherwise they won't be defined when we 38# import params below, and the recursive import of this file from --- 583 unchanged lines hidden (view full) --- 622 623 if isSimObject(value): 624 value._maybe_set_parent(self, attr) 625 elif isSimObjectSequence(value): 626 value = SimObjVector(value) 627 if len(value) == 1: 628 value[0]._maybe_set_parent(self, attr) 629 else: | 33 34import proxy 35import m5 36from util import * 37 38# These utility functions have to come first because they're 39# referenced in params.py... otherwise they won't be defined when we 40# import params below, and the recursive import of this file from --- 583 unchanged lines hidden (view full) --- 624 625 if isSimObject(value): 626 value._maybe_set_parent(self, attr) 627 elif isSimObjectSequence(value): 628 value = SimObjVector(value) 629 if len(value) == 1: 630 value[0]._maybe_set_parent(self, attr) 631 else: |
632 width = int(math.ceil(math.log(len(value))/math.log(10))) |
|
630 for i,v in enumerate(value): | 633 for i,v in enumerate(value): |
631 v._maybe_set_parent(self, "%s%d" % (attr, i)) | 634 v._maybe_set_parent(self, "%s%0*d" % (attr, width, i)) |
632 633 self._values[attr] = value 634 635 def path(self): 636 if not self._parent: 637 return 'root' 638 ppath = self._parent.path() 639 if ppath == 'root': --- 248 unchanged lines hidden --- | 635 636 self._values[attr] = value 637 638 def path(self): 639 if not self._parent: 640 return 'root' 641 ppath = self._parent.path() 642 if ppath == 'root': --- 248 unchanged lines hidden --- |