diff --git a/CI/scripts/build_bsp.sh b/CI/scripts/build_bsp.sh index 10b4de2d..62fe78da 100644 --- a/CI/scripts/build_bsp.sh +++ b/CI/scripts/build_bsp.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -x +set -xe if [ -z "${HDLBRANCH}" ]; then HDLBRANCH='hdl_2021_r2' @@ -29,23 +29,70 @@ if [ ! -d "hdl" ]; then exit 1 fi -# Get required vivado version needed for HDL -if [ -f "hdl/library/scripts/adi_ip.tcl" ]; then - TARGET="hdl/library/scripts/adi_ip.tcl" -else - TARGET="hdl/library/scripts/adi_ip_xilinx.tcl" +if [ -z "${VIVADO}" ]; then + echo "VIVADO not set, will parse HDL" + + # Get required vivado version needed for HDL + TARGET="hdl/scripts/adi_env.tcl" + # Use grep to find the line containing "set required_vivado_version" + matched_line=$(grep 'set required_vivado_version' "$TARGET") + + # Use awk to extract the version number + VIVADO=$(echo "$matched_line" | awk -F'"' '{print $2}') + + # Print the extracted version number + echo "Parsed Vivado Version: $VIVADO" fi -VER=$(awk '/set required_vivado_version/ {print $3}' $TARGET | sed 's/"//g') -echo "Required Vivado version ${VER}" -VIVADOFULL=${VER} -if [ ${#VER} = 8 ] -then -VER=${VER:0:6} + +# If not of the form 20xx.x, exit +if [[ ! $VIVADO =~ ^20[0-9]{2}\.[0-9]$ ]]; then + echo "Vivado version not of the form 20xx.x" + exit 1 fi -VIVADO=${VER} + +# Update vivado version in MATLAB files +echo "Updating toolbox files to use desired Vivado version" +cd .. +# Update Version.m +sed -i "s/Vivado = .*/Vivado = \'${VIVADO}\';/" +adi/Version.m +# Update plugin_rd +sed -i "s/hRD\.SupportedToolVersion = .*/hRD\.SupportedToolVersion = {\'${VIVADO}\'};/" hdl/vendor/AnalogDevices/+AnalogDevices/plugin_rd.m + +# Demos +cd trx_examples +# Update all occurances of hWC.ReferenceDesignToolVersion = '20XX.X'; to use new version +FILES=$(grep -lrn . -e 'hWC.ReferenceDesignToolVersion =') +for f in $FILES; do + echo "Updating: $f" + sed -i "s/hWC\.ReferenceDesignToolVersion = .*/hWC\.ReferenceDesignToolVersion = \'${VIVADO}\';/" "$f" +done +# Update all occurances of hRD.SupportedToolVersion = {'20XX.X'}; to use new version +FILES=$(grep -lr . -e 'hRD.SupportedToolVersion =') +for f in $FILES; do + echo "Updating: $f" + sed -i "s/hRD\.SupportedToolVersion = .*/hRD\.SupportedToolVersion = {\'${VIVADO}\'};/" "$f" +done +# Update all occurances of Vivado sourcing +FILES=$(grep -lrn . -e 'source /opt/Xilinx/Vivado/20') +for f in $FILES; do + echo "Updating: $f" + sed -i "s/source \/opt\/Xilinx\/Vivado\/20.*/source \/opt\/Xilinx\/Vivado\/${VIVADO}\/settings64.sh/" "$f" +done +cd .. + +# Tests +cd test +# Update line 35 of DemoTests.m to use new version +sed -i "35s/.*/ testCase.setupVivado('${VIVADO}');/" DemoTests.m +sed -i "47s/.*/ testCase.setupVivado('${VIVADO}');/" DemoTests.m +sed -i "59s/.*/ testCase.setupVivado('${VIVADO}');/" DemoTests.m + +cd .. + +cd CI # Setup -source /opt/Xilinx/Vivado/$VIVADO/settings64.sh +# source /opt/Xilinx/Vivado/$VIVADO/settings64.sh # Pre-build IP library # cd hdl/library @@ -78,6 +125,12 @@ sed -i 's/16.27/30/' hdl/projects/pluto/system_constr.xdc # update .mk to .prj in zc706_plddr3_dacfifo_bd.tcl sed -i 's/.mk/.prj/' hdl/projects/common/zc706/zc706_plddr3_dacfifo_bd.tcl sed -i '10i file copy -force $ad_hdl_dir/projects/common/zc706/zc706_plddr3_mig.mk $ad_hdl_dir/projects/common/zc706/zc706_plddr3_mig.prj' hdl/projects/common/zc706/zc706_plddr3_dacfifo_bd.tcl +# Update ADRV9001 design to include util_sync as dependent IP +sed -i '23i # Custom Sync IP' hdl/projects/adrv9001/zcu102/Makefile +sed -i '24i LIB_DEPS += util_sync/util_delay' hdl/projects/adrv9001/zcu102/Makefile +sed -i '25i LIB_DEPS += util_sync/sync_fast_to_slow' hdl/projects/adrv9001/zcu102/Makefile +sed -i '26i LIB_DEPS += util_sync/sync_slow_to_fast' hdl/projects/adrv9001/zcu102/Makefile + mv hdl $TARGET # Post-process ports.json diff --git a/CI/scripts/library/util_sync/sync_delay/Makefile b/CI/scripts/library/util_sync/util_delay/Makefile similarity index 100% rename from CI/scripts/library/util_sync/sync_delay/Makefile rename to CI/scripts/library/util_sync/util_delay/Makefile diff --git a/CI/scripts/library/util_sync/sync_delay/util_delay.v b/CI/scripts/library/util_sync/util_delay/util_delay.v similarity index 100% rename from CI/scripts/library/util_sync/sync_delay/util_delay.v rename to CI/scripts/library/util_sync/util_delay/util_delay.v diff --git a/CI/scripts/library/util_sync/sync_delay/util_delay_ip.tcl b/CI/scripts/library/util_sync/util_delay/util_delay_ip.tcl similarity index 100% rename from CI/scripts/library/util_sync/sync_delay/util_delay_ip.tcl rename to CI/scripts/library/util_sync/util_delay/util_delay_ip.tcl diff --git a/CI/scripts/matlab_processors.tcl b/CI/scripts/matlab_processors.tcl index 2d4eb4e4..8c756d5c 100644 --- a/CI/scripts/matlab_processors.tcl +++ b/CI/scripts/matlab_processors.tcl @@ -229,10 +229,10 @@ proc data_synchronizer {rxtx number_of_inputs number_of_bits number_of_valids mu } if {$rxtx == "rxtx" || $rxtx == "txrx"} { # build synchronizer IPs - exec cp ../../../../../hdl/vendor/AnalogDevices/vivado/quiet.mk ../../../. - exec make -C ../../../library/util_sync/sync_delay - exec make -C ../../../library/util_sync/sync_fast_to_slow - exec make -C ../../../library/util_sync/sync_slow_to_fast + #exec cp ../../../../../hdl/vendor/AnalogDevices/vivado/quiet.mk ../../../. + #exec make -C ../../../library/util_sync/sync_delay + #exec make -C ../../../library/util_sync/sync_fast_to_slow + #exec make -C ../../../library/util_sync/sync_slow_to_fast update_ip_catalog -rebuild ### synchronize the input diff --git a/Jenkinsfile b/Jenkinsfile index b540ce92..ee4c9983 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,7 @@ dockerHost = 'docker' //////////////////////////// -hdlBranches = ['master','hdl_2021_r2'] +hdlBranches = ['main','hdl_2021_r2'] stage("Build Toolbox") { dockerParallelBuild(hdlBranches, dockerHost, dockerConfig) { @@ -70,6 +70,7 @@ cstage("HDL Tests", "", flags) { */ cstage("Installer", branchName, flags) { unstash "builtSources" + sh 'rm -rf hdl' sh 'make -C ./CI/scripts test_installer' junit testResults: 'test/*.xml', allowEmptyResults: true archiveArtifacts artifacts: 'test/logs/*', followSymlinks: false, allowEmptyArchive: true @@ -151,11 +152,5 @@ node('baremetal || lab_b5') { unstash "builtSources" uploadArtifactory('TransceiverToolbox','*.mltbx') } - if (env.BRANCH_NAME == 'master') { - cstage('Deploy Production', "", flags) { - unstash "builtSources" - uploadFTP('TransceiverToolbox','*.mltbx') - } - } } diff --git a/hdl/vendor/AnalogDevices/+AnalogDevices/plugin_rd.m b/hdl/vendor/AnalogDevices/+AnalogDevices/plugin_rd.m index 9d8cb3af..cb4a24f9 100644 --- a/hdl/vendor/AnalogDevices/+AnalogDevices/plugin_rd.m +++ b/hdl/vendor/AnalogDevices/+AnalogDevices/plugin_rd.m @@ -102,6 +102,7 @@ fullfile('projects')... fullfile('library')... fullfile('scripts')... + fullfile('quiet.mk')... }; if strcmpi(project, 'adrv9002')