Skip to content
Snippets Groups Projects
Commit 0806022c authored by Pascal Grafe's avatar Pascal Grafe
Browse files

Initial

parents
Branches main
No related tags found
No related merge requests found
# Readme
Replaces IP versions and removes the the version check in Vivado block design.
The block design must be exported as a tcl script. Run `upgrade_design_to_current_vivado_version.sh` with the name of the tcl script of the block design to adapt it to the Vivado version currently in your path.
## Warnings
* Use with care!
* Tested on Linux only
* There is no guarantee the updated script still works.
* The tcl script is replaced. Make a backup.
\ No newline at end of file
#!/usr/bin/env bash
set -e
if [ $# -ne 1 ]; then
echo "Usage $(basename $0) <system.tcl file>" >&2
exit 1
fi
# create temporary files
new_design_tcl=$(mktemp XXXXXXXXXXXXXXXXXX.tcl)
remove_vivado_version_check=$(mktemp XXXXXXXXXX.awk)
get_ips=$(mktemp XXXXXXXXXX.tcl)
all_ips=$(mktemp XXXXXXXXXX.txt)
# awk script to remove version check
cat >> $remove_vivado_version_check <<EOF
/if .* .scripts_vivado_version .current_vivado_version.* == -1.*/ {
in_block = 1
}
{
if (!in_block) {
print \$0
}
}
/return .*/ {
if (in_block) {
after_return = 1
}
}
/ *\\}.*/ {
if (after_return) {
in_block = 0
}
}
EOF
chmod +x "$remove_vivado_version_check"
# tcl script for vivado to save list of IPs in file provided as first argument
cat > $get_ips <<EOF
set f [open [lindex \$argv 0] w]
cd /tmp
set name "prj_[clock seconds]_[format %08x [expr int(rand()*(1<<32))]]"
file mkdir "\$name"
cd "\$name"
create_project -name "\$name"
foreach ip [get_ipdefs] {
puts \$f \$ip
}
close \$f
close_project
cd ..
file delete -force "\$name"
exit
EOF
# create sed command to replace IP versions
vivado -mode tcl -source "$get_ips" -tclargs "$all_ips" > /dev/null
replace_ip_versions=$(sed "s/^\(.*\):\([^:]*\)$/s\/\1:[0-9.]\\\\+\/\1:\2\/g;/g" $all_ips | tr -d $'\n')
# update script
cat "$1" | \
awk -f "$remove_vivado_version_check" | \
sed "$replace_ip_versions" > $new_design_tcl
# show what was changed
diff --color=always "$1" "$new_design_tcl"
# replace script in place
cat "$new_design_tcl" > "$1"
# clean up
rm "$get_ips"
rm "$all_ips"
rm "$new_design_tcl"
rm "$remove_vivado_version_check"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment