set script_dir [file normalize [file dirname [info script]]] set project_root [file normalize [file join $script_dir ".." ".."]] set hls_root [file normalize [file join $project_root "hls_cnn"]] set build_root [file normalize [file join $hls_root "build"]] set ip_repo [file normalize [file join $hls_root "ip_repo"]] file mkdir $build_root file mkdir $ip_repo cd $build_root open_project -reset "tiny_cnn_hls" set_top tiny_cnn_accel add_files [file join $hls_root "src" "tiny_cnn_accel.cpp"] -cflags "-I[file join $hls_root include] -I[file join $hls_root src]" add_files -tb [file join $hls_root "tb" "tiny_cnn_tb.cpp"] -cflags "-I[file join $hls_root include] -I[file join $hls_root src]" open_solution -reset "solution1" set_part {xc7z020clg400-1} create_clock -period 10 -name default csim_design csynth_design # Vivado/Vitis HLS 2020.2 creates a date-based IP core_revision. On current # dates that value can exceed what the 2020.2 IP packager accepts. Keep the # generated run_ippack.tcl even if export_design fails; the Windows wrapper # patches the revision and re-runs Vivado IP packaging. set export_status [catch { export_design -format ip_catalog -rtl verilog -description "TinyCNN HLS accelerator" -vendor "xilinx.com" -library "hls" -version "1.0" -output [file join $ip_repo "tiny_cnn_accel.zip"] } export_msg] if {$export_status != 0} { puts "WARNING: export_design failed: $export_msg" set ippack_tcl [file join $build_root "tiny_cnn_hls" "solution1" "impl" "ip" "run_ippack.tcl"] if {![file exists $ippack_tcl]} { error "export_design failed before run_ippack.tcl was generated" } puts "WARNING: continuing after export_design failure; wrapper will patch and package IP" } exit