基于PYNQ-Z2重建BNN工程
基于PYNQ重建BNN工程
Github鏈接
環(huán)境:ubuntu18.04 vivado2018.3
參考步驟(源自Github的Readme)
Hardware design rebuilt
In order to rebuild the hardware designs, the repo should be cloned in a machine with installation of the Vivado Design Suite (tested with 2018.2).
Following the step-by-step instructions:
git clone https://github.com/Xilinx/BNN-PYNQ.git --recursive;
./make-hw.sh {network} {platform} {mode} where:
- network can be cnvW1A1, cnvW1A2, cnvW2A2 or lfcW1A1, lfcW1A2;
- platform can be pynqZ1-Z2 or ultra96;
- mode can be h to launch Vivado HLS synthesis, b to launch the Vivado project (needs HLS synthesis results), a to launch both;
- bitstream: contains the generated bitstream(s);
- hls-syn: contains the Vivado HLS generated RTL and IP (in the subfolder named as the target network and target platform);
- report: contains the Vivado and Vivado HLS reports;
- vivado: contains the Vivado project;
重建過程
1.下載Github上的BNN項目壓縮包到自己制定的目錄下。(或者在Ubuntu上直接git clone,但Ubuntu無梯子,經常下到一半斷了,所以建議在Windows上下好壓縮包拷貝過去)
2.解壓壓縮包至bnn文件夾下。
unzip -d /home/yourname/bnn BNN_PYNQ.zip
3.切換路徑到BNN-PYNQ-master中的network文件夾下
cd /home/yourname/bnn/BNN-PYNQ-master/bnn/src/network/
4.設置臨時的環(huán)境變量
PATH=$PATH:/opt/Xilinx/Vivado/2018.2/bin XILINX_BNN_ROOT=$XILINX_BNN_ROOT:/home/yourname/bnn/BNN-PYNQ-master/bnn/src/
5.執(zhí)行shell腳本,生成hls IP。
./make-hw.sh cnvW1A1 pynqZ1-Z2 h
問題:
-
make-hw.sh腳本中仍去git了兩個包,ubuntu無梯子也很容易失敗,建議在windows上下好兩個包放在指定路徑即可。將xilinx-tiny-cnn放在BNN-PYNQ-master/bnn/src文件夾下,將finn-hlslib放在BNN-PYNQ-master/bnn/src/library文件夾下。windows仍下不了的話我把兩個包的下載鏈接放于文章末尾。
-
執(zhí)行腳本時可以搭建工程,但csim報compiler error:*ERROR: [SIM 211-100] ‘csim_design’ failed: compilation error(s).*打開搭建好的工程發(fā)現testbench中部分庫文件找不到,報紅,但源文件沒問題,所以在hls-syn.tcl文件中直接刪除csim這一行,直接跑綜合,可以解決問題。
6.執(zhí)行shell腳本,生成vivado工程
./make-hw.sh cnvW1A1 pynqZ1-Z2 b
問題:
將下圖路徑中所有的TCL文件中的vivado版本號修改,理論上應高于2018.2。
7.重建完成
注意事項:
1.不要在Windows下重建工程。
2.打開新終端時需重新執(zhí)行步驟4,設置臨時變量。
3.重建vivado工程時,由于ps7為只讀,部分參數設置不了,導致bit流最終仍存在一定問題,若想燒寫出正確的bit流請自行對照tcl文件修改ps7核的參數。
重建項目下載鏈接
finn-hlslib
xilinx-tiny-cnn
cnvW1A1_output
cnvW1A2_output
cnvW2A2_output
lfcW1A1_output
lfcW1A2_output
總結
以上是生活随笔為你收集整理的基于PYNQ-Z2重建BNN工程的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Ultra96_v2实现交通标示识别
- 下一篇: JPA字段长度 Mysql数据库