0

memtest.py 以这种方式工作正常:

     build/X86/gem5.opt configs/example/memtest.py 

但是当我给出参数时,它没有给出这样的选项错误:

build/X86/gem5.opt configs/example/memtest.py --cpu-type=TimingSimpleCPU
gem5 Simulator System.  http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.

gem5 compiled Jul 27 2018 14:19:35
gem5 started Sep 17 2018 15:31:03
gem5 executing on 2030044470, pid 5045
command line: build/X86/gem5.opt configs/example/memtest.py --cpu-type=TimingSimpleCPU

Usage: memtest.py [options]

memtest.py: error: no such option: --cpu-type

另一方面 se.py 和 fs.py 可以很好地使用附加参数:

build/X86/gem5.opt configs/example/se.py -c /home/prakhar/gem5/tests/test-progs/hello/bin/x86/linux/hello --cpu-type=TimingSimpleCPU 

有什么方法可以使用 --cpu-type 和 --mem-type 参数运行 memtest.py 吗?

4

2 回答 2

0

正如错误所告知的那样,没有这样的选项。

在调用时为 se.py 和 fs.py 添加了 cpu 类型

Options.addCommonOptions(parser)

您可以通过按照以下方式手动添加 cpu-type 和 mem-type

from m5.util import addToPath, fatal
addToPath('../')
from common import CpuConfig
from common import MemConfig

并将选项添加到解析器

parser = optparse.OptionParser()

# Other parser options

parser.add_option("--cpu-type", type="choice", default="AtomicSimpleCPU",
                  choices=CpuConfig.cpu_names(),
                  help = "type of cpu to run with")
parser.add_option("--mem-type", type="choice", default="DDR3_1600_8x8",
                  choices=MemConfig.mem_names(),
                  help = "type of memory to use")

然后将选项添加为options.cpu_typeoptions.mem_type。您可以查看其他示例(在 configs/example/ 中)以了解是否需要修改其他内容以符合您的意图。

于 2018-09-17T12:46:35.307 回答
0

好吧,我一直在努力解决这个问题,然后我在 gem5/configs/example/memtest.py 中找到了这一行:

system = System(physmem = SimpleMemory(),cache_line_size = block_size)

如果您想使用任何其他内存运行,即。DRAMSim2 你可以改变这条线。

system = System(physmem = DRAMSim2(),cache_line_size = block_size)

这将启用运行内存类型为 DRAMSim2 的 memtest.py。您现在可以这样:

build/X86/gem5.opt configs/example/memtest.py

另外要更改 cpu-type ypu 可以参考以下行:

if options.atomic:
    root.system.mem_mode = 'atomic'
else:
    root.system.mem_mode = 'timing'

默认 cpu-type 是定时,您可以通过在命令中添加 --atomic 将其更改为原子。

于 2018-09-18T09:54:54.197 回答