1 |
6 |
julius |
######################################################################
|
2 |
|
|
#### ####
|
3 |
|
|
#### ORPSoCv2 Testbenches Makefile ####
|
4 |
|
|
#### ####
|
5 |
|
|
#### Description ####
|
6 |
|
|
#### ORPSoCv2 Testbenches Makefile, containing rules for ####
|
7 |
|
|
#### configuring and running different tests on the current ####
|
8 |
|
|
#### ORPSoC(v2) design. ####
|
9 |
|
|
#### ####
|
10 |
|
|
#### To do: ####
|
11 |
|
|
#### ####
|
12 |
|
|
#### Author(s): ####
|
13 |
360 |
julius |
#### - Julius Baxter, julius@opencores.org ####
|
14 |
6 |
julius |
#### ####
|
15 |
|
|
#### ####
|
16 |
|
|
######################################################################
|
17 |
|
|
#### ####
|
18 |
348 |
julius |
#### Copyright (C) 2009,2010 Authors and OPENCORES.ORG ####
|
19 |
6 |
julius |
#### ####
|
20 |
|
|
#### This source file may be used and distributed without ####
|
21 |
|
|
#### restriction provided that this copyright statement is not ####
|
22 |
|
|
#### removed from the file and that any derivative work contains ####
|
23 |
|
|
#### the original copyright notice and the associated disclaimer. ####
|
24 |
|
|
#### ####
|
25 |
|
|
#### This source file is free software; you can redistribute it ####
|
26 |
|
|
#### and/or modify it under the terms of the GNU Lesser General ####
|
27 |
|
|
#### Public License as published by the Free Software Foundation; ####
|
28 |
|
|
#### either version 2.1 of the License, or (at your option) any ####
|
29 |
|
|
#### later version. ####
|
30 |
|
|
#### ####
|
31 |
|
|
#### This source is distributed in the hope that it will be ####
|
32 |
|
|
#### useful, but WITHOUT ANY WARRANTY; without even the implied ####
|
33 |
|
|
#### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ####
|
34 |
|
|
#### PURPOSE. See the GNU Lesser General Public License for more ####
|
35 |
|
|
#### details. ####
|
36 |
|
|
#### ####
|
37 |
|
|
#### You should have received a copy of the GNU Lesser General ####
|
38 |
|
|
#### Public License along with this source; if not, download it ####
|
39 |
|
|
#### from http://www.opencores.org/lgpl.shtml ####
|
40 |
|
|
#### ####
|
41 |
|
|
######################################################################
|
42 |
|
|
|
43 |
360 |
julius |
# Name of the directory we're currently in
|
44 |
|
|
CUR_DIR=$(shell pwd)
|
45 |
6 |
julius |
|
46 |
360 |
julius |
# The root path of the whole project
|
47 |
|
|
PROJECT_ROOT ?=$(CUR_DIR)/../..
|
48 |
6 |
julius |
|
49 |
360 |
julius |
# Need this for individual test variables to not break
|
50 |
|
|
TEST ?= or1200-simple
|
51 |
6 |
julius |
|
52 |
360 |
julius |
TESTS ?= or1200-simple or1200-cbasic or1200-dctest or1200-float or1200-mmu or1200asm-basic or1200asm-except or1200asm-mac or1200asm-linkregtest or1200asm-tick or1200asm-ticksyscall uart-simple
|
53 |
6 |
julius |
|
54 |
360 |
julius |
DESIGN_NAME=orpsoc
|
55 |
|
|
RTL_TESTBENCH_TOP=$(DESIGN_NAME)_testbench
|
56 |
6 |
julius |
|
57 |
360 |
julius |
# Gets turned into verilog `define
|
58 |
|
|
SIM_TYPE=RTL
|
59 |
6 |
julius |
|
60 |
360 |
julius |
# Paths to other important parts of this test suite
|
61 |
|
|
RTL_DIR = $(PROJECT_ROOT)/rtl
|
62 |
|
|
RTL_VERILOG_DIR = $(RTL_DIR)/verilog
|
63 |
|
|
RTL_VERILOG_INCLUDE_DIR = $(RTL_VERILOG_DIR)/include
|
64 |
|
|
#RTL_VHDL_DIR = $(RTL_DIR)/vhdl
|
65 |
6 |
julius |
|
66 |
360 |
julius |
PROJECT_VERILOG_DEFINES=$(RTL_VERILOG_INCLUDE_DIR)/$(DESIGN_NAME)-defines.v
|
67 |
|
|
# Detect technology to use for the simulation
|
68 |
|
|
DESIGN_DEFINES=$(shell cat $(PROJECT_VERILOG_DEFINES) | sed s://.*::g | sed s:\`:\#:g | sed 's:^[ ]*::' | awk '{print};/^\#define/{printf "_%s=%s\n",$$2,$$2}' | grep -v PERIOD | cpp -P | sed s:^_::g | sed s:=$$::g )
|
69 |
6 |
julius |
|
70 |
360 |
julius |
# Rule to look at what defines are being extracted from main file
|
71 |
|
|
print-defines:
|
72 |
|
|
@echo echo; echo "\t### Design defines ###"; echo
|
73 |
|
|
@echo "\tParsing "$(PROJECT_VERILOG_DEFINES)" and exporting:"
|
74 |
|
|
@echo $(DESIGN_DEFINES)
|
75 |
6 |
julius |
|
76 |
|
|
|
77 |
360 |
julius |
# Simulation directories
|
78 |
|
|
SIM_DIR ?=$(PROJECT_ROOT)/sim
|
79 |
|
|
RTL_SIM_DIR=$(SIM_DIR)
|
80 |
|
|
RTL_SIM_RUN_DIR=$(RTL_SIM_DIR)/run
|
81 |
|
|
RTL_SIM_BIN_DIR=$(RTL_SIM_DIR)/bin
|
82 |
|
|
RTL_SIM_SRC_DIR=$(RTL_SIM_DIR)/src
|
83 |
|
|
RTL_SIM_RESULTS_DIR=$(RTL_SIM_DIR)/out
|
84 |
6 |
julius |
|
85 |
360 |
julius |
# Testbench paths
|
86 |
6 |
julius |
BENCH_DIR=$(PROJECT_ROOT)/bench
|
87 |
|
|
BENCH_VERILOG_DIR=$(BENCH_DIR)/verilog
|
88 |
360 |
julius |
#BENCH_VHDL_DIR=$(BENCH_DIR)/vhdl
|
89 |
|
|
|
90 |
|
|
# System software dir
|
91 |
6 |
julius |
SW_DIR=$(PROJECT_ROOT)/sw
|
92 |
360 |
julius |
# BootROM code, which generates a verilog array select values
|
93 |
|
|
BOOTROM_FILE=bootrom.v
|
94 |
|
|
BOOTROM_SW_DIR=$(SW_DIR)/bootrom
|
95 |
|
|
BOOTROM_SRC=$(shell ls $(BOOTROM_SW_DIR)/* | grep -v $(BOOTROM_FILE))
|
96 |
|
|
BOOTROM_VERILOG=$(BOOTROM_SW_DIR)/$(BOOTROM_FILE)
|
97 |
|
|
$(BOOTROM_VERILOG): $(BOOTROM_SRC)
|
98 |
|
|
$(Q)echo; echo "\t### Generating bootup ROM ###"; echo
|
99 |
|
|
$(Q)$(MAKE) -C $(BOOTROM_SW_DIR) $(BOOTROM_FILE)
|
100 |
6 |
julius |
|
101 |
360 |
julius |
# Suffix of file to check after each test for the string
|
102 |
|
|
TEST_OUT_FILE_SUFFIX=-general.log
|
103 |
|
|
TEST_OK_STRING=8000000d
|
104 |
6 |
julius |
|
105 |
360 |
julius |
# Dynamically generated verilog file defining configuration for various things
|
106 |
|
|
TEST_DEFINES_VLG=test-defines.v
|
107 |
57 |
julius |
# Set V=1 when calling make to enable verbose output
|
108 |
|
|
# mainly for debugging purposes.
|
109 |
|
|
ifeq ($(V), 1)
|
110 |
|
|
Q=
|
111 |
360 |
julius |
QUIET=
|
112 |
57 |
julius |
else
|
113 |
360 |
julius |
Q ?=@
|
114 |
|
|
QUIET=-quiet
|
115 |
57 |
julius |
endif
|
116 |
|
|
|
117 |
360 |
julius |
# Modelsim variables
|
118 |
|
|
MGC_VSIM=vsim
|
119 |
|
|
MGC_VLOG_COMP=vlog
|
120 |
|
|
MGC_VHDL_COMP=vcom
|
121 |
|
|
MODELSIM=modelsim
|
122 |
6 |
julius |
|
123 |
360 |
julius |
# Icarus variables
|
124 |
|
|
ICARUS_COMPILE=iverilog
|
125 |
|
|
ICARUS_RUN=vvp
|
126 |
|
|
ICARUS_SCRIPT=icarus.scr
|
127 |
|
|
ICARUS_SIM_EXE=vlogsim.elf
|
128 |
|
|
ICARUS=icarus
|
129 |
58 |
julius |
|
130 |
360 |
julius |
#Default simulator is Icarus Verilog
|
131 |
|
|
# Set SIMULATOR=modelsim to use Modelsim
|
132 |
|
|
# Set SIMULATOR=ncverilog to use Cadence's NC-Verilog - TODO
|
133 |
|
|
# Set SIMULATOR=icarus to use Icarus Verilog (Default)
|
134 |
68 |
julius |
|
135 |
58 |
julius |
SIMULATOR ?= $(ICARUS)
|
136 |
|
|
|
137 |
51 |
julius |
|
138 |
360 |
julius |
# VPI debugging interface variables
|
139 |
|
|
VPI_SRC_C_DIR=$(BENCH_VERILOG_DIR)/vpi/c
|
140 |
|
|
VPI_SRCS=$(shell ls $(VPI_SRC_C_DIR)/*.[ch])
|
141 |
58 |
julius |
|
142 |
360 |
julius |
# Modelsim VPI compile variables
|
143 |
|
|
MODELTECH_VPILIB=msim_jp_vpi.sl
|
144 |
|
|
# Icarus VPI compile target
|
145 |
|
|
ICARUS_VPILIB=jp_vpi
|
146 |
58 |
julius |
|
147 |
77 |
rherveille |
|
148 |
|
|
|
149 |
360 |
julius |
#
|
150 |
|
|
# Modelsim-specific settings
|
151 |
|
|
#
|
152 |
|
|
VOPT_ARGS=$(QUIET) -suppress 2241
|
153 |
55 |
julius |
# If VCD dump is desired, tell Modelsim not to optimise
|
154 |
|
|
# away everything.
|
155 |
|
|
ifeq ($(VCD), 1)
|
156 |
360 |
julius |
#VOPT_ARGS=-voptargs="+acc=rnp"
|
157 |
|
|
VOPT_ARGS=+acc=rnpqv
|
158 |
55 |
julius |
endif
|
159 |
360 |
julius |
# VSIM commands
|
160 |
|
|
# Suppressed warnings - 3009: Failed to open $readmemh() file
|
161 |
|
|
# Suppressed warnings - 3009: Module 'blah' does not have a `timescale directive in effect, but previous modules do.
|
162 |
|
|
# Suppressed warnings - 8598: Non-positive replication multiplier inside concat. Replication will be ignored
|
163 |
|
|
VSIM_ARGS= -suppress 7 -suppress 3009 -suppress 8598 -c $(QUIET) -do "set StdArithNoWarnings 1; run -all; exit"
|
164 |
|
|
# Modelsim VPI settings
|
165 |
|
|
ifeq ($(VPI), 1)
|
166 |
|
|
VPI_LIBS=$(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB)
|
167 |
|
|
VSIM_ARGS += -pli $(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB)
|
168 |
58 |
julius |
endif
|
169 |
360 |
julius |
# Rule to make the VPI library for modelsim
|
170 |
|
|
$(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB): $(VPI_SRCS)
|
171 |
|
|
$(MAKE) -C $(VPI_SRC_C_DIR) $(MODELTECH_VPILIB)
|
172 |
58 |
julius |
|
173 |
55 |
julius |
|
174 |
6 |
julius |
|
175 |
360 |
julius |
#
|
176 |
|
|
# Icarus Verilog-specific settings
|
177 |
|
|
#
|
178 |
77 |
rherveille |
|
179 |
360 |
julius |
# Rule to make the VPI library for Icarus
|
180 |
|
|
$(VPI_SRC_C_DIR)/$(ICARUS_VPILIB): $(VPI_SRCS)
|
181 |
|
|
$(MAKE) -C $(VPI_SRC_C_DIR) $(ICARUS_VPILIB)
|
182 |
77 |
rherveille |
|
183 |
6 |
julius |
|
184 |
360 |
julius |
#
|
185 |
|
|
# Verilog DUT source variables
|
186 |
|
|
#
|
187 |
|
|
# A list of paths under rtl/verilog we wish to exclude for module searching
|
188 |
|
|
VERILOG_MODULES_EXCLUDE= include components
|
189 |
|
|
VERILOG_MODULES_EXCLUDE_LIST_E=$(shell for exclude in $(VERILOG_MODULES_EXCLUDE); do echo "-e $$exclude"; done)
|
190 |
|
|
RTL_VERILOG_MODULES=$(shell ls $(RTL_VERILOG_DIR) | grep -v $(VERILOG_MODULES_EXCLUDE_LIST_E) )
|
191 |
|
|
# Specific files to exclude, currently none.
|
192 |
|
|
#VERILOG_EXCLUDE=
|
193 |
|
|
#VERILOG_EXCLUDE_LIST_E=$(shell for exclude in $(VERILOG_EXCLUDE); do echo "-e $$exclude"; done)
|
194 |
|
|
# List of verilog source files, minus excluded files
|
195 |
|
|
#RTL_VERILOG_SRC=$(shell for module in $(RTL_VERILOG_MODULES); do if [ -d $(RTL_VERILOG_DIR)/$$module ]; then ls $(RTL_VERILOG_DIR)/$$module/*.v | grep -v $(VERILOG_EXCLUDE_LIST_E); fi; done)
|
196 |
|
|
# List of verilog source files, ignoring excludes
|
197 |
|
|
RTL_VERILOG_SRC=$(shell for module in $(RTL_VERILOG_MODULES); do if [ -d $(RTL_VERILOG_DIR)/$$module ]; then ls $(RTL_VERILOG_DIR)/$$module/*.v; fi; done)
|
198 |
6 |
julius |
|
199 |
|
|
|
200 |
|
|
|
201 |
360 |
julius |
# List of verilog includes
|
202 |
|
|
RTL_VERILOG_INCLUDES=$(shell ls $(RTL_VERILOG_INCLUDE_DIR)/*.*)
|
203 |
6 |
julius |
|
204 |
360 |
julius |
print-verilog-src:
|
205 |
|
|
@echo echo; echo "\t### Verilog source ###"; echo
|
206 |
|
|
@echo $(RTL_VERILOG_SRC)
|
207 |
51 |
julius |
|
208 |
360 |
julius |
# Rules to make RTL we might need
|
209 |
|
|
# Expects modules, if they need making, to have their top verilog file to
|
210 |
|
|
# correspond to their module name, and the directory should have a make file
|
211 |
|
|
# and rule which works for this command.
|
212 |
|
|
# Add name of module to this list, currently only does verilog ones.
|
213 |
|
|
# Rule 'rtl' is called just before generating DUT modelsim compilation script
|
214 |
|
|
RTL_TO_CHECK=
|
215 |
|
|
rtl:
|
216 |
|
|
$(Q)for module in $(RTL_TO_CHECK); do \
|
217 |
|
|
$(MAKE) -C $(RTL_VERILOG_DIR)/$$module $$module.v; \
|
218 |
|
|
done
|
219 |
6 |
julius |
|
220 |
55 |
julius |
#
|
221 |
360 |
julius |
# VHDL DUT source variables
|
222 |
55 |
julius |
#
|
223 |
360 |
julius |
# VHDL modules
|
224 |
|
|
#RTL_VHDL_MODULES=$(shell ls $(RTL_VHDL_DIR))
|
225 |
|
|
# VHDL sources
|
226 |
|
|
#RTL_VHDL_SRC=$(shell for module in $(RTL_VHDL_MODULES); do if [ -d $(RTL_VHDL_DIR)/$$module ]; then ls $(RTL_VHDL_DIR)/$$module/*.vhd; fi; done)
|
227 |
|
|
#print-vhdl-src:
|
228 |
|
|
# @echo echo; echo "\t### VHDL modules and source ###"; echo
|
229 |
|
|
# @echo "modules: "; echo $(RTL_VHDL_MODULES); echo
|
230 |
|
|
# @echo "source: "$(RTL_VHDL_SRC)
|
231 |
6 |
julius |
|
232 |
40 |
julius |
|
233 |
360 |
julius |
# Testbench verilog source
|
234 |
|
|
BENCH_VERILOG_SRC=$(shell ls $(BENCH_VERILOG_DIR)/*.v | grep -v define)
|
235 |
40 |
julius |
|
236 |
360 |
julius |
# Testbench source subdirectory detection
|
237 |
|
|
BENCH_VERILOG_SRC_SUBDIRS=$(shell for file in `ls $(BENCH_VERILOG_DIR)`; do if [ -d $(BENCH_VERILOG_DIR)/$$file ]; then echo $(BENCH_VERILOG_DIR)/$$file; fi; done)
|
238 |
40 |
julius |
|
239 |
360 |
julius |
# Compile script generation rules:
|
240 |
40 |
julius |
|
241 |
360 |
julius |
modelsim_dut.scr: rtl $(RTL_VERILOG_SRC) $(RTL_VERILOG_INCLUDES) $(BOOTROM_VERILOG)
|
242 |
|
|
$(Q)echo "+incdir+"$(RTL_VERILOG_INCLUDE_DIR) > $@;
|
243 |
|
|
$(Q)echo "+incdir+"$(RTL_SIM_SRC_DIR) >> $@;
|
244 |
|
|
$(Q)echo "+incdir+"$(BOOTROM_SW_DIR) >> $@;
|
245 |
|
|
$(Q)echo "+incdir+"$(BENCH_VERILOG_DIR) >> $@;
|
246 |
|
|
$(Q)echo "+libext+.v" >> $@;
|
247 |
|
|
$(Q)for module in $(RTL_VERILOG_MODULES); do if [ -d $(RTL_VERILOG_DIR)/$$module ]; then echo "-y " $(RTL_VERILOG_DIR)/$$module >> $@; fi; done
|
248 |
|
|
$(Q)echo >> $@
|
249 |
6 |
julius |
|
250 |
360 |
julius |
modelsim_bench.scr: $(BENCH_VERILOG_SRC)
|
251 |
|
|
$(Q)echo "+incdir+"$(BENCH_VERILOG_DIR) > $@;
|
252 |
|
|
$(Q)for path in $(BENCH_VERILOG_SRC_SUBDIRS); do echo "+incdir+"$$path >> $@; done
|
253 |
|
|
$(Q)for path in $(BENCH_VERILOG_SRC_SUBDIRS); do echo "-y "$$path >> $@; done
|
254 |
|
|
$(Q)echo "+incdir+"$(RTL_VERILOG_INCLUDE_DIR) >> $@;
|
255 |
|
|
$(Q)echo "+incdir+"$(RTL_SIM_SRC_DIR) >> $@;
|
256 |
|
|
$(Q)echo "+libext+.v" >> $@;
|
257 |
|
|
$(Q)echo "-y" $(RTL_SIM_SRC_DIR) >> $@;
|
258 |
|
|
$(Q)for vsrc in $(BENCH_VERILOG_SRC); do echo $$vsrc >> $@; done
|
259 |
|
|
$(Q)echo >> $@
|
260 |
6 |
julius |
|
261 |
360 |
julius |
# Compile DUT into "work" library
|
262 |
|
|
DUT_TOP=$(RTL_VERILOG_DIR)/$(DESIGN_NAME)_top/$(DESIGN_NAME)_top.v
|
263 |
|
|
work: modelsim_dut.scr #$(RTL_VHDL_SRC)
|
264 |
|
|
$(Q)if [ ! -e $@ ]; then vlib $@; fi
|
265 |
|
|
# $(Q)echo; echo "\t### Compiling VHDL design library ###"; echo
|
266 |
|
|
# $(Q)vcom -93 $(QUIET) $(RTL_VHDL_SRC)
|
267 |
|
|
$(Q)echo; echo "\t### Compiling Verilog design library ###"; echo
|
268 |
|
|
$(Q)vlog $(QUIET) -f $< $(DUT_TOP)
|
269 |
6 |
julius |
|
270 |
360 |
julius |
# Single compile rule
|
271 |
|
|
.PHONY : $(MODELSIM)
|
272 |
|
|
$(MODELSIM): modelsim_bench.scr $(TEST_DEFINES_VLG) $(VPI_LIBS) work
|
273 |
|
|
$(Q)echo; echo "\t### Compiling testbench ###"; echo
|
274 |
|
|
$(Q)vlog $(QUIET) -nologo -incr $(BENCH_VERILOG_SRC) -f $<
|
275 |
|
|
$(Q)vopt $(QUIET) $(RTL_TESTBENCH_TOP) $(VOPT_ARGS) -o tb
|
276 |
|
|
$(Q)echo; echo "\t### Launching simulation ###"; echo
|
277 |
|
|
$(Q)vsim $(VSIM_ARGS) tb
|
278 |
6 |
julius |
|
279 |
|
|
|
280 |
360 |
julius |
#
|
281 |
|
|
# Icarus Verilog simulator build and run rules
|
282 |
|
|
#
|
283 |
|
|
.PHONY: $(ICARUS_SCRIPT)
|
284 |
|
|
$(ICARUS_SCRIPT): $(RTL_VERILOG_SRC) $(RTL_VERILOG_INCLUDES) $(BOOTROM_VERILOG) $(BENCH_VERILOG_SRC)
|
285 |
|
|
$(Q)echo "# Icarus Verilog simulation script" > $@
|
286 |
|
|
$(Q)echo "# Auto generated. Any alterations will be written over!" >> $@
|
287 |
|
|
$(Q)echo "+incdir+"$(RTL_VERILOG_INCLUDE_DIR) > $@;
|
288 |
|
|
$(Q)echo "+incdir+"$(RTL_SIM_SRC_DIR) >> $@;
|
289 |
|
|
$(Q)echo "+incdir+"$(BENCH_VERILOG_DIR) >> $@;
|
290 |
|
|
$(Q)echo "+incdir+"$(BOOTROM_SW_DIR) >> $@;
|
291 |
|
|
$(Q)for path in $(BENCH_VERILOG_SRC_SUBDIRS); do echo "+incdir+"$$path >> $@; done
|
292 |
|
|
$(Q)for path in $(BENCH_VERILOG_SRC_SUBDIRS); do echo "-y "$$path >> $@; done
|
293 |
|
|
$(Q)for module in $(RTL_VERILOG_MODULES); do echo "-y " $(RTL_VERILOG_DIR)/$$module >> $@; done
|
294 |
|
|
$(Q)echo "-y" $(RTL_SIM_SRC_DIR) >> $@;
|
295 |
|
|
$(Q)for vsrc in $(BENCH_VERILOG_SRC); do echo $$vsrc >> $@; done
|
296 |
|
|
$(Q) echo >> $@
|
297 |
6 |
julius |
|
298 |
360 |
julius |
# Icarus design compilation rule
|
299 |
|
|
$(ICARUS_SIM_EXE): $(ICARUS_SCRIPT) $(TEST_DEFINES_VLG)
|
300 |
|
|
$(Q)echo; echo "\t### Compiling ###"; echo
|
301 |
|
|
$(Q) $(ICARUS_COMPILE) -s$(RTL_TESTBENCH_TOP) -c $< -o $@
|
302 |
49 |
julius |
|
303 |
360 |
julius |
# Icarus simulation run rule
|
304 |
|
|
$(ICARUS): $(ICARUS_SIM_EXE) $(ICARUS_VPI_LIB)
|
305 |
|
|
$(Q)echo; echo "\t### Launching simulation ###"; echo
|
306 |
|
|
$(Q) $(ICARUS_RUN) $(ICARUS_VPI_ARGS) -l ../out/$(ICARUS_RUN).log $<
|
307 |
63 |
julius |
|
308 |
49 |
julius |
|
309 |
|
|
|
310 |
360 |
julius |
.PHONY: rtl-test
|
311 |
|
|
rtl-test: clean-sim-test-sw sw clean-test-defines $(TEST_DEFINES_VLG) \
|
312 |
|
|
$(SIMULATOR)
|
313 |
6 |
julius |
|
314 |
360 |
julius |
# Run an RTL test followed by checking of generated results
|
315 |
|
|
rtl-test-with-check: rtl-test
|
316 |
|
|
$(Q)$(MAKE) check-test-log; \
|
317 |
|
|
if [ $$? -ne 0 ]; then \
|
318 |
|
|
echo; echo "\t### "$(TEST)" test FAIL ###"; echo; \
|
319 |
|
|
else \
|
320 |
|
|
echo; echo "\t### "$(TEST)" test OK ###"; echo; \
|
321 |
|
|
fi
|
322 |
6 |
julius |
|
323 |
360 |
julius |
# Do check, don't print anything out
|
324 |
|
|
rtl-test-with-check-no-print: rtl-test check-test-log
|
325 |
6 |
julius |
|
326 |
360 |
julius |
# Main RTL test loop
|
327 |
|
|
.PHONY: rtl-tests
|
328 |
|
|
rtl-tests:
|
329 |
|
|
$(Q)for test in $(TESTS); do \
|
330 |
|
|
export TEST=$$test; \
|
331 |
|
|
$(MAKE) rtl-test-with-check-no-print; \
|
332 |
|
|
if [ $$? -ne 0 ]; then break; fi; \
|
333 |
|
|
echo; echo "\t### $$test test OK ###"; echo; \
|
334 |
6 |
julius |
done
|
335 |
|
|
|
336 |
|
|
|
337 |
360 |
julius |
.PHONY: check-test-log
|
338 |
|
|
check-test-log:
|
339 |
|
|
$(Q)echo "#!/bin/bash" > $@
|
340 |
|
|
$(Q)echo "function check-test-log { if [ \`grep -c -i "$(TEST_OK_STRING)" "$(RTL_SIM_RESULTS_DIR)"/"$(TEST)$(TEST_OUT_FILE_SUFFIX)"\` -gt 0 ]; then return 0; else return 1; fi; }" >> $@
|
341 |
|
|
$(Q)echo "check-test-log" >> $@
|
342 |
|
|
$(Q)chmod +x $@
|
343 |
|
|
$(Q) echo; echo "\t### Checking simulation results for "$(TEST)" test ###"; echo;
|
344 |
|
|
$(Q)./$@
|
345 |
6 |
julius |
|
346 |
|
|
|
347 |
360 |
julius |
# Test defines.v file, called recursively, .PHONY to force its generation
|
348 |
|
|
.PHONY: $(TEST_DEFINES_VLG)
|
349 |
|
|
$(TEST_DEFINES_VLG):
|
350 |
|
|
$(Q)echo "\`define "$(SIM_TYPE)"_SIM" > $@
|
351 |
|
|
$(Q)echo "\`define SIMULATOR_"`echo $(SIMULATOR) | tr "[:lower:]" "[:upper:]"` > $@
|
352 |
|
|
$(Q)echo "\`define TEST_NAME_STRING \""$(TEST)"\"" >> $@
|
353 |
|
|
$(Q)if [ ! -z $$VCD ]; \
|
354 |
|
|
then echo "\`define VCD" >> $@; \
|
355 |
|
|
fi
|
356 |
|
|
$(Q)if [ ! -z $$VCD_DELAY ]; \
|
357 |
|
|
then echo "\`define VCD_DELAY "$$VCD_DELAY >> $@; \
|
358 |
|
|
fi
|
359 |
|
|
$(Q)if [ ! -z $$VCD_DEPTH ]; \
|
360 |
|
|
then echo "\`define VCD_DEPTH "$$VCD_DEPTH >> $@; \
|
361 |
|
|
fi
|
362 |
|
|
$(Q)if [ ! -z $$VCD_DELAY_INSNS ]; \
|
363 |
|
|
then echo "\`define VCD_DELAY_INSNS "$$VCD_DELAY_INSNS >> $@; \
|
364 |
|
|
fi
|
365 |
|
|
$(Q)if [ ! -z $$END_TIME ]; \
|
366 |
|
|
then echo "\`define END_TIME "$$END_TIME >> $@; \
|
367 |
|
|
fi
|
368 |
|
|
$(Q)if [ ! -z $$END_INSNS ]; \
|
369 |
|
|
then echo "\`define END_INSNS "$$END_INSNS >> $@; \
|
370 |
|
|
fi
|
371 |
|
|
$(Q)if [ ! -z $$PRELOAD_RAM ]; \
|
372 |
|
|
then echo "\`define PRELOAD_RAM "$$END_TIME >> $@; \
|
373 |
|
|
fi
|
374 |
|
|
$(Q)if [ -z $$NO_SIM_LOGGING ]; \
|
375 |
|
|
then echo "\`define OR1200_DISPLAY_ARCH_STATE" >> $@; \
|
376 |
|
|
fi
|
377 |
|
|
$(Q)if [ ! -z $$VPI ]; \
|
378 |
|
|
then echo "\`define VPI_DEBUG" >> $@; \
|
379 |
|
|
fi
|
380 |
|
|
$(Q)if [ ! -z $$SIM_QUIET ]; \
|
381 |
|
|
then echo "\`define SIM_QUIET" >> $@; \
|
382 |
|
|
fi
|
383 |
6 |
julius |
|
384 |
|
|
|
385 |
360 |
julius |
# $(Q)for module in $(GATELEVEL_MODULES); do echo "\`define "$$module"_IS_GATELEVEL " >> $@; done
|
386 |
|
|
# More possible test defines go here
|
387 |
6 |
julius |
|
388 |
51 |
julius |
|
389 |
360 |
julius |
# Software make rules (called recursively)
|
390 |
|
|
TEST_SW_DIR=$(SW_DIR)/$(shell echo $(TEST) | cut -d "-" -f 1)
|
391 |
6 |
julius |
|
392 |
360 |
julius |
# Set PRELOAD_RAM=1 to preload the system memory, avoiding lengthy SPI FLASH
|
393 |
|
|
# bootloader process.
|
394 |
|
|
#ifeq ($(PRELOAD_RAM), 1)
|
395 |
|
|
SIM_SW_IMAGE ?=sram.vmem
|
396 |
|
|
#else
|
397 |
|
|
#SIM_SW_IMAGE ?=flash.in
|
398 |
|
|
#endif
|
399 |
6 |
julius |
|
400 |
360 |
julius |
.PHONY : sw
|
401 |
|
|
sw: $(SIM_SW_IMAGE)
|
402 |
6 |
julius |
|
403 |
360 |
julius |
flash.in: $(TEST_SW_DIR)/$(TEST).flashin
|
404 |
|
|
$(Q)if [ -L $@ ]; then unlink $@; fi
|
405 |
|
|
$(Q)ln -s $< $@
|
406 |
6 |
julius |
|
407 |
360 |
julius |
sram.vmem: $(TEST_SW_DIR)/$(TEST).vmem
|
408 |
|
|
$(Q)if [ -L $@ ]; then unlink $@; fi
|
409 |
|
|
$(Q)ln -s $< $@
|
410 |
6 |
julius |
|
411 |
360 |
julius |
.PHONY: $(TEST_SW_DIR)/$(TEST).flashin
|
412 |
|
|
$(TEST_SW_DIR)/$(TEST).flashin:
|
413 |
|
|
$(Q) echo; echo "\t### Compiling software ###"; echo;
|
414 |
|
|
$(Q)$(MAKE) -C $(TEST_SW_DIR) $(TEST).flashin
|
415 |
6 |
julius |
|
416 |
360 |
julius |
.PHONY: $(TEST_SW_DIR)/$(TEST).vmem
|
417 |
|
|
$(TEST_SW_DIR)/$(TEST).vmem:
|
418 |
|
|
$(Q) echo; echo "\t### Compiling software ###"; echo;
|
419 |
|
|
$(Q)$(MAKE) -C $(TEST_SW_DIR) $(TEST).vmem
|
420 |
63 |
julius |
|
421 |
360 |
julius |
#
|
422 |
|
|
# Cleaning rules
|
423 |
|
|
#
|
424 |
|
|
clean: clean-sim clean-sim-test-sw clean-bootrom clean-out clean-sw
|
425 |
63 |
julius |
|
426 |
360 |
julius |
clean-sim:
|
427 |
|
|
$(Q) echo; echo "\t### Cleaning simulation run directory ###"; echo;
|
428 |
|
|
$(Q)rm -rf *.* lib_* work transcript check-test-log
|
429 |
|
|
$(Q) if [ -e $(VPI_SRC_C_DIR) ]; then $(MAKE) -C $(VPI_SRC_C_DIR) clean; fi
|
430 |
6 |
julius |
|
431 |
360 |
julius |
clean-bootrom:
|
432 |
|
|
$(MAKE) -C $(BOOTROM_SW_DIR) clean
|
433 |
6 |
julius |
|
434 |
360 |
julius |
clean-out:
|
435 |
|
|
$(Q)rm -rf $(RTL_SIM_RESULTS_DIR)/*.*
|
436 |
6 |
julius |
|
437 |
360 |
julius |
clean-test-defines:
|
438 |
|
|
$(Q)rm -f $(TEST_DEFINES_VLG)
|
439 |
6 |
julius |
|
440 |
360 |
julius |
clean-sim-test-sw:
|
441 |
|
|
$(Q)if [ -e $(SIM_SW_IMAGE) ]; then unlink $(SIM_SW_IMAGE); fi
|
442 |
6 |
julius |
|
443 |
|
|
clean-sw:
|
444 |
360 |
julius |
$(Q) echo; echo "\t### Cleaning simulation sw directories ###"; echo;
|
445 |
|
|
$(Q) $(MAKE) -C $(SW_DIR)/support distclean
|
446 |
6 |
julius |
|
447 |
36 |
julius |
clean-rtl:
|
448 |
360 |
julius |
$(Q) echo; echo "\t### Cleaning generated verilog RTL ###"; echo;
|
449 |
|
|
for module in $(RTL_TO_CHECK); do \
|
450 |
|
|
$(MAKE) -C $(RTL_VERILOG_DIR)/$$module clean; \
|
451 |
|
|
done
|
452 |
44 |
julius |
|
453 |
360 |
julius |
# Removes any checked out RTL
|
454 |
|
|
distclean: clean
|
455 |
|
|
$(Q) echo; echo "\t### Cleaning generated verilog RTL ###"; echo;
|
456 |
|
|
$(Q)for module in $(RTL_TO_CHECK); do \
|
457 |
|
|
$(MAKE) -C $(RTL_VERILOG_DIR)/$$module distclean; \
|
458 |
|
|
done
|