我尝试按照github上的说明测试 RISC-V Rocket-Chip 周期准确的 C++ 仿真器,但出现如下所示的错误。
g++ -O1 -std=c++11 -I/home/iorivur/src/scala/riscv/toolchain/include -I/home/iorivur/src/test/rocket-chip/csrc -I/home/iorivur/src/test/rocket-chip/dramsim2 -o emulator-D
efaultCPPConfig emulator.o mm.o mm_dramsim2.o Top.DefaultCPPConfig.o -L/home/iorivur/src/scala/riscv/toolchain/lib -Wl,-rpath,/home/iorivur/src/scala/riscv/toolchain/lib
-L. -ldramsim -lfesvr -lpthread
./emulator-DefaultCPPConfig +dramsim +max-cycles=100000000 +verbose +loadmem=output/rv64ui-p-add.hex none 2> output/rv64ui-p-add.out && [ $PIPESTATUS -eq 0 ]
./emulator-DefaultCPPConfig +dramsim +max-cycles=100000000 +verbose +loadmem=output/rv64ui-p-addi.hex none 2> output/rv64ui-p-addi.out && [ $PIPESTATUS -eq 0 ]
./emulator-DefaultCPPConfig +dramsim +max-cycles=100000000 +verbose +loadmem=output/rv64ui-p-amoadd_d.hex none 2> output/rv64ui-p-amoadd_d.out && [ $PIPESTATUS -eq 0 ]
./emulator-DefaultCPPConfig +dramsim +max-cycles=100000000 +verbose +loadmem=output/rv64ui-p-amoadd_w.hex none 2> output/rv64ui-p-amoadd_w.out && [ $PIPESTATUS -eq 0 ]
./emulator-DefaultCPPConfig +dramsim +max-cycles=100000000 +verbose +loadmem=output/rv64ui-p-amoand_d.hex none 2> output/rv64ui-p-amoand_d.out && [ $PIPESTATUS -eq 0 ]
/bin/sh: line 1: 11307 Aborted (core dumped) ./emulator-DefaultCPPConfig +dramsim +max-cycles=100000000 +verbose +loadmem=output/rv64ui-p-amoadd_w.hex non
e 2> output/rv64ui-p-amoadd_w.out
/bin/sh: line 1: 11304 Aborted (core dumped) ./emulator-DefaultCPPConfig +dramsim +max-cycles=100000000 +verbose +loadmem=output/rv64ui-p-addi.hex none 2>
output/rv64ui-p-addi.out
/bin/sh: line 1: 11305 Aborted (core dumped) ./emulator-DefaultCPPConfig +dramsim +max-cycles=100000000 +verbose +loadmem=output/rv64ui-p-add.hex none 2>
output/rv64ui-p-add.out
Makefile:71: recipe for target 'output/rv64ui-p-addi.out' failed
make: *** [output/rv64ui-p-addi.out] Error 134
make: *** Waiting for unfinished jobs....
Makefile:71: recipe for target 'output/rv64ui-p-add.out' failed
make: *** [output/rv64ui-p-add.out] Error 134
Makefile:71: recipe for target 'output/rv64ui-p-amoadd_w.out' failed
make: *** [output/rv64ui-p-amoadd_w.out] Error 134
/bin/sh: line 1: 11311 Aborted (core dumped) ./emulator-DefaultCPPConfig +dramsim +max-cycles=100000000 +verbose +loadmem=output/rv64ui-p-amoand_d.hex non
e 2> output/rv64ui-p-amoand_d.out
Makefile:71: recipe for target 'output/rv64ui-p-amoand_d.out' failed
make: *** [output/rv64ui-p-amoand_d.out] Error 134
/bin/sh: line 1: 11306 Aborted (core dumped) ./emulator-DefaultCPPConfig +dramsim +max-cycles=100000000 +verbose +loadmem=output/rv64ui-p-amoadd_d.hex non
e 2> output/rv64ui-p-amoadd_d.out
Makefile:71: recipe for target 'output/rv64ui-p-amoadd_d.out' failed
make: *** [output/rv64ui-p-amoadd_d.out] Error 134
“output/rv64ui-p-amoadd_w.out”的内容是:
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
我发现程序在mm_t
初始化时发疯了。
这段代码会占用 4GB 内存,如果失败,程序会突然死掉。