1 |
2 |
daniel.kho |
#!/bin/bash
|
2 |
|
|
#
|
3 |
|
|
# Example bash script for Mentor Graphics QuestaSim/ModelSim simulation.
|
4 |
|
|
#
|
5 |
|
|
# Author: Daniel C.K. Kho <daniel.kho@tauhop.com>
|
6 |
|
|
# Copyright© 2012-2013 Daniel C.K. Kho <daniel.kho@tauhop.com>
|
7 |
|
|
#
|
8 |
|
|
# This program is free software: you can redistribute it and/or modify
|
9 |
|
|
# it under the terms of the GNU General Public License as published by
|
10 |
|
|
# the Free Software Foundation, either version 3 of the License, or
|
11 |
|
|
# (at your option) any later version.
|
12 |
|
|
#
|
13 |
|
|
# This program is distributed in the hope that it will be useful,
|
14 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
# GNU General Public License for more details.
|
17 |
|
|
#
|
18 |
|
|
# You should have received a copy of the GNU General Public License
|
19 |
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
20 |
|
|
#
|
21 |
|
|
# This notice and disclaimer must be retained as part of this text at all times.
|
22 |
|
|
#
|
23 |
|
|
# @dependencies:
|
24 |
|
|
# @designer: Daniel C.K. Kho [daniel.kho@gmail.com] | [daniel.kho@tauhop.com]
|
25 |
|
|
# @history: @see Mercurial log for full list of changes.
|
26 |
|
|
#
|
27 |
|
|
# @Description:
|
28 |
|
|
#
|
29 |
|
|
|
30 |
|
|
#read -p "press Enter to run full simulation now, or Ctrl-C to exit: ";
|
31 |
|
|
echo $(date "+[%Y-%m-%d %H:%M:%S]: Removing previously-generated files and folders...");
|
32 |
|
|
rm -rf modelsim.ini ./simulate.log ./work ./altera ./osvvm ./tauhop;
|
33 |
|
|
|
34 |
|
|
echo $(date "+[%Y-%m-%d %H:%M:%S]: Remove successful.");
|
35 |
|
|
echo $(date "+[%Y-%m-%d %H:%M:%S]: Compiling project...");
|
36 |
|
|
vlib work; vmap work work;
|
37 |
|
|
#vlib osvvm; vmap osvvm osvvm;
|
38 |
|
|
vlib tauhop; vmap tauhop tauhop;
|
39 |
|
|
|
40 |
|
|
#vcom -2008 -work osvvm ../../rtl/packages/os-vvm/SortListPkg_int.vhd \
|
41 |
|
|
# ../../rtl/packages/os-vvm/RandomBasePkg.vhd \
|
42 |
|
|
# ../../rtl/packages/os-vvm/RandomPkg.vhd \
|
43 |
|
|
# ../../rtl/packages/os-vvm/CoveragePkg.vhd;
|
44 |
|
|
|
45 |
|
|
vcom -2008 -work work ../../rtl/galois-lfsr.vhdl \
|
46 |
|
|
../../rtl/user.vhdl \
|
47 |
|
|
| tee -ai ./simulate.log;
|
48 |
|
|
|
49 |
|
|
#vsim -t ps -do ./waves.do -voptargs="+acc" "work.user(rtl)";
|
50 |
|
|
|
51 |
|
|
errorStr=`grep "\*\* Error: " ./simulate.log`
|
52 |
|
|
if [ `echo ${#errorStr}` -gt 0 ]
|
53 |
|
|
then echo "Errors exist. Refer simulate.log for more details. Exiting."; exit;
|
54 |
|
|
else vsim -t ps -do ./waves.do -voptargs="+acc" "work.user(rtl)";
|
55 |
|
|
fi
|
56 |
|
|
|
57 |
|
|
echo $(date "+[%Y-%m-%d %H:%M:%S]: simulation loaded.");
|