OpenCores
URL https://opencores.org/ocsvn/wb_fifo/wb_fifo/trunk

Subversion Repositories wb_fifo

[/] [wb_fifo/] [trunk/] [workspaces/] [simulate.sh] - Blame information for rev 9

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 daniel.kho
#!/bin/bash
2
#
3
#       Example bash script for Mentor Graphics QuestaSim/ModelSim simulation.
4
#
5
#       Author(s):
6
#       - Daniel C.K. Kho, daniel.kho@opencores.org | daniel.kho@tauhop.com
7
#
8
#       Copyright (C) 2012-2013 Authors and OPENCORES.ORG
9
#
10
# This program is free software: you can redistribute it and/or modify
11
# it under the terms of the GNU General Public License as published by
12
# the Free Software Foundation, either version 3 of the License, or
13
# (at your option) any later version.
14
#
15
# This program is distributed in the hope that it will be useful,
16
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
# GNU General Public License for more details.
19
#
20
# You should have received a copy of the GNU General Public License
21
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
#
23
# This notice and disclaimer must be retained as part of this text at all times.
24
#
25
#       @dependencies:
26
#       @designer: Daniel C.K. Kho [daniel.kho@gmail.com] | [daniel.kho@tauhop.com]
27
#       @history: @see Mercurial log for full list of changes.
28
#
29
#       @Description:
30
#
31
 
32
ROOT_PATH=$PWD
33
MODEL_SRC_PATH=$ROOT_PATH/../model
34
VHDL_SRC_PATH=$ROOT_PATH/../hw/vhdl
35
TB_SRC_PATH=$ROOT_PATH/../hw/tester
36
#set COMMONFILES_PATH = $SRC_PATH/common
37
 
38
# model files
39
#set MODEL_FILES = $SRC_PATH/*.sagews $SRC_PATH/*.m $SRC_PATH/*.c
40
 
41
# vhdl files
42
#VHDL_FILES = $(SRC_PATH)/*.vhdl
43
#COMMON_VHDL_FILES = $(COMMONFILES_PATH)/*.vhdl
44
 
45
# build options
46
GHDL_BUILD_OPTS=--std=02
47
QUESTA_BUILD_OPTS=-2008
48
DC_BUILD_OPTS=
49
VCS_BUILD_OPTS=-vhdl08
50
 
51
# Simulation break condition
52
GHDL_SIM_OPTS=--assert-level=error
53
#GHDL_SIM_OPTS    = --stop-time=5us             #500ns
54
 
55
# Workspaces
56
#SIM_PATH = $(ROOT_PATH)/simulation/ghdl
57
#SYNTH_PATH = $(ROOT_PATH)/synthesis/vivado
58
VCS_SIM_PATH=$ROOT_PATH/simulation/vcs-mx
59
QUESTA_SIM_PATH=$ROOT_PATH/simulation/questa
60
DC_SYNTH_PATH=$ROOT_PATH/synthesis/dc
61
 
62
##read -p "press Enter to run full simulation now, or Ctrl-C to exit: ";
63
#echo $(date "+[%Y-%m-%d %H:%M:%S]: Removing previously-generated files and folders...");
64
#rm -rf *./simulate.log ./work ./altera ./osvvm ./tauhop;
65
#
66
#echo $(date "+[%Y-%m-%d %H:%M:%S]: Remove successful.");
67
#echo $(date "+[%Y-%m-%d %H:%M:%S]: Compiling project...");
68
#vlib work; vmap work work;
69
#vlib tauhop; vmap tauhop tauhop;
70
#vlib osvvm; vmap osvvm osvvm;
71
 
72
isNotExists_vhdlan=`hash vhdlan 2>&1 | grep >&1 "not found"` ;
73
if [ `echo ${#isNotExists_vhdlan}` -gt 0 ]
74
then echo "Warning: vhdlan not installed. Skipping compilation for VCS.";
75
else
76
        echo "Starting VCS compile..."
77
 
78 9 daniel.kho
        cd $VCS_SIM_PATH;
79 8 daniel.kho
 
80 9 daniel.kho
        eval 2>&1 "vhdlan $VCS_BUILD_OPTS -work osvvm \
81
                $(cat ../osvvm.f)" \
82
                | tee -ai ./simulate.log;
83
 
84
        #vcom -2008 -work tauhop $VHDL_SRC_PATH/packages/pkg-types.vhdl \
85
        eval 2>&1 "vhdlan $VCS_BUILD_OPTS -work tauhop \
86
                $(cat ../tauhop.f)" \
87
                | tee -ai ./simulate.log;
88
                #../../model/vhdl/packages/pkg-resolved.vhdl \
89
 
90
        eval 2>&1 "vhdlan $VCS_BUILD_OPTS -work work \
91
                $(cat ../work.f)" \
92
                | tee -ai ./simulate.log;
93
 
94
        errorStr=`grep "Error-\[" ./simulate.log`;
95 8 daniel.kho
        if [ `echo ${#errorStr}` -gt 0 ]
96
        then echo "Errors exist. Refer simulate.log for more details. Exiting."; exit;
97
        else
98
                echo $(date "+[%Y-%m-%d %H:%M:%S]: Running simulation...");
99
 
100
                #vcs -R -debug_all work.system 2>&1 \
101
                vcs -debug_all work.system 2>&1 \
102 9 daniel.kho
                        | tee -ai ./simulate.log;
103 8 daniel.kho
 
104 9 daniel.kho
                ./simv -gui -dve_opt -session=./view-session.tcl -dve_opt -cmd=run 2>&1 \
105
                        | tee -ai ./simulate.log;
106 8 daniel.kho
 
107
                echo $(date "+[%Y-%m-%d %H:%M:%S]: simulation loaded.");
108
        fi
109
fi
110
 
111
isNotExists_vcom=`hash vcom 2>&1 | grep >&1 "not found"` ;
112
#isNotExists_vcom=`hash vhdlan 2>/dev/null || { echo >&2 "Warning: vcom not installed. Skipping compilation for Questa/ModelSim."; }`;
113
if [ `echo ${#isNotExists_vcom}` -gt 0 ]
114
then echo "Warning: vcom not installed. Skipping compilation for Questa/ModelSim.";
115
else
116
        echo "Starting Questa/ModelSim compile..."
117
 
118
        cd $QUESTA_SIM_PATH;
119
 
120
        #read -p "press Enter to run full simulation now, or Ctrl-C to exit: ";
121
        echo $(date "+[%Y-%m-%d %H:%M:%S]: Removing previously-generated files and folders...");
122
        rm -rf ./transcript ./simulate.log ./work ./altera ./osvvm ./tauhop;
123
        echo $(date "+[%Y-%m-%d %H:%M:%S]: Remove successful.");
124
 
125
        echo $(date "+[%Y-%m-%d %H:%M:%S]: Compiling project...");
126
        vlib work; vmap work work;
127
        vlib tauhop; vmap tauhop tauhop;
128
        vlib osvvm; vmap osvvm osvvm;
129
 
130
        #vcom $QUESTA_BUILD_OPTS -work osvvm 2>&1 \
131
        #       $VHDL_SRC_PATH/packages/os-vvm/SortListPkg_int.vhd \
132
        #       $VHDL_SRC_PATH/packages/os-vvm/RandomBasePkg.vhd \
133
        #       $VHDL_SRC_PATH/packages/os-vvm/RandomPkg.vhd \
134
        #       $VHDL_SRC_PATH/packages/os-vvm/CoveragePkg.vhd \
135
        #       | tee -ai ./simulate.log;
136
        # Pass the simulation path into script.
137
        eval 2>&1 "vcom $QUESTA_BUILD_OPTS -work osvvm \
138
                $(cat ../osvvm.f)" \
139
                | tee -ai ./simulate.log;
140
 
141
        #vcom -2008 -work tauhop $VHDL_SRC_PATH/packages/pkg-types.vhdl \
142
        eval 2>&1 "vcom $QUESTA_BUILD_OPTS -work tauhop \
143
                $(cat ../tauhop.f)" \
144
                | tee -ai ./simulate.log;
145
                #../../model/vhdl/packages/pkg-resolved.vhdl \
146
 
147
        eval 2>&1 "vcom $QUESTA_BUILD_OPTS -work work \
148
                $(cat ../work.f)" \
149
                | tee -ai ./simulate.log;
150
 
151
        errorStr=`grep "\*\* Error: " ./simulate.log`
152
        if [ `echo ${#errorStr}` -gt 0 ]
153
        then echo "Errors exist. Refer simulate.log for more details. Exiting."; exit;
154
        else
155
                echo $(date "+[%Y-%m-%d %H:%M:%S]: Running simulation...");
156
                vsim -i -t fs -do ./waves.do -voptargs="+acc" "work.testbench(simulation)" 2>&1 \
157
                        | tee -ai ./simulate.log &
158
                #vsim -t ps -voptargs="+acc" "tauhop.fifo(rtl)";
159
                #vsim -t ps -voptargs="+acc" "work.testbench(simulation)";
160
                echo $(date "+[%Y-%m-%d %H:%M:%S]: simulation loaded.");
161
        fi
162
fi

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.