Python Parameter Types

From gem5
Jump to: navigation, search

The information below came from src/python/m5/params.py and src/python/m5/util/convert.py. Reference those files for the most up to date information.

Python Type Name C++ Type Format Notes
String std::string
Int int 32 bits
Unsigned unsigned 32 bits
Int8 int8_t
UInt8 uint8_t
Int16 int16_t
UInt16 uint16_t
Int32 int32_t
UInt32 uint32_t
Int64 int64_t
UInt64 uint64_t
Counter Counter
Tick Tick
TcpPort uint16_t
UdpPort uint16_t
Percent int Between 0 and 100.
Float double
MemorySize uint64_t A string formatted as [value][unit] where value is a base 10 number and unit is one of the following:
* PB => pebibytes
* TB => tebibytes
* GB => gibibytes
* MB => mebibytes
* kB => kibibytes
* B => bytes
kibi, mebi, etc. are true powers of 2.
MemorySize32 uint32_t See "MemorySize" above. See "MemorySize" above.
Addr Addr See "MemorySize" above See "MemorySize" above. Also, an addr may be specified as a string with units, or a raw integer value.
Range Range<[type]>, type is int by default Defined as a "start" and "end" or "size" value. Exactly one of "end" or "size" is recognized as a keyword argument. A positional argument will be treated as "end", and "size" arguments are convected to "end" internally by adding to "start" and subtracting one.
AddrRange Range<Addr> See "Range" above.
TickRange Range<Tick> See "Range" above.
Bool bool
EthernetAddr Net::EthAddr Six pairs of 2 digit hex values seperated by ":"s, for instance "01:23:45:67:89:AB" May be set to NextEthernetAddr. All EthernetAddrs set to NextEthernetAddr will be assigned to incremental ethernet addresses starting with 00:90:00:00:00:01.
IpAddress Net::IpAddress Four decimal values between 0 and 255 separated by "."s, for instance "1.23.45.67", or an integer where the leftmost component is the most significant byte.
IpNetmask Net::IpNetmask A string representation of an IpAddress followed by either "/n" where n is a decimal value from 0 to 32 or "/e.f.g.h" where e-h are integer values between 0 and 255 and where when represented as binary from left to right the number is all 1s and the all 0s. The ip and netmask can also be passed in as positional or keyword arguments where the ip is an integer as described in IpAddress, and the netmask is a decimal value from 0 to 32.
IpWithPort Net::IpWithPort A string representation of an IpAddress followed by ":p" where p is a decimal value from 0 to 65535. The ip and port can also be passed in as positional or keyword arguments where the ip is an integer as described in IpAddress, and the port is a decimal value from 0 to 65535.
Time tm May be a Python struct_time, int, long, datetime, or date, the string "Now" or "Today", or a string parseable by Python's strptime with one of the following formats:
* "%a %b %d %H:%M:%S %Z %Y"
* "%a %b %d %H:%M:%S %Z %Y"
* "%Y/%m/%d %H:%M:%S"
* "%Y/%m/%d %H:%M"
* "%Y/%m/%d"
* "%m/%d/%Y %H:%M:%S"
* "%m/%d/%Y %H:%M"
* "%m/%d/%Y"
* "%m/%d/%y %H:%M:%S"
* "%m/%d/%y %H:%M"
* "%m/%d/%y"
subclasses of Enum enum named after the parameter type A string defined as part of the enum This description applies to all enum parameter types which are defined as subclasses of Enum. The possible string values and optionally their mappings are specified in a dict called "map" or a list called "vals" defined as members of the Enum subclass itself.
Latency Tick Can be assigned an existing Clock or Frequency parameter, or a string with the format [value][unit] where value is a base 10 number and unit is one of the following:
* t => Ticks
* ps => picoseconds
* ns => nanoseconds
* us => microseconds
* ms => milliseconds
* s => seconds
Frequency Tick Can be assigned an existing Latency or Clock parameter, or a string with the format [value][unit] where value is a base 10 number and unit is one of the following:
* THz => terahertz
* GHz => gigahertz
* MHz => megahertz
* kHz => kilohertz
* Hz => hertz
The frequency value is converted into a period in units of Ticks when transfered to C++.
Clock Tick Can be assigned an existing Latency or Frequency parameter, or a string with the format [value][unit] where value is a base 10 number and unit is one of the following:
* t => Ticks
* ps => picoseconds
* ns => nanoseconds
* us => microseconds
* ms => milliseconds
* s => seconds
* THz => terahertz
* GHz => gigahertz
* MHz => megahertz
* kHz => kilohertz
* Hz => hertz
This type is like a combination of the Frequency and Latency types described above.
NetworkBandwidth float A floating point value specifying bits per second, or a string formatted as [value][unit] where value is a base 10 number and unit is one of the following:
* Tbps => terabits per second
* Gbps => gigabits per second
* Mbps => megabits per second
* kbps => kilobits per second
* bps => bits per second
The network bandwidth value is converted to Ticks per byte before being transfered to C++.
MemoryBandwidth float A string formatted as [value][unit] where value is a base 10 number and unit is one of the following:
* PB/s => pebibytes per second
* TB/s => tebibytes per second
* GB/s => gibibytes per second
* MB/s => mebibytes per second
* kB/s => kibibytes per second
* B/s => bytes per second
The memory bandwidth value is converted to Ticks per byte before being transferred to C++. kibi, mebi, etc. are true powers of 2.
subclass of SimObject defined in subclass These parameter types are for assigning one simobject to another as a parameter. The may be set to nothing using the special "NULL" python object.