Files
light-petal-recognition/hls_cnn/scripts/create_hls_qcnn_vivado_project.tcl

95 lines
5.4 KiB
Tcl

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 vivado_root [file normalize [file join $hls_root "vivado"]]
set ip_repo [file normalize [file join $hls_root "build" "hls_qcnn_hls" "solution1" "impl" "ip"]]
file mkdir $vivado_root
set part_name "xc7z020clg400-1"
set project_name "hls_qcnn_pynq_z2"
create_project -force $project_name $vivado_root -part $part_name
set_property target_language Verilog [current_project]
set_property ip_repo_paths [list $ip_repo] [current_project]
update_ip_catalog
create_bd_design "hls_qcnn_bd"
create_bd_cell -type ip -vlnv xilinx.com:ip:processing_system7:5.5 processing_system7_0
apply_bd_automation -rule xilinx.com:bd_rule:processing_system7 -config {make_external "FIXED_IO, DDR" apply_board_preset "0" Master "Disable" Slave "Disable"} [get_bd_cells processing_system7_0]
set_property -dict [list \
CONFIG.PCW_USE_S_AXI_HP0 {1} \
CONFIG.PCW_USE_M_AXI_GP0 {1} \
CONFIG.PCW_FPGA0_PERIPHERAL_FREQMHZ {100.0} \
] [get_bd_cells processing_system7_0]
create_bd_cell -type ip -vlnv xilinx.com:hls:hls_qcnn_accel:1.0 hls_qcnn_accel_0
create_bd_cell -type ip -vlnv xilinx.com:ip:proc_sys_reset:5.0 rst_ps7_0_100M
create_bd_cell -type ip -vlnv xilinx.com:ip:axi_interconnect:2.1 axi_lite_interconnect_0
set_property CONFIG.NUM_MI {1} [get_bd_cells axi_lite_interconnect_0]
create_bd_cell -type ip -vlnv xilinx.com:ip:axi_interconnect:2.1 axi_mem_interconnect_0
set_property CONFIG.NUM_SI {5} [get_bd_cells axi_mem_interconnect_0]
set_property CONFIG.NUM_MI {1} [get_bd_cells axi_mem_interconnect_0]
connect_bd_net [get_bd_pins processing_system7_0/FCLK_CLK0] [get_bd_pins processing_system7_0/M_AXI_GP0_ACLK]
connect_bd_net [get_bd_pins processing_system7_0/FCLK_CLK0] [get_bd_pins processing_system7_0/S_AXI_HP0_ACLK]
connect_bd_net [get_bd_pins processing_system7_0/FCLK_CLK0] [get_bd_pins hls_qcnn_accel_0/ap_clk]
connect_bd_net [get_bd_pins processing_system7_0/FCLK_CLK0] [get_bd_pins rst_ps7_0_100M/slowest_sync_clk]
connect_bd_net [get_bd_pins processing_system7_0/FCLK_CLK0] [get_bd_pins axi_lite_interconnect_0/ACLK]
connect_bd_net [get_bd_pins processing_system7_0/FCLK_CLK0] [get_bd_pins axi_lite_interconnect_0/S00_ACLK]
connect_bd_net [get_bd_pins processing_system7_0/FCLK_CLK0] [get_bd_pins axi_lite_interconnect_0/M00_ACLK]
connect_bd_net [get_bd_pins processing_system7_0/FCLK_CLK0] [get_bd_pins axi_mem_interconnect_0/ACLK]
for {set i 0} {$i < 5} {incr i} {
connect_bd_net [get_bd_pins processing_system7_0/FCLK_CLK0] [get_bd_pins axi_mem_interconnect_0/S0${i}_ACLK]
}
connect_bd_net [get_bd_pins processing_system7_0/FCLK_CLK0] [get_bd_pins axi_mem_interconnect_0/M00_ACLK]
connect_bd_net [get_bd_pins processing_system7_0/FCLK_RESET0_N] [get_bd_pins rst_ps7_0_100M/ext_reset_in]
connect_bd_net [get_bd_pins rst_ps7_0_100M/peripheral_aresetn] [get_bd_pins hls_qcnn_accel_0/ap_rst_n]
connect_bd_net [get_bd_pins rst_ps7_0_100M/interconnect_aresetn] [get_bd_pins axi_lite_interconnect_0/ARESETN]
connect_bd_net [get_bd_pins rst_ps7_0_100M/peripheral_aresetn] [get_bd_pins axi_lite_interconnect_0/S00_ARESETN]
connect_bd_net [get_bd_pins rst_ps7_0_100M/peripheral_aresetn] [get_bd_pins axi_lite_interconnect_0/M00_ARESETN]
connect_bd_net [get_bd_pins rst_ps7_0_100M/interconnect_aresetn] [get_bd_pins axi_mem_interconnect_0/ARESETN]
for {set i 0} {$i < 5} {incr i} {
connect_bd_net [get_bd_pins rst_ps7_0_100M/peripheral_aresetn] [get_bd_pins axi_mem_interconnect_0/S0${i}_ARESETN]
}
connect_bd_net [get_bd_pins rst_ps7_0_100M/peripheral_aresetn] [get_bd_pins axi_mem_interconnect_0/M00_ARESETN]
connect_bd_intf_net [get_bd_intf_pins processing_system7_0/M_AXI_GP0] [get_bd_intf_pins axi_lite_interconnect_0/S00_AXI]
connect_bd_intf_net [get_bd_intf_pins axi_lite_interconnect_0/M00_AXI] [get_bd_intf_pins hls_qcnn_accel_0/s_axi_control]
connect_bd_intf_net [get_bd_intf_pins hls_qcnn_accel_0/m_axi_gmem0] [get_bd_intf_pins axi_mem_interconnect_0/S00_AXI]
connect_bd_intf_net [get_bd_intf_pins hls_qcnn_accel_0/m_axi_gmem1] [get_bd_intf_pins axi_mem_interconnect_0/S01_AXI]
connect_bd_intf_net [get_bd_intf_pins hls_qcnn_accel_0/m_axi_gmem2] [get_bd_intf_pins axi_mem_interconnect_0/S02_AXI]
connect_bd_intf_net [get_bd_intf_pins hls_qcnn_accel_0/m_axi_gmem3] [get_bd_intf_pins axi_mem_interconnect_0/S03_AXI]
connect_bd_intf_net [get_bd_intf_pins hls_qcnn_accel_0/m_axi_gmem4] [get_bd_intf_pins axi_mem_interconnect_0/S04_AXI]
connect_bd_intf_net [get_bd_intf_pins axi_mem_interconnect_0/M00_AXI] [get_bd_intf_pins processing_system7_0/S_AXI_HP0]
assign_bd_address
validate_bd_design
save_bd_design
make_wrapper -files [get_files [file join $vivado_root $project_name.srcs sources_1 bd hls_qcnn_bd hls_qcnn_bd.bd]] -top
add_files -norecurse [file join $vivado_root $project_name.gen sources_1 bd hls_qcnn_bd hdl hls_qcnn_bd_wrapper.v]
update_compile_order -fileset sources_1
launch_runs synth_1 -jobs 4
wait_on_run synth_1
launch_runs impl_1 -to_step write_bitstream -jobs 4
wait_on_run impl_1
set output_dir [file normalize [file join $hls_root "output"]]
file mkdir $output_dir
file copy -force [file join $vivado_root $project_name.runs impl_1 hls_qcnn_bd_wrapper.bit] [file join $output_dir hls_qcnn.bit]
file copy -force [file join $vivado_root $project_name.gen sources_1 bd hls_qcnn_bd hw_handoff hls_qcnn_bd.hwh] [file join $output_dir hls_qcnn.hwh]
exit