#!/bin/bash ######################################################################## # Auto Create Vivado Project # # # # # # How to use ? # # 1.Modify internal parameters in" create_project.tcl "# # 2.Execute " source run.sh "in the terminal # # # # # # If you want to create Vivado Project by GUI # # Use "vivado -source $PATH/create_project.tcl"# # If you want to create Vivado Project by Batch mode (No GUI) # # Use "vivado -mode batch -source $PATH/create_project.tcl"# # # # # ######################################################################## PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd ../00_proj module add Vivado/2023.2.1 #vivado -source$PATH/create_project.tcl vivado -mode batch -source $PATH/create_project.tcl cd -
proc read_filelist {filename} { global GITLAB set fp [open$filename r] set lines [split [read$fp] "\n"] close$fp
foreach line $lines { if {[string match "*\${GITLAB}"$line] && ![string match "*_sim_netlist*"$line]} { set new_line [string map [list"\${GITLAB}""$GITLAB"] $line] set cmd "add_files -norecurse $new_line" eval$cmd } } }
######################################################################## # # # Set Variables # # # ######################################################################## # ---------------- 1.Set Gitlab Path ----------------------------------- set GITLAB /proj/winkiliang set source_dir /proj/winkiliang/ifpga set common_dir /proj/winkiliang/common
# ---------------- 2.Set Project Name ---------------------------------- set project_name "my_project"
# ---------------- 3.Set Top Module ------------------------------------ set top_module "VU13P_TOP"
# ---------------- 4.Set Header File ----------------------------------- set header_name "glb_header.vh"
# ---------------- 5.Set FPGA Part Name -------------------------------- set target_device "xcvu13p-flga2577-2-i"
######################################################################## # # # Auto Modify Version Data # # # ######################################################################## set tcl_path [file dirname [info script]]
# ---------------- 1.Set header file ----------------------------------- set header_file ${tcl_path}/../01_src/hdl/top/glb_header.vh # ---------------- 2.Set Match filed ----------------------------------- set match_filed "*parameter*VERSION_DATA*"
set rd_file [open$header_file r] set lines [split [read$rd_file] "\n"] set timestamp [clockformat [clock seconds] -format %m%d%H%M] close$rd_file
set wr_file [open$header_file w]
foreach line $lines { if {[string match $match_filed$line]} { puts$wr_file" parameter VERSION_DATA = 32'h${timestamp}" } else { puts$wr_file$line } } close$wr_file
######################################################################## # # # Auto Modify Version Data # # # ######################################################################## set tcl_path [file dirname [info script]]
# ---------------- 1.Set header file ----------------------------------- set header_file ${tcl_path}/../01_src/hdl/top/glb_header.vh # ---------------- 2.Set output direction ------------------------------ set output_name ~/bitstream/vu13p_$timestamp
set rd_file [open$header_file r] set timestamp ""
while {[gets$rd_file line] >= 0} { if {[regexp -nocase {VERSION_DATA\s*=\s*\d+'h([0-9a-f]+)} $line -> timestamp]} { puts$timestamp break } }
close$rd_file
#set impl_dir [get_property DIRECTORY [current_run -implementation]] set impl_dir [get_property DIRECTORY [get_runs $::env(ACTIVE_STEP_RUN)]] set bin_file [glob -nocomplain -directory $impl_dir *.bit] set ltx_file [glob -nocomplain -directory $impl_dir *.ltx]