Spinal-sim Verilator install on Windows

Spinal-sim Verilator install on Windows

Verilator install on Windows

Step1 : install MSYS32

到官网https://www.msys2.org/ 下载最近安装文件 msys2-x86_64-20190524.exe

运行安装到d:/msys64,安装完毕后打开 mingw64.exe

在命令行输入 pacman -Suyy

如果遇到以下异常

1
2
3
4
5
# pacman -Syuu
错误:无法初始化事务处理 (无法锁定数据库)
错误:无法锁定数据库:File exists
如果你确认软件包管理器没有在运行,
你可以删除 /var/lib/pacman/db.lck。

解决办法,删掉之前的文件: /var/lib/pacman/db.lck
出现错误的原因是,之前同步的时候,由于异常中断,导致之前进程锁文件未被释放。

Step2 Change mirrors for China user

如果更新库很慢导致失败

1
2
3
4
5
6
7
# pacman -Syuu
:: 正在同步软件包数据库...
错误:无法从 repo.msys2.org : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'mingw32.db'] 49%
错误:无法从 sourceforge.net : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'mingw32.db' 3%
错误:无法从 www2.futureware.at : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'mingw32.db'7%
错误:无法从 mirror.yandex.ru : Operation too slow. Less than 1 bytes/sec transferred the last 10 seconds 获取文件 'mingw32.db' 10%
错误:无法升级 mingw32 (下载数据库出错)

请更新 清华镜像

编辑 /etc/pacman.d/mirrorlist.mingw32 ,在文件开头添加:

1
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686

编辑 /etc/pacman.d/mirrorlist.mingw64 ,在文件开头添加:

1
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64

编辑 /etc/pacman.d/mirrorlist.msys ,在文件开头添加:

1
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch

然后执行 pacman -Sy 刷新软件包数据即可。

Step3: Install Verilator

1
2
3
4
5
6
pacman -Syuu
#Close the MSYS2 shell once you're asked to
pacman -Syuu
pacman -S --needed base-devel mingw-w64-x86_64-toolchain \
git flex\
mingw-w64-x86_64-cmake
1
pacman -S mingw-w64-x86_64-verilator

Step4: Add to ENV

Add D:\msys64\usr\bin;D:\msys64\mingw64\bin to you windows PATH

Step4: Spinal simulation by verialtor

1
2
3
4
5
6
7
8
9
10
11
12
[Progress] Verilator compilation started
VDFT2Cell.mk:67: /mingw64/share/verilator/include/verilated.mk: No such file or directory
make: *** No rule to make target '/mingw64/share/verilator/include/verilated.mk'. Stop.
Exception in thread "main" java.lang.AssertionError: assertion failed: Verilator C++ model compilation failed
at scala.Predef$.assert(Predef.scala:170)
at spinal.sim.VerilatorBackend.compileVerilator(VerilatorBackend.scala:376)
at spinal.sim.VerilatorBackend.<init>(VerilatorBackend.scala:429)
at spinal.core.sim.SpinalVerilatorBackend$.apply(SimBootstraps.scala:120)
at spinal.core.sim.SpinalSimConfig.compile(SimBootstraps.scala:400)
at spinal.core.sim.SpinalSimConfig.compile(SimBootstraps.scala:364)
at FFT.DFT2CellTest$.main(FFTsim.scala:27)
at FFT.DFT2CellTest.main(FFTsim.scala)

显示verilated.mk路径找不到,我忍为应该是VERILATOR_ROOT目录设置有误, 查找verilated.mk的目录所在地,
然后在windows Env 中添加系统变量 VERILATOR_ROOT= /d/msys64/mingw64/share/verilator

任然遇到问题

1
2
3
4
5
6
7
8
9
x86_64-w64-mingw32-g++.exe: error: /d/msys64/mingw64/share/verilator/include/verilated.cpp: No such file or directory
x86_64-w64-mingw32-g++.exe: fatal error: no input files
compilation terminated.
make: *** [/d/msys64/mingw64/share/verilator/include/verilated.mk:192: verilated.o] Error 1
make: *** Waiting for unfinished jobs....
x86_64-w64-mingw32-g++.exe: error: /d/msys64/mingw64/share/verilator/include/verilated_vcd_c.cpp: No such file or directory
x86_64-w64-mingw32-g++.exe: fatal error: no input files
compilation terminated.
Exception in thread "main" java.lang.AssertionError: assertion failed: Verilator C++ model compilation failed

x86_64-w64-mingw32-g++.exe 不能访问/d/myss64/….,后来重新安装MSYS2到 C盘,并且将系统变量删除 VERILATOR_ROOT

任然遇到问题:
检查环境变量Paht的值为C:\Users\Administrator\.babun\cygwin\bin;D:\Program\emacs-26.2\bin;C:\Users\Administrator\.babun;C:\Users\Administrator\AppData\Roaming\npm;%IntelliJ IDEA Community Edition%;C:\Users\Administrator\AppData\Local\Pandoc\;c:\msys64\usr\bin\;c:\msys64\mingw64\bin\ 发现很乱 ,删除一些不用的
D:\Program\emacs-26.2\bin;C:\Users\Administrator\.babun;C:\Users\Administrator\AppData\Local\Pandoc\;c:\msys64\usr\bin\;c:\msys64\mingw64\bin\;
更新PATH

重新开启Project , 运行Spinal-sim ,Wow 居然成了, 非常痛苦, 饶了一大圈,居然是PATH变量的问题。总算是解决了

最后:

特别注意:

尽量把MSYS2安装到C盘 在环境变量Path末尾追加C:\msys64\usr\bin;C:\msys64\mingw64\bin

不要多此一举设置VERILATOR_ROOT, Spinal会默认识别到 /mingw64/share/verilator

如果运行不成功,请检查你的PATH,设置是不是非常杂乱,请删除不用的,尽量保持干净。

评论