Last active
June 4, 2019 20:21
-
-
Save milannedic/354e558e81edb2d6b63d5217de04f921 to your computer and use it in GitHub Desktop.
Automation of VHDL compile/simulate process using GHDL and GTKWave. This script simulates testbench file, dumps .ghw file and runs GTKWave with it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# call this like: | |
# ./sim.sh psds_v2 2_1 top_level_tb 1000ns wave.gtkw | |
# params: | |
# 1 - lesson dir | |
# 2 - problem folder, e.g 2_2 | |
# 3 - model to test | |
# 4 - time interval to simulate | |
# 5 - gtkw setup file | |
echo -e "\n\n\t\t -- Removing old .o files" | |
find . -name '*.o' -delete # clean all .o files | |
echo -e "\t\t -- Removing old .cf files" | |
find . -name '*.cf' -delete # clean all .cf files | |
echo -e "\t\t -- Removing old .ghw files\n\n" | |
find . -name '*.ghw' -delete # clean all .ghw files | |
execs=$(find ./ -type f | xargs file | grep "ELF.*executable" | awk -F: '{print $1}' | xargs echo) | |
exec_print="\t\t -- Deleting old executables: $execs" | |
echo -e "$exec_print \n\n" | |
# delete executables | |
find ./ -type f | xargs file | grep "ELF.*executable" | awk -F: '{print $1}' | xargs rm | |
ghdl -i ./$1/$2/*.vhd | |
ghdl -i ./util_pkg.vhd # two directories behind | |
ghdl -m -fexplicit --ieee=synopsys $3 | |
ghdl -r $3 --stop-time=$4 --wave=wave.ghw | |
gtkwave wave.ghw ./$1/$2/$5 # wave.gtkw |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment