Coyote/scripts/comp_hls.tcl.in

77 lines
2.9 KiB
Tcl

if {[catch {
########################################################################################################
# Config
source "${CMAKE_BINARY_DIR}/base.tcl"
if {$cfg(load_apps) eq 1} {
puts "[color $clr_flow "** HLS compilation ..."]"
puts "[color $clr_flow "**"]"
# Applications:
${APPS_ALL}
for {set i 0} {$i < $cfg(n_config)} {incr i} {
for {set j 0} {$j < $cfg(n_reg)} {incr j} {
set tmp_val "[format "\$vfpga_c$i\_$j"]"
set tmp_path "[format "%s" $tmp_val]"
set cmd "[format "set tmp_path $tmp_path"]"
eval $cmd
# Compile all hls cores
if {[file isdirectory "${CMAKE_SOURCE_DIR}/$tmp_path/hls"]} {
set krnls [glob -nocomplain -tails -directory "${CMAKE_SOURCE_DIR}/$tmp_path/hls" -type d *]
foreach krnl $krnls {
# Copy all files
file mkdir "$build_dir/$project\_config_$i/user\_c$i\_$j/hdl/ext/$krnl\_hls"
set files_hdl [glob -nocomplain "${CMAKE_SOURCE_DIR}/$tmp_path/hls/$krnl/*.hpp" "${CMAKE_SOURCE_DIR}/$tmp_path/hls/$krnl/*.cpp"]
if {[llength $files_hdl]} {
file copy -force {*}$files_hdl "$build_dir/$project\_config_$i/user\_c$i\_$j/hdl/ext/$krnl\_hls"
}
# Create project
cd $build_dir/$project\_config_$i/user\_c$i\_$j/hdl/ext/$krnl\_hls
open_project "$krnl\_c$i\_$j"
open_solution "solution1"
set_part ${FPGA_PART}
if {$cfg(en_uclk) eq 1} {
create_clock -period "$cfg(uclk_p)" -name default
} else {
create_clock -period "$cfg(aclk_p)" -name default
}
# Add files
set_top "$krnl"
add_files "$build_dir/$project\_config_$i/user\_c$i\_$j/hdl/ext/$krnl\_hls/$krnl.cpp" -cflags "-std=c++11 -I $build_dir/$project\_config_$i/user\_c$i\_$j/hdl/ext/$krnl\_hls"
# Synth
csynth_design
# Sim (Uncomment for simulation)
# csim_design
# Export IP
export_design -format ip_catalog -ipname "$krnl\_c$i\_$j" -display_name "$krnl\_c$i\_$j" -description "" -vendor "user.org" -version "1.0"
file mkdir ${IPREPO_DIR}
file delete -force ${IPREPO_DIR}/$krnl\_c$i\_$j
file copy -force $krnl\_c$i\_$j/solution1/impl/ip ${IPREPO_DIR}/$krnl\_c$i\_$j/
}
}
}
}
}
########################################################################################################
} errorstring]} {
puts "[color $clr_error "** CERR: $errorstring"]"
puts "[color $clr_error "**"]"
exit 1
}
exit 0