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 10

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 10 daniel.kho
GHDL_BUILD_OPTS=--std=02 --assert-level=error
47 8 daniel.kho
QUESTA_BUILD_OPTS=-2008
48
DC_BUILD_OPTS=
49
VCS_BUILD_OPTS=-vhdl08
50
 
51
# Workspaces
52 10 daniel.kho
GHDL_SIM_PATH=$ROOT_PATH/simulation/ghdl
53
QUESTA_SIM_PATH=$ROOT_PATH/simulation/questa
54 8 daniel.kho
VCS_SIM_PATH=$ROOT_PATH/simulation/vcs-mx
55 10 daniel.kho
VIVADO_SYNTH_PATH=$ROOT_PATH/synthesis/vivado
56 8 daniel.kho
DC_SYNTH_PATH=$ROOT_PATH/synthesis/dc
57
 
58
isNotExists_vhdlan=`hash vhdlan 2>&1 | grep >&1 "not found"` ;
59
if [ `echo ${#isNotExists_vhdlan}` -gt 0 ]
60
then echo "Warning: vhdlan not installed. Skipping compilation for VCS.";
61
else
62
        echo "Starting VCS compile..."
63
 
64 9 daniel.kho
        cd $VCS_SIM_PATH;
65 8 daniel.kho
 
66 9 daniel.kho
        eval 2>&1 "vhdlan $VCS_BUILD_OPTS -work osvvm \
67
                $(cat ../osvvm.f)" \
68
                | tee -ai ./simulate.log;
69
 
70
        #vcom -2008 -work tauhop $VHDL_SRC_PATH/packages/pkg-types.vhdl \
71
        eval 2>&1 "vhdlan $VCS_BUILD_OPTS -work tauhop \
72
                $(cat ../tauhop.f)" \
73
                | tee -ai ./simulate.log;
74
                #../../model/vhdl/packages/pkg-resolved.vhdl \
75
 
76
        eval 2>&1 "vhdlan $VCS_BUILD_OPTS -work work \
77
                $(cat ../work.f)" \
78
                | tee -ai ./simulate.log;
79
 
80
        errorStr=`grep "Error-\[" ./simulate.log`;
81 8 daniel.kho
        if [ `echo ${#errorStr}` -gt 0 ]
82
        then echo "Errors exist. Refer simulate.log for more details. Exiting."; exit;
83
        else
84
                echo $(date "+[%Y-%m-%d %H:%M:%S]: Running simulation...");
85
 
86
                #vcs -R -debug_all work.system 2>&1 \
87
                vcs -debug_all work.system 2>&1 \
88 9 daniel.kho
                        | tee -ai ./simulate.log;
89 8 daniel.kho
 
90 9 daniel.kho
                ./simv -gui -dve_opt -session=./view-session.tcl -dve_opt -cmd=run 2>&1 \
91
                        | tee -ai ./simulate.log;
92 8 daniel.kho
 
93
                echo $(date "+[%Y-%m-%d %H:%M:%S]: simulation loaded.");
94
        fi
95
fi
96
 
97
isNotExists_vcom=`hash vcom 2>&1 | grep >&1 "not found"` ;
98
if [ `echo ${#isNotExists_vcom}` -gt 0 ]
99
then echo "Warning: vcom not installed. Skipping compilation for Questa/ModelSim.";
100
else
101
        echo "Starting Questa/ModelSim compile..."
102
 
103
        cd $QUESTA_SIM_PATH;
104
 
105
        #read -p "press Enter to run full simulation now, or Ctrl-C to exit: ";
106
        echo $(date "+[%Y-%m-%d %H:%M:%S]: Removing previously-generated files and folders...");
107
        rm -rf ./transcript ./simulate.log ./work ./altera ./osvvm ./tauhop;
108
        echo $(date "+[%Y-%m-%d %H:%M:%S]: Remove successful.");
109
 
110
        echo $(date "+[%Y-%m-%d %H:%M:%S]: Compiling project...");
111
        vlib work; vmap work work;
112
        vlib tauhop; vmap tauhop tauhop;
113
        vlib osvvm; vmap osvvm osvvm;
114
 
115
        #vcom $QUESTA_BUILD_OPTS -work osvvm 2>&1 \
116
        #       $VHDL_SRC_PATH/packages/os-vvm/SortListPkg_int.vhd \
117
        #       $VHDL_SRC_PATH/packages/os-vvm/RandomBasePkg.vhd \
118
        #       $VHDL_SRC_PATH/packages/os-vvm/RandomPkg.vhd \
119
        #       $VHDL_SRC_PATH/packages/os-vvm/CoveragePkg.vhd \
120
        #       | tee -ai ./simulate.log;
121
        # Pass the simulation path into script.
122
        eval 2>&1 "vcom $QUESTA_BUILD_OPTS -work osvvm \
123
                $(cat ../osvvm.f)" \
124
                | tee -ai ./simulate.log;
125
 
126
        #vcom -2008 -work tauhop $VHDL_SRC_PATH/packages/pkg-types.vhdl \
127
        eval 2>&1 "vcom $QUESTA_BUILD_OPTS -work tauhop \
128
                $(cat ../tauhop.f)" \
129
                | tee -ai ./simulate.log;
130
                #../../model/vhdl/packages/pkg-resolved.vhdl \
131
 
132
        eval 2>&1 "vcom $QUESTA_BUILD_OPTS -work work \
133
                $(cat ../work.f)" \
134
                | tee -ai ./simulate.log;
135
 
136
        errorStr=`grep "\*\* Error: " ./simulate.log`
137
        if [ `echo ${#errorStr}` -gt 0 ]
138
        then echo "Errors exist. Refer simulate.log for more details. Exiting."; exit;
139
        else
140
                echo $(date "+[%Y-%m-%d %H:%M:%S]: Running simulation...");
141
                vsim -i -t fs -do ./waves.do -voptargs="+acc" "work.testbench(simulation)" 2>&1 \
142
                        | tee -ai ./simulate.log &
143
                #vsim -t ps -voptargs="+acc" "tauhop.fifo(rtl)";
144
                #vsim -t ps -voptargs="+acc" "work.testbench(simulation)";
145
                echo $(date "+[%Y-%m-%d %H:%M:%S]: simulation loaded.");
146
        fi
147
fi

powered by: WebSVN 2.1.0

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