From a18bd8a62717c3c777253035096153fbe2624b51 Mon Sep 17 00:00:00 2001
From: Daniel van der Schuur <schuur@astron.nl>
Date: Fri, 30 Nov 2018 08:38:57 +0000
Subject: [PATCH] Added shell script that demoes the usage of the GHDL
 simulator with the dp_repack_data core and its dependencies.

---
 cores/ghdl_test.sh | 92 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100755 cores/ghdl_test.sh

diff --git a/cores/ghdl_test.sh b/cores/ghdl_test.sh
new file mode 100755
index 0000000000..14655a03e7
--- /dev/null
+++ b/cores/ghdl_test.sh
@@ -0,0 +1,92 @@
+#!/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
-- 
GitLab