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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [sim/] [bin/] [Makefile] - Blame information for rev 170

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

Line No. Rev Author Line
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
####    * Test if each software test file gets made properly      ####
12
####      before it's run in whatever model we're using           ####
13
####    * Expand software test-suite (uClibc, ecos tests, LTP?)   ####
14
####                                                              ####
15
####  Author(s):                                                  ####
16
####      - jb, jb@orsoc.se                                       ####
17
####                                                              ####
18
####                                                              ####
19
######################################################################
20
####                                                              ####
21
#### Copyright (C) 2009 Authors and OPENCORES.ORG                 ####
22
####                                                              ####
23
#### This source file may be used and distributed without         ####
24
#### restriction provided that this copyright statement is not    ####
25
#### removed from the file and that any derivative work contains  ####
26
#### the original copyright notice and the associated disclaimer. ####
27
####                                                              ####
28
#### This source file is free software; you can redistribute it   ####
29
#### and/or modify it under the terms of the GNU Lesser General   ####
30
#### Public License as published by the Free Software Foundation; ####
31
#### either version 2.1 of the License, or (at your option) any   ####
32
#### later version.                                               ####
33
####                                                              ####
34
#### This source is distributed in the hope that it will be       ####
35
#### useful, but WITHOUT ANY WARRANTY; without even the implied   ####
36
#### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ####
37
#### PURPOSE.  See the GNU Lesser General Public License for more ####
38
#### details.                                                     ####
39
####                                                              ####
40
#### You should have received a copy of the GNU Lesser General    ####
41
#### Public License along with this source; if not, download it   ####
42
#### from http://www.opencores.org/lgpl.shtml                     ####
43
####                                                              ####
44
######################################################################
45
 
46
# Usage:
47
#
48
#       make rtl-tests
49
#
50
#       Run the software tests in the RTL model of the ORPSoC being
51 55 julius
#       simulated with an event-driven simulator like Icarus. It's also
52
#       possible to use Modelsim's vsim and Cadence's Verilog simulators.
53 6 julius
#
54
#       make vlt-tests
55
#
56
#       Run all the software tests in the RTL model which has been
57
#       converted into a cycle-accurate SystemC model with Verilator.
58
#
59
#       make sim-tests
60
#
61
#       Run all the software tests in the architectural simulator
62
#
63 40 julius
#
64
# Debugging modes:
65
#
66
#       make rtl-debug
67
#
68
#       Enable a GDB stub integrated into the simulation via VPI. This will
69
#       start a simulation, then the GDB server, and allow the user to connect
70
#       using the OpenRISC GDB port. It should provide the same functionality
71
#       as GDB to a physical target, although a little slower.
72
#       It is provided here as an example of how to compile and run an OpenRISC
73
#       model at RTL level with support for debugging from GDB.
74
#       UART output from printf() is enabled by default. The model loads with
75
#       the dhrystone test running as default, but can be changed by defining
76
#       VPI_TEST_SW at the command line. Logging of the processor's execution
77
#       is also disabled by default to speed up simulation.
78
#
79 6 julius
 
80
# Simulation results:
81
#
82
# The results and output of the event-driven simulations are in the
83
# results path, in parallel to the simulation run and bin paths.
84
 
85
# Specific tests:
86
#
87
# To run an individual test, specify it in the variable TESTS when
88
# calling make, eg:
89
#
90
#        make rtl-tests TESTS="mmu-nocache mul-idcd-O2"
91
 
92
# UART printf:
93
#
94
# It is possible to enable printf to the console via the UART when
95
# running the event-driven simulators. To do this define UART_PRINTF=1
96
# when calling make. The SystemC cycle-acccurate model uses this by
97
# default.
98
# Also note when switching between runs with and without UART printf
99
# enabled, run a clean-sw so the library files are recompiled when
100
# the tests are run - this is not done automatically.
101
 
102
# VCDs:
103
#
104
# VCD (value change dumps, usable in a waveform viewer, such as gtkwave
105
# to inspect the internals of the system graphically) files can be
106
# generated by defining a variable VCD, eg.
107
#
108
#       make rtl-tests VCD=1
109
#
110
# and a dump file will be created in the simulation results directory,
111
# and named according to the test run which generated it. This is
112
# possible for both event-driven and cycle-accurate simulations.
113
# However the cycle-accurate
114
 
115
# NO_SIM_LOGGING:
116
#
117
# It is possible to speed up the event-driven simulation slightly by
118
# disabling log output of the processor's state to files by defining
119
# NO_SIM_LOGGING, eg:
120
#
121
#       make rtl-tests TESTS=except-icdc NO_SIM_LOGGING=1
122
#
123
 
124
# Cleaning:
125
# A simple "make clean" cleans everything - software and all temporary
126
# simulation files and directories. To clean just the software run:
127
#
128
#       make clean-sw
129
#
130
# and to clean just the temporary simulation files (including VCDs,
131
# results logs - everything under, and including, sim/results/, run
132
#
133
#       make clean-sim
134
#
135
 
136
# Note:
137
#
138
# The way each of the test loops is written is probably a bit overly complex
139
# but this is to save maintaining, and calling, multiple files.
140
#
141
 
142
# Model configuration:
143
#
144
# Currently, the ORPSoCv2, by default, contains an internal SRAM (configurable
145
# size - check the defparam in rtl/verilog/orpsoc_top.v), standard OR1200 (check
146
# the config in rtl/verilog/or1200_defines.v) and UART.
147
# Switches can be passed to enable certain parts of the design if testing with
148
# these is desired.
149
#
150
# SDRAM and controller
151
#
152
# To enable the use of SDRAM, define USE_SDRAM when calling the sim -this
153
# only has an effect in the event-driven simulators as the external SDRAM model
154
# is not availble in SystemC format. eg:
155
#
156
#       make rtl-tests USE_SDRAM=1
157
#
158
# This not only enables SDRAM but also enables the booting from external SPI
159
# interfaced flash memory. This causes significant increase in the time taken
160
# for simulation as the program to test is first loaded out of SPI flash memory
161
# and into SDRAM before it is executed. Although this more closely mimics the
162
# behaviour of the hardware, for simulation purposes it is purely time-consuming
163
# however it may be useful to track down any problems with this boot-loading
164 43 julius
# process. Therefore, becuase it enables SDRAM memory, it also enables the flash
165 6 julius
# memory model and SPI controller inside ORPSoC.
166
#
167
# Ethernet
168
#
169
# Ethernet is disabled by default. This is due to the fact that it is not
170
# supported in the verilator/systemC model. Also, there is currently no software
171
# which tests it in any meaningful way.
172
#
173
 
174
#
175
# Event-driven simulation compilation
176
#
177
# The way the event-driven simulations are compiled is simply using the
178
# configuration script file in this directory, currently called icarus.scr -
179
# however it is first processesed to replace the variables, beginning with $'s,
180
# with the appropriate paths. Instead of naming each file to be compiled, the
181
# paths to be searched for each module are instead defined ( -y paths), and
182
# only the toplevel testbench and library source files are explicitly named.
183
# This simplifies the script, and also requires that the name of each verilog
184
# source file is the same as the module it contains (a good convention
185
# regardless.) In addition to the script/command file, defines are passed to
186
# the compiler via the command line in the EVENT_SIM_FLAGS variable.
187
# Additionally, a source file, test_define.v, is created with  some defines
188
# that cannot be passed to the compiled reliably (there are differences between
189
# the way, for instance, icarus and ncverilog parse strings +define+'d on the
190
# command line). This file is then included at the appropriate places.
191
# It is probably not ideal that the entire design be re-compiled for each test,
192
# but currently the design is small enough so that this doesn't cause a
193
# significant overhead, unlike the cycle-accurate model compile time.
194
#
195
 
196
#
197
# SystemC cycle-accurate model compilation
198
#
199
# A new addition to ORPSoC v2 is the cycle-accurate model. The primary enabler
200 44 julius
# behind this is verilator, which processes the RTL source and generates a c++
201
# description of the system. This c++ description is then compiled, with a
202 6 julius
# SystemC wrapper. Finally a top-level SystemC testbench instantiates the
203 44 julius
# model, and other useful modules - in this case a reset generation, UART
204 6 julius
# decoder, and monitor module are included at the top level. These additional
205 44 julius
# modules and models are written in SystemC. Finally, everything is linked with
206
# the cycle-accurate ORPSoC model to create the simulation executable. This
207
# executable is the cycle-representation of the system.
208
#
209 49 julius
# Run the resulting executable with the -h switch for usage.
210 44 julius
#
211
# The compilation is all done with the GNU c++ compiler, g++.
212
#
213
# The compilation process is a little more complicated than the event-driven
214 6 julius
# simulator. It proceeds basically by generating the makefiles for compiling
215
# the design with verilator, running these makes which produces a library
216
# containing the cycle-accurate ORPSoC design, compiling the additional
217
# top-level, and testbench, systemC models into a library, and then linking it
218
# all together into the simulation executable.
219 44 julius
#
220 6 julius
# The major advantage of the cycle-accurate model is that it is quicker, in
221
# terms of simulated cycles/second, when compared with event-driven simulators.
222
# It is, of course, less accurate in that it cannot model propegation delays.
223
# However this is usually not an issue for simulating a design which is known
224
# to synthesize and run OK. It is very useful for running complex software,
225
# such as the linux kernel and real-time OS applications, which generally
226 44 julius
# result in long simulation times.
227
#
228 6 julius
# Currently the cycle-accurate model being used doesn't contain much more than
229
# the processor and a UART, however it's exepected in future this will be
230
# expanded on and more complex software test suites will be implemented to put
231
# the system through its paces.
232
#
233 44 julius
#
234 49 julius
#
235 6 julius
 
236 44 julius
# Name of the directory we're currently in
237 6 julius
CUR_DIR=$(shell pwd)
238
 
239
# The root path of the whole project
240 67 julius
PROJECT_ROOT ?=$(CUR_DIR)/../..
241 6 julius
 
242
# Tests is only defined if it wasn't already defined when make was called
243
# This is the default list of every test that is currently possible
244
TESTS ?= basic-nocache cbasic-nocache-O2 dhry-nocache-O2 except-nocache mmu-nocache mul-nocache-O2 syscall-nocache tick-nocache uart-nocache basic-icdc cbasic-icdc-O2 dhry-icdc-O2 except-icdc mmu-icdc mul-icdc-O2 syscall-icdc tick-icdc uart-icdc
245
 
246
# Paths to other important parts of this test suite
247 67 julius
SIM_DIR ?=$(PROJECT_ROOT)/sim
248 6 julius
SIM_RUN_DIR=$(SIM_DIR)/run
249
SIM_BIN_DIR=$(SIM_DIR)/bin
250
SIM_RESULTS_DIR=$(SIM_DIR)/results
251
SIM_VLT_DIR=$(SIM_DIR)/vlt
252
BENCH_DIR=$(PROJECT_ROOT)/bench
253 67 julius
BACKEND_DIR ?=$(PROJECT_ROOT)/backend
254 6 julius
BENCH_VERILOG_DIR=$(BENCH_DIR)/verilog
255 67 julius
BENCH_TOP_VERILOG_DIR ?= $(BENCH_DIR)/verilog
256 6 julius
BENCH_SYSC_DIR=$(BENCH_DIR)/sysc
257
BENCH_SYSC_SRC_DIR=$(BENCH_SYSC_DIR)/src
258
BENCH_SYSC_INCLUDE_DIR=$(BENCH_SYSC_DIR)/include
259
RTL_VERILOG_DIR=$(PROJECT_ROOT)/rtl/verilog
260
SW_DIR=$(PROJECT_ROOT)/sw
261
 
262
ICARUS=iverilog
263
ICARUS_VVP=vvp
264 58 julius
VSIM_COMP=vlog
265
VSIM=vsim
266
NCVERILOG=ncverilog
267 77 rherveille
SILOS=silos
268 6 julius
ICARUS_COMMAND_FILE=icarus.scr
269
VLT_COMMAND_FILE=verilator.scr
270
SIM_SUCCESS_MESSAGE=deaddead
271 55 julius
MGC_COMMAND_FILE=modelsim.scr
272 6 julius
 
273
ARCH_SIM_EXE=or32-elf-sim
274
ARCH_SIM_CFG_FILE=or1ksim-orpsocv2.cfg
275
 
276 57 julius
# Set V=1 when calling make to enable verbose output
277
# mainly for debugging purposes.
278
ifeq ($(V), 1)
279
Q=
280
else
281
Q=@
282
endif
283
 
284 6 julius
# If USE_SDRAM is defined we'll add it to the simulator's defines on the
285
# command line becuase it's used by many different modules and it's easier
286
# to do it this way than make them all include a file.
287
ifdef USE_SDRAM
288 68 julius
EVENT_SIM_FLAGS +=USE_SDRAM=$(USE_SDRAM)
289 6 julius
endif
290
 
291 58 julius
# Enable ethernet if defined on the command line
292
ifdef USE_ETHERNET
293 68 julius
EVENT_SIM_FLAGS +=USE_ETHERNET=$(USE_ETHERNET) USE_ETHERNET_IO=$(USE_ETHERNET)
294 58 julius
# Extra tests we do if ethernet is enabled
295
TESTS += eth-basic eth-int
296
endif
297
 
298 68 julius
DASH_D_EVENT_SIM_FLAGS=$(shell for flag in $(EVENT_SIM_FLAGS); do echo "-D "$$flag; done)
299
PLUS_DEFINE_EVENT_SIM_FLAGS=$(shell for flag in $(EVENT_SIM_FLAGS); do echo "+define+"$$flag; done)
300
 
301 58 julius
#Default simulator is Icarus Verilog
302
# Set SIMULATOR=vsim to use Modelsim
303
# Set SIMULATOR=ncverilog to use Cadence's NC-Verilog
304
SIMULATOR ?= $(ICARUS)
305
 
306
# Set the command file to use, simulator dependent
307
ifeq ($(SIMULATOR), $(ICARUS))
308 55 julius
# Icarus Verilog Simulator
309
SIM_COMMANDFILE=$(ICARUS_COMMAND_FILE)
310
endif
311 51 julius
 
312 58 julius
ifeq ($(SIMULATOR), $(VSIM))
313
# Modelsim has own command file (it's a little more stupid than Icarus & NC)
314
SIM_COMMANDFILE=$(MGC_COMMAND_FILE)
315
endif
316
 
317
ifeq ($(SIMULATOR), $(NCVERILOG))
318
# NCVerilog uses same command file as Icarus
319
SIM_COMMANDFILE=$(ICARUS_COMMAND_FILE)
320
endif
321
 
322 77 rherveille
ifeq ($(SIMULATOR), $(SILOS))
323
# SILOS uses same command file as Icarus (this should be default)
324
SIM_COMMANDFILE=$(ICARUS_COMMAND_FILE)
325
endif
326
 
327
 
328 55 julius
GENERATED_COMMANDFILE=$(SIM_COMMANDFILE).generated
329 51 julius
 
330 55 julius
# When Modelsim is selected as simulator, we compile
331
# the ORPSoC system into one library called orpsoc and
332
# then simply re-compile the testbench and or1200_monitor
333
# whenever we run the simulation, so just that part is
334
# recompiled for every test, instead of the whole thing.
335
MGC_ORPSOC_LIB=orpsoc
336
MGC_ORPSOC_LIB_DIR=$(SIM_RUN_DIR)/$(MGC_ORPSOC_LIB)
337
 
338
# If VCD dump is desired, tell Modelsim not to optimise
339
# away everything.
340
ifeq ($(VCD), 1)
341
VOPT_ARGS=-voptargs="+acc=rnp"
342
endif
343
 
344 67 julius
# RTL testbench toplevel name
345
RTL_TESTBENCH_TOP ?= orpsoc_testbench
346
 
347 55 julius
# Simulation compile and run commands, depending on your
348 58 julius
# simulator.
349
 
350
# Icarus Verilog
351
ifeq ($(SIMULATOR), $(ICARUS))
352
# Icarus Verilog Simulator compile and run commands
353 68 julius
SIM_COMMANDCOMPILE=rm -f $(SIM_RUN_DIR)/a.out; $(ICARUS) -s$(RTL_TESTBENCH_TOP) -c $(SIM_RUN_DIR)/$(GENERATED_COMMANDFILE) $(DASH_D_EVENT_SIM_FLAGS)
354 58 julius
# Icarus Verilog run command
355
SIM_COMMANDRUN=$(ICARUS_VVP) -l $(SIM_RESULTS_DIR)/$$TEST-vvp-out.log a.out
356
endif
357
 
358
# Modelsim
359
ifeq ($(SIMULATOR), $(VSIM))
360 55 julius
# Line to compile the orpsoc design into a modelsim library.
361 68 julius
SIM_COMMANDCOMPILE=if [ ! -e work ]; then vlib work; vlib $(MGC_ORPSOC_LIB); vlog -work $(MGC_ORPSOC_LIB) -f $(SIM_RUN_DIR)/$(GENERATED_COMMANDFILE) $(PLUS_DEFINE_EVENT_SIM_FLAGS); fi
362 55 julius
# Final modelsim compile, done each time, pulling in or1200
363
# monitor and the new test_defines.v file:
364 68 julius
VSIM_COMPILE_TB=vlog +incdir+. +incdir+$(BENCH_VERILOG_DIR) -y $(BENCH_VERILOG_DIR) +libext+.v +incdir+$(BENCH_TOP_VERILOG_DIR) +incdir+$(RTL_VERILOG_DIR) +define+TEST_DEFINE_FILE $(PLUS_DEFINE_EVENT_SIM_FLAGS) $(BENCH_TOP_VERILOG_DIR)/$(RTL_TESTBENCH_TOP).v
365 55 julius
# Simulation run command:
366 67 julius
SIM_COMMANDRUN=$(VSIM_COMPILE_TB); $(VSIM) -c -quiet +nowarnTFMPC -L $(MGC_ORPSOC_LIB) $(VOPT_ARGS) -do "run -all; exit" $(RTL_TESTBENCH_TOP)
367 55 julius
endif
368
 
369 58 julius
# NCVerilog
370
ifeq ($(SIMULATOR), $(NCVERILOG))
371
SIM_COMMANDCOMPILE=echo
372
SIM_COMMANDRUN=$(NCVERILOG) -f $(SIM_RUN_DIR)/$(GENERATED_COMMANDFILE) -Q -l $(SIM_RESULTS_DIR)/$$TEST-$(NCVERILOG)-out.log $(EVENT_SIM_FLAGS)
373 6 julius
endif
374
 
375 77 rherveille
# Silos
376
ifeq ($(SIMULATOR), $(SILOS))
377
SIM_COMMANDCOMPILE=echo
378 78 rherveille
SIM_COMMANDRUN=$(SILOS) -b -w +width_mistmatches -f $(SIM_RUN_DIR)/$(GENERATED_COMMANDFILE) -l $(SIM_RESULTS_DIR)/$$TEST-$(SILOS)-out.log $(EVENT_SIM_FLAGS)
379 77 rherveille
endif
380
 
381
 
382 58 julius
# Names of memory files used in simulation
383 6 julius
SIM_FLASH_MEM_FILE="flash.in"
384
FLASH_MEM_FILE_SUFFIX="-twobyte-sizefirst.hex"
385
SIM_SRAM_MEM_FILE="sram.vmem"
386
 
387
TESTS_PASSED=0
388
TESTS_PERFORMED=0;
389
 
390
################################################################################
391 58 julius
# Event-driven simulator build rules
392 6 julius
################################################################################
393
 
394 51 julius
$(RTL_VERILOG_DIR)/components/wb_sdram_ctrl/wb_sdram_ctrl_fsm.v:
395
        @cd $(RTL_VERILOG_DIR)/components/wb_sdram_ctrl && perl fizzim.pl -encoding onehot -terse < wb_sdram_ctrl_fsm.fzm > wb_sdram_ctrl_fsm.v
396 6 julius
 
397 57 julius
.PHONY: prepare-rtl
398
prepare-rtl: $(RTL_VERILOG_DIR)/components/wb_sdram_ctrl/wb_sdram_ctrl_fsm.v
399 6 julius
 
400 55 julius
$(SIM_RUN_DIR)/$(GENERATED_COMMANDFILE): $(SIM_BIN_DIR)/$(SIM_COMMANDFILE)
401 57 julius
        $(Q)sed < $(SIM_BIN_DIR)/$(SIM_COMMANDFILE) > $(SIM_RUN_DIR)/$(GENERATED_COMMANDFILE) \
402 55 julius
                -e s!\$$BENCH_DIR!$(BENCH_VERILOG_DIR)!              \
403
                -e s!\$$RTL_DIR!$(RTL_VERILOG_DIR)!                  \
404
                -e s!\$$BACKEND_DIR!$(BACKEND_DIR)!                  \
405
                -e \\!^//.*\$$!d -e \\!^\$$!d ; \
406
        echo "+define+TEST_DEFINE_FILE=\"test_define.v\"" >> $(SIM_RUN_DIR)/$(GENERATED_COMMANDFILE); \
407
        if [ ! -z $$VCD ]; \
408
                then echo "+define+VCD" >> $(SIM_RUN_DIR)/$(GENERATED_COMMANDFILE); \
409 58 julius
                if [ $(SIMULATOR) = $(NCVERILOG) ]; \
410
                        then echo "+access+r" >> $(SIM_RUN_DIR)/$(GENERATED_COMMANDFILE); \
411
                fi; \
412 55 julius
        fi; \
413
        if [ ! -z $$UART_PRINTF ]; \
414
                then echo "+define+UART_PRINTF" >> $(SIM_RUN_DIR)/$(GENERATED_COMMANDFILE); \
415 58 julius
        fi; \
416
        if [ $(SIMULATOR) = $(NCVERILOG) ]; \
417
                then echo "+nocopyright" >> $(SIM_RUN_DIR)/$(GENERATED_COMMANDFILE); \
418
                echo "+nowarn+MACRDF" >> $(SIM_RUN_DIR)/$(GENERATED_COMMANDFILE); \
419 55 julius
        fi
420 51 julius
 
421 6 julius
ifdef UART_PRINTF
422 44 julius
TEST_SW_MAKE_OPTS="UART_PRINTF=1"
423 6 julius
endif
424
 
425 57 julius
.PHONY: prepare-sw
426
prepare-sw:
427
        $(Q)$(MAKE) -C $(SW_DIR)/support all $(TEST_SW_MAKE_OPTS)
428
        $(Q)$(MAKE) -C $(SW_DIR)/utils all
429 6 julius
 
430
# A rule with UART_PRINTF hard defined ... used by verilator make sw
431 57 julius
prepare-sw-uart-printf:
432
        $(Q)$(MAKE) -C $(SW_DIR)/support all UART_PRINTF=1 $(TEST_SW_MAKE_OPTS)
433
        $(Q)$(MAKE) -C $(SW_DIR)/utils all
434 6 julius
 
435 57 julius
prepare-dirs:
436
        $(Q)if [ ! -d $(SIM_RESULTS_DIR) ]; then mkdir -p $(SIM_RESULTS_DIR); fi
437 6 julius
 
438 55 julius
#
439
# Rough guide to how event driven simulation test loop works:
440
#
441
# 1. Compile software support programs.
442
# 2. Generate RTL compilation script file
443
# 3. For each test listed in $(TESTS), loop and
444
#       a) Compile software
445
#       b) Create appropriate image to be loaded into sim
446
#       c) Create a verilog file to be included by top level
447
#       d) Compile the RTL design
448
#       e) Run the RTL design in the chosen simulator
449
#       f) Check the output (files in ../results)
450
#
451
# Default setup is:
452
#       * Event-driven simulation with Icarus Verilog
453
#       * Internal SRAM memory, preloaded with application
454
#       * Ethernet disabled
455
#       * VCD generation disabled
456
#       * printf() via UART disabled
457
#       * Logging enabled
458
#
459
# Options:
460
#       SIMULATOR=vsim
461
#               Use Mentor Graphics Modelsim simulator
462 58 julius
#       SIMULATOR=ncverilog
463
#               Use Cadence's NC-Verilog
464 55 julius
#       USE_SDRAM=1
465
#               Enable use of SDRAM - changes boot sequence and takes
466
#               a lot longer due to application being loaded out of
467
#               external FLASH memory and into SDRAM before execution
468
#               from the SDRAM.
469
#       VCD=1
470
#               Enable VCD generation. These files are output to
471
#               ../results
472
#       USE_ETHERNET=1
473
#               Turns on ethernet core inclusion. There are currently
474
#               some tests, but not included by default. Check the sw
475
#               directory
476
#       UART_PRINTF=1
477
#               Make the software use the UART core to print out
478
#               printf() calls.
479
#       NO_SIM_LOGGING=1
480
#               Turn off generation of logging files in the ../results
481
#               directory.
482
#
483 57 julius
rtl-tests: $(SIM_RUN_DIR)/$(GENERATED_COMMANDFILE) prepare-sw prepare-rtl prepare-dirs
484 6 julius
        @echo
485
        @echo "Beginning loop that will complete the following tests: $(TESTS)"
486
        @echo
487 57 julius
        $(Q)for TEST in $(TESTS); do \
488 6 julius
                echo "################################################################################"; \
489
                echo; \
490
                echo "\t#### Current test: $$TEST ####"; echo; \
491
                echo "\t#### Compiling software ####"; echo; \
492
                CURRENT_TEST_SW_DIR=$(SW_DIR)/`echo $$TEST | cut -d "-" -f 1`; \
493
                $(MAKE) -C $$CURRENT_TEST_SW_DIR $$TEST $(TEST_SW_MAKE_OPTS); \
494
                rm -f $(SIM_RUN_DIR)/$(SIM_FLASH_MEM_FILE); \
495
                rm -f $(SIM_RUN_DIR)/$(SIM_SRAM_MEM_FILE); \
496
                ln -s $$CURRENT_TEST_SW_DIR/$$TEST$(FLASH_MEM_FILE_SUFFIX) $(SIM_RUN_DIR)/$(SIM_FLASH_MEM_FILE); \
497
                ln -s $$CURRENT_TEST_SW_DIR/$$TEST.vmem $(SIM_RUN_DIR)/$(SIM_SRAM_MEM_FILE); \
498 55 julius
                echo "\`define TEST_NAME_STRING \"$$TEST\"" > $(SIM_RUN_DIR)/test_define.v; \
499
                echo "\`define TEST_RESULTS_DIR \"$(SIM_RESULTS_DIR)/\" " >> $(SIM_RUN_DIR)/test_define.v; \
500 6 julius
                if [ ! -z $$VCD ]; \
501 55 julius
                        then echo "\`define VCD" >> $(SIM_RUN_DIR)/test_define.v; \
502 6 julius
                fi; \
503
                if [ ! -z $$UART_PRINTF ]; \
504 55 julius
                        then echo "\`define UART_PRINTF" >> $(SIM_RUN_DIR)/test_define.v; \
505 6 julius
                fi; \
506 44 julius
                if echo $$TEST | grep -q -i ^eth; then \
507
                        echo "\`define ENABLE_ETH_STIM" >> $(SIM_RUN_DIR)/test_define.v; \
508
                        echo "\`define ETH_PHY_VERBOSE" >> $(SIM_RUN_DIR)/test_define.v; \
509
                fi; \
510 43 julius
                if [ -z $$NO_SIM_LOGGING ]; then \
511 6 julius
                        echo "\`define OR1200_DISPLAY_ARCH_STATE" >> $(SIM_RUN_DIR)/test_define.v; \
512
                fi; \
513
                echo ; \
514
                echo "\t#### Compiling RTL ####"; \
515 55 julius
                $(SIM_COMMANDCOMPILE); \
516 6 julius
                echo; \
517
                echo "\t#### Beginning simulation ####"; \
518 55 julius
                time -p $(SIM_COMMANDRUN) ; \
519 78 rherveille
                if [ "$$SIMULATOR" != "$$SILOS" ]; then if [ $$? -gt 0 ]; then exit $$?; fi; fi; \
520 6 julius
                TEST_RESULT=`cat $(SIM_RESULTS_DIR)/$$TEST-general.log | grep report | grep $(SIM_SUCCESS_MESSAGE) -c`; \
521
                echo; echo "\t####"; \
522
                if [ $$TEST_RESULT -gt 0 ]; then \
523
                        echo "\t#### Test $$TEST PASSED ####";TESTS_PASSED=`expr $$TESTS_PASSED + 1`;\
524
                else    echo "\t#### Test $$TEST FAILED ####";\
525
                fi; \
526
                echo "\t####"; echo; \
527
                TESTS_PERFORMED=`expr $$TESTS_PERFORMED + 1`;\
528
        done; \
529
        echo "Test results: "$$TESTS_PASSED" out of "$$TESTS_PERFORMED" tests passed"; echo
530
 
531
################################################################################
532 40 julius
# RTL simulation in Icarus with GDB stub via VPI for debugging
533
################################################################################
534
# This compiles a version of the system which starts up the dhrystone nocache
535
# test, and launches the simulator with a VPI module that provides a GDB stub
536
# allowing the OpenRISC compatible GDB to connect and debug the system.
537
# The launched test can be changed by defining VPI_TEST_SW on the make line
538
VPI_DIR=$(BENCH_VERILOG_DIR)/vpi
539
VPI_C_DIR=$(VPI_DIR)/c
540
VPI_VERILOG_DIR=$(VPI_DIR)/verilog
541
VPI_LIB_NAME=jp_vpi
542
ICARUS_VPI_OPTS=-M$(VPI_C_DIR) -m$(VPI_LIB_NAME)
543
VPI_TEST_SW ?= dhry-nocache-O2
544
 
545 57 julius
prepare-vpi:
546 40 julius
## Build the VPI library
547
        $(MAKE) -C $(VPI_C_DIR) $(VPI_LIB_NAME)
548
 
549 49 julius
clean-vpi:
550 40 julius
        $(MAKE) -C $(VPI_C_DIR) clean
551
 
552 57 julius
rtl-debug: prepare-sw-uart-printf prepare-rtl prepare-vpi prepare-dirs
553 40 julius
## Prepare the software for the test
554
        @echo "\t#### Compiling software ####"; echo; \
555
        CURRENT_TEST_SW_DIR=$(SW_DIR)/`echo $(VPI_TEST_SW) | cut -d "-" -f 1`; \
556
        $(MAKE) -C $$CURRENT_TEST_SW_DIR $(VPI_TEST_SW) $(TEST_SW_MAKE_OPTS); \
557
        rm -f $(SIM_RUN_DIR)/$(SIM_FLASH_MEM_FILE); \
558
        rm -f $(SIM_RUN_DIR)/$(SIM_SRAM_MEM_FILE); \
559
        ln -s $$CURRENT_TEST_SW_DIR/$(VPI_TEST_SW)$(FLASH_MEM_FILE_SUFFIX) $(SIM_RUN_DIR)/$(SIM_FLASH_MEM_FILE); \
560
        ln -s $$CURRENT_TEST_SW_DIR/$(VPI_TEST_SW).vmem $(SIM_RUN_DIR)/$(SIM_SRAM_MEM_FILE)
561
## Generate the icarus script we'll compile with
562 57 julius
        $(Q)sed < $(SIM_BIN_DIR)/$(ICARUS_COMMAND_FILE) > $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated \
563 40 julius
                -e s!\$$BENCH_DIR!$(BENCH_VERILOG_DIR)!              \
564
                -e s!\$$RTL_DIR!$(RTL_VERILOG_DIR)!                  \
565
                -e s!\$$BACKEND_DIR!$(BACKEND_DIR)!                  \
566
                -e \\!^//.*\$$!d -e \\!^\$$!d
567
## Add a couple of extra defines to the icarus compile script
568 57 julius
        $(Q)echo "+define+TEST_DEFINE_FILE=\"test_define.v\"" >> $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated
569 40 julius
## The define that enables the VPI debug module
570 57 julius
        $(Q)echo "+define+VPI_DEBUG_ENABLE" >> $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated
571
        $(Q)if [ ! -z $$VCD ];then echo "+define+VCD" >> $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated;fi
572 40 julius
## Unless NO_UART_PRINTF=1 we use printf via the UART
573 57 julius
        $(Q)if [ -z $$NO_UART_PRINTF ];then echo "+define+UART_PRINTF" >> $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated; fi
574
        $(Q)echo "\`define TEST_NAME_STRING \"$(VPI_TEST_SW)-vpi\"" > $(SIM_RUN_DIR)/test_define.v
575
        $(Q)echo "\`define TEST_RESULTS_DIR \"$(SIM_RESULTS_DIR)/\" " >> $(SIM_RUN_DIR)/test_define.v
576
        $(Q)if [ -z $$NO_SIM_LOGGING ]; then echo "\`define OR1200_DISPLAY_ARCH_STATE" >> $(SIM_RUN_DIR)/test_define.v; fi
577 40 julius
        @echo
578
        @echo "\t#### Compiling RTL ####"
579 57 julius
        $(Q)rm -f $(SIM_RUN_DIR)/a.out
580 67 julius
        $(Q)$(ICARUS) -s$(RTL_TESTBENCH_TOP) -c $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated $(EVENT_SIM_FLAGS)
581 40 julius
        @echo
582
        @echo "\t#### Beginning simulation with VPI debug module enabled ####"; echo
583 57 julius
        $(Q)$(ICARUS_VVP) $(ICARUS_VPI_OPTS) -l $(SIM_RESULTS_DIR)/$(VPI_TEST_SW)-vvp-out.log a.out
584 40 julius
 
585
################################################################################
586 6 julius
# Verilator model build rules
587
################################################################################
588
 
589
 
590
SYSC_LIB_ARCH_DIR=$(shell ls $$SYSTEMC | grep "lib-")
591
 
592
 
593
# List of System C models - use this list to link the sources into the Verilator
594
# build directory
595 51 julius
SYSC_MODELS=OrpsocAccess MemoryLoad
596 6 julius
 
597 49 julius
ifdef VLT_DEBUG
598
VLT_DEBUG_COMPILE_FLAGS = -g
599
# Enabling the following generates a TON of debugging
600
# when running verilator. Not so helpful.
601
#VLT_DEBUG_OPTIONS = --debug --dump-tree
602
VLT_SYSC_DEBUG_DEFINE = VLT_DEBUG=1
603 6 julius
endif
604
 
605 49 julius
# If set on the command line we build the cycle accurate model which will generate verilator-specific profiling information. This is useful for checking the efficiency of the model - not really useful for checking code or the function of the model.
606
ifdef VLT_ORPSOC_PROFILING
607 63 julius
VLT_CPPFLAGS +=-pg
608 49 julius
VLT_DEBUG_OPTIONS +=-profile-cfuncs
609
else
610 63 julius
VLT_CPPFLAGS +=-fprofile-use -Wcoverage-mismatch
611 53 julius
#VLT_CPPFLAGS=-Wall
612 49 julius
endif
613
 
614 63 julius
# Set VLT_IN_GDB=1 when making if going to run the cycle accurate model executable in GDB to check suspect behavior. This also removes optimisation.
615
ifdef VLT_IN_GDB
616
VLT_CPPFLAGS +=-g -O0
617
else
618
# The default optimisation flag applied to all of the cycle accurate model files
619
VLT_CPPFLAGS +=-O3
620
endif
621
 
622 49 julius
ifdef VLT_DO_PROFILING
623 63 julius
VLT_CPPFLAGS +=-ftest-coverage -fprofile-arcs -fprofile-generate
624 49 julius
endif
625
 
626
# VCD Enabled by default when building, enable it at runtime
627
#ifdef VCD
628
VLT_FLAGS +=-trace
629
TRACE_FLAGS=-DVM_TRACE=1 -I${SYSTEMPERL}/src
630
#endif
631
 
632 6 julius
# Only need the trace target if we are tracing
633 49 julius
#ifneq (,$(findstring -trace, $(VLT_FLAGS)))
634 70 julius
VLT_TRACEOBJ = verilated_vcd_c
635 49 julius
#endif
636 6 julius
 
637
# This is the list of extra models we'll issue make commands for
638
# Included is the SystemPerl trace model
639
SYSC_MODELS_BUILD=$(SYSC_MODELS) $(VLT_TRACEOBJ)
640
 
641 63 julius
prepare-vlt: prepare-rtl vlt-model-links $(SIM_VLT_DIR)/Vorpsoc_top
642 54 julius
        @echo;echo "\tCycle-accurate model compiled successfully"
643
        @echo;echo "\tRun the executable with the -h option for usage instructions:";echo
644
        $(SIM_VLT_DIR)/Vorpsoc_top -h
645
        @echo;echo
646 6 julius
 
647
$(SIM_VLT_DIR)/Vorpsoc_top: $(SIM_VLT_DIR)/libVorpsoc_top.a $(SIM_VLT_DIR)/OrpsocMain.o
648
# Final linking of the simulation executable. Order of libraries here is important!
649
        @echo; echo "\tGenerating simulation executable"; echo
650 49 julius
        cd $(SIM_VLT_DIR) && g++ $(VLT_DEBUG_COMPILE_FLAGS) $(VLT_CPPFLAGS) -I$(BENCH_SYSC_INCLUDE_DIR) -I$(SIM_VLT_DIR) -I$(VERILATOR_ROOT)/include -I$(SYSTEMC)/include -o Vorpsoc_top -L. -L$(BENCH_SYSC_SRC_DIR) -L$(SYSTEMC)/$(SYSC_LIB_ARCH_DIR) OrpsocMain.o -lVorpsoc_top -lmodules -lsystemc
651 6 julius
 
652 51 julius
# Now compile the top level systemC "testbench" module from the systemC source path
653
$(SIM_VLT_DIR)/OrpsocMain.o: $(BENCH_SYSC_SRC_DIR)/OrpsocMain.cpp
654 6 julius
        @echo; echo "\tCompiling top level SystemC testbench"; echo
655 49 julius
        cd $(SIM_VLT_DIR) && g++ $(VLT_DEBUG_COMPILE_FLAGS) $(VLT_CPPFLAGS) $(TRACE_FLAGS) -I$(BENCH_SYSC_INCLUDE_DIR) -I$(SIM_VLT_DIR) -I$(VERILATOR_ROOT)/include -I$(SYSTEMC)/include -c $(BENCH_SYSC_SRC_DIR)/OrpsocMain.cpp
656 6 julius
 
657 57 julius
$(SIM_VLT_DIR)/libVorpsoc_top.a: $(SIM_VLT_DIR)/Vorpsoc_top__ALL.a vlt-modules-compile $(SIM_VLT_DIR)/verilated.o
658 6 julius
# Now archive all of the libraries from verilator witht he other modules we might have
659
        @echo; echo "\tArchiving libraries into libVorpsoc_top.a"; echo
660 57 julius
        $(Q)cd $(SIM_VLT_DIR) && \
661 6 julius
        cp Vorpsoc_top__ALL.a libVorpsoc_top.a && \
662
        ar rcs libVorpsoc_top.a verilated.o; \
663
        for SYSCMODEL in $(SYSC_MODELS_BUILD); do \
664
                ar rcs libVorpsoc_top.a $$SYSCMODEL.o; \
665
        done
666
 
667
$(SIM_VLT_DIR)/verilated.o:
668
        @echo; echo "\tCompiling verilated.o"; echo
669 57 julius
        $(Q)cd $(SIM_VLT_DIR) && \
670 49 julius
        export CXXFLAGS=$(VLT_DEBUG_COMPILE_FLAGS); \
671
        export USER_CPPFLAGS="$(VLT_CPPFLAGS)"; \
672
        export USER_LDDFLAGS="$(VLT_CPPFLAGS)"; \
673 6 julius
        $(MAKE) -f Vorpsoc_top.mk verilated.o
674
 
675 57 julius
.PHONY: vlt-modules-compile
676
vlt-modules-compile:
677 6 julius
# Compile the module files
678
        @echo; echo "\tCompiling SystemC models"
679 57 julius
        $(Q)cd $(SIM_VLT_DIR) && \
680 6 julius
        for SYSCMODEL in $(SYSC_MODELS_BUILD); do \
681
                echo;echo "\t$$SYSCMODEL"; echo; \
682 49 julius
                export CXXFLAGS=$(VLT_DEBUG_COMPILE_FLAGS); \
683 51 julius
                export USER_CPPFLAGS="$(VLT_CPPFLAGS) -I$(BENCH_SYSC_INCLUDE_DIR)"; \
684 49 julius
                export USER_LDDFLAGS="$(VLT_CPPFLAGS)"; \
685
                 $(MAKE) -f Vorpsoc_top.mk $$SYSCMODEL.o; \
686
        done
687 6 julius
 
688
$(SIM_VLT_DIR)/Vorpsoc_top__ALL.a: $(SIM_VLT_DIR)/Vorpsoc_top.mk
689
        @echo; echo "\tCompiling main design"; echo
690 57 julius
        $(Q)cd $(SIM_VLT_DIR) && \
691 49 julius
        export USER_CPPFLAGS="$(VLT_CPPFLAGS)"; \
692
        export USER_LDDFLAGS="$(VLT_CPPFLAGS)"; \
693 6 julius
        $(MAKE) -f Vorpsoc_top.mk Vorpsoc_top__ALL.a
694
 
695
$(SIM_VLT_DIR)/Vorpsoc_top.mk: $(SIM_VLT_DIR)/$(VLT_COMMAND_FILE).generated $(SIM_VLT_DIR)/libmodules.a
696
# Now call verilator to generate the .mk files
697
        @echo; echo "\tGenerating makefiles with Verilator"; echo
698
        cd $(SIM_VLT_DIR) && \
699 49 julius
        verilator -language 1364-2001 -Wno-lint --top-module orpsoc_top $(VLT_DEBUG_OPTIONS) -Mdir . -sc $(VLT_FLAGS) -I$(BENCH_SYSC_INCLUDE_DIR) -I$(BENCH_SYSC_SRC_DIR) -f $(VLT_COMMAND_FILE).generated
700 6 julius
 
701
# SystemC modules library
702
$(SIM_VLT_DIR)/libmodules.a:
703
        @echo; echo "\tCompiling SystemC modules"; echo
704 57 julius
        $(Q)export VLT_CPPFLAGS="$(VLT_CPPFLAGS)"; \
705 49 julius
        $(MAKE) -C $(BENCH_SYSC_SRC_DIR) -f $(BENCH_SYSC_SRC_DIR)/Modules.make $(VLT_SYSC_DEBUG_DEFINE)
706 6 julius
 
707
 
708 51 julius
ALL_VLOG=$(shell find $(RTL_VERILOG_DIR) -name "*.v")
709
 
710 6 julius
# Verilator command script
711 51 julius
# Generate the compile script to give Verilator - make it sensitive to the RTL
712
$(SIM_VLT_DIR)/$(VLT_COMMAND_FILE).generated: $(ALL_VLOG)
713 6 julius
        @echo; echo "\tGenerating verilator compile script"; echo
714 57 julius
        $(Q)sed < $(SIM_BIN_DIR)/$(VLT_COMMAND_FILE) > $(SIM_VLT_DIR)/$(VLT_COMMAND_FILE).generated \
715 6 julius
                -e s!\$$BENCH_DIR!$(BENCH_VERILOG_DIR)!              \
716
                -e s!\$$RTL_DIR!$(RTL_VERILOG_DIR)!                  \
717
                -e s!\$$BACKEND_DIR!$(BACKEND_DIR)!                  \
718
                -e \\!^//.*\$$!d -e \\!^\$$!d;
719
 
720 63 julius
.PHONY: vlt-model-links
721
vlt-model-links:
722 6 julius
# Link all the required system C model files into the verilator work dir
723
        @echo; echo "\tLinking SystemC model source to verilator build path"; echo
724
        @if [ ! -d $(SIM_VLT_DIR) ]; then mkdir $(SIM_VLT_DIR); fi
725 57 julius
        $(Q)cd $(SIM_VLT_DIR) && \
726 6 julius
        for SYSCMODEL in $(SYSC_MODELS); do \
727
                if [ ! -e $$SYSCMODEL.cpp ]; then \
728
                        ln -s $(BENCH_SYSC_SRC_DIR)/$$SYSCMODEL.cpp .; \
729
                        ln -s $(BENCH_SYSC_INCLUDE_DIR)/$$SYSCMODEL.h .; \
730
                fi; \
731
        done
732
 
733
 
734
################################################################################
735
# Verilator test loop
736
################################################################################
737
 
738
# Verilator defaults to internal memories
739 66 julius
vlt-tests: prepare-sw prepare-rtl prepare-dirs prepare-vlt
740 6 julius
        @echo
741
        @echo "Beginning loop that will complete the following tests: $(TESTS)"
742
        @echo
743 57 julius
        $(Q)for TEST in $(TESTS); do \
744 6 julius
                echo "################################################################################"; \
745
                echo; \
746
                echo "\t#### Current test: $$TEST ####"; echo; \
747
                echo "\t#### Compiling software ####"; echo; \
748
                CURRENT_TEST_SW_DIR=$(SW_DIR)/`echo $$TEST | cut -d "-" -f 1`; \
749
                $(MAKE) -C $$CURRENT_TEST_SW_DIR $$TEST $(TEST_SW_MAKE_OPTS) UART_PRINTF=1; \
750
                rm -f $(SIM_RUN_DIR)/$(SIM_SRAM_MEM_FILE); \
751
                ln -s $$CURRENT_TEST_SW_DIR/$$TEST.vmem $(SIM_RUN_DIR)/$(SIM_SRAM_MEM_FILE); \
752
                echo "\t#### Beginning simulation ####"; \
753
                time -p $(SIM_VLT_DIR)/Vorpsoc_top $$TEST; \
754
                if [ $$? -gt 0 ]; then exit $$?; fi; \
755
                TEST_RESULT=1; \
756
                echo; echo "\t####"; \
757
                if [ $$TEST_RESULT -gt 0 ]; then \
758
                        echo "\t#### Test $$TEST PASSED ####";TESTS_PASSED=`expr $$TESTS_PASSED + 1`;\
759
                else    echo "\t#### Test $$TEST FAILED ####";\
760
                fi; \
761
                echo "\t####"; echo; \
762
                TESTS_PERFORMED=`expr $$TESTS_PERFORMED + 1`;\
763
        done; \
764
        echo "Test results: "$$TESTS_PASSED" out of "$$TESTS_PERFORMED" tests passed"; echo
765
 
766 49 julius
###############################################################################
767
# Verilator profiled module make
768
###############################################################################
769 57 julius
# To run this, first run a "make prepare-vlt VLT_DO_PROFILING=1" then do a
770
# "make clean" and then a "make prepare-vlt_profiled"
771 49 julius
# This new make target copies athe results of the profiling back to the right
772
# paths before we create everything again
773
###############################################################################
774 63 julius
.PHONY: prepare-vlt-profiled
775
prepare-vlt-profiled: $(SIM_VLT_DIR)/OrpsocMain.gcda clean vlt-restore-profileoutput prepare-rtl vlt-model-links $(SIM_VLT_DIR)/Vorpsoc_top
776 6 julius
 
777 63 julius
$(SIM_VLT_DIR)/OrpsocMain.gcda: $(SIM_VLT_DIR)/Vorpsoc_top-for-profiling prepare-sw-uart-printf
778
        $(MAKE) -C $(SW_DIR)/dhry dhry-nocache-O2 NUM_RUNS=200
779
        $(SIM_VLT_DIR)/Vorpsoc_top -f $(SW_DIR)/dhry/dhry-nocache-O2.or32 -v -l sim.log --crash-monitor
780
 
781
.PHONY: $(SIM_VLT_DIR)/Vorpsoc_top-for-profiling
782
$(SIM_VLT_DIR)/Vorpsoc_top-for-profiling:
783
        $(MAKE) prepare-vlt VLT_DO_PROFILING=1
784
 
785
.PHONY: vlt-restore-profileoutput
786 57 julius
vlt-restore-profileoutput:
787 49 julius
        @echo;echo "\tRestoring profiling outputs"; echo
788 57 julius
        $(Q)mkdir -p ../vlt
789
        $(Q)cp /tmp/*.gc* $(SIM_VLT_DIR)
790
        $(Q)cp /tmp/*.gc* $(BENCH_SYSC_SRC_DIR)
791 6 julius
 
792
################################################################################
793
# Architectural simulator test loop
794
################################################################################
795
 
796
# Verilator defaults to internal memories
797 66 julius
sim-tests: prepare-sw
798 6 julius
        @if [ ! -d $(SIM_RESULTS_DIR) ]; then mkdir -p $(SIM_RESULTS_DIR); fi
799
        @echo
800
        @echo "Beginning loop that will complete the following tests: $(TESTS)"
801
        @echo
802 57 julius
        $(Q)for TEST in $(TESTS); do \
803 6 julius
                echo "################################################################################"; \
804
                echo; \
805
                echo "\t#### Current test: $$TEST ####"; echo; \
806
                echo "\t#### Compiling software ####"; echo; \
807
                CURRENT_TEST_SW_DIR=$(SW_DIR)/`echo $$TEST | cut -d "-" -f 1`; \
808
                $(MAKE) -C $$CURRENT_TEST_SW_DIR $$TEST $(TEST_SW_MAKE_OPTS) UART_PRINTF=1; \
809
                rm -f $(SIM_RUN_DIR)/$(SIM_SRAM_MEM_FILE); \
810
                ln -s $$CURRENT_TEST_SW_DIR/$$TEST.or32 $(SIM_RUN_DIR)/.; \
811
                echo;echo "\t#### Launching architectural simulator ####"; \
812
                time -p $(ARCH_SIM_EXE) --nosrv -f $(SIM_BIN_DIR)/$(ARCH_SIM_CFG_FILE) $$TEST.or32 > $(SIM_RESULTS_DIR)/$$TEST-or1ksim.log 2>&1; \
813
                if [ $$? -gt 0 ]; then exit $$?; fi; \
814
                if [ `tail -n 10 $(SIM_RESULTS_DIR)/$$TEST-or1ksim.log | grep -c $(SIM_SUCCESS_MESSAGE)` -gt 0 ]; then \
815
                        TEST_RESULT=1; \
816
                fi; \
817
                echo; echo "\t####"; \
818
                if [ $$TEST_RESULT -gt 0 ]; then \
819
                        echo "\t#### Test $$TEST PASSED ####";TESTS_PASSED=`expr $$TESTS_PASSED + 1`;\
820
                else    echo "\t#### Test $$TEST FAILED ####";\
821
                fi; \
822
                echo "\t####"; echo; \
823
                TESTS_PERFORMED=`expr $$TESTS_PERFORMED + 1`;\
824
                unlink $(SIM_RUN_DIR)/$$TEST.or32; \
825
        done; \
826
        echo "Test results: "$$TESTS_PASSED" out of "$$TESTS_PERFORMED" tests passed"; echo
827
 
828
 
829
 
830
################################################################################
831
# Cleaning rules
832
################################################################################
833
 
834 69 julius
dist-clean: clean
835
        $(MAKE) -C $(SW_DIR)/utils clean
836
 
837 49 julius
clean: clean-sw clean-sim clean-sysc clean-rtl clean-vpi
838 6 julius
 
839
clean-sw:
840 69 julius
        @for SWDIR in `ls $(SW_DIR) | grep -v utils`; do \
841 44 julius
                echo $$SWDIR; \
842
                $(MAKE) -C $(SW_DIR)/$$SWDIR clean; \
843 6 julius
        done
844
 
845
clean-sim:
846 49 julius
#backup any profiling output files
847 51 julius
        @if [ -f $(SIM_VLT_DIR)/OrpsocMain.gcda ]; then echo;echo "\tBacking up verilator profiling output to /tmp"; echo; \
848 49 julius
        cp $(SIM_VLT_DIR)/*.gc* /tmp; \
849
        cp $(BENCH_SYSC_SRC_DIR)/*.gc* /tmp; fi
850 55 julius
        rm -rf $(SIM_RESULTS_DIR) $(SIM_RUN_DIR)/*.* $(SIM_VLT_DIR) $(MGC_ORPSOC_LIB_DIR) $(SIM_RUN_DIR)/work $(SIM_RUN_DIR)/transcript
851 36 julius
 
852
clean-sysc:
853
# Clean away dependency files generated by verilator
854 42 julius
        $(MAKE) -C $(BENCH_SYSC_SRC_DIR) -f $(BENCH_SYSC_SRC_DIR)/Modules.make clean
855 36 julius
 
856
clean-rtl:
857
# Clean away temporary verilog source files
858 44 julius
        rm -f $(RTL_VERILOG_DIR)/components/wb_sdram_ctrl/wb_sdram_ctrl_fsm.v
859
 

powered by: WebSVN 2.1.0

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