Skip to content
Snippets Groups Projects
Commit a18bd8a6 authored by Daniel van der Schuur's avatar Daniel van der Schuur
Browse files

Added shell script that demoes the usage of the GHDL simulator with the

dp_repack_data core and its dependencies.
parent 4686701b
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
###############################################################################
#
# Copyright (C) 2018
# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
# Author:
# . Daniel van der Schuur
# Purpose:
# . Test our VHDL code the GHDL compiler/simulator.
# Usage:
# . Execute: ./ghdl_test.sh
# Description:
# . Requires a working install of the GHDL simulator.
# . This script was tested with:
# $ ghdl --version
# GHDL 0.36-dev (tarball) [Dunoon edition]
# Compiled with GNAT Version: Community 2018 (20180524-73)
# mcode code generator
# . The waveform can be written by uncommenting the corresponding line below
# (wave.vcd)
# . The written waveform can be viewed using e.g. GTK Wave Viewer.
# . The simulation runs fine, but is (2min vs 1min) slower than ModelSim 6.6c,
# probably due to a memory leak (it uses about 10GB of RAM).
# . Apart from the mem leak, another back end (rather than the mcode backend)
# could be used (GCC or LLVM) to increase sim speed.
mkdir $HDL_BUILD_DIR/generic
###############################################################################
# Analyze (-a)
###############################################################################
mkdir $HDL_BUILD_DIR/generic/common_pkg
ghdl -a -g --work=common_pkg_lib --workdir=$HDL_BUILD_DIR/generic/common_pkg --ieee=synopsys --std=08 \
$RADIOHDL/cores/base/common/common_pkg/common_pkg.vhd \
$RADIOHDL/cores/base/common/common_pkg/common_str_pkg.vhd \
$RADIOHDL/cores/base/common/common_pkg/common_lfsr_sequences_pkg.vhd \
$RADIOHDL/cores/base/common/common_pkg/tb_common_pkg.vhd
mkdir $HDL_BUILD_DIR/generic/dp_pkg
ghdl -a -g --work=dp_pkg_lib --workdir=$HDL_BUILD_DIR/generic/dp_pkg --ieee=synopsys --std=08 \
-P$HDL_BUILD_DIR/generic/common_pkg \
$RADIOHDL/cores/base/dp/dp_pkg/dp_stream_pkg.vhd \
$RADIOHDL/cores/base/dp/dp_pkg/tb_dp_pkg.vhd \
$RADIOHDL/cores/base/dp/dp_pkg/dp_stream_stimuli.vhd \
$RADIOHDL/cores/base/dp/dp_pkg/dp_stream_verify.vhd
mkdir $HDL_BUILD_DIR/generic/dp_repack_data
ghdl -a -g --work=dp_repack_data_lib --workdir=$HDL_BUILD_DIR/generic/dp_repack_data --ieee=synopsys --std=08 \
-P$HDL_BUILD_DIR/generic/common_pkg \
-P$HDL_BUILD_DIR/generic/dp_pkg \
$RADIOHDL/cores/base/dp/dp_repack_data/dp_repack_data.vhd \
$RADIOHDL/cores/base/dp/dp_repack_data/tb_dp_repack_data.vhd \
$RADIOHDL/cores/base/dp/dp_repack_data/tb_tb_dp_repack_data.vhd
###############################################################################
# Elaborate (-e)
###############################################################################
ghdl -e -g --std=08 \
-P$HDL_BUILD_DIR/generic/common_pkg \
-P$HDL_BUILD_DIR/generic/dp_pkg \
--work=dp_repack_data_lib --workdir=$HDL_BUILD_DIR/generic/dp_repack_data tb_tb_dp_repack_data
###############################################################################
# Run! (-r)
###############################################################################
ghdl -r -g --std=08 \
-P$HDL_BUILD_DIR/generic/common_pkg \
-P$HDL_BUILD_DIR/generic/dp_pkg \
--work=dp_repack_data_lib --workdir=$HDL_BUILD_DIR/generic/dp_repack_data tb_tb_dp_repack_data
#--vcd=$HDL_BUILD_DIR/generic/dp_repack_data/wave.vcd \
###############################################################################
# View the wave window
###############################################################################
#gtkwave $HDL_BUILD_DIR/generic/dp_repack_data/wave.vcd
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment