Deleted Added
sdiff udiff text old ( 6214:1ec0ec8933ae ) new ( 6654:4c84e771cca7 )
full compact
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

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

45#####################################################################
46
47import copy
48import datetime
49import re
50import sys
51import time
52
53import convert
54import proxy
55import ticks
56from util import *
57
58import SimObject
59
60def isSimObject(*args, **kwargs):
61 return SimObject.isSimObject(*args, **kwargs)
62
63def isSimObjectSequence(*args, **kwargs):
64 return SimObject.isSimObjectSequence(*args, **kwargs)
65
66def isSimObjectClass(*args, **kwargs):
67 return SimObject.isSimObjectClass(*args, **kwargs)

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

706 else:
707 raise TypeError, "Enum-derived class must define "\
708 "attribute 'map' or 'vals'"
709
710 cls.cxx_type = 'Enums::%s' % name
711
712 super(MetaEnum, cls).__init__(name, bases, init_dict)
713
714 def __str__(cls):
715 return cls.__name__
716
717 # Generate C++ class declaration for this enum type.
718 # Note that we wrap the enum in a class/struct to act as a namespace,
719 # so that the enum strings can be brief w/o worrying about collisions.
720 def cxx_decl(cls):
721 code = "#ifndef __ENUM__%s\n" % cls
722 code += '#define __ENUM__%s\n' % cls
723 code += '\n'
724 code += 'namespace Enums {\n'
725 code += ' enum %s {\n' % cls
726 for val in cls.vals:
727 code += ' %s = %d,\n' % (val, cls.map[val])
728 code += ' Num_%s = %d,\n' % (cls, len(cls.vals))
729 code += ' };\n'
730 code += ' extern const char *%sStrings[Num_%s];\n' % (cls, cls)
731 code += '}\n'
732 code += '\n'
733 code += '#endif\n'
734 return code
735
736 def cxx_def(cls):
737 code = '#include "enums/%s.hh"\n' % cls
738 code += 'namespace Enums {\n'
739 code += ' const char *%sStrings[Num_%s] =\n' % (cls, cls)
740 code += ' {\n'
741 for val in cls.vals:
742 code += ' "%s",\n' % val
743 code += ' };\n'
744 code += '}\n'
745 return code
746
747# Base class for enum types.

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

1165# proxy objects (via set_param_desc()) so that proxy error messages
1166# make sense.
1167class PortParamDesc(object):
1168 __metaclass__ = Singleton
1169
1170 ptype_str = 'Port'
1171 ptype = Port
1172
1173__all__ = ['Param', 'VectorParam',
1174 'Enum', 'Bool', 'String', 'Float',
1175 'Int', 'Unsigned', 'Int8', 'UInt8', 'Int16', 'UInt16',
1176 'Int32', 'UInt32', 'Int64', 'UInt64',
1177 'Counter', 'Addr', 'Tick', 'Percent',
1178 'TcpPort', 'UdpPort', 'EthernetAddr',
1179 'MemorySize', 'MemorySize32',
1180 'Latency', 'Frequency', 'Clock',
1181 'NetworkBandwidth', 'MemoryBandwidth',
1182 'Range', 'AddrRange', 'TickRange',
1183 'MaxAddr', 'MaxTick', 'AllMemory',
1184 'Time',
1185 'NextEthernetAddr', 'NULL',
1186 'Port', 'VectorPort']