1 |
15 |
daniel.kho |
#
|
2 |
|
|
# Example Makefile for Synopsys VCS-MX simulation.
|
3 |
|
|
#
|
4 |
|
|
# Author(s):
|
5 |
|
|
# - Daniel C.K. Kho, daniel.kho@opencores.org | daniel.kho@tauhop.com
|
6 |
|
|
#
|
7 |
|
|
# Copyright (C) 2012-2014 Authors and OPENCORES.ORG
|
8 |
|
|
#
|
9 |
|
|
# This program is free software: you can redistribute it and/or modify
|
10 |
|
|
# it under the terms of the GNU General Public License as published by
|
11 |
|
|
# the Free Software Foundation, either version 3 of the License, or
|
12 |
|
|
# (at your option) any later version.
|
13 |
|
|
#
|
14 |
|
|
# This program is distributed in the hope that it will be useful,
|
15 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
|
|
# GNU General Public License for more details.
|
18 |
|
|
#
|
19 |
|
|
# You should have received a copy of the GNU General Public License
|
20 |
|
|
# along with this program. If not, see .
|
21 |
|
|
#
|
22 |
|
|
# This notice and disclaimer must be retained as part of this text at all times.
|
23 |
|
|
#
|
24 |
|
|
# @dependencies:
|
25 |
|
|
# @designer: Daniel C.K. Kho [daniel.kho@gmail.com] | [daniel.kho@tauhop.com]
|
26 |
|
|
# @history: @see Mercurial log for full list of changes.
|
27 |
|
|
#
|
28 |
|
|
# @Description:
|
29 |
|
|
#
|
30 |
|
|
|
31 |
|
|
SHELL = /bin/bash
|
32 |
|
|
|
33 |
|
|
# project name
|
34 |
|
|
PROJECT = fir_wishbone
|
35 |
|
|
|
36 |
|
|
ROOT_PATH = $(PWD)
|
37 |
|
|
MODEL_SRC_PATH = $(ROOT_PATH)/../model
|
38 |
17 |
daniel.kho |
VHDL_SRC_PATH = $(ROOT_PATH)/../hw
|
39 |
15 |
daniel.kho |
VHDL_TB_PATH = $(ROOT_PATH)/../tester
|
40 |
|
|
#COMMONFILES_PATH = $(SRC_PATH)/common
|
41 |
|
|
|
42 |
|
|
# model files
|
43 |
|
|
MODEL_FILES = $(SRC_PATH)/*.sagews $(SRC_PATH)/*.m $(SRC_PATH)/*.c
|
44 |
|
|
|
45 |
|
|
# vhdl files
|
46 |
|
|
#VHDL_FILES = $(SRC_PATH)/*.vhdl
|
47 |
|
|
#COMMON_VHDL_FILES = $(COMMONFILES_PATH)/*.vhdl
|
48 |
|
|
|
49 |
|
|
# build options
|
50 |
|
|
GHDL_BUILD_OPTS = #--std=02
|
51 |
|
|
DC_BUILD_OPTS =
|
52 |
|
|
VCS_BUILD_OPTS = -vhdl08
|
53 |
|
|
QUESTA_BUILD_OPTS = -2008
|
54 |
|
|
|
55 |
|
|
# Simulation break condition
|
56 |
|
|
GHDL_SIM_OPTS = --assert-level=error
|
57 |
|
|
#GHDL_SIM_OPTS = --stop-time=5us #500ns
|
58 |
|
|
|
59 |
|
|
# Workspaces
|
60 |
|
|
#SIM_PATH = $(ROOT_PATH)/simulation/ghdl
|
61 |
|
|
#SYNTH_PATH = $(ROOT_PATH)/synthesis/vivado
|
62 |
|
|
#SYNTH_PATH = $(ROOT_PATH)/synthesis/dc
|
63 |
|
|
SIM_PATH = $(ROOT_PATH)/simulation
|
64 |
|
|
SYNTH_PATH = $(ROOT_PATH)/synthesis
|
65 |
|
|
|
66 |
|
|
# testbench
|
67 |
|
|
TARGET = tb_fir
|
68 |
|
|
#SIMFILES = testbench/led_top_tb.vhd
|
69 |
|
|
|
70 |
|
|
#LIBS = -Pcommon
|
71 |
|
|
LIBS = -P$(SRC_PATH)/common
|
72 |
|
|
#GHDL_FLAGS = --ieee=synopsys --warn-no-vital-generic
|
73 |
|
|
|
74 |
|
|
build-model:
|
75 |
|
|
#sage ...
|
76 |
|
|
#gcc ...
|
77 |
|
|
|
78 |
|
|
# TODO automatically check if tool exists before running commands.
|
79 |
|
|
simulate:
|
80 |
|
|
#make clean-sim;
|
81 |
|
|
|
82 |
|
|
#echo $(date "+[%Y-%m-%d %H:%M:%S]: Compiling project...");
|
83 |
|
|
|
84 |
|
|
## Build the sources for simulation.
|
85 |
|
|
## with GHDL:
|
86 |
|
|
#cd $(SIM_PATH)/ghdl; \
|
87 |
|
|
# mkdir -p ./work ./tauhop ./osvvm;
|
88 |
|
|
#
|
89 |
|
|
#cd $(SIM_PATH)/ghdl; \
|
90 |
|
|
# ghdl $(GHDL_BUILD_OPTS) -i $(LIBS) --workdir=$(COMMONFILES_PATH) --work=common $(COMMON_FILES);
|
91 |
|
|
#
|
92 |
|
|
#cd $(SIM_PATH)/ghdl; \
|
93 |
|
|
# ghdl $(GHDL_BUILD_OPTS) -i $(LIBS) --workdir=$(SIM_PATH) --work=work $(FILES);
|
94 |
|
|
#
|
95 |
|
|
#cd $(SIM_PATH)/ghdl; \
|
96 |
|
|
# ghdl -m $(LIBS) --workdir=$(SIM_PATH) --work=work $(TARGET);
|
97 |
|
|
## [end] build with GHDL.
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
## with VCS:
|
102 |
|
|
#cd $(SIM_PATH)/vcs-mx; \
|
103 |
|
|
# mkdir -p ./work ./tauhop ./osvvm;
|
104 |
|
|
#
|
105 |
|
|
#cd $(SIM_PATH)/vcs-mx; \
|
106 |
|
|
# vhdlan $(VCS_BUILD_OPTS) -work tauhop \
|
107 |
|
|
# $(VHDL_SRC_PATH)/packages/tauhop/pkg-tlm.vhdl \
|
108 |
|
|
# $(VHDL_SRC_PATH)/packages/tauhop/pkg-dsp.vhdl \
|
109 |
|
|
# | tee -ai $(SIM_PATH)/simulate.log;
|
110 |
|
|
#
|
111 |
|
|
#cd $(SIM_PATH)/vcs-mx; \
|
112 |
|
|
# vhdlan $(VCS_BUILD_OPTS) -work work \
|
113 |
|
|
# $(VHDL_SRC_PATH)/fir.vhdl \
|
114 |
|
|
# $(VHDL_TB_PATH)/tb_fir.vhdl \
|
115 |
|
|
# | tee -ai ./simulate.log;
|
116 |
|
|
## [end] build with VCS.
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
# with Questa / Modelsim:
|
122 |
|
|
echo "$(date): Compiling project..." | tee -i $(SIM_PATH)/questa/simulate.log;
|
123 |
|
|
make clean-sim | tee -ai $(SIM_PATH)/questa/simulate.log;
|
124 |
|
|
|
125 |
|
|
cd $(SIM_PATH)/questa; \
|
126 |
|
|
mkdir -p ./work ./osvvm ./tauhop \
|
127 |
|
|
| tee -ai $(SIM_PATH)/questa/simulate.log;
|
128 |
|
|
|
129 |
|
|
cd $(SIM_PATH)/questa; \
|
130 |
|
|
vlib work; vmap ./work work | tee -ai $(SIM_PATH)/questa/simulate.log; \
|
131 |
|
|
vlib osvvm; vmap ./osvvm osvvm | tee -ai $(SIM_PATH)/questa/simulate.log; \
|
132 |
|
|
vlib tauhop; vmap ./tauhop tauhop | tee -ai $(SIM_PATH)/questa/simulate.log;
|
133 |
|
|
|
134 |
|
|
cd $(SIM_PATH)/questa; \
|
135 |
|
|
vcom $(QUESTA_BUILD_OPTS) -work tauhop \
|
136 |
|
|
$(VHDL_SRC_PATH)/packages/pkg-tlm.vhdl \
|
137 |
|
|
$(VHDL_SRC_PATH)/packages/pkg-dsp.vhdl \
|
138 |
|
|
| tee -ai $(SIM_PATH)/questa/simulate.log;
|
139 |
|
|
|
140 |
|
|
cd $(SIM_PATH)/questa; \
|
141 |
|
|
vcom $(QUESTA_BUILD_OPTS) -work work \
|
142 |
|
|
$(VHDL_SRC_PATH)/fir.vhdl \
|
143 |
|
|
$(VHDL_TB_PATH)/tb_fir.vhdl \
|
144 |
|
|
| tee -ai $(SIM_PATH)/questa/simulate.log;
|
145 |
|
|
# [end] build with Questa / Modelsim.
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
|
149 |
|
|
# Run the simulation and store the results.
|
150 |
|
|
## with GHDL:
|
151 |
|
|
##ghdl -r $(TARGET)
|
152 |
|
|
#@$(SIM_PATH)/$(TARGET) $(GHDL_SIM_OPTS) --vcdgz=$(SIM_PATH)/$(TARGET).vcdgz &
|
153 |
|
|
##@$(SRC_PATH)/$(TARGET) $(GHDL_SIM_OPTS) --wave=$(SIM_PATH)/$(TARGET).ghw &
|
154 |
|
|
#
|
155 |
|
|
## View the results with a waveform viewer.
|
156 |
|
|
## View with GTKWAVE (for GHDL)
|
157 |
|
|
#gzip --decompress --stdout $(SIM_PATH)/$(TARGET).vcdgz | gtkwave --vcd $(SIM_PATH)/$(TARGET).gtkwave.sav &
|
158 |
|
|
##gtkwave $(SIM_PATH)/$(TARGET).ghw $(SRC_PATH)/$(TARGET).gtkwave.gtkw &
|
159 |
|
|
## [end] simulate with GHDL.
|
160 |
|
|
|
161 |
|
|
|
162 |
|
|
## with VCS:
|
163 |
|
|
## Pass the simulation path into script.
|
164 |
|
|
#$(SIM_PATH)/simulate.sh `echo $(SIM_PATH)`;
|
165 |
|
|
## [end] simulate with VCS.
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
# with Questa / Modelsim:
|
169 |
|
|
# Pass the simulation path into script.
|
170 |
|
|
cd $(SIM_PATH)/questa; \
|
171 |
|
|
$(SIM_PATH)/questa/simulate.sh `echo $(SIM_PATH)/questa` \
|
172 |
|
|
| tee -ai $(SIM_PATH)/questa/simulate.log;
|
173 |
|
|
# [end] simulate with Questa / Modelsim.
|
174 |
|
|
|
175 |
|
|
|
176 |
|
|
|
177 |
|
|
|
178 |
|
|
synthesise:
|
179 |
|
|
make clean-synth;
|
180 |
|
|
|
181 |
|
|
echo $(date);
|
182 |
|
|
|
183 |
|
|
# with Design Compiler
|
184 |
|
|
#dc_shell -f $(SYNTH_PATH)/dc/synthesise.f \
|
185 |
|
|
# 2>&1 \
|
186 |
|
|
# | tee -i $(SYNTH_PATH)/dc/synthesise.log;
|
187 |
|
|
|
188 |
|
|
$(SYNTH_PATH)/quartus/synthesise.sh `echo $(SYNTH_PATH)/quartus` \
|
189 |
|
|
| tee -ai $(SYNTH_PATH)/quartus/synthesise.log;
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
ghdl-clean:
|
193 |
|
|
ghdl --clean --workdir=$(SIM_PATH)
|
194 |
|
|
|
195 |
|
|
clean-sim:
|
196 |
|
|
rm -rf \
|
197 |
|
|
$(SIM_PATH)/questa/modelsim.ini \
|
198 |
|
|
$(SIM_PATH)/questa/transcript \
|
199 |
|
|
$(SIM_PATH)/questa/vsim.wlf \
|
200 |
|
|
$(SIM_PATH)/questa/work \
|
201 |
|
|
$(SIM_PATH)/questa/altera \
|
202 |
|
|
$(SIM_PATH)/questa/osvvm \
|
203 |
|
|
$(SIM_PATH)/questa/tauhop;
|
204 |
|
|
#./simv* \
|
205 |
|
|
#$(SIM_PATH)/vcs-mx/simv* \
|
206 |
|
|
#$(SIM_PATH)/vcs-mx/64 \
|
207 |
|
|
#$(SIM_PATH)/vcs-mx/simulate.log \
|
208 |
|
|
#$(SIM_PATH)/vcs-mx/work \
|
209 |
|
|
#$(SIM_PATH)/vcs-mx/osvvm \
|
210 |
|
|
#$(SIM_PATH)/vcs-mx/tauhop;
|
211 |
|
|
|
212 |
|
|
#echo $(date "+[%Y-%m-%d %H:%M:%S]: Remove successful.");
|
213 |
|
|
echo "$(date): Remove successful.";
|
214 |
|
|
|
215 |
|
|
clean-synth:
|
216 |
|
|
rm -rf \
|
217 |
|
|
$(SYNTH_PATH)/dc/command.log \
|
218 |
|
|
$(SYNTH_PATH)/dc/default.svf;
|
219 |
|
|
|
220 |
|
|
echo $(date "+[%Y-%m-%d %H:%M:%S]: Remove successful.");
|