gem5 文档
开发
构建
使用 KVM
Sphinx 文档
Doxygen 文档
gem5 API
全系统模拟 (Full System)
内存系统
Ruby 内存系统
检查点 (Checkpoints)
定向测试器 (Directed Testers)
调试 (Debugging)
架构支持
功耗与热模型
编译工作负载
统计包 (Stats)
统计 API
Develop 分支
v19.0.0.0
v20.0.0.0
v20.0.0.2
v20.0.0.3
v20.1.0.0
v20.1.0.1
v20.1.0.5
v21.0.0.0
v21.0.1.0
v21.1.0.0
v21.1.0.1
v21.1.0.2
v21.2.0.0
v21.2.1.0
v21.2.1.1
v22.0.0.0
v22.0.0.1
v22.1.0.0
v23.0.0.0
v23.0.0.1
v24.1.0.1
gem5 标准库 (Stdlib)
gem5 资源 (Resources)
Ruby 概述
缓存一致性协议
Garnet 2.0
HeteroGarnet
MOESI CMP 目录
Garnet 合成流量
SLICC 语言
MI 示例
Garnet 独立运行
互连网络
MOESI Hammer
MOESI CMP Token
MESI 两级缓存
CHI 协议
替换策略
CPU 模型
GPU 模型
M5ops 指令
authors: Bobby R. Bruce
last edited: 2026-01-30 06:21:33 +0000
last edited: 2026-01-30 06:21:33 +0000
Garnet 合成流量
Garnet 合成流量提供了一个框架,用于使用受控输入模拟 Garnet 网络。这对于网络测试/调试 或使用合成流量进行纯网络模拟很有用。
Note: The garnet synthetic traffic injector only works with Garnet_standalone coherence protocol.
Related Files
configs/example/garnet_synth_traffic.py: file to invoke the network testersrc/cpu/tester/garnet_sythetic_taffic/GarnetSyntheticTraffic.*: files implementing the tester
How to run
First build gem5 with the Garnet_standalone coherence protocol. This protocol is ISA-agnostic, and hence we build it with the NULL ISA.
For gem5 <= 23.0:
scons build/NULL/gem5.debug PROTOCOL=Garnet_standalone
For gem5 >= 23.1
scons defconfig build/NULL build_opts/NULL
scons setconfig build/NULL RUBY_PROTOCOL_GARNET_STANDALONE=y
scons build/NULL/gem5.debug
Example command:
./build/NULL/gem5.debug configs/example/garnet_synth_traffic.py \
--num-cpus=16 \
--num-dirs=16 \
--network=garnet2.0 \
--topology=Mesh_XY \
--mesh-rows=4 \
--sim-cycles=1000 \
--synthetic=uniform_random \
--injectionrate=0.01
Parameterized Options
| System Configuration | Description |
|---|---|
--num-cpus |
Number of cpus. This is the number of source (injection) nodes in the network. |
--num-dirs |
Number of directories. This is the number of destination (ejection) nodes in the network. |
--network |
Network model: simple or garnet2.0. Use garnet2.0 for running synthetic traffic. |
--topology |
Topology for connecting the cpus and dirs to the network routers/switches. |
--mesh-rows |
The number of rows in the mesh. Only valid when –topology is Mesh* MeshDirCorners* |
| Network Configuration | Description |
|---|---|
--router-latency |
Default number of pipeline stages in the garnet router. Has to be >= 1. Can be over-ridden on a per router basis in the topology file. |
--link-latency |
Default latency of each link in the network. Has to be >= 1. Can be over-ridden on a per link basis in the topology file. |
--vcs-per-vnet |
Number of VCs per Virtual Network. |
--link-width-bits |
Width in bits for all links inside the garnet network. Default = 128. |
| Traffic Injection Configuration | Description |
|---|---|
--sim-cycles |
Total number of cycles for which the simulation should run. |
--synthetic |
The type of synthetic traffic to be injected. The following synthetic traffic patterns are currently supported: uniform_random, tornado, bit_complement, bit_reverse, bit_rotation, neighbor, shuffle, and transpose |
--injectionrate |
Traffic Injection Rate in packets/node/cycle. It can take any decimal value between 0 and 1. The number of digits of precision after the decimal point can be controlled by --precision which is set to 3 as default in garnet_synth_traffic.py. |
--single-sender-id |
Only inject from this sender. To send from all nodes, set to -1. |
--single-dest-id |
Only send to this destination. To send to all destinations as specified by the synthetic traffic pattern, set to -1. |
--num-packets-max |
Maximum number of packets to be injected by each cpu node. Default value is -1 (keep injecting till sim-cycles). |
--inj-vnet |
Only inject in this vnet (0, 1 or 2). 0 and 1 are 1-flit, 2 is 5-flit. Set to -1 to inject randomly in all vnets. |
Implementation of Garnet Synthetic Traffic
The synthetic traffic injector is implemente in GarnetSnytheticTraffic.cc.
The sequence of steps involved in generating and sending a packet are as
follows.
- Every cycle, each cpu performs a bernouli trial with probability equal to –injectionrate to determine whether to generate a packet or not.
- If
--num-packets-maxis non negative, each cpu stops generating new packets after generating--num-packets-maxnumber of packets. The injector terminates after--sim-cycles. - If the cpu has to generate a new packet, it computes the destination for the
new packet based on the synthetic traffic type (
--synthetic). - This destination is embedded into the bits after block offset in the packet address.
- The generated packet is randomly tagged as a
ReadReq, or anINST_FETCH, or aWriteReq, and sent to the Ruby Port (src/mem/ruby/system/RubyPort.hh/cc). - The Ruby Port converts the packet into a
RubyRequestType:LD,RubyRequestType:IFETCH, andRubyRequestType:ST, respectively, and sends it to the Sequencer, which in turn sends it to the Garnet_standalone cache controller. - The cache controller extracts the destination directory from the packet address.
- The cache controller injects the
LD,IFETCHandSTinto virtual networks 0, 1 and 2 respectively. LDandIFETCHare injected as control packets (8 bytes), whileSTis injected as a data packet (72 bytes).- The packet traverses the network and reaches the directory.
- The directory controller simply drops it.
