Line 91... |
Line 91... |
|
|
ICARUS=iverilog
|
ICARUS=iverilog
|
ICARUS_VVP=vvp
|
ICARUS_VVP=vvp
|
ICARUS_COMMAND_FILE=icarus.scr
|
ICARUS_COMMAND_FILE=icarus.scr
|
VLT_COMMAND_FILE=verilator.scr
|
VLT_COMMAND_FILE=verilator.scr
|
SIM_MEM_FILE="flash.in"
|
|
SIM_SUCCESS_MESSAGE=deaddead
|
SIM_SUCCESS_MESSAGE=deaddead
|
|
|
|
# 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
|
|
# to do it this way than make them all include a file.
|
|
ifdef USE_SDRAM
|
|
RTL_SIM_FLAGS += "-D USE_SDRAM=$(USE_SDRAM)"
|
|
endif
|
|
SIM_FLASH_MEM_FILE="flash.in"
|
|
FLASH_MEM_FILE_SUFFIX="-twobyte-sizefirst.hex"
|
|
SIM_SRAM_MEM_FILE="sram.vmem"
|
|
|
.PHONY: prepare_rtl
|
.PHONY: prepare_rtl
|
prepare_rtl:
|
prepare_rtl:
|
@cd $(RTL_VERILOG_DIR)/components/wb_sdram_ctrl && perl fizzim.pl -encoding onehot -terse < wb_sdram_ctrl_fsm.fzm > wb_sdram_ctrl_fsm.v
|
@cd $(RTL_VERILOG_DIR)/components/wb_sdram_ctrl && perl fizzim.pl -encoding onehot -terse < wb_sdram_ctrl_fsm.fzm > wb_sdram_ctrl_fsm.v
|
@cd $(RTL_VERILOG_DIR) && sed '/defparam/!s/\([a-zA-Z0-9_]\)\.//g' intercon.vm > intercon.v
|
@cd $(RTL_VERILOG_DIR) && sed '/defparam/!s/\([a-zA-Z0-9_]\)\.//g' intercon.vm > intercon.v
|
|
|
Line 111... |
Line 120... |
# compiled, and then the software library files.
|
# compiled, and then the software library files.
|
# Next the few verilog files that need preperation are taken care of.
|
# Next the few verilog files that need preperation are taken care of.
|
# The test begins by starting a loop in bash using on the strings defined in
|
# The test begins by starting a loop in bash using on the strings defined in
|
# TESTS. Each one corresponds to a certain module of software for the OpenRISC
|
# TESTS. Each one corresponds to a certain module of software for the OpenRISC
|
# that is included in this test suite. Under the sw/ path is a set of paths,
|
# that is included in this test suite. Under the sw/ path is a set of paths,
|
# and all except the support/ and utils/ paths contain code which is run to test
|
# and all except the support/ and utils/ paths contain code which is run to
|
# the OR1k used in this test suite. For each of these software modules, it is
|
# test the OR1k used in this test suite. For each of these software modules,
|
# possible that different tests are done using the same module. These tests can
|
# it is possible that different tests are done using the same module. These
|
# vary by either using different levels of optimisation during compilation,
|
# tests can vary by either using different levels of optimisation during
|
# and/or by having the OR1k's caches enabled or disabled.
|
# compilation, and/or by having the OR1k's caches enabled or disabled.
|
# Each test has a unique name, and under the $(SIM_RESULTS_DIR), which is
|
# Each test has a unique name, and under the $(SIM_RESULTS_DIR), which is
|
# usually just ../results, log files, and optionally VCD files, are created for
|
# usually just ../results, log files, and optionally VCD files, are created for
|
# inspection later and are named according to the test. Inspect the file
|
# inspection later and are named according to the test. Inspect the file
|
# bench/verilog/or1200_monitor.v to find out in detail what each log consists of.
|
# bench/verilog/or1200_monitor.v to find out in detail what each log consists
|
|
# of.
|
# For each test, a few things occur. First the software that will run inside
|
# For each test, a few things occur. First the software that will run inside
|
# the simulated OR1k system is compiled, converted to a format which can be read
|
# the simulated OR1k system is compiled, converted to a format which can be
|
|
# read
|
# into the flash memory model via $readmemh() and linked to the sim/run
|
# into the flash memory model via $readmemh() and linked to the sim/run
|
# directory as $(SIM_MEM_FILE), which currently is flash.in. Next a compilation
|
# directory as $(SIM_FLASH_MEM_FILE), which currently is flash.in. Next a
|
# script for icarus is generated, containing a list of all the RTL files and
|
# compilation script for icarus is generated, containing a list of all the
|
# include directories. Next, an include file for the verilog testbench is
|
# RTL files and include directories. Next, an include file for the verilog
|
# generated, containing a string of the name of the current test, path to the
|
# testbench is generated, containing a string of the name of the current
|
# results directory (for VCD generation) and any other things which might vary
|
# test, path to the results directory (for VCD generation) and any other
|
# from test to test. This is not done by +define lines in the icarus script
|
# things which might vary from test to test. This is not done by +define
|
# because of string handling incosistencies between different simulators and
|
# lines in the icarus script because of string handling incosistencies
|
# shells.
|
# between different simulators and shells.
|
# Once all the files are generated, icarus is called to compile the rtl design,
|
# Once all the files are generated, icarus is called to compile the rtl
|
# and then run it.
|
# design, and then run it. Each of the tested software modules have code which
|
# Each of the tested software modules have code which will trigger the
|
# will trigger the simulation to be stopped by use of the l.nop instruction
|
# simulation to be stopped by use of the l.nop instruction with an immediate
|
# with an immediate value of 1. When the simulation finishes, the simulation
|
# value of 1. When the simulation finishes, the simulation executable exits and
|
# executable exits and the log of the simulation is inspected for the expected
|
# the log of the simulation is inspected for the expected output. Currently, the
|
# output. Currently, the string "deaddead" indicates that the software
|
# string "deaddead" indicates that the software completed successfully. This is
|
# completed successfully. This is counted as the ORPSoC "passing" the test. In
|
# counted as the ORPSoC "passing" the test. In fact, whether the system did the
|
# fact, whether the system did the right thing or not requires more
|
# right thing or not requires more inspection, but roughly this is a good
|
# inspection, but roughly this is a good indicator that nothing major went
|
# indicator that nothing major went wrong.
|
# wrong.
|
# Once the current test is finished, the next begins with the compilation of its
|
# Once the current test is finished, the next begins with the compilation of its
|
# software and linking of the resulting hex file to the run path, etc.
|
# software and linking of the resulting hex file to the run path, etc.
|
|
# Main RAM setup - (RTL simulation with Icarus/NCSim only!):
|
|
# Define USE_SDRAM to enable the external SDRAM, otherwise the simulation
|
|
# defaults to an internal SRAM. Eg. $ make rtl-tests USE_SDRAM=1 VCD=1
|
|
# Verilator defaults to internal memories
|
rtl-tests: prepare_sw prepare_rtl
|
rtl-tests: prepare_sw prepare_rtl
|
@if [ ! -d $(SIM_RESULTS_DIR) ]; then mkdir -p $(SIM_RESULTS_DIR); fi
|
@if [ ! -d $(SIM_RESULTS_DIR) ]; then mkdir -p $(SIM_RESULTS_DIR); fi
|
@echo
|
@echo
|
@echo "Beginning loop that will complete the following tests: $(TESTS)"
|
@echo "Beginning loop that will complete the following tests: $(TESTS)"
|
@echo
|
@echo
|
Line 155... |
Line 170... |
echo; \
|
echo; \
|
echo "\t#### Current test: $$TEST ####"; echo; \
|
echo "\t#### Current test: $$TEST ####"; echo; \
|
echo "\t#### Compiling software ####"; echo; \
|
echo "\t#### Compiling software ####"; echo; \
|
CURRENT_TEST_SW_DIR=$(SW_DIR)/`echo $$TEST | cut -d "-" -f 1`; \
|
CURRENT_TEST_SW_DIR=$(SW_DIR)/`echo $$TEST | cut -d "-" -f 1`; \
|
$(MAKE) -C $$CURRENT_TEST_SW_DIR $$TEST; \
|
$(MAKE) -C $$CURRENT_TEST_SW_DIR $$TEST; \
|
rm -f $(SIM_RUN_DIR)/$(SIM_MEM_FILE); \
|
rm -f $(SIM_RUN_DIR)/$(SIM_FLASH_MEM_FILE); \
|
ln -s $$CURRENT_TEST_SW_DIR/$$TEST.hex $(SIM_RUN_DIR)/$(SIM_MEM_FILE); \
|
rm -f $(SIM_RUN_DIR)/$(SIM_SRAM_MEM_FILE); \
|
|
ln -s $$CURRENT_TEST_SW_DIR/$$TEST$(FLASH_MEM_FILE_SUFFIX) $(SIM_RUN_DIR)/$(SIM_FLASH_MEM_FILE); \
|
|
ln -s $$CURRENT_TEST_SW_DIR/$$TEST.vmem $(SIM_RUN_DIR)/$(SIM_SRAM_MEM_FILE); \
|
sed < $(SIM_BIN_DIR)/$(ICARUS_COMMAND_FILE) > $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated \
|
sed < $(SIM_BIN_DIR)/$(ICARUS_COMMAND_FILE) > $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated \
|
-e s!\$$BENCH_DIR!$(BENCH_VERILOG_DIR)! \
|
-e s!\$$BENCH_DIR!$(BENCH_VERILOG_DIR)! \
|
-e s!\$$RTL_DIR!$(RTL_VERILOG_DIR)! \
|
-e s!\$$RTL_DIR!$(RTL_VERILOG_DIR)! \
|
-e s!\$$BACKEND_DIR!$(BACKEND_DIR)! \
|
-e s!\$$BACKEND_DIR!$(BACKEND_DIR)! \
|
-e \\!^//.*\$$!d -e \\!^\$$!d ; \
|
-e \\!^//.*\$$!d -e \\!^\$$!d ; \
|
Line 202... |
Line 219... |
echo; \
|
echo; \
|
echo "\t#### Current test: $$TEST ####"; echo; \
|
echo "\t#### Current test: $$TEST ####"; echo; \
|
echo "\t#### Compiling software ####"; echo; \
|
echo "\t#### Compiling software ####"; echo; \
|
CURRENT_TEST_SW_DIR=$(SW_DIR)/`echo $$TEST | cut -d "-" -f 1`; \
|
CURRENT_TEST_SW_DIR=$(SW_DIR)/`echo $$TEST | cut -d "-" -f 1`; \
|
$(MAKE) -C $$CURRENT_TEST_SW_DIR $$TEST; \
|
$(MAKE) -C $$CURRENT_TEST_SW_DIR $$TEST; \
|
rm -f $(SIM_RUN_DIR)/$(SIM_MEM_FILE); \
|
rm -f $(SIM_RUN_DIR)/$(SIM_FLASH_MEM_FILE); \
|
ln -s $$CURRENT_TEST_SW_DIR/$$TEST.hex $(SIM_RUN_DIR)/$(SIM_MEM_FILE); \
|
rm -f $(SIM_RUN_DIR)/$(SIM_SRAM_MEM_FILE); \
|
|
ln -s $$CURRENT_TEST_SW_DIR/$$TEST_twobyte_sizefirst.hex $(SIM_RUN_DIR)/$(SIM_FLASH_MEM_FILE); \
|
|
ln -s $$CURRENT_TEST_SW_DIR/$$TEST_fourbyte.hex $(SIM_RUN_DIR)/$(SIM_SRAM_MEM_FILE); \
|
sed < $(SIM_BIN_DIR)/$(ICARUS_COMMAND_FILE) > $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated \
|
sed < $(SIM_BIN_DIR)/$(ICARUS_COMMAND_FILE) > $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated \
|
-e s!\$$BENCH_DIR!$(BENCH_VERILOG_DIR)! \
|
-e s!\$$BENCH_DIR!$(BENCH_VERILOG_DIR)! \
|
-e s!\$$RTL_DIR!$(RTL_VERILOG_DIR)! \
|
-e s!\$$RTL_DIR!$(RTL_VERILOG_DIR)! \
|
-e s!\$$BACKEND_DIR!$(BACKEND_DIR)! \
|
-e s!\$$BACKEND_DIR!$(BACKEND_DIR)! \
|
-e \\!^//.*\$$!d -e \\!^\$$!d ; \
|
-e \\!^//.*\$$!d -e \\!^\$$!d ; \
|
echo "+define+TEST_DEFINE_FILE=\"test_define.v\"" >> $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated; \
|
echo "+define+TEST_DEFINE_FILE=\"test_define.v\"" >> $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated; \
|
if [ ! -z $$VCD ]; \
|
if [ ! -z $$VCD ]; \
|
then echo "+define+VCD" >> $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated; \
|
then echo "+define+VCD" >> $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated; \
|
echo "+access+r" >> $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated; \
|
echo "+access+r" >> $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated; \
|
fi; \
|
fi; \
|
|
if [ ! -z $$USE_SDRAM ]; then \
|
|
echo "\`define USE_SDRAM" >> $(SIM_RUN_DIR)/test_define.v; \
|
|
fi; \
|
echo "+nocopyright" >> $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated; \
|
echo "+nocopyright" >> $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated; \
|
echo "+nowarn+MACRDF" >> $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated; \
|
echo "+nowarn+MACRDF" >> $(SIM_RUN_DIR)/$(ICARUS_COMMAND_FILE).generated; \
|
echo "\`define TEST_NAME_STRING \"$$TEST\"" > $(SIM_RUN_DIR)/test_define.v; \
|
echo "\`define TEST_NAME_STRING \"$$TEST\"" > $(SIM_RUN_DIR)/test_define.v; \
|
echo "\`define TEST_RESULTS_DIR \"$(SIM_RESULTS_DIR)/\" " >> $(SIM_RUN_DIR)/test_define.v; \
|
echo "\`define TEST_RESULTS_DIR \"$(SIM_RESULTS_DIR)/\" " >> $(SIM_RUN_DIR)/test_define.v; \
|
if [ -z $$NO_SIM_LOGGING ]; then \
|
if [ -z $$NO_SIM_LOGGING ]; then \
|