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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [boards/] [xilinx/] [ml501/] [sim/] [bin/] [Makefile] - Blame information for rev 415

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

Line No. Rev Author Line
1 412 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
####      - Julius Baxter, julius@opencores.org                   ####
14
####                                                              ####
15
####                                                              ####
16
######################################################################
17
####                                                              ####
18
#### Copyright (C) 2009,2010 Authors and OPENCORES.ORG            ####
19
####                                                              ####
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 67 julius
 
43 412 julius
# Name of the directory we're currently in
44
CUR_DIR=$(shell pwd)
45 67 julius
 
46
# The root path of the whole project
47 412 julius
PROJECT_ROOT ?=$(CUR_DIR)/../../../../..
48 67 julius
 
49 412 julius
DESIGN_NAME=orpsoc
50
RTL_TESTBENCH_TOP=$(DESIGN_NAME)_testbench
51 67 julius
 
52 412 julius
# Hardset the board name, even though we could probably determine it
53
FPGA_VENDOR=xilinx
54
BOARD_NAME=ml501
55
BOARD_DIR=$(PROJECT_ROOT)/boards/$(FPGA_VENDOR)/$(BOARD_NAME)
56 67 julius
 
57 412 julius
# Export BOARD_PATH for the software makefiles
58
BOARD_PATH=$(BOARD_DIR)
59
export BOARD_PATH
60 67 julius
 
61 412 julius
# Paths to other important parts of this test suite
62
COMMON_RTL_DIR = $(PROJECT_ROOT)/rtl
63
COMMON_RTL_VERILOG_DIR = $(COMMON_RTL_DIR)/verilog
64
#COMMON_RTL_VHDL_DIR = $(COMMON_RTL_DIR)/vhdl
65 67 julius
 
66 412 julius
BOARD_RTL_DIR=$(BOARD_DIR)/rtl
67
BOARD_RTL_VERILOG_DIR=$(BOARD_RTL_DIR)/verilog
68
# Only 1 include path for board builds - their own!
69
BOARD_RTL_VERILOG_INCLUDE_DIR=$(BOARD_RTL_VERILOG_DIR)/include
70 67 julius
 
71 412 julius
BOARD_BENCH_DIR=$(BOARD_DIR)/bench
72
BOARD_BENCH_VERILOG_DIR=$(BOARD_BENCH_DIR)/verilog
73
BOARD_BENCH_VERILOG_INCLUDE_DIR=$(BOARD_BENCH_VERILOG_DIR)/include
74 67 julius
 
75 412 julius
COMMON_BENCH_DIR=$(PROJECT_ROOT)
76
COMMON_BENCH_VERILOG_DIR=$(COMMON_BENCH_DIR)/verilog
77
COMMON_BENCH_VERILOG_INCLUDE_DIR=$(COMMON_BENCH_VERILOG_DIR)/include
78 67 julius
 
79 412 julius
# Top level files for DUT and testbench
80
DUT_TOP=$(BOARD_RTL_VERILOG_DIR)/$(DESIGN_NAME)_top/$(DESIGN_NAME)_top.v
81
BENCH_TOP=$(BOARD_BENCH_VERILOG_DIR)/$(DESIGN_NAME)_testbench.v
82 67 julius
 
83 412 julius
# Software tests we'll run
84 67 julius
 
85 412 julius
# Need this for individual test variables to not break
86
TEST ?= or1200-simple
87 67 julius
 
88 412 julius
TESTS ?= or1200-simple or1200-cbasic or1200-dctest or1200-float or1200-mmu or1200-basic or1200-except or1200-tick or1200-ticksyscall uart-simple
89 67 julius
 
90 412 julius
# Gets turned into verilog `define
91
SIM_TYPE=RTL
92
 
93
# Main defines file is from board include path
94
PROJECT_VERILOG_DEFINES=$(BOARD_RTL_VERILOG_INCLUDE_DIR)/$(DESIGN_NAME)-defines.v
95
 
96
# Detect technology to use for the simulation
97
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 )
98
 
99
# Rule to look at what defines are being extracted from main file
100
print-defines:
101
        @echo echo; echo "\t### Design defines ###"; echo;
102
        @echo "\tParsing "$(PROJECT_VERILOG_DEFINES)" and exporting:"
103
        @echo $(DESIGN_DEFINES)
104
 
105
print-tests:
106
        @echo; echo; echo "\t### Software tests to be run ###"; echo;
107
        @echo $(TESTS)
108
        @echo
109
 
110
# Simulation directories
111
SIM_DIR ?=$(BOARD_DIR)/sim
112
RTL_SIM_DIR=$(SIM_DIR)
113
RTL_SIM_RUN_DIR=$(RTL_SIM_DIR)/run
114
RTL_SIM_BIN_DIR=$(RTL_SIM_DIR)/bin
115
RTL_SIM_RESULTS_DIR=$(RTL_SIM_DIR)/out
116
 
117
# Testbench paths
118
BOARD_BENCH_DIR=$(BOARD_DIR)/bench
119
BOARD_BENCH_VERILOG_DIR=$(BOARD_BENCH_DIR)/verilog
120
COMMON_BENCH_DIR=$(PROJECT_ROOT)/bench
121
COMMON_BENCH_VERILOG_DIR=$(COMMON_BENCH_DIR)/verilog
122
 
123
#BENCH_VHDL_DIR=$(BENCH_DIR)/vhdl
124
# No SystemC or Verilator support for this build
125
#BENCH_SYSC_DIR=$(BENCH_DIR)/sysc
126
#BENCH_SYSC_SRC_DIR=$(BENCH_SYSC_DIR)/src
127
#BENCH_SYSC_INCLUDE_DIR=$(BENCH_SYSC_DIR)/include
128
 
129
# Backend directories
130
# This one is the board build's backend dir.
131
BOARD_BACKEND_DIR=$(BOARD_DIR)/backend
132
BOARD_BACKEND_VERILOG_DIR=$(BOARD_BACKEND_DIR)/rtl/verilog
133
TECHNOLOGY_BACKEND_DIR=$(BOARD_DIR)/../backend
134
# This path is for the technology library
135
TECHNOLOGY_BACKEND_VERILOG_DIR=$(TECHNOLOGY_BACKEND_DIR)/rtl/verilog
136
 
137
# Synthesis directory for board
138
BOARD_SYN_DIR=$(BOARD_DIR)/syn/synplify
139
BOARD_SYN_OUT_DIR=$(BOARD_SYN_DIR)/out
140
 
141
# System software dir
142
COMMON_SW_DIR=$(PROJECT_ROOT)/sw
143
BOARD_SW_DIR=$(BOARD_DIR)/sw
144
 
145
# BootROM code, which generates a verilog array select values
146
BOOTROM_FILE=bootrom.v
147 415 julius
BOARD_BOOTROM_SW_DIR=$(BOARD_SW_DIR)/bootrom
148
BOOTROM_SRC=$(shell ls $(BOARD_BOOTROM_SW_DIR)/* | grep -v $(BOOTROM_FILE))
149
BOOTROM_VERILOG=$(BOARD_BOOTROM_SW_DIR)/$(BOOTROM_FILE)
150 412 julius
 
151
bootrom: $(BOOTROM_VERILOG)
152
 
153
$(BOOTROM_VERILOG): $(BOOTROM_SRC)
154
        $(Q)echo; echo "\t### Generating bootup ROM ###"; echo
155 415 julius
        $(Q)$(MAKE) -C $(BOARD_BOOTROM_SW_DIR) $(BOOTROM_FILE)
156 412 julius
 
157
# Suffix of file to check after each test for the string
158
TEST_OUT_FILE_SUFFIX=-general.log
159
TEST_OK_STRING=8000000d
160
 
161
# Dynamically generated verilog file defining configuration for various things
162
# Rule actually generating this is found in definesgen.inc file.
163
TEST_DEFINES_VLG=test-defines.v
164 415 julius
.PHONY: $(TEST_DEFINES_VLG)
165 412 julius
# Set V=1 when calling make to enable verbose output
166
# mainly for debugging purposes.
167
ifeq ($(V), 1)
168
Q=
169
QUIET=
170
else
171
Q ?=@
172
QUIET=-quiet
173
endif
174
 
175
# Modelsim variables
176
MGC_VSIM=vsim
177
MGC_VLOG_COMP=vlog
178
MGC_VHDL_COMP=vcom
179
MODELSIM=modelsim
180
 
181
# Default simulator is Modelsim here as we're using the ProASIC3
182
# libraries which are not compilable with Icarus.
183
# Set SIMULATOR=modelsim to use Modelsim (Default)
184
# Set SIMULATOR=ncverilog to use Cadence's NC-Verilog - TODO
185
# Set SIMULATOR=icarus to use Icarus Verilog (Not supported for this board)
186
 
187
SIMULATOR ?= $(MODELSIM)
188
 
189
#
190
# Modelsim-specific settings
191
#
192
VOPT_ARGS=$(QUIET) -suppress 2241
193
# If VCD dump is desired, tell Modelsim not to optimise
194
# away everything.
195 67 julius
ifeq ($(VCD), 1)
196 412 julius
#VOPT_ARGS=-voptargs="+acc=rnp"
197
VOPT_ARGS=+acc=rnpqv
198 67 julius
endif
199 412 julius
# VSIM commands
200
# Suppressed warnings - 3009: Failed to open $readmemh() file
201
# Suppressed warnings - 3009: Module 'blah' does not have a `timescale directive in effect, but previous modules do.
202
# Suppressed warnings - 8598: Non-positive replication multiplier inside concat. Replication will be ignored
203
VSIM_ARGS=  -suppress 7 -suppress 3009 -suppress 8598 -c $(QUIET) -do "set StdArithNoWarnings 1; run -all; exit"
204
# Modelsim VPI settings
205
ifeq ($(VPI), 1)
206
VPI_LIBS=$(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB)
207
VSIM_ARGS += -pli $(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB)
208
endif
209
# Rule to make the VPI library for modelsim
210
$(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB): $(VPI_SRCS)
211
        $(MAKE) -C $(VPI_SRC_C_DIR) $(MODELTECH_VPILIB)
212 67 julius
 
213 412 julius
#
214
# Verilog DUT source variables
215
#
216 67 julius
 
217 412 julius
# First consider any modules we'll use gatelevel descriptions of.
218
# These will have to be set on the command line
219
GATELEVEL_MODULES ?=
220 67 julius
 
221 412 julius
# First we get a list of modules in the RTL path of the board's path.
222
# Next we check which modules not in the board's RTL path are in the root RTL
223
# path (modules which can be commonly instantiated, but over which board
224
# build-specific versions take precedence.)
225 67 julius
 
226 412 julius
# Paths under board/***/rtl/verilog we wish to exclude when getting modules
227
BOARD_VERILOG_MODULES_EXCLUDE= include $(GATELEVEL_MODULES)
228
BOARD_VERILOG_MODULES_DIR_LIST=$(shell ls $(BOARD_RTL_VERILOG_DIR))
229
# Apply exclude to list of modules
230
BOARD_RTL_VERILOG_MODULES=$(filter-out $(BOARD_VERILOG_MODULES_EXCLUDE),$(BOARD_VERILOG_MODULES_DIR_LIST))
231 67 julius
 
232 412 julius
# Rule for debugging this script
233
print-board-modules:
234
        @echo echo; echo "\t### Board verilog modules ###"; echo
235
        @echo $(BOARD_RTL_VERILOG_MODULES)
236 67 julius
 
237 412 julius
# Now get list of modules that we don't have a version of in the board path
238
COMMON_VERILOG_MODULES_EXCLUDE= include
239
COMMON_VERILOG_MODULES_EXCLUDE += $(BOARD_RTL_VERILOG_MODULES)
240
COMMON_VERILOG_MODULES_EXCLUDE += $(GATELEVEL_MODULES)
241
 
242
COMMON_RTL_VERILOG_MODULES_DIR_LIST=$(shell ls $(COMMON_RTL_VERILOG_DIR))
243
COMMON_RTL_VERILOG_MODULES=$(filter-out $(COMMON_VERILOG_MODULES_EXCLUDE), $(COMMON_RTL_VERILOG_MODULES_DIR_LIST))
244
 
245
 
246
# Add these to exclude their RTL directories from being included in scripts
247
 
248
 
249
 
250
# Rule for debugging this script
251
print-common-modules-exclude:
252
        @echo echo; echo "\t### Common verilog modules being excluded due to board versions ###"; echo
253
        @echo "$(COMMON_VERILOG_MODULES_EXCLUDE)"
254
 
255
print-common-modules:
256
        @echo echo; echo "\t###  Verilog modules from common RTL dir ###"; echo
257
        @echo $(COMMON_RTL_VERILOG_MODULES)
258
 
259
# List of verilog source files (only .v files!)
260
# Board RTL modules first
261
RTL_VERILOG_SRC=$(shell for module in $(BOARD_RTL_VERILOG_MODULES); do if [ -d $(BOARD_RTL_VERILOG_DIR)/$$module ]; then ls $(BOARD_RTL_VERILOG_DIR)/$$module/*.v; fi; done)
262
# Common RTL module source
263
RTL_VERILOG_SRC +=$(shell for module in $(COMMON_RTL_VERILOG_MODULES); do if [ -d $(COMMON_RTL_VERILOG_DIR)/$$module ]; then ls $(COMMON_RTL_VERILOG_DIR)/$$module/*.v; fi; done)
264
 
265
# List of verilog includes from board RTL path - only for rule sensitivity
266
RTL_VERILOG_INCLUDES=$(shell ls $(BOARD_RTL_VERILOG_INCLUDE_DIR)/*.*)
267
 
268
print-verilog-src:
269
        @echo echo; echo "\t### Verilog source ###"; echo
270
        @echo $(RTL_VERILOG_SRC)
271
 
272
# Rules to make RTL we might need
273
# Expects modules, if they need making, to have their top verilog file to
274
# correspond to their module name, and the directory should have a make file
275
# and rule which works for this command.
276
# Add name of module to this list, currently only does verilog ones.
277
# Rule 'rtl' is called just before generating DUT modelsim compilation script
278
RTL_TO_CHECK=
279
rtl:
280
        $(Q)for module in $(RTL_TO_CHECK); do \
281
                $(MAKE) -C $(RTL_VERILOG_DIR)/$$module $$module.v; \
282
        done
283
 
284
#
285
# VHDL DUT source variables
286
#
287
# VHDL modules
288
#RTL_VHDL_MODULES=$(shell ls $(RTL_VHDL_DIR))
289
# VHDL sources
290
#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)
291
#print-vhdl-src:
292
#       @echo echo; echo "\t### VHDL modules and source ###"; echo
293
#       @echo "modules: "; echo $(RTL_VHDL_MODULES); echo
294
#       @echo "source: "$(RTL_VHDL_SRC)
295
 
296
#
297
# Testbench source
298
#
299
BOARD_BENCH_VERILOG_SRC=$(shell ls $(BOARD_BENCH_VERILOG_DIR)/*.v | grep -v $(DESIGN_NAME)_testbench )
300
BOARD_BENCH_VERILOG_SRC_FILES=$(notdir $(BOARD_BENCH_VERILOG_SRC))
301
 
302
# Now only take the source from the common path that we don't already have in
303
# our board's
304
COMMON_BENCH_VERILOG_DIR_LS=$(shell ls $(COMMON_BENCH_VERILOG_DIR)/*.v)
305
COMMON_BENCH_VERILOG_SRC_FILES=$(notdir $(COMMON_BENCH_VERILOG_DIR_LS))
306
COMMON_BENCH_VERILOG_SRC_FILTERED=$(filter-out $(BOARD_BENCH_VERILOG_SRC_FILES) $(DESIGN_NAME)_testbench.v,$(COMMON_BENCH_VERILOG_SRC_FILES))
307
COMMON_BENCH_VERILOG_SRC=$(addprefix $(COMMON_BENCH_VERILOG_DIR)/, $(COMMON_BENCH_VERILOG_SRC_FILTERED))
308
 
309
print-board-bench-src:
310
        $(Q)echo "\tBoard bench verilog source"; \
311
        echo $(BOARD_BENCH_VERILOG_SRC)
312
 
313
print-common-bench-src:
314
        $(Q)echo "\Common bench verilog source"; \
315
        echo $(COMMON_BENCH_VERILOG_SRC)
316
 
317
# Testbench source subdirectory detection (exclude include, we always use
318
# board bench include directory!)
319
BOARD_BENCH_VERILOG_SUBDIRS=$(shell cd $(BOARD_BENCH_VERILOG_DIR) && ls -d */ | grep -v include)
320
COMMON_BENCH_VERILOG_SUBDIRS=$(shell cd $(COMMON_BENCH_VERILOG_DIR) && ls -d */ | grep -v include)
321
 
322
# Get rid of ones we have a copy of locally
323
COMMON_BENCH_VERILOG_SUBDIRS_EXCLUDE_BOARDS=$(filter-out $(BOARD_BENCH_VERILOG_SUBDIRS),$(COMMON_BENCH_VERILOG_SUBDIRS))
324
 
325
# Construct list of paths we will want to include
326
BENCH_VERILOG_SUBDIRS=$(addprefix $(COMMON_BENCH_VERILOG_DIR)/,$(COMMON_BENCH_VERILOG_SUBDIRS_EXCLUDE_BOARDS))
327
BENCH_VERILOG_SUBDIRS += $(addprefix $(BOARD_BENCH_VERILOG_DIR)/,$(BOARD_BENCH_VERILOG_SUBDIRS))
328
 
329
# Finally, add include path from local bench path
330
BENCH_VERILOG_SUBDIRS += $(BOARD_BENCH_VERILOG_DIR)/include
331
 
332
print-board-bench-subdirs:
333
        $(Q)echo "\tBoard bench subdirectories"; \
334
        echo $(BOARD_BENCH_VERILOG_SUBDIRS)
335
 
336
print-common-bench-subdirs:
337
        $(Q)echo "\tCommon bench subdirectories"; \
338
        echo $(COMMON_BENCH_VERILOG_SUBDIRS)
339
 
340
print-bench-subdirs:
341
        $(Q)echo "\tBench subdirectories"; \
342
        echo $(BENCH_VERILOG_SUBDIRS)
343
 
344
 
345
# Backend technology library files
346
# We don't do this for the board backend stuff - that should all be properly
347
# named, and so we only need to pass the "-y" option for that path.
348
BOARD_BACKEND_VERILOG_SRC=$(shell ls $(BOARD_BACKEND_VERILOG_DIR)/*.v )
349
 
350
#
351
# Compile script generation rules:
352
#
353
 
354
# Modelsim library compilation rules
355
#       $(Q)echo "-y " $(BOARD_BACKEND_VERILOG_DIR) >> $@;
356
# DUT compile script
357
modelsim_dut.scr: rtl $(RTL_VERILOG_SRC) $(RTL_VERILOG_INCLUDES) $(BOOTROM_VERILOG)
358
        $(Q)echo "+incdir+"$(BOARD_RTL_VERILOG_INCLUDE_DIR) > $@;
359 415 julius
        $(Q)echo "+incdir+"$(BOARD_BOOTROM_SW_DIR) >> $@;
360 412 julius
        $(Q)echo "+incdir+"$(BOARD_BENCH_VERILOG_INCLUDE_DIR) >> $@;
361
        $(Q)echo "+libext+.v" >> $@;
362
        $(Q)for module in $(BOARD_RTL_VERILOG_MODULES); do if [ -d $(BOARD_RTL_VERILOG_DIR)/$$module ]; then echo "-y " $(BOARD_RTL_VERILOG_DIR)/$$module >> $@; fi; done
363
        $(Q)for module in $(COMMON_RTL_VERILOG_MODULES); do if [ -d $(COMMON_RTL_VERILOG_DIR)/$$module ]; then echo "-y " $(COMMON_RTL_VERILOG_DIR)/$$module >> $@; fi; done
364
        $(Q)echo "-y "$(TECHNOLOGY_BACKEND_VERILOG_DIR)"/src/unisims" >> $@;
365
        $(Q)echo "-y "$(TECHNOLOGY_BACKEND_VERILOG_DIR)"/src/XilinxCoreLib" >> $@;
366
        $(Q)if [ ! -z "$$GATELEVEL_MODULES" ]; \
367
                then echo "-y " $(BOARD_SYN_OUT_DIR) >> $@; \
368
                echo "+libext+.vm" >> $@; \
369 67 julius
        fi
370 412 julius
        $(Q)echo >> $@
371 67 julius
 
372 412 julius
modelsim_bench.scr: $(BOARD_BENCH_VERILOG_SRC) $(COMMON_BENCH_VERILOG_SRC)
373
        $(Q)echo "+incdir+"$(BOARD_BENCH_VERILOG_INCLUDE_DIR) > $@;
374
        $(Q)echo "+incdir+"$(COMMON_BENCH_VERILOG_INCLUDE_DIR) >> $@;
375
        $(Q)for path in $(BENCH_VERILOG_SUBDIRS); do echo "+incdir+"$$path >> $@; done
376
        $(Q)for path in $(BENCH_VERILOG_SUBDIRS); do echo "-y "$$path >> $@; done
377
        $(Q)echo "+incdir+"$(BOARD_RTL_VERILOG_INCLUDE_DIR) >> $@;
378
        $(Q)echo "+libext+.v" >> $@;
379
        $(Q)echo "+incdir+"$(TECHNOLOGY_BACKEND_VERILOG_DIR)"/src" >> $@;
380
        $(Q)for vsrc in $(BOARD_BENCH_VERILOG_SRC); do echo $$vsrc >> $@; done
381
        $(Q)for vsrc in $(COMMON_BENCH_VERILOG_SRC); do echo $$vsrc >> $@; done
382
        $(Q)echo >> $@
383 67 julius
 
384 412 julius
# Modelsim library compilation rules
385 67 julius
 
386 412 julius
# Compile DUT into "work" library
387
work: modelsim_dut.scr
388
        $(Q)if [ ! -e $@ ]; then vlib $@; fi
389
        $(Q)echo; echo "\t### Compiling Verilog design library ###"; echo
390
        $(Q)vlog $(QUIET) -f $< $(DUT_TOP)
391
#       $(Q)echo; echo "\t### Compiling VHDL design library ###"; echo
392
#       $(Q)vcom -93 $(QUIET) $(RTL_VHDL_SRC)
393 67 julius
 
394 412 julius
# Single compile rule
395
.PHONY : $(MODELSIM)
396
$(MODELSIM): modelsim_bench.scr $(TEST_DEFINES_VLG) $(VPI_LIBS) work
397
        $(Q)echo; echo "\t### Compiling Xilinx support libs, user design & testbench ###"; echo
398
        $(Q)vlog $(QUIET) -nologo -incr $(BENCH_TOP) -f $<
399
        $(Q)vopt $(QUIET) glbl $(RTL_TESTBENCH_TOP) $(VOPT_ARGS) -o tb
400
        $(Q)echo; echo "\t### Launching simulation ###"; echo
401
        $(Q)vsim $(VSIM_ARGS) tb
402 67 julius
 
403
 
404 412 julius
.PHONY: rtl-test
405
rtl-test: clean-sim-test-sw sw clean-test-defines $(TEST_DEFINES_VLG) \
406
        $(SIMULATOR)
407 67 julius
 
408 412 julius
# Run an RTL test followed by checking of generated results
409
rtl-test-with-check: rtl-test
410
        $(Q)$(MAKE) check-test-log; \
411
        if [ $$? -ne 0 ]; then \
412
                echo; echo "\t### "$(TEST)" test FAIL ###"; echo; \
413
        else \
414
                echo; echo "\t### "$(TEST)" test OK ###"; echo; \
415
        fi
416
 
417
# Do check, don't print anything out
418
rtl-test-with-check-no-print: rtl-test check-test-log
419
 
420
# Main RTL test loop
421
rtl-tests:
422
        $(Q)for test in $(TESTS); do \
423
                export TEST=$$test; \
424
                $(MAKE) rtl-test-with-check-no-print; \
425
                if [ $$? -ne 0 ]; then break; fi; \
426
                echo; echo "\t### $$test test OK ###"; echo; \
427
        done
428
 
429
 
430
.PHONY: check-test-log
431
check-test-log:
432
        $(Q)echo "#!/bin/bash" > $@
433
        $(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; }" >> $@
434
        $(Q)echo "check-test-log" >> $@
435
        $(Q)chmod +x $@
436
        $(Q) echo; echo "\t### Checking simulation results for "$(TEST)" test ###"; echo;
437
        $(Q)./$@
438
 
439
# Include the test-defines.v generation rule
440
include $(PROJECT_ROOT)/sim/bin/definesgen.inc
441
 
442
#
443
# Software make rules (called recursively)
444
#
445
 
446
# Path for the current test
447
# First check for a local copy of the test. If it doesn't exist then we
448
# default to the software tests in the root directory
449
TEST_MODULE=$(shell echo $(TEST) | cut -d "-" -f 1)
450
BOARD_SW_TEST_DIR=$(BOARD_SW_DIR)/tests/$(TEST_MODULE)/sim
451
COMMON_SW_TEST_DIR=$(COMMON_SW_DIR)/tests/$(TEST_MODULE)/sim
452
# Do this by testing for the file's existence
453
SW_TEST_DIR=$(shell if [ -e $(BOARD_SW_TEST_DIR)/$(TEST).[cS] ]; then echo $(BOARD_SW_TEST_DIR); else echo $(COMMON_SW_TEST_DIR); fi)
454
 
455
print-test-sw-dir:
456
        @echo; echo "\tTest software is in the following path"; echo;
457
        @echo $(BOARD_SW_DIR); echo;
458
        @echo $(BOARD_SW_TEST_DIR); echo;
459
        @echo $(SW_TEST_DIR); echo;
460
 
461
print-sw-tests:
462
        $(Q) $(MAKE) -C $(COMMON_SW_DIR)/lib print-sw-tests
463
        $(Q) $(MAKE) -C $(COMMON_SW_DIR)/lib print-sw-tests-subdirs
464
 
465
 
466
# Name of the image the RAM model will attempt to load via Verilog $readmemh
467
# system function.
468
 
469
# Set PRELOAD_RAM=1 to preload the system memory - be sure the bootROM program
470
# chosen in board.h is the one booting from the reset vector.
471
ifeq ($(PRELOAD_RAM), 1)
472
SIM_SW_IMAGE ?=sram.vmem
473
else
474
SIM_SW_IMAGE ?=flash.in
475
endif
476
 
477 415 julius
# Amount to pad the image we'll load into the SPI flash
478
HEX_IMAGE_PADDING ?=0x1c0000
479
 
480 412 julius
.PHONY : sw
481
sw: $(SIM_SW_IMAGE)
482
 
483
 
484
flash.in: $(SW_TEST_DIR)/$(TEST).flashin
485
        $(Q)if [ -L $@ ]; then unlink $@; fi
486
        $(Q)ln -s $< $@
487
 
488
sram.vmem: $(SW_TEST_DIR)/$(TEST).vmem
489
        $(Q)if [ -L $@ ]; then unlink $@; fi
490
        $(Q)ln -s $< $@
491
 
492
.PHONY: $(SW_TEST_DIR)/$(TEST).flashin
493
$(SW_TEST_DIR)/$(TEST).flashin:
494
        $(Q) echo; echo "\t### Compiling software ###"; echo;
495 415 julius
        $(Q)$(MAKE) -C $(SW_TEST_DIR) $(TEST).flashin \
496
                HEX_IMAGE_PADDING=$(HEX_IMAGE_PADDING)
497 412 julius
 
498
.PHONY: $(SW_TEST_DIR)/$(TEST).vmem
499
$(SW_TEST_DIR)/$(TEST).vmem:
500
        $(Q) echo; echo "\t### Compiling software ###"; echo;
501
        $(Q)$(MAKE) -C $(SW_TEST_DIR) $(TEST).vmem
502
 
503
# Create test software disassembly
504
 
505
sw-dis: $(SW_TEST_DIR)/$(TEST).dis
506
        $(Q)cp -v $< .
507
 
508
$(SW_TEST_DIR)/$(TEST).dis:
509
        $(Q)$(MAKE) -C $(SW_TEST_DIR) $(TEST).dis
510
 
511
#
512
# Cleaning rules
513
#
514
clean: clean-sim clean-sim-test-sw clean-bootrom clean-out clean-sw
515
 
516
clean-sim:
517
        $(Q) echo; echo "\t### Cleaning simulation run directory ###"; echo;
518
        $(Q)rm -rf *.* lib_* work transcript check-test-log
519
# No VPI support for now.       $(Q) if [ -e $(VPI_SRC_C_DIR) ]; then $(MAKE) -C $(VPI_SRC_C_DIR) clean; fi
520
 
521
clean-bootrom:
522 415 julius
        $(MAKE) -C $(BOARD_BOOTROM_SW_DIR) clean
523 412 julius
 
524
clean-out:
525
        $(Q)rm -rf $(RTL_SIM_RESULTS_DIR)/*.*
526
 
527
clean-test-defines:
528
        $(Q)rm -f $(TEST_DEFINES_VLG)
529
 
530
clean-sim-test-sw:
531
        $(Q)if [ -e $(SIM_SW_IMAGE) ]; then unlink $(SIM_SW_IMAGE); fi
532
 
533
clean-sw:
534
        $(Q) echo; echo "\t### Cleaning simulation sw directories ###"; echo;
535
        $(Q) $(MAKE) -C $(COMMON_SW_DIR)/lib clean-all
536
 
537
clean-rtl:
538
        $(Q) echo; echo "\t### Cleaning generated verilog RTL ###"; echo;
539
        for module in $(RTL_TO_CHECK); do \
540
                $(MAKE) -C $(RTL_VERILOG_DIR)/$$module clean; \
541
        done
542
 
543
# Removes any checked out RTL
544
distclean: clean
545
        $(Q) echo; echo "\t### Cleaning generated verilog RTL ###"; echo;
546
        $(Q)for module in $(RTL_TO_CHECK); do \
547
                $(MAKE) -C $(RTL_VERILOG_DIR)/$$module distclean; \
548
        done

powered by: WebSVN 2.1.0

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