欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

gem5中正确使用缓存的方法

程序员文章站 2022-06-03 22:46:04
...

本节博客参考官网和人间之清欢的博客

开始以为自己指定了缓存的大小,命令如下

build/X86/gem5.opt configs/example/se.py --cmd=tests/test-progs/hello/bin/x86/linux/hello --cpu-type=TimingSimpleCPU --l1d_size=64kB --l1i_size=16kB

然后grep一下发现结果是这样的

cache_line_size=64
dcache_port=system.membus.slave[2]
icache_port=system.membus.slave[1]
slave=system.system_port system.cpu.icache_port system.cpu.dcache_port system.cpu.itb.walker.port system.cpu.dtb.walker.port system.cpu.interrupts.int_master

然后指定–cache

build/X86/gem5.opt configs/example/se.py --cmd=tests/test-progs/hello/bin/x86/linux/hello --cpu-type=TimingSimpleCPU --l1d_size=64kB --l1i_size=16kB --caches

现在cache是这样的

cache_line_size=64
children=dcache dtb dtb_walker_cache icache interrupts isa itb itb_walker_cache tracer workload
dcache_port=system.cpu.dcache.cpu_side
icache_port=system.cpu.icache.cpu_side
[system.cpu.dcache]
type=Cache
replacement_policy=system.cpu.dcache.replacement_policy
tags=system.cpu.dcache.tags
cpu_side=system.cpu.dcache_port
[system.cpu.dcache.replacement_policy]
[system.cpu.dcache.tags]
indexing_policy=system.cpu.dcache.tags.indexing_policy
replacement_policy=system.cpu.dcache.replacement_policy
[system.cpu.dcache.tags.indexing_policy]
port=system.cpu.dtb_walker_cache.cpu_side
[system.cpu.dtb_walker_cache]
type=Cache
replacement_policy=system.cpu.dtb_walker_cache.replacement_policy
tags=system.cpu.dtb_walker_cache.tags
[system.cpu.dtb_walker_cache.replacement_policy]
[system.cpu.dtb_walker_cache.tags]
indexing_policy=system.cpu.dtb_walker_cache.tags.indexing_policy
replacement_policy=system.cpu.dtb_walker_cache.replacement_policy
[system.cpu.dtb_walker_cache.tags.indexing_policy]
[system.cpu.icache]
type=Cache
replacement_policy=system.cpu.icache.replacement_policy
tags=system.cpu.icache.tags
cpu_side=system.cpu.icache_port
[system.cpu.icache.replacement_policy]
[system.cpu.icache.tags]
indexing_policy=system.cpu.icache.tags.indexing_policy
replacement_policy=system.cpu.icache.replacement_policy
[system.cpu.icache.tags.indexing_policy]
port=system.cpu.itb_walker_cache.cpu_side
[system.cpu.itb_walker_cache]
type=Cache
replacement_policy=system.cpu.itb_walker_cache.replacement_policy
tags=system.cpu.itb_walker_cache.tags
[system.cpu.itb_walker_cache.replacement_policy]
[system.cpu.itb_walker_cache.tags]
indexing_policy=system.cpu.itb_walker_cache.tags.indexing_policy
replacement_policy=system.cpu.itb_walker_cache.replacement_policy
[system.cpu.itb_walker_cache.tags.indexing_policy]
slave=system.system_port system.cpu.icache.mem_side system.cpu.dcache.mem_side system.cpu.itb_walker_cache.mem_side system.cpu.dtb_walker_cache.mem_side system.cpu.interrupts.int_master

只要你用了cache正常情况下结果都特别长

源代码分析

parser.add_option("--caches", action="store_true")
相关标签: 内存