Line 5... |
Line 5... |
#### Description ####
|
#### Description ####
|
#### ORPSoCv2 Testbenches Makefile, containing rules for ####
|
#### ORPSoCv2 Testbenches Makefile, containing rules for ####
|
#### configuring and running different tests on the current ####
|
#### configuring and running different tests on the current ####
|
#### ORPSoC(v2) design. ####
|
#### ORPSoC(v2) design. ####
|
#### ####
|
#### ####
|
#### To Do: ####
|
#### To do: ####
|
#### * Arrange verilator make rules so that the whole thing ####
|
#### * Arrange verilator make rules so that the whole thing ####
|
#### isn't recompiled when a single SystemC module is ####
|
#### isn't recompiled when a single SystemC module is ####
|
#### updated. ####
|
#### updated. ####
|
#### * Test if each software test file gets made properly ####
|
#### * Test if each software test file gets made properly ####
|
|
#### before it's run in whatever model we're using ####
|
#### * Expand software test-suite (uClibc, ecos tests, LTP?) ####
|
#### * Expand software test-suite (uClibc, ecos tests, LTP?) ####
|
#### ####
|
#### ####
|
#### Author(s): ####
|
#### Author(s): ####
|
#### - jb, jb@orsoc.se ####
|
#### - jb, jb@orsoc.se ####
|
#### ####
|
#### ####
|
Line 121... |
Line 122... |
#
|
#
|
|
|
# Note:
|
# Note:
|
#
|
#
|
# The way each of the test loops is written is probably a bit overly complex
|
# The way each of the test loops is written is probably a bit overly complex
|
# but this is to save maintaining and calling other files to get this done.
|
# but this is to save maintaining, and calling, multiple files.
|
#
|
#
|
|
|
# Name of the directory we're currently in
|
# Model configuration:
|
|
#
|
|
# Currently, the ORPSoCv2, by default, contains an internal SRAM (configurable
|
|
# size - check the defparam in rtl/verilog/orpsoc_top.v), standard OR1200 (check
|
|
# the config in rtl/verilog/or1200_defines.v) and UART.
|
|
# Switches can be passed to enable certain parts of the design if testing with
|
|
# these is desired.
|
|
#
|
|
# SDRAM and controller
|
|
#
|
|
# To enable the use of SDRAM, define USE_SDRAM when calling the sim -this
|
|
# only has an effect in the event-driven simulators as the external SDRAM model
|
|
# is not availble in SystemC format. eg:
|
|
#
|
|
# make rtl-tests USE_SDRAM=1
|
|
#
|
|
# This not only enables SDRAM but also enables the booting from external SPI
|
|
# interfaced flash memory. This causes significant increase in the time taken
|
|
# for simulation as the program to test is first loaded out of SPI flash memory
|
|
# and into SDRAM before it is executed. Although this more closely mimics the
|
|
# behaviour of the hardware, for simulation purposes it is purely time-consuming
|
|
# however it may be useful to track down any problems with this boot-loading
|
|
# process. Therefore, becuase it enables SDRAM memory, ir also enables the flash
|
|
# memory model and SPI controller inside ORPSoC.
|
|
#
|
|
# Ethernet
|
|
#
|
|
# Ethernet is disabled by default. This is due to the fact that it is not
|
|
# supported in the verilator/systemC model. Also, there is currently no software
|
|
# which tests it in any meaningful way.
|
|
#
|
|
|
|
#
|
|
# Event-driven simulation compilation
|
|
#
|
|
# The way the event-driven simulations are compiled is simply using the
|
|
# configuration script file in this directory, currently called icarus.scr -
|
|
# however it is first processesed to replace the variables, beginning with $'s,
|
|
# with the appropriate paths. Instead of naming each file to be compiled, the
|
|
# paths to be searched for each module are instead defined ( -y paths), and
|
|
# only the toplevel testbench and library source files are explicitly named.
|
|
# This simplifies the script, and also requires that the name of each verilog
|
|
# source file is the same as the module it contains (a good convention
|
|
# regardless.) In addition to the script/command file, defines are passed to
|
|
# the compiler via the command line in the EVENT_SIM_FLAGS variable.
|
|
# Additionally, a source file, test_define.v, is created with some defines
|
|
# that cannot be passed to the compiled reliably (there are differences between
|
|
# the way, for instance, icarus and ncverilog parse strings +define+'d on the
|
|
# command line). This file is then included at the appropriate places.
|
|
# It is probably not ideal that the entire design be re-compiled for each test,
|
|
# but currently the design is small enough so that this doesn't cause a
|
|
# significant overhead, unlike the cycle-accurate model compile time.
|
|
#
|
|
|
|
#
|
|
# SystemC cycle-accurate model compilation
|
|
#
|
|
# A new addition to ORPSoC v2 is the cycle-accurate model. The primary enabler
|
|
# behind this is verilator, which processes the RTL sources and generates a c++
|
|
# description of the system. This c++ description is then compiled with a
|
|
# SystemC wrapper. Finally a top-level SystemC testbench instantiates the
|
|
# model, as well as any other modules - in this case a reset generation, UART
|
|
# decoder, and monitor module are included at the top level. These additional
|
|
# modules and models are written in SystemC and compiled all together with the
|
|
# cycle-accurate ORPSoC model to create the simulation executable. Finally this
|
|
# executable is run and should be a cycle-representation of the system. VCDs
|
|
# can be generated if enabled. The compiled mentioned above is all done with
|
|
# the GNU c++ compiler, g++.
|
|
# The compilation process is a little more tricky than a typical even-driven
|
|
# simulator. It proceeds basically by generating the makefiles for compiling
|
|
# the design with verilator, running these makes which produces a library
|
|
# containing the cycle-accurate ORPSoC design, compiling the additional
|
|
# top-level, and testbench, systemC models into a library, and then linking it
|
|
# all together into the simulation executable.
|
|
# The major advantage of the cycle-accurate model is that it is quicker, in
|
|
# terms of simulated cycles/second, when compared with event-driven simulators.
|
|
# It is, of course, less accurate in that it cannot model propegation delays.
|
|
# However this is usually not an issue for simulating a design which is known
|
|
# to synthesize and run OK. It is very useful for running complex software,
|
|
# such as the linux kernel and real-time OS applications, which generally
|
|
# require long simulation times.
|
|
# Currently the cycle-accurate model being used doesn't contain much more than
|
|
# the processor and a UART, however it's exepected in future this will be
|
|
# expanded on and more complex software test suites will be implemented to put
|
|
# the system through its paces.
|
|
#
|
|
|
|
|
|
# Name of
|
|
# the directory we're currently in
|
CUR_DIR=$(shell pwd)
|
CUR_DIR=$(shell pwd)
|
|
|
# The root path of the whole project
|
# The root path of the whole project
|
PROJECT_ROOT=$(CUR_DIR)/../..
|
PROJECT_ROOT=$(CUR_DIR)/../..
|
|
|
Line 162... |
Line 252... |
|
|
# If USE_SDRAM is defined we'll add it to the simulator's defines on the
|
# If USE_SDRAM is defined we'll add it to the simulator's defines on the
|
# command line becuase it's used by many different modules and it's easier
|
# command line becuase it's used by many different modules and it's easier
|
# to do it this way than make them all include a file.
|
# to do it this way than make them all include a file.
|
ifdef USE_SDRAM
|
ifdef USE_SDRAM
|
RTL_SIM_FLAGS += "-D USE_SDRAM=$(USE_SDRAM)"
|
EVENT_SIM_FLAGS += "-D USE_SDRAM=$(USE_SDRAM)"
|
endif
|
endif
|
SIM_FLASH_MEM_FILE="flash.in"
|
SIM_FLASH_MEM_FILE="flash.in"
|
FLASH_MEM_FILE_SUFFIX="-twobyte-sizefirst.hex"
|
FLASH_MEM_FILE_SUFFIX="-twobyte-sizefirst.hex"
|
SIM_SRAM_MEM_FILE="sram.vmem"
|
SIM_SRAM_MEM_FILE="sram.vmem"
|
|
|
Line 277... |
Line 367... |
echo "\`define OR1200_DISPLAY_ARCH_STATE" >> $(SIM_RUN_DIR)/test_define.v; \
|
echo "\`define OR1200_DISPLAY_ARCH_STATE" >> $(SIM_RUN_DIR)/test_define.v; \
|
fi; \
|
fi; \
|
echo ; \
|
echo ; \
|
echo "\t#### Compiling RTL ####"; \
|
echo "\t#### Compiling RTL ####"; \
|
rm -f $(SIM_RUN_DIR)/a.out; \
|
rm -f $(SIM_RUN_DIR)/a.out; \
|
$(ICARUS) -sorpsoc_testbench -c $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated $(RTL_SIM_FLAGS); \
|
$(ICARUS) -sorpsoc_testbench -c $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated $(EVENT_SIM_FLAGS); \
|
echo; \
|
echo; \
|
echo "\t#### Beginning simulation ####"; \
|
echo "\t#### Beginning simulation ####"; \
|
time -p $(ICARUS_VVP) -l $(SIM_RESULTS_DIR)/$$TEST-vvp-out.log a.out ; \
|
time -p $(ICARUS_VVP) -l $(SIM_RESULTS_DIR)/$$TEST-vvp-out.log a.out ; \
|
if [ $$? -gt 0 ]; then exit $$?; fi; \
|
if [ $$? -gt 0 ]; then exit $$?; fi; \
|
TEST_RESULT=`cat $(SIM_RESULTS_DIR)/$$TEST-general.log | grep report | grep $(SIM_SUCCESS_MESSAGE) -c`; \
|
TEST_RESULT=`cat $(SIM_RESULTS_DIR)/$$TEST-general.log | grep report | grep $(SIM_SUCCESS_MESSAGE) -c`; \
|
Line 337... |
Line 427... |
if [ -z $$NO_SIM_LOGGING ]; then \
|
if [ -z $$NO_SIM_LOGGING ]; then \
|
echo "\`define OR1200_DISPLAY_ARCH_STATE" >> $(SIM_RUN_DIR)/test_define.v; \
|
echo "\`define OR1200_DISPLAY_ARCH_STATE" >> $(SIM_RUN_DIR)/test_define.v; \
|
fi; \
|
fi; \
|
echo ; \
|
echo ; \
|
echo "\t#### Beginning simulation ####"; \
|
echo "\t#### Beginning simulation ####"; \
|
time -p ncverilog -f $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated -Q -l $(SIM_RESULTS_DIR)/$$TEST-ius-out.log $(RTL_SIM_FLAGS); \
|
time -p ncverilog -f $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated -Q -l $(SIM_RESULTS_DIR)/$$TEST-ius-out.log $(EVENT_SIM_FLAGS); \
|
if [ $$? -gt 0 ]; then exit $$?; fi; \
|
if [ $$? -gt 0 ]; then exit $$?; fi; \
|
TEST_RESULT=`cat $(SIM_RESULTS_DIR)/$$TEST-general.log | grep report | grep $(SIM_SUCCESS_MESSAGE) -c`; \
|
TEST_RESULT=`cat $(SIM_RESULTS_DIR)/$$TEST-general.log | grep report | grep $(SIM_SUCCESS_MESSAGE) -c`; \
|
echo; echo "\t####"; \
|
echo; echo "\t####"; \
|
if [ $$TEST_RESULT -gt 0 ]; then \
|
if [ $$TEST_RESULT -gt 0 ]; then \
|
echo "\t#### Test $$TEST PASSED ####";TESTS_PASSED=`expr $$TESTS_PASSED + 1`;\
|
echo "\t#### Test $$TEST PASSED ####";TESTS_PASSED=`expr $$TESTS_PASSED + 1`;\
|