参考链接:GEM5- GEM5 给 SimObject 添加 Param — Yilong Zhao
GEM5 是通过某种方式将 python 中的数据类型和 c++ 中的数据类型打通,进而完成将 python config 脚本中的参数传递给 c++ 代码的任务。 因此在 GEM5 的源码中,默认参数类型在 c++ 文件和 python 文件分别定义了一份。下面的列表我们将描述 python 文件中定义的数据类型,并列出对应的 c++ 数据类型:
Python 类型 | c++ 类型 | c++ 头文件 |
---|---|---|
Int | std::string | 内置类型 |
(U)Int(8,16...) | (u)int(8,16...)_t | 内置类型 |
Float | double | 内置类型 |
Bool | bool | 内置类型 |
Counter | Counter | base/type.hh |
Tick | Tick | base/type.hh |
TcpPort / UdpPort | uint16_t | 内置类型 |
Percent | int | 内置类型 |
Cycles | Cycles | base/type.hh |
MemorySize / MemorySize32 | uint64_t | 内置类型 |
Addr | Addr | base/type.hh |
AddrRange | AddrRange | base/addr_range.hh |
EthernetAddr | Net::EthAddr | base/inet.hh |
IpAddress | Net::IpAddress | base/inet.hh |
IpNetmask | Net::IpNetmask | base/inet.hh |
IpWithPort | Net::IpWithPort | base/inet.hh |
Time | tm | base/time.hh |
TickParamValue / Latency / Frequency / Clock | Tick | base/types.hh |
Voltage / Current / Energy / NetworkBandwidth / MemoryBandwidth | double | 内置类型 |
NullSimObject | Null | 内置类型 |