Skip to content

Commit

Permalink
Merge pull request #166 from analogdevicesinc/tfcollins/adrv9001-sync-ip
Browse files Browse the repository at this point in the history
Tfcollins/adrv9001 sync ip
  • Loading branch information
tfcollins authored Jan 17, 2024
2 parents f5089b4 + 770477e commit cbcde79
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 25 deletions.
81 changes: 67 additions & 14 deletions CI/scripts/build_bsp.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -x
set -xe

if [ -z "${HDLBRANCH}" ]; then
HDLBRANCH='hdl_2021_r2'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions CI/scripts/matlab_processors.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 2 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dockerHost = 'docker'

////////////////////////////

hdlBranches = ['master','hdl_2021_r2']
hdlBranches = ['main','hdl_2021_r2']

stage("Build Toolbox") {
dockerParallelBuild(hdlBranches, dockerHost, dockerConfig) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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')
}
}
}

1 change: 1 addition & 0 deletions hdl/vendor/AnalogDevices/+AnalogDevices/plugin_rd.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
fullfile('projects')...
fullfile('library')...
fullfile('scripts')...
fullfile('quiet.mk')...
};

if strcmpi(project, 'adrv9002')
Expand Down

0 comments on commit cbcde79

Please sign in to comment.