Vivado HLSについて再入門しようと思っている。 最近は環境をVirtual BoxからWindows Subsystem on Linux(WSL)に変更したので、その環境下でVivado HLSが動くようにしておきたい。
私が使うのは、基本的にGUIは立ち上げずにスクリプトだけで処理を行いたい。 そのため、これまでに作ったスクリプトがちゃんとWSL上のVivado HLSで動作するのかを確認しておいた。
使用したのは、昔作ったedge_filterのデザインだ。
実行してみると、どうもincludeファイルが読み込めずに失敗してしまう。
fpga_designs/vivado_hls/edge_filter/test_edge_filter.cpp
#include <stdio.h> #include <stdint.h> #include "./edge_filter.h"
コンパイルすると以下のようにエラーが発生する。
make
INFO: [HLS 200-10] Setting target device to 'xc7z020clg484-1' INFO: [SIM 211-2] *************** CSIM start *************** INFO: [SIM 211-4] CSIM will launch GCC as the compiler. make[1]: Entering directory '/home/msyksphinz/work/fpga_designs/vivado_hls/edge_filter/edge_filter/normal/csim/build' Compiling ../../../../test_edge_filter.cpp in debug mode csim.mk:77: recipe for target 'obj/test_edge_filter.o' failed make[1]: Leaving directory '/home/msyksphinz/work/fpga_designs/vivado_hls/edge_filter/edge_filter/normal/csim/build' In file included from ../../../../test_edge_filter.cpp:1:0: /usr/include/stdio.h:27:36: fatal error: bits/libc-header-start.h: No such file or directory #include <bits/libc-header-start.h> ^ compilation terminated. make[1]: *** [obj/test_edge_filter.o] Error 1
SDAccelなどのQ&Aを調査していると、どうもいろいろパッケージをインストールしなければならない様だ。
sudo apt-get install gcc-multilib g++-multilib
上記のパッケージをインストールすると、次に以下のエラーが発生する。
INFO: [SIM 211-2] *************** CSIM start *************** INFO: [SIM 211-4] CSIM will launch GCC as the compiler. make[1]: Entering directory '/home/msyksphinz/work/fpga_designs/vivado_hls/edge_filter/edge_filter/normal/csim/build' Compiling ../../../../test_edge_filter.cpp in debug mode Compiling ../../../../edge_filter.cpp in debug mode Generating csim.exe Makefile.rules:399: recipe for target 'csim.exe' failed make[1]: Leaving directory '/home/msyksphinz/work/fpga_designs/vivado_hls/edge_filter/edge_filter/normal/csim/build' /tools/Xilinx/Vivado/2018.3/tps/lnx64/binutils-2.26/bin/ld: cannot find crt1.o: No such file or directory /tools/Xilinx/Vivado/2018.3/tps/lnx64/binutils-2.26/bin/ld: cannot find crti.o: No such file or directory /tools/Xilinx/Vivado/2018.3/tps/lnx64/binutils-2.26/bin/ld: cannot find -lpthread /tools/Xilinx/Vivado/2018.3/tps/lnx64/binutils-2.26/bin/ld: cannot find -lm collect2: error: ld returned 1 exit status make[1]: *** [csim.exe] Error 1
今度はcrtが存在しないと怒られてしまった。これはどうしたらいいんだ?
SDAccelのQ&Aを見ていると、以下のようにシンボリックリンクを張れば良いらしい。
sudo ln -s /usr/lib/x86_64-linux-gnu /usr/lib64
これで動作するようになった。無事にシミュレーションとVerilogの生成に成功した。