OpenXiangShan / XiangShan

Open-source high-performance RISC-V processor
https://xiangshan.cc
Other
4.84k stars 662 forks source link

make emu error #852

Closed jfan0 closed 3 years ago

jfan0 commented 3 years ago

Hi,

Thanks for this great open source CPU.

After I successfully make verilog. I tried make emu. But the error occurs, and the error info is as follows. Thank your very much for any suggestion.

Error output

Connection:[DISPLAY_LOG_ENABLE] type:[func] source location:[SimTop] sink location:[AXI4RAM_1] Connection:[logTimestamp] type:[func] source location:[SimTop] sink location:[AXI4RAM_1] Connection:[XSPERF_CLEAN] type:[func] source location:[SimTop] sink location:[L2Prefetcher] Connection:[XSPERF_DUMP] type:[func] source location:[SimTop] sink location:[L2Prefetcher] [deprecated] ListBuffer.scala:153 (5 calls): do_toBools is deprecated: "Use asBools instead" [deprecated] ListBuffer.scala:164 (5 calls): do_toBools is deprecated: "Use asBools instead" [warn] There were 2 deprecated function(s) used. These may stop compiling in a future release - you are encouraged to fix these issues. [warn] Line numbers for deprecations reported by Chisel may be inaccurate; enable scalac compiler deprecation warnings via either of the following methods: [warn] In the sbt interactive console, enter: [warn] set scalacOptions in ThisBuild ++= Seq("-unchecked", "-deprecation") [warn] or, in your build.sbt, add the line: [warn] scalacOptions := Seq("-unchecked", "-deprecation") Done elaborating. ./scripts/vlsi_mem_gen build/SimTop.v.conf --output_file build/SimTop.v.sram.v sed -i -e 's/$fatal/xs_assert(`LINE)/g' ./build/SimTop.v Sat, 26 Jun 2021 17:38:50 +0800 time -a -o ./build/time.log verilator --cc --exe --top-module SimTop +define+VERILATOR=1 +define+PRINTF_COND=1 +define+RANDOMIZE_REG_INIT +define+RANDOMIZE_MEM_INIT +define+RANDOMIZE_GARBAGE_ASSIGN +define+RANDOMIZE_DELAY=0 -Wno-STMTDLY -Wno-WIDTH -I/home/username/riscv/open_xiangshan/XiangShan/build --x-assign unique -O3 -CFLAGS "-std=c++11 -static -Wall -I/home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator -I/home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common -I/home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest -DVERILATOR -Wno-maybe-uninitialized" -LDFLAGS "-lpthread -lSDL2 -ldl -lz" --assert --stats-vars --output-split 30000 --output-split-cfuncs 30000 \ -o /home/username/riscv/open_xiangshan/XiangShan/build/emu -Mdir build/emu-compile build/SimTop.v ./src/test/vsrc/common/assert.v ./src/test/vsrc/common/difftest.v ./src/test/vsrc/common/ref.v ./src/test/vsrc/common/ram.v /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator/emu.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator/main.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator/snapshot.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/compress.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/uart.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/ram.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/common.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/axi4.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/sdcard.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/vga.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/flash.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/keyboard.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/device.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/difftest.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/goldenmem.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/ref.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/nemuproxy.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/interface.cpp Killed %Error: Command Failed /usr/bin/verilator_bin --cc --exe --top-module SimTop +define+VERILATOR\=1 +define+PRINTF_COND\=1 +define+RANDOMIZE_REG_INIT +define+RANDOMIZE_MEM_INIT +define+RANDOMIZE_GARBAGE_ASSIGN +define+RANDOMIZE_DELAY\=0 -Wno-STMTDLY -Wno-WIDTH -I/home/username/riscv/open_xiangshan/XiangShan/build --x-assign unique -O3 -CFLAGS -std\=c++11\ -static\ -Wall\ -I/home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator\ -I/home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common\ -I/home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest\ -DVERILATOR\ -Wno-maybe-uninitialized -LDFLAGS -lpthread\ -lSDL2\ -ldl\ -lz --assert --stats-vars --output-split 30000 --output-split-cfuncs 30000 -o /home/username/riscv/open_xiangshan/XiangShan/build/emu -Mdir build/emu-compile build/SimTop.v ./src/test/vsrc/common/assert.v ./src/test/vsrc/common/difftest.v ./src/test/vsrc/common/ref.v ./src/test/vsrc/common/ram.v /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator/emu.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator/main.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator/snapshot.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/compress.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/uart.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/ram.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/common.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/axi4.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/sdcard.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/vga.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/flash.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/keyboard.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/device.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/difftest.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/goldenmem.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/ref.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/nemuproxy.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/interface.cpp make: *** [verilator.mk:107: build/emu-compile/VSimTop.mk] Error 137

My environment:

$ java --version openjdk 11.0.11 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04) OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

$ mill --version Mill Build Tool version 0.9.6 Java version: 11.0.11, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: en, platform encoding: UTF-8 OS name: "Linux", version: 5.4.72-microsoft-standard-WSL2, arch: amd64

$ verilator --version Verilator 4.028 2020-02-06 rev v4.026-92-g890cecc1

$gcc --version gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

poemonsense commented 3 years ago

Is there any more error information when it crashes?

Did you ctrl-c to kill the process? I see from the log

Killed
%Error: Command Failed
jfan0 commented 3 years ago

Is there any more error information when it crashes?

Did you ctrl-c to kill the process? I see from the log

Killed
%Error: Command Failed

No more error info. And I don't kill the process manually.

Killed %Error: Command Failed

is printed automatically when it crashed.

poemonsense commented 3 years ago

Can you try a newer version of Verilator? Refer to Section Git Quick Install on https://verilator.org/guide/latest/install.html.

v4.028 was released more than one year ago. We are currently using v4.204.

jfan0 commented 3 years ago

Can you try a newer version of Verilator? Refer to Section Git Quick Install on https://verilator.org/guide/latest/install.html.

v4.028 was released more than one year ago. We are currently using v4.204.

Tried Verilator 4.204 2021-06-12 rev v4.204, same error info.

username@100013000737:~/riscv/open_xiangshan/XiangShan$ make emu time -a -o ./build/time.log verilator --cc --exe --top-module SimTop +define+VERILATOR=1 +define+PRINTF_COND=1 +define+RANDOMIZE_REG_INIT +define+RANDOMIZE_MEM_INIT +define+RANDOMIZE_GARBAGE_ASSIGN +define+RANDOMIZE_DELAY=0 -Wno-STMTDLY -Wno-WIDTH -I/home/username/riscv/open_xiangshan/XiangShan/build --x-assign unique -O3 -CFLAGS "-std=c++11 -static -Wall -I/home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator -I/home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common -I/home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest -DVERILATOR -Wno-maybe-uninitialized" -LDFLAGS "-lpthread -lSDL2 -ldl -lz" --assert --stats-vars --output-split 30000 --output-split-cfuncs 30000 \ -o /home/username/riscv/open_xiangshan/XiangShan/build/emu -Mdir build/emu-compile build/SimTop.v ./src/test/vsrc/common/assert.v ./src/test/vsrc/common/difftest.v ./src/test/vsrc/common/ref.v ./src/test/vsrc/common/ram.v /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator/emu.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator/main.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator/snapshot.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/compress.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/uart.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/ram.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/common.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/axi4.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/sdcard.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/vga.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/flash.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/keyboard.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/device.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/difftest.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/goldenmem.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/ref.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/nemuproxy.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/interface.cpp Killed %Error: Command Failed /usr/local/bin/verilator_bin --cc --exe --top-module SimTop +define+VERILATOR=1 +define+PRINTF_COND=1 +define+RANDOMIZE_REG_INIT +define+RANDOMIZE_MEM_INIT +define+RANDOMIZE_GARBAGE_ASSIGN +define+RANDOMIZE_DELAY=0 -Wno-STMTDLY -Wno-WIDTH -I/home/username/riscv/open_xiangshan/XiangShan/build --x-assign unique -O3 -CFLAGS -std=c++11\ -static\ -Wall\ -I/home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator\ -I/home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common\ -I/home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest\ -DVERILATOR\ -Wno-maybe-uninitialized -LDFLAGS -lpthread\ -lSDL2\ -ldl\ -lz --assert --stats-vars --output-split 30000 --output-split-cfuncs 30000 -o /home/username/riscv/open_xiangshan/XiangShan/build/emu -Mdir build/emu-compile build/SimTop.v ./src/test/vsrc/common/assert.v ./src/test/vsrc/common/difftest.v ./src/test/vsrc/common/ref.v ./src/test/vsrc/common/ram.v /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator/emu.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator/main.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/verilator/snapshot.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/compress.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/uart.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/ram.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/common.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/axi4.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/sdcard.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/vga.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/flash.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/keyboard.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/common/device.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/difftest.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/goldenmem.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/ref.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/nemuproxy.cpp /home/username/riscv/open_xiangshan/XiangShan/src/test/csrc/difftest/interface.cpp make: *** [verilator.mk:107: build/emu-compile/VSimTop.mk] Error 137

poemonsense commented 3 years ago

What's the configurations of your machine? For example, cpu, memory, storage?

jfan0 commented 3 years ago

It's a laptop, WSL on Windows 10, Ubuntu 20.04.2 LTS, Intel Core i7-8565U @ 1.8GHz, 16.0 GB memory , 512GB SSD. make verilog succeed. make emu failed, and error info is here.

jfan0 commented 3 years ago

Tried on another machine: A cloud server, CentOS 8.2, 16.0 GB memory, 50GB SSD.

make verilog succeed with export _JAVA_OPTIONS='-XX:-UseGCOverheadLimit -Xms256m -Xmx11g -Xss256K'. make emu still error.

My environment

[user@VM-0-17-centos XiangShan]# verilator --version
Verilator 4.204 2021-06-12 rev v4.204

[user@VM-0-17-centos XiangShan]# java -version
openjdk version "11.0.11" 2021-04-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.11+9-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.11+9-LTS, mixed mode, sharing)

[user@VM-0-17-centos XiangShan]# g++ --version
g++ (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[user@VM-0-17-centos XiangShan]# mill --version
Mill Build Tool version 0.9.8
Java version: 1.8.0_292, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-1.el8_4.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "Linux", version: 4.18.0-193.28.1.el8_2.x86_64, arch: amd64

Error output of make emu. Keyinfo is Error: Verilator threw signal 9. Suggest trying --debug --gdbbt. And I found https://github.com/chipsalliance/rocket-chip/issues/780, but I use the Verilator version 4.204 recommended by @poemonsense , so seems not problem with Verilator version.

[user@VM-0-17-centos XiangShan]# make emu Sat, 10 Jul 2021 21:13:37 +0800 time -a -o ./build/time.log verilator --cc --exe --top-module SimTop +define+VERILATOR=1 +define+PRINTF_COND=1 +define+RANDOMIZE_REG_INIT +define+RAN DOMIZE_MEM_INIT +define+RANDOMIZE_GARBAGE_ASSIGN +define+RANDOMIZE_DELAY=0 -Wno-STMTDLY -Wno-WIDTH -I/user/riscv/OpenXiangShan/XiangShan/build --x-as sign unique -O3 -CFLAGS "-std=c++11 -static -Wall -I/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/verilator -I/user/riscv/OpenXiangShan/XiangShan /src/test/csrc/common -I/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest -DVERILATOR -Wno-maybe-uninitialized -DNUM_CORES=1" -LDFLAGS "-lpt hread -lSDL2 -ldl -lz" --assert --stats-vars --output-split 30000 --output-split-cfuncs 30000 \ -o /user/riscv/OpenXiangShan/XiangShan/build/emu -Mdir build/emu-compile build/SimTop.v ./src/test/vsrc/common/ref.v ./src/test/vsrc/common/a ssert.v ./src/test/vsrc/common/difftest.v ./src/test/vsrc/common/ram.v /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/verilator/emu.cpp /user/risc v/OpenXiangShan/XiangShan/src/test/csrc/verilator/snapshot.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/verilator/main.cpp /user/riscv/OpenX iangShan/XiangShan/src/test/csrc/common/sdcard.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/uart.cpp /user/riscv/OpenXiangShan/XiangS han/src/test/csrc/common/axi4.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/vga.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/ common/keyboard.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/device.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/ram. cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/common.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/flash.cpp /user/risc v/OpenXiangShan/XiangShan/src/test/csrc/common/compress.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/goldenmem.cpp /user/riscv/Open XiangShan/XiangShan/src/test/csrc/difftest/interface.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/nemuproxy.cpp /user/riscv/OpenXia ngShan/XiangShan/src/test/csrc/difftest/ref.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/difftest.cpp %Error: Verilator threw signal 9. Suggest trying --debug --gdbbt %Error: Command Failed /usr/local/bin/verilator_bin --cc --exe --top-module SimTop +define+VERILATOR=1 +define+PRINTF_COND=1 +define+RANDOMIZE_REG_IN IT +define+RANDOMIZE_MEM_INIT +define+RANDOMIZE_GARBAGE_ASSIGN +define+RANDOMIZE_DELAY=0 -Wno-STMTDLY -Wno-WIDTH -I/user/riscv/OpenXiangShan/XiangSha n/build --x-assign unique -O3 -CFLAGS -std=c++11\ -static\ -Wall\ -I/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/verilator\ -I/user/riscv/OpenXi angShan/XiangShan/src/test/csrc/common\ -I/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest\ -DVERILATOR\ -Wno-maybe-uninitialized\ -DNUM_CO RES=1 -LDFLAGS -lpthread\ -lSDL2\ -ldl\ -lz --assert --stats-vars --output-split 30000 --output-split-cfuncs 30000 -o /user/riscv/OpenXiangShan/Xiang Shan/build/emu -Mdir build/emu-compile build/SimTop.v ./src/test/vsrc/common/ref.v ./src/test/vsrc/common/assert.v ./src/test/vsrc/common/difftest.v ./src/test/vsrc/common/ram.v /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/verilator/emu.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/ve rilator/snapshot.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/verilator/main.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/sd card.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/uart.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/axi4.cpp /user/ri scv/OpenXiangShan/XiangShan/src/test/csrc/common/vga.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/keyboard.cpp /user/riscv/OpenXiangS han/XiangShan/src/test/csrc/common/device.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/ram.cpp /user/riscv/OpenXiangShan/XiangShan/sr c/test/csrc/common/common.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/flash.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/co mmon/compress.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/goldenmem.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest /interface.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/nemuproxy.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/re f.cpp /user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/difftest.cpp make: *** [verilator.mk:107: build/emu-compile/VSimTop.mk] Error 255

I tried add --debug --gdbbg option to verilator, the error info is below. From No stack., it seems not enough memory fot stack? Maybe similiar to https://github.com/nvdla/hw/issues/112. Any suggestions are appreciated.

  • V3Unknown.cpp:489: unknownAll:
  • V3Ast.cpp:1123: Dumping build/emu-compile/VSimTop_025_unknown.tree
  • V3Inline.cpp:712: inlineAll:

Program terminated with signal SIGKILL, Killed. The program no longer exists. No stack. %Error: export VERILATOR_ROOT= %Error: gdb /usr/local/bin/verilator_bin_dbg --batch --quiet --return-child-result -ex "run --cc --exe --top-module SimTop +define+VERILATOR=1 +define+PRINTF_COND=1 +define+RANDOMIZE_REG_INIT +define+RANDOMIZE_MEM_INIT +define+RANDOMIZE_GARBAGE_ASSIGN +define+RANDOMIZE_DELAY=0 -Wno-STMTDLY -Wno-WIDTH -I/home/user/riscv/OpenXiangShan/XiangShan/build --x-assign unique -O3 -CFLAGS -std=c++11\ -static\ -Wall\ -I/home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/verilator\ -I/home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common\ -I/home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest\ -DVERILATOR\ -Wno-maybe-uninitialized\ -DNUM_CORES=1 -LDFLAGS -lpthread\ -lSDL2\ -ldl\ -lz --debug --gdbbt --threads 2 --threads-dpi all --assert --stats-vars --output-split 30000 --output-split-cfuncs 30000 -o /home/user/riscv/OpenXiangShan/XiangShan/build/emu -Mdir build/emu-compile build/SimTop.v ./src/test/vsrc/common/ref.v ./src/test/vsrc/common/assert.v ./src/test/vsrc/common/difftest.v ./src/test/vsrc/common/ram.v /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/verilator/emu.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/verilator/snapshot.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/verilator/main.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/sdcard.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/uart.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/axi4.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/vga.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/keyboard.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/device.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/ram.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/common.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/flash.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/compress.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/goldenmem.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/interface.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/nemuproxy.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/ref.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/difftest.cpp" -ex 'set width 0' -ex 'bt' -ex 'quit' %Error: Command Failed gdb /usr/local/bin/verilator_bin_dbg --batch --quiet --return-child-result -ex "run --cc --exe --top-module SimTop +define+VERILATOR=1 +define+PRINTF_COND=1 +define+RANDOMIZE_REG_INIT +define+RANDOMIZE_MEM_INIT +define+RANDOMIZE_GARBAGE_ASSIGN +define+RANDOMIZE_DELAY=0 -Wno-STMTDLY -Wno-WIDTH -I/home/user/riscv/OpenXiangShan/XiangShan/build --x-assign unique -O3 -CFLAGS -std=c++11\ -static\ -Wall\ -I/home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/verilator\ -I/home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common\ -I/home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest\ -DVERILATOR\ -Wno-maybe-uninitialized\ -DNUM_CORES=1 -LDFLAGS -lpthread\ -lSDL2\ -ldl\ -lz --debug --gdbbt --threads 2 --threads-dpi all --assert --stats-vars --output-split 30000 --output-split-cfuncs 30000 -o /home/user/riscv/OpenXiangShan/XiangShan/build/emu -Mdir build/emu-compile build/SimTop.v ./src/test/vsrc/common/ref.v ./src/test/vsrc/common/assert.v ./src/test/vsrc/common/difftest.v ./src/test/vsrc/common/ram.v /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/verilator/emu.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/verilator/snapshot.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/verilator/main.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/sdcard.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/uart.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/axi4.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/vga.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/keyboard.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/device.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/ram.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/common.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/flash.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/common/compress.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/goldenmem.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/interface.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/nemuproxy.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/ref.cpp /home/user/riscv/OpenXiangShan/XiangShan/src/test/csrc/difftest/difftest.cpp" -ex 'set width 0' -ex 'bt' -ex 'quit' make: *** [verilator.mk:107: build/emu-compile/VSimTop.mk] Error 255

JustLuoyu commented 3 years ago

I have a similar error : $make emu CONFIG=MinimalConfig EMU_THREADS=2 -j16 xxx %Error: Invalid Option: --threads-dpi

JustLuoyu commented 3 years ago

I have a similar error : $make emu CONFIG=MinimalConfig EMU_THREADS=2 -j16 xxx %Error: Invalid Option: --threads-dpi the version of Verilator which apt-get installed is too low. Git Quick Install solved my problem

poemonsense commented 3 years ago

Tried on another machine: A cloud server, CentOS 8.2, 16.0 GB memory, 50GB SSD.

make verilog succeed with export _JAVA_OPTIONS='-XX:-UseGCOverheadLimit -Xms256m -Xmx11g -Xss256K'. make emu still error.

My environment


[user@VM-0-17-centos XiangShan]# verilator --version
Verilator 4.204 2021-06-12 rev v4.204

It looks like 16GB memory is not enough for verilator. I just tried on our machine (i9-10850k with 128GB memory). Verilator uses 31GB memory when I pass --threads 8 --trace to it.

Sorry we didn't expect verilator requires so much memory. Can you try a larger swap size? Or using a machine with a larger memory?

jfan0 commented 3 years ago

Finally make emu CONFIG=MinimalConfig SIM_ARGS=--disable-log EMU_THREADS=2 -j1 succeed, but it took me 16 hours with the swap size set to 32GB after 8/16GB failed. (Change swap size by referring to https://net2.com/how-to-increase-swap-space-in-linux/).

By the way, I also install SDL2 to make emu, just paste the installing script below in case anyone need this.

!/bin/bash

if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" exit 1 fi cd /tmp git clone https://github.com/libsdl-org/SDL.git; cd SDL; mkdir build; cd build; ../configure make; make install; sudo ln -s /usr/local/lib/libSDL2-2.0.so.0 /usr/lib64/libSDL2-2.0.so.0

jfan0 commented 3 years ago

So, can I draw a conclusion that if I don't have a machine with great performance(maybe 64GB, i9-10850K), I can hardly explore XiangShan and make contribution?

poemonsense commented 3 years ago

So, can I draw a conclusion that if I don't have a machine with great performance(maybe 64GB, i9-10850K), I can hardly explore XiangShan and make contribution?

Thanks and you have made contributions to XiangShan by filing an issue to us, which we didn't expect to be a real issue.

We have been working on this problem. Currently the diffculty for reproducing XiangShan on personal laptops is not what we want and what we expected.

We have considered the following possibilities to allow users with their laptops to participate in XiangShan ecosystem:

If you have some ideas on how we can make this better, feel free to let us know.

BTW, there's no need to manually install the SDL lib (this lib is used in only one file and we rarely use it. Feel free to help us disable this file via some macro). Using sudo apt install libsdl2-dev to install by apt is more easier.

Also, allowing make to use more threads via -jN like -j4 helps the compilation a lot. Verilator produces hundreds of C++ files and we need to compile them all. If you have Synopsys VCS installed, it's much faster than Verilator since they work in different ways on simulation. It only takes less than 2 minutes to produce the simv though it simulates a lot slower than Verilator (hundreds of cycles per second in VCS v.s. 4K-6K cycles per second in Verilator with 8 threads).

poemonsense commented 3 years ago

@Kevo-Gabo Hi, we have updated MinimalConfig on the master branch to include only 2 ALUs and 1FMAC. Could you please have a try to see how long it takes to generate verilog and the simulator? See build/time.log for the time result after it succeeds.

jfan0 commented 3 years ago

Hi @poemonsense , thanks a lot for the update. Now, make emu CONFIG=MinimalConfig SIM_ARGS=--disable-log EMU_THREADS=2 -j8 takes about 15min.

poemonsense commented 3 years ago

Thanks!

fatalfeel commented 3 years ago

I have a similar error : $make emu CONFIG=MinimalConfig EMU_THREADS=2 -j16 xxx %Error: Invalid Option: --threads-dpi the version of Verilator which apt-get installed is too low. Git Quick Install solved my problem

%Error: Invalid Option: --threads apt remove verilator git clone --recursive https://github.com/verilator/verilator cd verilator autoconf ./configure make -j8 && make install