@@ -29,20 +29,67 @@ if [ ! -d "hdl" ]; then
2929 exit 1
3030fi
3131
32- # Get required vivado version needed for HDL
33- if [ -f " hdl/library/scripts/adi_ip.tcl" ]; then
34- TARGET=" hdl/library/scripts/adi_ip.tcl"
35- else
36- TARGET=" hdl/library/scripts/adi_ip_xilinx.tcl"
32+ if [ -z " ${VIVADO} " ]; then
33+ echo " VIVADO not set, will parse HDL"
34+
35+ # Get required vivado version needed for HDL
36+ TARGET=" hdl/scripts/adi_env.tcl"
37+ # Use grep to find the line containing "set required_vivado_version"
38+ matched_line=$( grep ' set required_vivado_version' " $TARGET " )
39+
40+ # Use awk to extract the version number
41+ VIVADO=$( echo " $matched_line " | awk -F' "' ' {print $2}' )
42+
43+ # Print the extracted version number
44+ echo " Parsed Vivado Version: $VIVADO "
3745fi
38- VER=$( awk ' /set required_vivado_version/ {print $3}' $TARGET | sed ' s/"//g' )
39- echo " Required Vivado version ${VER} "
40- VIVADOFULL=${VER}
41- if [ ${# VER} = 8 ]
42- then
43- VER=${VER: 0: 6}
46+
47+ # If not of the form 20xx.x, exit
48+ if [[ ! $VIVADO =~ ^20[0-9]{2}\. [0-9]$ ]]; then
49+ echo " Vivado version not of the form 20xx.x"
50+ exit 1
4451fi
45- VIVADO=${VER}
52+
53+ # Update vivado version in MATLAB files
54+ echo " Updating toolbox files to use desired Vivado version"
55+ cd ..
56+ # Update Version.m
57+ sed -i " s/Vivado = .*/Vivado = \'${VIVADO} \';/" +adi/Version.m
58+ # Update plugin_rd
59+ sed -i " s/hRD\.SupportedToolVersion = .*/hRD\.SupportedToolVersion = {\'${VIVADO} \'};/" hdl/vendor/AnalogDevices/+AnalogDevices/plugin_rd.m
60+
61+ # Demos
62+ cd trx_examples
63+ # Update all occurances of hWC.ReferenceDesignToolVersion = '20XX.X'; to use new version
64+ FILES=$( grep -lrn . -e ' hWC.ReferenceDesignToolVersion =' )
65+ for f in $FILES ; do
66+ echo " Updating: $f "
67+ sed -i " s/hWC\.ReferenceDesignToolVersion = .*/hWC\.ReferenceDesignToolVersion = \'${VIVADO} \';/" " $f "
68+ done
69+ # Update all occurances of hRD.SupportedToolVersion = {'20XX.X'}; to use new version
70+ FILES=$( grep -lr . -e ' hRD.SupportedToolVersion =' )
71+ for f in $FILES ; do
72+ echo " Updating: $f "
73+ sed -i " s/hRD\.SupportedToolVersion = .*/hRD\.SupportedToolVersion = {\'${VIVADO} \'};/" " $f "
74+ done
75+ # Update all occurances of Vivado sourcing
76+ FILES=$( grep -lrn . -e ' source /opt/Xilinx/Vivado/20' )
77+ for f in $FILES ; do
78+ echo " Updating: $f "
79+ sed -i " s/source \/opt\/Xilinx\/Vivado\/20.*/source \/opt\/Xilinx\/Vivado\/${VIVADO} \/settings64.sh/" " $f "
80+ done
81+ cd ..
82+
83+ # Tests
84+ cd test
85+ # Update line 35 of DemoTests.m to use new version
86+ sed -i " 35s/.*/ testCase.setupVivado('${VIVADO} ');/" DemoTests.m
87+ sed -i " 47s/.*/ testCase.setupVivado('${VIVADO} ');/" DemoTests.m
88+ sed -i " 59s/.*/ testCase.setupVivado('${VIVADO} ');/" DemoTests.m
89+
90+ cd ..
91+
92+ cd CI
4693
4794# Setup
4895source /opt/Xilinx/Vivado/$VIVADO /settings64.sh
0 commit comments