params.py (7675:2221ec64132f) params.py (7677:c6e283904437)
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;

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

236 tmp_list = [ ParamDesc.convert(self, value) ]
237
238 if isSimObjectSequence(tmp_list):
239 return SimObjectVector(tmp_list)
240 else:
241 return VectorParamValue(tmp_list)
242
243 def swig_predecls(self, code):
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;

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

236 tmp_list = [ ParamDesc.convert(self, value) ]
237
238 if isSimObjectSequence(tmp_list):
239 return SimObjectVector(tmp_list)
240 else:
241 return VectorParamValue(tmp_list)
242
243 def swig_predecls(self, code):
244 code('%import "${{self.ptype_str}}_vptype.i"')
244 code('%import "vptype_${{self.ptype_str}}.i"')
245
246 def swig_decl(self, code):
247 code('%{')
248 self.ptype.cxx_predecls(code)
249 code('%}')
250 code()
251 self.ptype.swig_predecls(code)
252 code()

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

664 self.value = value
665
666 def unproxy(self, base):
667 if self.value == NextEthernetAddr:
668 return EthernetAddr(self.value())
669 return self
670
671 def getValue(self):
245
246 def swig_decl(self, code):
247 code('%{')
248 self.ptype.cxx_predecls(code)
249 code('%}')
250 code()
251 self.ptype.swig_predecls(code)
252 code()

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

664 self.value = value
665
666 def unproxy(self, base):
667 if self.value == NextEthernetAddr:
668 return EthernetAddr(self.value())
669 return self
670
671 def getValue(self):
672 from m5.objects.params import EthAddr
672 from m5.internal.params import EthAddr
673 return EthAddr(self.value)
674
675 def ini_str(self):
676 return self.value
677
678time_formats = [ "%a %b %d %H:%M:%S %Z %Y",
679 "%a %b %d %H:%M:%S %Z %Y",
680 "%Y/%m/%d %H:%M:%S",

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

723 @classmethod
724 def swig_predecls(cls, code):
725 code('%include "python/swig/time.i"')
726
727 def __init__(self, value):
728 self.value = parse_time(value)
729
730 def getValue(self):
673 return EthAddr(self.value)
674
675 def ini_str(self):
676 return self.value
677
678time_formats = [ "%a %b %d %H:%M:%S %Z %Y",
679 "%a %b %d %H:%M:%S %Z %Y",
680 "%Y/%m/%d %H:%M:%S",

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

723 @classmethod
724 def swig_predecls(cls, code):
725 code('%include "python/swig/time.i"')
726
727 def __init__(self, value):
728 self.value = parse_time(value)
729
730 def getValue(self):
731 from m5.objects.params import tm
731 from m5.internal.params import tm
732
733 c_time = tm()
734 py_time = self.value
735
736 # UNIX is years since 1900
737 c_time.tm_year = py_time.tm_year - 1900;
738
739 # Python starts at 1, UNIX starts at 0

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

830}
831
832#endif // __ENUM__${name}__
833''')
834
835 def cxx_def(cls, code):
836 name = cls.__name__
837 code('''\
732
733 c_time = tm()
734 py_time = self.value
735
736 # UNIX is years since 1900
737 c_time.tm_year = py_time.tm_year - 1900;
738
739 # Python starts at 1, UNIX starts at 0

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

830}
831
832#endif // __ENUM__${name}__
833''')
834
835 def cxx_def(cls, code):
836 name = cls.__name__
837 code('''\
838#include "enums/${name}.hh"
838#include "enums/$name.hh"
839namespace Enums {
840 const char *${name}Strings[Num_${name}] =
841 {
842''')
843 code.indent(2)
844 for val in cls.vals:
845 code('"$val",')
846 code.dedent(2)

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

861 self.value = value
862
863 @classmethod
864 def cxx_predecls(cls, code):
865 code('#include "enums/$0.hh"', cls.__name__)
866
867 @classmethod
868 def swig_predecls(cls, code):
839namespace Enums {
840 const char *${name}Strings[Num_${name}] =
841 {
842''')
843 code.indent(2)
844 for val in cls.vals:
845 code('"$val",')
846 code.dedent(2)

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

861 self.value = value
862
863 @classmethod
864 def cxx_predecls(cls, code):
865 code('#include "enums/$0.hh"', cls.__name__)
866
867 @classmethod
868 def swig_predecls(cls, code):
869 code('%import "enums/$0.i"', cls.__name__)
869 code('%import "python/m5/internal/enum_$0.i"', cls.__name__)
870
871 def getValue(self):
872 return int(self.map[self.value])
873
874 def __str__(self):
875 return self.value
876
877# how big does a rounding error need to be before we warn about it?

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

1163 except:
1164 print "Error in unproxying port '%s' of %s" % \
1165 (self.name, self.simobj.path())
1166 raise
1167 self.connect(realPeer)
1168
1169 # Call C++ to create corresponding port connection between C++ objects
1170 def ccConnect(self):
870
871 def getValue(self):
872 return int(self.map[self.value])
873
874 def __str__(self):
875 return self.value
876
877# how big does a rounding error need to be before we warn about it?

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

1163 except:
1164 print "Error in unproxying port '%s' of %s" % \
1165 (self.name, self.simobj.path())
1166 raise
1167 self.connect(realPeer)
1168
1169 # Call C++ to create corresponding port connection between C++ objects
1170 def ccConnect(self):
1171 from m5.objects.params import connectPorts
1171 from m5.internal.params import connectPorts
1172
1173 if self.ccConnected: # already done this
1174 return
1175 peer = self.peer
1176 if not self.peer: # nothing to connect to
1177 return
1178 try:
1179 connectPorts(self.simobj.getCCObject(), self.name, self.index,

--- 150 unchanged lines hidden ---
1172
1173 if self.ccConnected: # already done this
1174 return
1175 peer = self.peer
1176 if not self.peer: # nothing to connect to
1177 return
1178 try:
1179 connectPorts(self.simobj.getCCObject(), self.name, self.index,

--- 150 unchanged lines hidden ---