Last active
April 11, 2019 11:56
-
-
Save milannedic/ab6e1a40257e5a5a20fe6cd2af8d8231 to your computer and use it in GitHub Desktop.
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
1# Install ghdl tool using this command: | |
sudo dpkg --install ghdl_0.33-1jessie1_amd64.deb | |
First you need to find it and download it from here (there are other versions as well): | |
https://sourceforge.net/projects/ghdl-updates/files/Builds/ghdl-0.33/debian/ | |
Ubuntu 16.04 Fix: https://github.com/ghdl/ghdl/issues/166#issuecomment-482078983 | |
---------------- | |
Had to manually download and Install dependencies: | |
sudo dpkg -i gnat-4.8-base_4.8.2-8ubuntu3_amd64.deb | |
sudo dpkg -i libgnat-4.8_4.8.2-8ubuntu3_amd64.deb | |
First download them from here: | |
https://packages.ubuntu.com/trusty/amd64/gnat-4.8-base/download | |
https://packages.ubuntu.com/trusty/i386/libgnat-4.8/download | |
---------------- | |
For more details: | |
https://sourceforge.net/p/ghdl-updates/wiki/Debian%20Instructions/ | |
Everything else you need for ghdl: https://media.readthedocs.org/pdf/ghdl/latest/ghdl.pdf | |
2# Install gtkwave tool, used to examine waves generated by ghdl simulator. | |
I tested only on Ubuntu 14.04 | |
sudo apt-get update | |
sudo apt-get install gtkwave | |
------------------------------------------ | |
Now we have all tools set for Vivado-free simulation experience. | |
I gathered these commands to further improve my experience using these tools. | |
Save this file as sim.sh: | |
https://gist.github.com/milannedic/354e558e81edb2d6b63d5217de04f921 | |
# My specific situation required this kind of organization, feel free to modify sim.sh | |
# to fit your needs due to project hierarchies: | |
psds-vezbe | |
psds_v1 | |
1_1 | |
1_2 | |
... | |
n_m | |
psds_v2 | |
1_1 | |
1_2 | |
... | |
n_m | |
... | |
# I placed libraries and packages .vhd files in psds-vezbe so they can be used throughout the | |
# whole practicing process and included when needed in all my design files. | |
# So thats why its called this way: | |
./sim.sh psds_v2 2_1 top_level_tb 1000ns wave.gtkw | |
--1. top_level_tb is a name of testbench .vhd file placed in psds-vezbe/psds_v2/2_1 | |
--2. 1000ns is desired simulation time you want to observe in your waves. | |
--3. wave.gtk wave is a file you need to manualy generate from gtkwave tool and save it in psds-vezbe/psds_v2/2_1 | |
-- so you dont have to append all your signals to the waves each time you run it. | |
----------------------------------------------------------------------------- | |
Basic workaround: | |
Source: http://www.dossmatik.de/ghdl/GHDL_uart_sim.pdf | |
ghdl -i *.vhd | |
ghdl -m -fexplicit --ieee=synopsys top_level_tb | |
ghdl -r top_level_tb --stop-time=500us --wave=wave.ghw | |
gtkwave wave.ghw | |
-- These lines will include all .vhd files into work library and link everything | |
-- .vhd files must be named as entities they contain. | |
-- Execute these commands positioned in psds-vezbe/psds_v2/2_1 | |
----------------------------------------------------------------------------- | |
# clean.sh | |
----------------------------------------------------------------------------- | |
# Save these lines as clean.sh, place it in psds-vezbe | |
# I call it before pushing my project files to Gitlab and this is basically | |
# make clean command in this "wheel reinvention" scenario | |
# It will remove all object files and other unnecessary files these tools generate during operation. | |
----------------------------------------------------------------------------- | |
echo -e "\n\n\t\t -- Removing all .o files" | |
find . -name '*.o' -delete # clean all .o files | |
echo -e "\t\t -- Removing all .cf files" | |
find . -name '*.cf' -delete # clean all .cf files | |
echo -e "\t\t -- Removing all .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 all executables: $execs" | |
echo -e "$exec_print \n\n" | |
# delete executables | |
find ./ -type f | xargs file | grep "ELF.*executable" | awk -F: '{print $1}' | xargs rm | |
----------------------------------------------------------------------------- | |
It is important to perform this: | |
sudo chmod +x sim.sh | |
sudo chmod +x clean.sh | |
----------------------------------------------------------------------------- | |
# Might be a good resource as well: | |
https://www.fpgarelated.com/showarticle/20.php |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment