URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/orpsocv2
- from Rev 537 to Rev 542
- ↔ Reverse comparison
Rev 537 → Rev 542
/doc/orpsoc.texi
1237,20 → 1237,41
@node ML501 SPI flash programming |
@subsection SPI flash programming |
|
There are two ways to program the M25P16 2MByte SPI flash from the Xilinx iMPACT tool - @emph{direct} and @emph{indirect}. Direct programming means the Xilinx programmer has a direct connection from its pins to the SPI bus. It then performs SPI accesses on the bus to erase and program the part. Indirect programming involves the FPGA and sets up connections to the SPI via it. Indirect programming may be slower, but it is the only supported method as of ISE 12 onwards. |
|
There may be a way of programming directly using the open source @emph{xc3sprog} tool, http://sourceforge.net/projects/xc3sprog/ , but the author is yet to figure out how, and would greatly appreciate anyone who can provide a quick rundown on how this could be achieved. |
|
Once programmed, booting from the SPI flash to ORPmon prompt is about 3 to 4 seconds. |
|
@node ML501 Direct SPI flash programming |
@subsubsection Direct SPI flash programming |
|
@emph{Note}: As of ISE 12, direct SPI flash programming is no longer supported. ISE 11 must be used if this method is to be used. Indirect SPI flash programming is the recommended method by Xilinx now. How annoying. |
|
For a guide on how to actually set up the ML501 board to program the SPI flash, see the section under ``@emph{My Own SPI Flash Image Demonstration}'' on page 26 of the Xilinx UG228 document, http://www.xilinx.com/support/documentation/boards_and_kits/ug228.pdf . Follow steps 1 to 4, and then 9 to 16, and supply the @code{.mcs} file generated here. |
|
A more general explanation of direct SPI flash programming can be found in XAPP951- http://www.xilinx.com/support/documentation/application\_notes/xapp951.pdf |
|
Be sure to set the @emph{CONFIG} switches to @code{00010101} (left-to-right when Xilinx logo in North-West of board) before attempting to program the SPI flash. The be sure to switch them back to @code{00000101} before attempting to boot the image. |
|
@emph{Note}: SPI flash programming will require fly-leads from the Xilinx programming cable to the the board. See page 6 of XAPP1053 for a picture of this for a @emph{different} board, but to get the idea: http://www.xilinx.com/support/documentation/application_notes/xapp1053.pdf . |
@emph{Note}: Direct SPI flash programming will require fly-leads from the Xilinx programming cable to the the board. See page 6 of XAPP1053 for a picture of this for a @emph{different} board, but to get the idea: http://www.xilinx.com/support/documentation/application_notes/xapp1053.pdf . |
|
@emph{Note}: If leaving the SPI programming fly leads in place and attempting to boot the image, be sure to remove the @code{Vref} (@code{VCC3V3} on JP2) connection before attempting to boot. Be sure the configuration DIP SW15 is set back to the @code{00000101} position! |
|
@emph{Note:} The other cable from the programmer (going to the JP1 header) @emph{must} be unplugged from the board before attempting to program the SPI flash. |
|
@node ML501 Inirect SPI flash programming |
@subsubsection Indirect SPI flash programming |
|
Booting from the SPI flash to ORPmon prompt is about 3 to 4 seconds. |
The indirect method of programming the SPI flash has the memory show up as an extrnal module off the FPGA when performing an automatic JTAG boundary scan. |
|
The following page has more information about the steps required. http://www.xilinx.com/support/documentation/sw\_manuals/xilinx11/pim\_p\_configure\_spi\_bpi\_through\_fpga.htm The @code{.mcs} file required is the one generated in previous steps in this guide. |
|
@emph{Note:} As we generate the @code{.mcs} file with bit/byte swapping disabled (with the use of the @code{-spi} option when running the promgen tool) we must disable iMPACT's automatic bit/byte swapping when programming the SPI flash. In ISE 12 this option is found by going to the @emph{Edit menu -> Preferences}, and in the @emph{Configuration Preferences} category, set the @emph{SPI Byte Swap} option to @emph{Ignore Setting}. |
|
@emph{Note:} iMPACT from ISE 12 introduced errors in the software image when being programmed. It is advisable that versions of iMPACT from ISEs other than 12 are used until this bug is fixed. |
|
|
@node ML501 Customising |
@section Customising |
|
/scripts/make/Makefile-board-benchsrc.inc
0,0 → 1,53
|
# |
# Testbench source |
# |
BOARD_BENCH_VERILOG_SRC=$(shell ls $(BOARD_BENCH_VERILOG_DIR)/*.v | grep -v $(DESIGN_NAME)_testbench ) |
BOARD_BENCH_VERILOG_SRC_FILES=$(notdir $(BOARD_BENCH_VERILOG_SRC)) |
|
# Now only take the source from the common path that we don't already have in |
# our board's |
COMMON_BENCH_VERILOG_DIR_LS=$(shell ls $(COMMON_BENCH_VERILOG_DIR)/*.v) |
COMMON_BENCH_VERILOG_SRC_FILES=$(notdir $(COMMON_BENCH_VERILOG_DIR_LS)) |
COMMON_BENCH_VERILOG_SRC_FILTERED=$(filter-out $(BOARD_BENCH_VERILOG_SRC_FILES) $(DESIGN_NAME)_testbench.v,$(COMMON_BENCH_VERILOG_SRC_FILES)) |
COMMON_BENCH_VERILOG_SRC=$(addprefix $(COMMON_BENCH_VERILOG_DIR)/, $(COMMON_BENCH_VERILOG_SRC_FILTERED)) |
|
print-board-bench-src: |
$(Q)echo "\tBoard bench verilog source"; \ |
echo $(BOARD_BENCH_VERILOG_SRC) |
|
print-common-bench-src: |
$(Q)echo "\Common bench verilog source"; \ |
echo $(COMMON_BENCH_VERILOG_SRC) |
|
# Testbench source subdirectory detection (exclude include, we always use |
# board bench include directory!) |
BOARD_BENCH_VERILOG_SUBDIRS=$(shell cd $(BOARD_BENCH_VERILOG_DIR) && ls -d */ | grep -v include) |
COMMON_BENCH_VERILOG_SUBDIRS=$(shell cd $(COMMON_BENCH_VERILOG_DIR) && ls -d */ | grep -v include) |
|
# Get rid of ones we have a copy of locally |
COMMON_BENCH_VERILOG_SUBDIRS_EXCLUDE_BOARDS=$(filter-out $(BOARD_BENCH_VERILOG_SUBDIRS),$(COMMON_BENCH_VERILOG_SUBDIRS)) |
|
# Construct list of paths we will want to include |
BENCH_VERILOG_SUBDIRS=$(addprefix $(COMMON_BENCH_VERILOG_DIR)/,$(COMMON_BENCH_VERILOG_SUBDIRS_EXCLUDE_BOARDS)) |
BENCH_VERILOG_SUBDIRS += $(addprefix $(BOARD_BENCH_VERILOG_DIR)/,$(BOARD_BENCH_VERILOG_SUBDIRS)) |
|
# Finally, add include path from local bench path |
BENCH_VERILOG_SUBDIRS += $(BOARD_BENCH_VERILOG_DIR)/include |
|
ifeq ($(VPI), 1) |
# Manually add the VPI bench verilog path |
COMMON_BENCH_VERILOG_SUBDIRS += $(VPI_SRC_VERILOG_DIR) |
endif |
|
print-board-bench-subdirs: |
$(Q)echo "\tBoard bench subdirectories"; \ |
echo $(BOARD_BENCH_VERILOG_SUBDIRS) |
|
print-common-bench-subdirs: |
$(Q)echo "\tCommon bench subdirectories"; \ |
echo $(COMMON_BENCH_VERILOG_SUBDIRS) |
|
print-bench-subdirs: |
$(Q)echo "\tBench subdirectories"; \ |
echo $(BENCH_VERILOG_SUBDIRS) |
/scripts/make/Makefile-rtltestrules.inc
0,0 → 1,47
# RTL test rules |
|
|
print-tests: |
@echo; echo; echo "\t### Software tests to be run ###"; echo; |
@echo $(TESTS) |
@echo |
|
|
# Suffix of file to check after each test for the string |
TEST_OUT_FILE_SUFFIX=-general.log |
TEST_OK_STRING=8000000d |
|
.PHONY: rtl-test |
rtl-test: clean-sim-test-sw sw clean-test-defines $(TEST_DEFINES_VLG) \ |
$(SIMULATOR) |
|
# Run an RTL test followed by checking of generated results |
rtl-test-with-check: rtl-test |
$(Q)$(MAKE) check-test-log; \ |
if [ $$? -ne 0 ]; then \ |
echo; echo "\t### "$(TEST)" test FAIL ###"; echo; \ |
else \ |
echo; echo "\t### "$(TEST)" test OK ###"; echo; \ |
fi |
|
# Do check, don't print anything out |
rtl-test-with-check-no-print: rtl-test check-test-log |
|
# Main RTL test loop |
rtl-tests: |
$(Q)for test in $(TESTS); do \ |
export TEST=$$test; \ |
$(MAKE) rtl-test-with-check-no-print; \ |
if [ $$? -ne 0 ]; then break; fi; \ |
echo; echo "\t### $$test test OK ###"; echo; \ |
done |
|
|
.PHONY: check-test-log |
check-test-log: |
$(Q)echo "#!/bin/bash" > $@ |
$(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; }" >> $@ |
$(Q)echo "check-test-log" >> $@ |
$(Q)chmod +x $@ |
$(Q) echo; echo "\t### Checking simulation results for "$(TEST)" test ###"; echo; |
$(Q)./$@ |
/scripts/make/Makefile-board-definesparse.inc
0,0 → 1,11
# Main defines file is from board include path |
PROJECT_VERILOG_DEFINES ?=$(BOARD_RTL_VERILOG_INCLUDE_DIR)/$(DESIGN_NAME)-defines.v |
|
# Detect technology to use for the simulation |
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 ) |
|
# Rule to look at what defines are being extracted from main file |
print-defines: |
@echo echo; echo "\t### Design defines ###"; echo; |
@echo "\tParsing "$(PROJECT_VERILOG_DEFINES)" and exporting:" |
@echo $(DESIGN_DEFINES) |
/scripts/make/Makefile-sim-definesgen.inc
0,0 → 1,48
# A make rule that creates the test defines verilog file. |
|
|
# Dynamically generated verilog file defining configuration for various things |
# Rule actually generating this is found in definesgen.inc file. |
TEST_DEFINES_VLG=test-defines.v |
|
|
# Test defines.v file made .PHONY to force its generation every time |
.PHONY: $(TEST_DEFINES_VLG) |
$(TEST_DEFINES_VLG): |
$(Q)echo "\`define "$(SIM_TYPE)"_SIM" > $@ |
$(Q)echo "\`define SIMULATOR_"`echo $(SIMULATOR) | tr "[:lower:]" "[:upper:]"` >> $@ |
$(Q)echo "\`define TEST_NAME_STRING \""$(TEST)"\"" >> $@ |
$(Q)if [ ! -z $$VCD ]; \ |
then echo "\`define VCD" >> $@; \ |
fi |
$(Q)if [ ! -z $$VCD_DELAY ]; \ |
then echo "\`define VCD_DELAY "$$VCD_DELAY >> $@; \ |
fi |
$(Q)if [ ! -z $$VCD_DEPTH ]; \ |
then echo "\`define VCD_DEPTH "$$VCD_DEPTH >> $@; \ |
fi |
$(Q)if [ ! -z $$VCD_DELAY_INSNS ]; \ |
then echo "\`define VCD_DELAY_INSNS "$$VCD_DELAY_INSNS >> $@; \ |
fi |
$(Q)if [ ! -z $$END_TIME ]; \ |
then echo "\`define END_TIME "$$END_TIME >> $@; \ |
fi |
$(Q)if [ ! -z $$END_INSNS ]; \ |
then echo "\`define END_INSNS "$$END_INSNS >> $@; \ |
fi |
$(Q)if [ ! -z $$PRELOAD_RAM ]; \ |
then echo "\`define PRELOAD_RAM "$$END_TIME >> $@; \ |
fi |
$(Q)if [ -z $$DISABLE_PROCESSOR_LOGS ]; \ |
then echo "\`define PROCESSOR_MONITOR_ENABLE_LOGS" >> $@; \ |
fi |
$(Q)if [ ! -z $$VPI ]; \ |
then echo "\`define VPI_DEBUG" >> $@; \ |
fi |
$(Q)if [ ! -z $$SIM_QUIET ]; \ |
then echo "\`define SIM_QUIET" >> $@; \ |
fi |
$(Q)for module in $(GATELEVEL_MODULES); do echo "\`define "$$module"_IS_GATELEVEL " >> $@; done |
|
|
|
/scripts/make/Makefile-board-modelsim.inc
0,0 → 1,126
# Modelsim script generation, compile and run rules for board simulations |
|
# |
# Modelsim-specific settings |
# |
VOPT_ARGS=$(QUIET) -suppress 2241 |
|
# If VCD dump is desired, tell Modelsim not to optimise |
# away everything. |
ifeq ($(VCD), 1) |
#VOPT_ARGS=-voptargs="+acc=rnp" |
VOPT_ARGS=+acc=rnpqv |
endif |
|
# VSIM commands |
# Suppressed warnings - 3009: Failed to open $readmemh() file |
# Suppressed warnings - 3009: Module 'blah' does not have a `timescale directive in effect, but previous modules do. |
# Suppressed warnings - 8598: Non-positive replication multiplier inside concat. Replication will be ignored |
VSIM_ARGS= -suppress 7 -suppress 3009 -suppress 8598 -c $(QUIET) -do "set StdArithNoWarnings 1; run -all; exit" |
|
# VPI debugging interface set up |
VPI_SRC_C_DIR=$(COMMON_BENCH_VERILOG_DIR)/vpi/c |
VPI_SRC_VERILOG_DIR=vpi/verilog |
VPI_SRCS=$(shell ls $(VPI_SRC_C_DIR)/*.[ch]) |
|
# Modelsim VPI compile variables |
MODELTECH_VPILIB=msim_jp_vpi.sl |
|
# Modelsim VPI settings |
ifeq ($(VPI), 1) |
VPI_LIBS=$(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB) |
VSIM_ARGS += -pli $(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB) |
endif |
|
# Rule to make the VPI library for modelsim |
$(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB): $(VPI_SRCS) |
$(MAKE) -C $(VPI_SRC_C_DIR) $(MODELTECH_VPILIB) |
|
# |
# Script generation rules |
# |
|
# Backend script generation - make these rules sensitive to source and includes |
modelsim_backend.scr: $(BOARD_BACKEND_VERILOG_SRC) |
$(Q)echo "+incdir+"$(TECHNOLOGY_BACKEND_VERILOG_DIR) > $@; |
$(Q)echo "-y " $(BOARD_BACKEND_VERILOG_DIR) >> $@; |
$(Q)for vsrc in $(BACKEND_TECHNOLOGY_VERILOG_SRC); do echo $$vsrc >> $@; done |
$(Q)echo "-y " $(TECHNOLOGY_LIBRARY_VERILOG_DIR) >> $@; |
$(Q)echo "+libext+.v" >> $@; |
$(Q)echo >> $@; |
|
# DUT compile script |
modelsim_dut.scr: $(RTL_VERILOG_SRC) $(RTL_VERILOG_INCLUDES) $(BOOTROM_VERILOG) |
$(Q)echo "+incdir+"$(BOARD_RTL_VERILOG_INCLUDE_DIR) > $@; |
$(Q)echo "+incdir+"$(BOOTROM_SW_DIR) >> $@; |
$(Q)echo "+incdir+"$(BOARD_BENCH_VERILOG_INCLUDE_DIR) >> $@; |
$(Q)echo "+libext+.v" >> $@; |
$(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 |
$(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 |
$(Q)echo "-y " $(BOARD_BACKEND_VERILOG_DIR) >> $@; |
$(Q)if [ ! -z "$$GATELEVEL_MODULES" ]; \ |
then echo "-y " $(BOARD_SYN_OUT_DIR) >> $@; \ |
echo "+libext+.vm" >> $@; \ |
fi |
ifeq ($(FPGA_VENDOR), xilinx) |
$(Q)echo "-y "$(XILINX_PATH)"/verilog/src/unisims" >> $@; |
$(Q)echo "-y "$(XILINX_PATH)"/verilog/src/XilinxCoreLib" >> $@; |
endif |
$(Q)echo >> $@ |
|
modelsim_bench.scr: $(BOARD_BENCH_VERILOG_SRC) $(COMMON_BENCH_VERILOG_SRC) |
$(Q)echo "+incdir+"$(BOARD_BENCH_VERILOG_INCLUDE_DIR) > $@; |
$(Q)echo "+incdir+"$(COMMON_BENCH_VERILOG_INCLUDE_DIR) >> $@; |
$(Q)for path in $(BENCH_VERILOG_SUBDIRS); do echo "+incdir+"$$path >> $@; done |
$(Q)for path in $(BENCH_VERILOG_SUBDIRS); do echo "-y "$$path >> $@; done |
$(Q)echo "+incdir+"$(BOARD_RTL_VERILOG_INCLUDE_DIR) >> $@; |
$(Q)echo "+libext+.v" >> $@; |
$(Q)for vsrc in $(BOARD_BENCH_VERILOG_SRC); do echo $$vsrc >> $@; done |
$(Q)for vsrc in $(COMMON_BENCH_VERILOG_SRC); do echo $$vsrc >> $@; done |
ifeq ($(FPGA_VENDOR), xilinx) |
$(Q)echo "+incdir+"$(XILINX_PATH)"/verilog/src" >> $@; |
endif |
$(Q)echo >> $@ |
|
# |
# Build rules |
# |
|
# Modelsim backend library compilation rules |
BACKEND_LIB=lib_backend |
$(BACKEND_LIB): modelsim_backend.scr |
$(Q)if [ ! -e $@ ]; then vlib $@; fi |
$(Q)echo; echo "\t### Compiling backend library ###"; echo |
$(Q)vlog -nologo $(QUIET) -work $@ -f $< |
|
# Compile DUT into "work" library |
work: modelsim_dut.scr |
$(Q)if [ ! -e $@ ]; then vlib $@; fi |
$(Q)echo; echo "\t### Compiling Verilog design library ###"; echo |
$(Q)vlog $(QUIET) -f $< $(DUT_TOP) |
|
|
# |
# Run rule |
# |
|
.PHONY : $(MODELSIM) |
ifeq ($(FPGA_VENDOR), actel) |
$(MODELSIM): modelsim_bench.scr $(TEST_DEFINES_VLG) $(BACKEND_LIB) $(VPI_LIBS) work |
$(Q)echo; echo "\t### Compiling testbench ###"; echo |
$(Q)vlog $(QUIET) -nologo -incr $(BENCH_TOP) -f $< |
$(Q)vopt $(QUIET) $(RTL_TESTBENCH_TOP) $(VOPT_ARGS) -L $(BACKEND_LIB) \ |
-o tb |
$(Q)echo; echo "\t### Launching simulation ###"; echo |
$(Q)vsim $(VSIM_ARGS) tb |
endif |
|
ifeq ($(FPGA_VENDOR), xilinx) |
$(MODELSIM): modelsim_bench.scr $(TEST_DEFINES_VLG) $(VPI_LIBS) work |
$(Q)echo; echo "\t### Compiling Xilinx support libs, user design & testbench ###"; echo |
$(Q)vlog $(QUIET) -nologo -incr $(BENCH_TOP) -f $< |
$(Q)vopt $(QUIET) glbl $(RTL_TESTBENCH_TOP) $(VOPT_ARGS) -o tb |
$(Q)echo; echo "\t### Launching simulation ###"; echo |
$(Q)vsim $(VSIM_ARGS) tb |
endif |
|
/scripts/make/Makefile-board-sw.inc
0,0 → 1,33
# |
# Software compile rules for boards (mainly used during simulation) |
# |
|
# Path for the current test |
# First check for a local copy of the test. If it doesn't exist then we |
# default to the software tests in the root directory |
TEST_MODULE=$(shell echo $(TEST) | cut -d "-" -f 1) |
BOARD_SW_TEST_DIR=$(BOARD_SW_DIR)/tests/$(TEST_MODULE)/sim |
COMMON_SW_TEST_DIR=$(COMMON_SW_DIR)/tests/$(TEST_MODULE)/sim |
# Do this by testing for the file's existence |
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) |
|
print-test-sw-dir: |
@echo; echo "\tTest software is in the following path"; echo; |
@echo $(BOARD_SW_DIR); echo; |
@echo $(BOARD_SW_TEST_DIR); echo; |
@echo $(SW_TEST_DIR); echo; |
|
print-sw-tests: |
$(Q) $(MAKE) -C $(COMMON_SW_DIR)/lib print-sw-tests |
$(Q) $(MAKE) -C $(COMMON_SW_DIR)/lib print-sw-tests-subdirs |
|
|
include $(PROJECT_ROOT)/scripts/make/Makefile-swrules.inc |
|
# |
# Board-specific clean rules |
# |
|
clean-sw: |
$(Q) echo; echo "\t### Cleaning simulation sw directories ###"; echo; |
$(Q) $(MAKE) -C $(COMMON_SW_DIR)/lib distclean |
/scripts/make/Makefile-board-rtlmodules.inc
0,0 → 1,49
|
# First we get a list of modules in the RTL path of the board's path. |
# Next we check which modules not in the board's RTL path are in the root RTL |
# path (modules which can be commonly instantiated, but over which board |
# build-specific versions take precedence.) |
|
# Also generate list of verilog source files |
|
# Paths under board/***/rtl/verilog we wish to exclude when getting modules |
BOARD_VERILOG_MODULES_EXCLUDE += include |
BOARD_VERILOG_MODULES_EXCLUDE += $(GATELEVEL_MODULES) |
BOARD_VERILOG_MODULES_DIR_LIST=$(shell ls $(BOARD_RTL_VERILOG_DIR)) |
# Apply exclude to list of modules |
BOARD_RTL_VERILOG_MODULES=$(filter-out $(BOARD_VERILOG_MODULES_EXCLUDE),$(BOARD_VERILOG_MODULES_DIR_LIST)) |
|
# Now get list of modules that we don't have a version of in the board path |
COMMON_VERILOG_MODULES_EXCLUDE += include |
COMMON_VERILOG_MODULES_EXCLUDE += $(BOARD_RTL_VERILOG_MODULES) |
COMMON_VERILOG_MODULES_EXCLUDE += $(GATELEVEL_MODULES) |
|
COMMON_RTL_VERILOG_MODULES_DIR_LIST=$(shell ls $(COMMON_RTL_VERILOG_DIR)) |
COMMON_RTL_VERILOG_MODULES=$(filter-out $(COMMON_VERILOG_MODULES_EXCLUDE), $(COMMON_RTL_VERILOG_MODULES_DIR_LIST)) |
|
# List of verilog source files (only .v files!) |
# Board RTL modules first |
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) |
# Common RTL module source |
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) |
|
# List of verilog includes from board RTL path - only for rule sensitivity |
RTL_VERILOG_INCLUDES=$(shell ls $(BOARD_RTL_VERILOG_INCLUDE_DIR)/*.*) |
|
# Debugging rules |
|
print-board-modules: |
@echo echo; echo "\t### Board verilog modules ###"; echo |
@echo $(BOARD_RTL_VERILOG_MODULES) |
|
print-common-modules-exclude: |
@echo echo; echo "\t### Common verilog modules being excluded due to board versions ###"; echo |
@echo "$(COMMON_VERILOG_MODULES_EXCLUDE)" |
|
print-common-modules: |
@echo echo; echo "\t### Verilog modules from common RTL dir ###"; echo |
@echo $(COMMON_RTL_VERILOG_MODULES) |
|
print-verilog-src: |
@echo echo; echo "\t### Verilog source ###"; echo |
@echo $(RTL_VERILOG_SRC) |
/scripts/make/Makefile-board-simclean.inc
0,0 → 1,16
# Clean rules |
|
clean: clean-sim clean-sim-test-sw clean-bootrom clean-out clean-sw |
|
clean-sim: |
$(Q) echo; echo "\t### Cleaning simulation run directory ###"; echo; |
$(Q)rm -rf *.* lib_* work transcript check-test-log |
$(Q) if [ -e $(VPI_SRC_C_DIR) ]; then $(MAKE) -C $(VPI_SRC_C_DIR) clean; fi |
|
clean-out: |
$(Q)rm -rf $(RTL_SIM_RESULTS_DIR)/*.* |
|
clean-test-defines: |
$(Q)rm -f $(TEST_DEFINES_VLG) |
|
distclean: clean |
/scripts/make/Makefile-simulators.inc
0,0 → 1,16
# Various simulator commands |
|
|
# Icarus verilog commands |
ICARUS_COMPILE=iverilog |
ICARUS_RUN=vvp |
ICARUS_SCRIPT=icarus.scr |
ICARUS_SIM_EXE=vlogsim.elf |
ICARUS=icarus |
|
|
# Modelsim variables |
MGC_VSIM=vsim |
MGC_VLOG_COMP=vlog |
MGC_VHDL_COMP=vcom |
MODELSIM=modelsim |
/scripts/make/Makefile-board-paths.inc
0,0 → 1,50
# Paths to RTL and testbench directories for board ports. |
|
COMMON_RTL_DIR = $(PROJECT_ROOT)/rtl |
COMMON_RTL_VERILOG_DIR = $(COMMON_RTL_DIR)/verilog |
#COMMON_RTL_VHDL_DIR = $(COMMON_RTL_DIR)/vhdl |
|
BOARD_RTL_DIR=$(BOARD_ROOT)/rtl |
BOARD_RTL_VERILOG_DIR=$(BOARD_RTL_DIR)/verilog |
#BOARD_RTL_VHDL_DIR = $(BOARD_RTL_DIR)/vhdl |
|
# Only 1 include path for board builds - their own! |
BOARD_RTL_VERILOG_INCLUDE_DIR=$(BOARD_RTL_VERILOG_DIR)/include |
|
BOARD_BENCH_DIR=$(BOARD_ROOT)/bench |
BOARD_BENCH_VERILOG_DIR=$(BOARD_BENCH_DIR)/verilog |
BOARD_BENCH_VERILOG_INCLUDE_DIR=$(BOARD_BENCH_VERILOG_DIR)/include |
|
COMMON_BENCH_DIR=$(PROJECT_ROOT) |
COMMON_BENCH_VERILOG_DIR=$(COMMON_BENCH_DIR)/verilog |
COMMON_BENCH_VERILOG_INCLUDE_DIR=$(COMMON_BENCH_VERILOG_DIR)/include |
|
# Simulation directories |
SIM_DIR ?=$(BOARD_ROOT)/sim |
RTL_SIM_DIR=$(SIM_DIR) |
RTL_SIM_RUN_DIR=$(RTL_SIM_DIR)/run |
RTL_SIM_BIN_DIR=$(RTL_SIM_DIR)/bin |
RTL_SIM_RESULTS_DIR=$(RTL_SIM_DIR)/out |
|
# Testbench paths |
BOARD_BENCH_DIR=$(BOARD_ROOT)/bench |
BOARD_BENCH_VERILOG_DIR=$(BOARD_BENCH_DIR)/verilog |
COMMON_BENCH_DIR=$(PROJECT_ROOT)/bench |
COMMON_BENCH_VERILOG_DIR=$(COMMON_BENCH_DIR)/verilog |
|
#COMMON_BENCH_VHDL_DIR=$(COMMON_BENCH_DIR)/vhdl |
#BOARD_BENCH_VHDL_DIR=$(BOARD_BENCH_DIR)/vhdl |
|
COMMON_BENCH_SYSC_DIR=$(COMMON_BENCH_DIR)/sysc |
COMMON_BENCH_SYSC_SRC_DIR=$(COMMON_BENCH_SYSC_DIR)/src |
COMMON_BENCH_SYSC_INCLUDE_DIR=$(COMMON_BENCH_SYSC_DIR)/include |
|
|
# Software directories |
COMMON_SW_DIR=$(PROJECT_ROOT)/sw |
BOARD_SW_DIR=$(BOARD_ROOT)/sw |
|
# Synthesis directory for board |
BOARD_SYN_DIR=$(BOARD_ROOT)/syn/$(SYNTHESIS_TOOL) |
BOARD_SYN_RUN_DIR=$(BOARD_SYN_DIR)/run |
BOARD_SYN_OUT_DIR=$(BOARD_SYN_DIR)/out |
/scripts/make/Makefile-swrules.inc
0,0 → 1,54
|
# |
# Software compilation rules used mostly in simulation. |
# |
|
# Name of the image the RAM model will attempt to load via Verilog $readmemh |
# system function. |
|
# Set PRELOAD_RAM=1 to preload the system memory |
ifeq ($(PRELOAD_RAM), 1) |
SIM_SW_IMAGE ?=sram.vmem |
endif |
|
ifeq ($(SIM_SW_IMAGE),) |
SIM_SW_IMAGE ?=flash.in |
endif |
|
.PHONY : sw |
sw: $(SIM_SW_IMAGE) |
|
|
flash.in: $(SW_TEST_DIR)/$(TEST).flashin |
$(Q)if [ -L $@ ]; then unlink $@; fi |
$(Q)ln -s $< $@ |
|
sram.vmem: $(SW_TEST_DIR)/$(TEST).vmem |
$(Q)if [ -L $@ ]; then unlink $@; fi |
$(Q)ln -s $< $@ |
|
.PHONY: $(SW_TEST_DIR)/$(TEST).flashin |
$(SW_TEST_DIR)/$(TEST).flashin: |
$(Q) echo; echo "\t### Compiling software ###"; echo; |
$(Q)$(MAKE) -C $(SW_TEST_DIR) $(TEST).flashin |
|
.PHONY: $(SW_TEST_DIR)/$(TEST).vmem |
$(SW_TEST_DIR)/$(TEST).vmem: |
$(Q) echo; echo "\t### Compiling software ###"; echo; |
$(Q)$(MAKE) -C $(SW_TEST_DIR) $(TEST).vmem |
|
# Create test software disassembly |
|
sw-dis: $(SW_TEST_DIR)/$(TEST).dis |
$(Q)cp -v $< . |
|
$(SW_TEST_DIR)/$(TEST).dis: |
$(Q)$(MAKE) -C $(SW_TEST_DIR) $(TEST).dis |
|
|
# |
# Clean rules |
# |
|
clean-sim-test-sw: |
$(Q)if [ -e $(SIM_SW_IMAGE) ]; then unlink $(SIM_SW_IMAGE); fi |
/scripts/make/Makefile-board-tops.inc
0,0 → 1,8
# Variables holding the names and paths to top-level files |
|
# Name of testbench top |
RTL_TESTBENCH_TOP=$(DESIGN_NAME)_testbench |
|
# Paths to top-level files |
DUT_TOP=$(BOARD_RTL_VERILOG_DIR)/$(DESIGN_NAME)_top/$(DESIGN_NAME)_top.v |
BENCH_TOP=$(BOARD_BENCH_VERILOG_DIR)/$(DESIGN_NAME)_testbench.v |
/scripts/make/Makefile-misc.inc
0,0 → 1,11
# Miscellaneous rules |
|
# Set V=1 when calling make to enable verbose output |
# mainly for debugging purposes. |
ifeq ($(V), 1) |
Q= |
QUIET= |
else |
Q ?=@ |
QUIET=-quiet |
endif |
/sw/apps/spiflash/spiflash-program.c
246,6 → 246,163
} |
|
|
int |
console_get_num(void) |
{ |
char c = 0x30; |
int num_nums = 0; |
int num_nums_total; |
char nums[16]; // up to 16 decimal digits long |
int retval = 0; |
int decimal_multiplier; |
int i; |
|
printf("Enter decimal value: "); |
|
while (c >= 0x30 && c < 0x40) |
{ |
c = uart_getc(DEFAULT_UART); |
|
if (c >= 0x30 && c < 0x40) |
{ |
printf("%d", c-0x30); |
nums[num_nums] = c-0x30; |
num_nums++; |
} |
|
} |
printf("\n"); |
|
num_nums_total = num_nums; |
|
while(num_nums--) |
{ |
decimal_multiplier = 1; |
for(i=1;i<num_nums_total - num_nums;i++) |
decimal_multiplier *= 10; |
//printf("%d * %d\n",decimal_multiplier,nums[num_nums]); |
|
retval += (decimal_multiplier * nums[num_nums]); |
} |
//printf("%d\n",retval); |
return retval; |
} |
|
|
// HEX chars in ASCII: |
// 0: 0x30 (48), 1: 0x31 ... 9: 0x39 |
// A: 0x41 (65), B: 0x42 ... F: 0x46 |
// a: 0x61 (97), b: 0x62 ... f: 0x66 |
|
#define IS_ASCII_HEX_CHAR(x) ((x>=0x41 && x<=0x46) || (x>=0x61 && x<=0x66) || \ |
(x>=0x30 && x<=0x39)) |
|
#define ASCII_TO_HEX_VAL(x) (x>=0x41 && x<=0x46) ? x - 55 : \ |
(x>=0x61 && x<=0x66) ? x - 87 : x - 48; |
unsigned long |
console_get_hex_num(void) |
{ |
char c = 0x30; |
char hexchar; |
int num_nums = 0; |
int num_nums_total; |
char nums[8]; // up to 8 decimal digits long |
unsigned long retval = 0; |
int base_multiplier; |
int i; |
|
printf("Enter hex value: "); |
|
while (IS_ASCII_HEX_CHAR(c)) |
{ |
c = uart_getc(DEFAULT_UART); |
|
if (IS_ASCII_HEX_CHAR(c) && num_nums < 8) |
{ |
//printf("%c 0x%02x", c&0xff, c&0xff); |
hexchar = ASCII_TO_HEX_VAL(c); |
printf("%1x", hexchar&0xff); |
nums[num_nums] = hexchar; |
num_nums++; |
} |
if (c==0x7f) //delete |
{ |
if (num_nums>0) |
{ |
printf("%c %c",0x8, 0x8); |
num_nums--; |
} |
c = 0x30; |
} |
|
} |
printf("\n"); |
|
num_nums_total = num_nums; |
|
while(num_nums--) |
{ |
base_multiplier = 1; |
for(i=1;i<num_nums_total - num_nums;i++) |
base_multiplier *= 16; |
//printf("%d * %d\n",base_multiplier,nums[num_nums]); |
|
retval += (base_multiplier * nums[num_nums]); |
} |
//printf("%d\n",retval); |
|
return retval; |
} |
|
|
void |
console_browse_buffer(char* buf) |
{ |
char c = 0; |
int offset = 0; |
const int linesize = 16; |
int i; |
printf("Press space to scroll through buffer, q to return\n"); |
printf("+/- alter address offset\n"); |
while (1) |
{ |
c = uart_getc(DEFAULT_UART); |
|
if (c == 'q') |
return; |
else if (c == 'r') |
offset=0; |
else if (c == '+') |
{ |
if (offset <= (256 - linesize)) |
offset+=linesize; |
printf("%04x:\r",offset); |
} |
else if (c == '-') |
{ |
if (offset >=linesize) |
offset-=linesize; |
|
printf("%04x:\r",offset); |
} |
else if (c == 0x20 && (offset < 256)) // space, print al ine |
{ |
printf("%04x:",offset); |
// print another line of the buffer |
for (i=0;i<linesize;i++) |
{ |
printf(" %02x", buf[offset+i]&0xff); |
} |
printf("\n"); |
if (offset <= (256 - linesize)) |
offset += linesize; |
|
} |
} |
|
} |
|
|
int |
main() |
{ |
254,6 → 411,7
|
volatile char c; |
int i,j; |
char browse_buf[256]; |
spi_master = 0; |
slave = 1; |
|
286,6 → 444,14
program_spi(spi_master, slave, (char *) &spiprogram_data, programming_file_length); |
else if (c == 'v') |
verify_spi(spi_master, slave, (char *) &spiprogram_data, programming_file_length); |
else if ( c== 'r') |
{ |
printf("Read page\n"); |
spi_read_block(spi_master, slave, ((console_get_num())<<8), |
256, |
browse_buf); |
console_browse_buffer(browse_buf); |
} |
|
|
} |
/boards/actel/ordb1a3pe1500/rtl/verilog/include/orpsoc-defines.v
184,7 → 184,7
// `define I2C1 |
// `define I2C2 |
// `define I2C3 |
// `define USB0 |
`define USB0 |
// `define USB1 |
//`define GPIO0 |
`define ETH0 |
/boards/actel/ordb1a3pe1500/Makefile.inc
0,0 → 1,62
# Makefile fragment with some variables global to this board board |
# Expects BOARD_ROOT to be set |
|
FPGA_VENDOR=actel |
BOARD_NAME=ordb1a3pe1500 |
BOARD=$(FPGA_VENDOR)/$(BOARD_NAME) |
DESIGN_NAME=orpsoc |
|
# Path down to root of project |
PROJECT_ROOT=$(BOARD_ROOT)/../../.. |
|
SYNTHESIS_TOOL=synplify |
|
export BOARD |
|
include $(PROJECT_ROOT)/scripts/make/Makefile-misc.inc |
include $(PROJECT_ROOT)/scripts/make/Makefile-board-paths.inc |
include $(PROJECT_ROOT)/scripts/make/Makefile-board-tops.inc |
include $(PROJECT_ROOT)/scripts/make/Makefile-board-definesparse.inc |
|
# Technology-specific paths |
|
# Backend directories |
# This one is the board build's backend dir. |
BOARD_BACKEND_DIR=$(BOARD_ROOT)/backend |
BOARD_BACKEND_VERILOG_DIR=$(BOARD_BACKEND_DIR)/rtl/verilog |
# Technology backend (vendor-specific) |
TECHNOLOGY_BACKEND_DIR=$(BOARD_ROOT)/../backend |
# This path is for the technology library |
TECHNOLOGY_LIBRARY_VERILOG_DIR=$(TECHNOLOGY_BACKEND_DIR)/rtl/verilog |
|
# Bootrom setup |
# BootROM code, which generates a verilog array select values |
BOOTROM_FILE=bootrom.v |
BOOTROM_SW_DIR=$(BOARD_SW_DIR)/bootrom |
BOOTROM_SRC=$(shell ls $(BOOTROM_SW_DIR)/* | grep -v $(BOOTROM_FILE)) |
BOOTROM_VERILOG=$(BOOTROM_SW_DIR)/$(BOOTROM_FILE) |
|
bootrom: $(BOOTROM_VERILOG) |
|
$(BOOTROM_VERILOG): $(BOOTROM_SRC) |
$(Q)echo; echo "\t### Generating bootup ROM ###"; echo |
$(Q)$(MAKE) -C $(BOOTROM_SW_DIR) $(BOOTROM_FILE) |
|
clean-bootrom: |
$(Q)echo; echo "\t### Cleaning bootup ROM ###"; echo |
$(Q)$(MAKE) -C $(BOOTROM_SW_DIR) clean |
|
include $(PROJECT_ROOT)/scripts/make/Makefile-board-rtlmodules.inc |
|
# Actel-specific stuff |
# "Backend" source file stuff (PLL, RAM macro models.) |
BOARD_BACKEND_VERILOG_SRC=$(shell ls $(BOARD_BACKEND_VERILOG_DIR)/*.v ) |
|
# BACKEND_TECHNOLOGY_VERILOG_SRC should be set if we need to compile specific |
# libraries, as in the Actel and Altera case, and left empty for Xilinx who |
# allow us to simply pass the path with the -y option because they have each |
# bit of the tech library in individual files, and in which case this variable |
# should be left unset. |
|
# ProASIC technology library |
BACKEND_TECHNOLOGY_VERILOG_SRC=$(shell ls $(TECHNOLOGY_LIBRARY_VERILOG_DIR)/*.v ) |
/boards/actel/ordb1a3pe1500/backend/par/bin/Makefile
19,34 → 19,19
# Name of the directory we're currently in |
CUR_DIR=$(shell pwd) |
|
VENDOR=actel |
# The root path of the whole project |
BOARD_ROOT ?=$(CUR_DIR)/../../.. |
include $(BOARD_ROOT)/Makefile.inc |
|
VENDOR_TCL_SHELL=acttclsh |
|
PROJECT_NAME=orpsoc |
PROJECT_TOP_NAME=$(PROJECT_NAME)_top |
PROJ_ADB_FILE_NAME=$(PROJECT_NAME).adb |
DESIGN_TOP_NAME=$(DESIGN_NAME)_top |
PROJ_ADB_FILE_NAME=$(DESIGN_NAME).adb |
PROJ_ADB_FILE=$(PROJ_ADB_FILE_NAME) |
|
# The root path of the whole project |
BOARD_DIR ?=$(CUR_DIR)/../../.. |
PROJECT_ROOT=$(BOARD_DIR)/../../.. |
|
BOARD_RTL_PATH=$(BOARD_DIR)/rtl |
BOARD_RTL_VERILOG_PATH=$(BOARD_RTL_PATH)/verilog |
BOARD_RTL_VERILOG_INCLUDES=$(BOARD_RTL_VERILOG_PATH)/include |
PROJECT_VERILOG_DEFINES=$(BOARD_RTL_VERILOG_INCLUDES)/$(PROJECT_NAME)-defines.v |
|
SYN_PATH=$(BOARD_DIR)/syn/synplify |
|
SW_PATH=$(PROJECT_ROOT)/sw |
|
PAR_PATH=$(BOARD_DIR)/backend/par |
PAR_RUN_PATH=$(PAR_PATH)/run |
PAR_OUT_PATH=$(PAR_PATH)/out |
|
# Required EDIF file names |
EDIF_NAME=$(PROJECT_TOP_NAME).edn |
PROJ_EDF_FILE=$(SYN_PATH)/out/$(EDIF_NAME) |
EDIF_NAME=$(DESIGN_TOP_NAME).edn |
PROJ_EDF_FILE=$(BOARD_SYN_DIR)/out/$(EDIF_NAME) |
|
# TCL script names |
TCL_SCRIPT_START=start.tcl |
80,17 → 65,17
ROUTE_INCREMENTAL ?= off |
PLACER_HIGH_EFFORT ?= off |
|
PDC_FILE ?=$(PROJECT_NAME).pdc |
SDC_FILE ?=$(PROJECT_NAME).sdc |
PDC_FILE ?=$(DESIGN_NAME).pdc |
SDC_FILE ?=$(DESIGN_NAME).sdc |
|
|
DEFINES_FILE_CUTOFF=$(shell grep -n "end of included module defines" $(PROJECT_VERILOG_DEFINES) | cut -d ':' -f 1) |
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 ) |
#DEFINES_FILE_CUTOFF=$(shell grep -n "end of included module defines" $(PROJECT_VERILOG_DEFINES) | cut -d ':' -f 1) |
#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 ) |
# Rule to look at what defines are being extracted from main file |
print-defines: |
@echo; echo "\t### Design defines ###"; echo |
@echo "\tParsing "$(PROJECT_VERILOG_DEFINES)" and exporting:" |
@echo $(DESIGN_DEFINES) |
#print-defines: |
# @echo; echo "\t### Design defines ###"; echo |
# @echo "\tParsing "$(PROJECT_VERILOG_DEFINES)" and exporting:" |
# @echo $(DESIGN_DEFINES) |
|
# Rule to print out current config of current session |
print-config: |
109,15 → 94,6
@echo "\tBackend pinout script:" |
@echo "\tBOARD_CONFIG="$(BOARD_CONFIG) |
|
|
# Set V=1 when calling make to enable verbose output |
# mainly for debugging purposes. |
ifeq ($(V), 1) |
Q= |
else |
Q ?=@ |
endif |
|
TIME_CMD=time -p |
|
# Rule for everything from, potentially, synthesis up to PAR |
150,7 → 126,7
$(TIME_CMD) $(VENDOR_TCL_SHELL) $(TCL_SCRIPT_START) |
|
$(PROJ_EDF_FILE): |
$(MAKE) -C $(SYN_PATH)/run all |
$(MAKE) -C $(BOARD_SYN_DIR)/run all |
|
create-compile: create compile |
|
158,11 → 134,11
rm -rf *.rpt *.log *~ *.tcl *.lok *.tmp *.dtf $(SDC_FILE) $(PDC_FILE) *.adb |
|
clean-syn: |
$(MAKE) -C $(SYN_PATH)/run distclean |
$(MAKE) -C $(BOARD_SYN_DIR)/run distclean |
|
clean-sw: |
$(Q) echo; echo "\t### Cleaning simulation sw directories ###"; echo; |
$(MAKE) -C $(SW_PATH)/lib distclean |
$(MAKE) -C $(COMMON_SW_DIR)/lib distclean |
|
|
distclean: clean-sw clean-syn clean |
245,8 → 221,8
$(Q)rm -f $(TCL_FILE); |
$(Q)echo; echo "\tGenerating "$(TCL_FILE); echo |
$(Q)echo "set compile_directory "$(COMP_DIR) >> $(TCL_FILE) |
$(Q)echo "set proj_name "$(PROJECT_NAME) >> $(TCL_FILE) |
$(Q)echo "set top_name "$(PROJECT_TOP_NAME) >> $(TCL_FILE) |
$(Q)echo "set proj_name "$(DESIGN_NAME) >> $(TCL_FILE) |
$(Q)echo "set top_name "$(DESIGN_TOP_NAME) >> $(TCL_FILE) |
$(Q)echo "set family "$(FPGA_FAMILY) >> $(TCL_FILE) |
$(Q)echo "set part "$(FPGA_PART) >> $(TCL_FILE) |
$(Q)echo "set package "$(FPGA_PACKAGE) >> $(TCL_FILE) |
341,7 → 317,7
$(Q)echo " -include_user_sets no " \\ >> $(TCL_FILE) |
$(Q)echo " -include_pin_to_pin yes " \\ >> $(TCL_FILE) |
$(Q)echo " -select_clock_domains no " \\ >> $(TCL_FILE) |
$(Q)echo " "$(PROJECT_NAME)"-timing.rpt " >> $(TCL_FILE) |
$(Q)echo " "$(DESIGN_NAME)"-timing.rpt " >> $(TCL_FILE) |
$(Q)echo " report " \\ >> $(TCL_FILE) |
$(Q)echo " -type timing_violations " \\ >> $(TCL_FILE) |
$(Q)echo " -analysis max " \\ >> $(TCL_FILE) |
349,7 → 325,7
$(Q)echo " -limit_max_paths yes " \\ >> $(TCL_FILE) |
$(Q)echo " -max_paths 100 " \\ >> $(TCL_FILE) |
$(Q)echo " -max_expanded_paths 0 " \\ >> $(TCL_FILE) |
$(Q)echo " "$(PROJECT_NAME)"-timviol.rpt " >> $(TCL_FILE) |
$(Q)echo " "$(DESIGN_NAME)"-timviol.rpt " >> $(TCL_FILE) |
$(Q)echo " report " \\ >> $(TCL_FILE) |
$(Q)echo " -type timing_violations " \\ >> $(TCL_FILE) |
$(Q)echo " -analysis min " \\ >> $(TCL_FILE) |
357,7 → 333,7
$(Q)echo " -limit_max_paths yes " \\ >> $(TCL_FILE) |
$(Q)echo " -max_paths 100 " \\ >> $(TCL_FILE) |
$(Q)echo " -max_expanded_paths 0 " \\ >> $(TCL_FILE) |
$(Q)echo " "$(PROJECT_NAME)"-timmindly.rpt " >> $(TCL_FILE) |
$(Q)echo " "$(DESIGN_NAME)"-timmindly.rpt " >> $(TCL_FILE) |
|
|
|
/boards/actel/ordb1a3pe1500/sim/bin/Makefile
15,7 → 15,7
#### #### |
###################################################################### |
#### #### |
#### Copyright (C) 2009,2010 Authors and OPENCORES.ORG #### |
#### Copyright (C) 2009,2010,2011 Authors and OPENCORES.ORG #### |
#### #### |
#### This source file may be used and distributed without #### |
#### restriction provided that this copyright statement is not #### |
44,527 → 44,45
CUR_DIR=$(shell pwd) |
|
# The root path of the whole project |
PROJECT_ROOT ?=$(CUR_DIR)/../../../../.. |
BOARD_ROOT ?=$(CUR_DIR)/../.. |
# Makefile fragment with most of the setup |
include $(BOARD_ROOT)/Makefile.inc |
|
DESIGN_NAME=orpsoc |
RTL_TESTBENCH_TOP=$(DESIGN_NAME)_testbench |
# Simulation-specific paths and files from this one |
include $(PROJECT_ROOT)/scripts/make/Makefile-board-benchsrc.inc |
|
# Hardset the board name, even though we could probably determine it |
FPGA_VENDOR=actel |
BOARD_NAME=ordb1a3pe1500 |
BOARD_DIR=$(PROJECT_ROOT)/boards/$(FPGA_VENDOR)/$(BOARD_NAME) |
|
# Export BOARD_PATH for the software makefiles |
BOARD=$(FPGA_VENDOR)/$(BOARD_NAME) |
export BOARD |
|
# Paths to other important parts of this test suite |
COMMON_RTL_DIR = $(PROJECT_ROOT)/rtl |
COMMON_RTL_VERILOG_DIR = $(COMMON_RTL_DIR)/verilog |
#COMMON_RTL_VHDL_DIR = $(COMMON_RTL_DIR)/vhdl |
|
BOARD_RTL_DIR=$(BOARD_DIR)/rtl |
BOARD_RTL_VERILOG_DIR=$(BOARD_RTL_DIR)/verilog |
# Only 1 include path for board builds - their own! |
BOARD_RTL_VERILOG_INCLUDE_DIR=$(BOARD_RTL_VERILOG_DIR)/include |
|
BOARD_BENCH_DIR=$(BOARD_DIR)/bench |
BOARD_BENCH_VERILOG_DIR=$(BOARD_BENCH_DIR)/verilog |
BOARD_BENCH_VERILOG_INCLUDE_DIR=$(BOARD_BENCH_VERILOG_DIR)/include |
|
COMMON_BENCH_DIR=$(PROJECT_ROOT) |
COMMON_BENCH_VERILOG_DIR=$(COMMON_BENCH_DIR)/verilog |
COMMON_BENCH_VERILOG_INCLUDE_DIR=$(COMMON_BENCH_VERILOG_DIR)/include |
|
# Top level files for DUT and testbench |
DUT_TOP=$(BOARD_RTL_VERILOG_DIR)/$(DESIGN_NAME)_top/$(DESIGN_NAME)_top.v |
BENCH_TOP=$(BOARD_BENCH_VERILOG_DIR)/$(DESIGN_NAME)_testbench.v |
|
# Software tests we'll run |
|
# Need this for individual test variables to not break |
TEST ?= or1200-simple |
|
TESTS ?= or1200-simple or1200-cbasic or1200-dctest or1200-float or1200-mmu or1200-basic or1200-except or1200-tick or1200-ticksyscall uart-simple |
|
include $(PROJECT_ROOT)/scripts/make/Makefile-simulators.inc |
|
# Gets turned into verilog `define |
SIM_TYPE=RTL |
|
# Main defines file is from board include path |
PROJECT_VERILOG_DEFINES=$(BOARD_RTL_VERILOG_INCLUDE_DIR)/$(DESIGN_NAME)-defines.v |
|
# Detect technology to use for the simulation |
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 ) |
|
# Rule to look at what defines are being extracted from main file |
print-defines: |
@echo echo; echo "\t### Design defines ###"; echo; |
@echo "\tParsing "$(PROJECT_VERILOG_DEFINES)" and exporting:" |
@echo $(DESIGN_DEFINES) |
|
print-tests: |
@echo; echo; echo "\t### Software tests to be run ###"; echo; |
@echo $(TESTS) |
@echo |
|
# Simulation directories |
SIM_DIR ?=$(BOARD_DIR)/sim |
RTL_SIM_DIR=$(SIM_DIR) |
RTL_SIM_RUN_DIR=$(RTL_SIM_DIR)/run |
RTL_SIM_BIN_DIR=$(RTL_SIM_DIR)/bin |
RTL_SIM_RESULTS_DIR=$(RTL_SIM_DIR)/out |
|
# Testbench paths |
BOARD_BENCH_DIR=$(BOARD_DIR)/bench |
BOARD_BENCH_VERILOG_DIR=$(BOARD_BENCH_DIR)/verilog |
COMMON_BENCH_DIR=$(PROJECT_ROOT)/bench |
COMMON_BENCH_VERILOG_DIR=$(COMMON_BENCH_DIR)/verilog |
|
#BENCH_VHDL_DIR=$(BENCH_DIR)/vhdl |
# No SystemC or Verilator support for this build |
#BENCH_SYSC_DIR=$(BENCH_DIR)/sysc |
#BENCH_SYSC_SRC_DIR=$(BENCH_SYSC_DIR)/src |
#BENCH_SYSC_INCLUDE_DIR=$(BENCH_SYSC_DIR)/include |
|
# Backend directories |
# This one is the board build's backend dir. |
BOARD_BACKEND_DIR=$(BOARD_DIR)/backend |
BOARD_BACKEND_VERILOG_DIR=$(BOARD_BACKEND_DIR)/rtl/verilog |
TECHNOLOGY_BACKEND_DIR=$(BOARD_DIR)/../backend |
# This path is for the technology library |
TECHNOLOGY_BACKEND_VERILOG_DIR=$(TECHNOLOGY_BACKEND_DIR)/rtl/verilog |
|
# Synthesis directory for board |
BOARD_SYN_DIR=$(BOARD_DIR)/syn/synplify |
BOARD_SYN_OUT_DIR=$(BOARD_SYN_DIR)/out |
|
# System software dir |
COMMON_SW_DIR=$(PROJECT_ROOT)/sw |
BOARD_SW_DIR=$(BOARD_DIR)/sw |
|
# BootROM code, which generates a verilog array select values |
BOOTROM_FILE=bootrom.v |
BOOTROM_SW_DIR=$(BOARD_SW_DIR)/bootrom |
BOOTROM_SRC=$(shell ls $(BOOTROM_SW_DIR)/* | grep -v $(BOOTROM_FILE)) |
BOOTROM_VERILOG=$(BOOTROM_SW_DIR)/$(BOOTROM_FILE) |
|
bootrom: $(BOOTROM_VERILOG) |
|
$(BOOTROM_VERILOG): $(BOOTROM_SRC) |
$(Q)echo; echo "\t### Generating bootup ROM ###"; echo |
$(Q)$(MAKE) -C $(BOOTROM_SW_DIR) $(BOOTROM_FILE) |
|
# Suffix of file to check after each test for the string |
TEST_OUT_FILE_SUFFIX=-general.log |
TEST_OK_STRING=8000000d |
|
# Dynamically generated verilog file defining configuration for various things |
# Rule actually generating this is found in definesgen.inc file. |
TEST_DEFINES_VLG=test-defines.v |
# Set V=1 when calling make to enable verbose output |
# mainly for debugging purposes. |
ifeq ($(V), 1) |
Q= |
QUIET= |
else |
Q ?=@ |
QUIET=-quiet |
endif |
|
# Modelsim variables |
MGC_VSIM=vsim |
MGC_VLOG_COMP=vlog |
MGC_VHDL_COMP=vcom |
MODELSIM=modelsim |
|
# Default simulator is Modelsim here as we're using the ProASIC3 |
# libraries which are not compilable with Icarus. |
# Set SIMULATOR=modelsim to use Modelsim (Default) |
# Set SIMULATOR=ncverilog to use Cadence's NC-Verilog - TODO |
# Set SIMULATOR=icarus to use Icarus Verilog (Not supported for this board) |
|
SIMULATOR ?= $(MODELSIM) |
|
# |
# Modelsim-specific settings |
# |
VOPT_ARGS=$(QUIET) -suppress 2241 |
# If VCD dump is desired, tell Modelsim not to optimise |
# away everything. |
ifeq ($(VCD), 1) |
#VOPT_ARGS=-voptargs="+acc=rnp" |
VOPT_ARGS=+acc=rnpqv |
endif |
# VSIM commands |
# Suppressed warnings - 3009: Failed to open $readmemh() file |
# Suppressed warnings - 3009: Module 'blah' does not have a `timescale directive in effect, but previous modules do. |
# Suppressed warnings - 8598: Non-positive replication multiplier inside concat. Replication will be ignored |
VSIM_ARGS= -suppress 7 -suppress 3009 -suppress 8598 -c $(QUIET) -do "set StdArithNoWarnings 1; run -all; exit" |
# Include the test-defines.v generation rule |
include $(PROJECT_ROOT)/scripts/make/Makefile-sim-definesgen.inc |
|
# VPI debugging interface variables |
VPI_SRC_C_DIR=$(COMMON_BENCH_VERILOG_DIR)/vpi/c |
VPI_SRC_VERILOG_DIR=vpi/verilog |
VPI_SRCS=$(shell ls $(VPI_SRC_C_DIR)/*.[ch]) |
|
# Modelsim VPI compile variables |
MODELTECH_VPILIB=msim_jp_vpi.sl |
|
|
# Modelsim VPI settings |
ifeq ($(VPI), 1) |
VPI_LIBS=$(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB) |
VSIM_ARGS += -pli $(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB) |
endif |
# Rule to make the VPI library for modelsim |
$(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB): $(VPI_SRCS) |
$(MAKE) -C $(VPI_SRC_C_DIR) $(MODELTECH_VPILIB) |
|
# |
# Verilog DUT source variables |
# Modelsim make rules for RTL tests |
# |
include $(PROJECT_ROOT)/scripts/make/Makefile-board-modelsim.inc |
|
# First consider any modules we'll use gatelevel descriptions of. |
# These will have to be set on the command line |
GATELEVEL_MODULES ?= |
|
# First we get a list of modules in the RTL path of the board's path. |
# Next we check which modules not in the board's RTL path are in the root RTL |
# path (modules which can be commonly instantiated, but over which board |
# build-specific versions take precedence.) |
|
# Paths under board/***/rtl/verilog we wish to exclude when getting modules |
BOARD_VERILOG_MODULES_EXCLUDE= include $(GATELEVEL_MODULES) |
BOARD_VERILOG_MODULES_DIR_LIST=$(shell ls $(BOARD_RTL_VERILOG_DIR)) |
# Apply exclude to list of modules |
BOARD_RTL_VERILOG_MODULES=$(filter-out $(BOARD_VERILOG_MODULES_EXCLUDE),$(BOARD_VERILOG_MODULES_DIR_LIST)) |
|
# Rule for debugging this script |
print-board-modules: |
@echo echo; echo "\t### Board verilog modules ###"; echo |
@echo $(BOARD_RTL_VERILOG_MODULES) |
|
# Now get list of modules that we don't have a version of in the board path |
COMMON_VERILOG_MODULES_EXCLUDE= include |
COMMON_VERILOG_MODULES_EXCLUDE += $(BOARD_RTL_VERILOG_MODULES) |
COMMON_VERILOG_MODULES_EXCLUDE += $(GATELEVEL_MODULES) |
|
COMMON_RTL_VERILOG_MODULES_DIR_LIST=$(shell ls $(COMMON_RTL_VERILOG_DIR)) |
COMMON_RTL_VERILOG_MODULES=$(filter-out $(COMMON_VERILOG_MODULES_EXCLUDE), $(COMMON_RTL_VERILOG_MODULES_DIR_LIST)) |
|
|
# Add these to exclude their RTL directories from being included in scripts |
|
|
|
# Rule for debugging this script |
print-common-modules-exclude: |
@echo echo; echo "\t### Common verilog modules being excluded due to board versions ###"; echo |
@echo "$(COMMON_VERILOG_MODULES_EXCLUDE)" |
|
print-common-modules: |
@echo echo; echo "\t### Verilog modules from common RTL dir ###"; echo |
@echo $(COMMON_RTL_VERILOG_MODULES) |
|
# List of verilog source files (only .v files!) |
# Board RTL modules first |
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) |
# Common RTL module source |
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) |
|
# List of verilog includes from board RTL path - only for rule sensitivity |
RTL_VERILOG_INCLUDES=$(shell ls $(BOARD_RTL_VERILOG_INCLUDE_DIR)/*.*) |
|
print-verilog-src: |
@echo echo; echo "\t### Verilog source ###"; echo |
@echo $(RTL_VERILOG_SRC) |
|
# Rules to make RTL we might need |
# Expects modules, if they need making, to have their top verilog file to |
# correspond to their module name, and the directory should have a make file |
# and rule which works for this command. |
# Add name of module to this list, currently only does verilog ones. |
# Rule 'rtl' is called just before generating DUT modelsim compilation script |
RTL_TO_CHECK= |
rtl: |
$(Q)for module in $(RTL_TO_CHECK); do \ |
$(MAKE) -C $(RTL_VERILOG_DIR)/$$module $$module.v; \ |
done |
|
# |
# VHDL DUT source variables |
# RTL test rules |
# |
# VHDL modules |
#RTL_VHDL_MODULES=$(shell ls $(RTL_VHDL_DIR)) |
# VHDL sources |
#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) |
#print-vhdl-src: |
# @echo echo; echo "\t### VHDL modules and source ###"; echo |
# @echo "modules: "; echo $(RTL_VHDL_MODULES); echo |
# @echo "source: "$(RTL_VHDL_SRC) |
include $(PROJECT_ROOT)/scripts/make/Makefile-rtltestrules.inc |
|
# |
# Testbench source |
# |
BOARD_BENCH_VERILOG_SRC=$(shell ls $(BOARD_BENCH_VERILOG_DIR)/*.v | grep -v $(DESIGN_NAME)_testbench ) |
BOARD_BENCH_VERILOG_SRC_FILES=$(notdir $(BOARD_BENCH_VERILOG_SRC)) |
|
# Now only take the source from the common path that we don't already have in |
# our board's |
COMMON_BENCH_VERILOG_DIR_LS=$(shell ls $(COMMON_BENCH_VERILOG_DIR)/*.v) |
COMMON_BENCH_VERILOG_SRC_FILES=$(notdir $(COMMON_BENCH_VERILOG_DIR_LS)) |
COMMON_BENCH_VERILOG_SRC_FILTERED=$(filter-out $(BOARD_BENCH_VERILOG_SRC_FILES) $(DESIGN_NAME)_testbench.v,$(COMMON_BENCH_VERILOG_SRC_FILES)) |
COMMON_BENCH_VERILOG_SRC=$(addprefix $(COMMON_BENCH_VERILOG_DIR)/, $(COMMON_BENCH_VERILOG_SRC_FILTERED)) |
|
print-board-bench-src: |
$(Q)echo "\tBoard bench verilog source"; \ |
echo $(BOARD_BENCH_VERILOG_SRC) |
|
print-common-bench-src: |
$(Q)echo "\Common bench verilog source"; \ |
echo $(COMMON_BENCH_VERILOG_SRC) |
|
# Testbench source subdirectory detection (exclude include, we always use |
# board bench include directory!) |
BOARD_BENCH_VERILOG_SUBDIRS=$(shell cd $(BOARD_BENCH_VERILOG_DIR) && ls -d */ | grep -v include) |
COMMON_BENCH_VERILOG_SUBDIRS=$(shell cd $(COMMON_BENCH_VERILOG_DIR) && ls -d */ | grep -v include) |
|
# Get rid of ones we have a copy of locally |
COMMON_BENCH_VERILOG_SUBDIRS_EXCLUDE_BOARDS=$(filter-out $(BOARD_BENCH_VERILOG_SUBDIRS),$(COMMON_BENCH_VERILOG_SUBDIRS)) |
|
# Construct list of paths we will want to include |
BENCH_VERILOG_SUBDIRS=$(addprefix $(COMMON_BENCH_VERILOG_DIR)/,$(COMMON_BENCH_VERILOG_SUBDIRS_EXCLUDE_BOARDS)) |
BENCH_VERILOG_SUBDIRS += $(addprefix $(BOARD_BENCH_VERILOG_DIR)/,$(BOARD_BENCH_VERILOG_SUBDIRS)) |
|
# Finally, add include path from local bench path |
BENCH_VERILOG_SUBDIRS += $(BOARD_BENCH_VERILOG_DIR)/include |
|
ifeq ($(VPI), 1) |
# Manually add the VPI bench verilog path |
COMMON_BENCH_VERILOG_SUBDIRS += $(VPI_SRC_VERILOG_DIR) |
endif |
|
print-board-bench-subdirs: |
$(Q)echo "\tBoard bench subdirectories"; \ |
echo $(BOARD_BENCH_VERILOG_SUBDIRS) |
|
print-common-bench-subdirs: |
$(Q)echo "\tCommon bench subdirectories"; \ |
echo $(COMMON_BENCH_VERILOG_SUBDIRS) |
|
print-bench-subdirs: |
$(Q)echo "\tBench subdirectories"; \ |
echo $(BENCH_VERILOG_SUBDIRS) |
|
|
# Backend technology library files |
# We don't do this for the board backend stuff - that should all be properly |
# named, and so we only need to pass the "-y" option for that path. |
BACKEND_TECHNOLOGY_VERILOG_SRC=$(shell ls $(TECHNOLOGY_BACKEND_VERILOG_DIR)/*.v ) |
BOARD_BACKEND_VERILOG_SRC=$(shell ls $(BOARD_BACKEND_VERILOG_DIR)/*.v ) |
|
# |
# Compile script generation rules: |
# |
|
# Modelsim library compilation rules |
|
# Backend script generation - make these rules sensitive to source and includes |
modelsim_backend.scr: $(BOARD_BACKEND_VERILOG_SRC) |
$(Q)echo "+incdir+"$(TECHNOLOGY_BACKEND_VERILOG_DIR) > $@; |
$(Q)echo "-y " $(BOARD_BACKEND_VERILOG_DIR) >> $@ |
$(Q)echo "+libext+.v" >> $@; |
$(Q)for vsrc in $(BACKEND_TECHNOLOGY_VERILOG_SRC); do echo $$vsrc >> $@; done |
$(Q)echo >> $@; |
|
# DUT compile script |
modelsim_dut.scr: rtl $(RTL_VERILOG_SRC) $(RTL_VERILOG_INCLUDES) $(BOOTROM_VERILOG) |
$(Q)echo "+incdir+"$(BOARD_RTL_VERILOG_INCLUDE_DIR) > $@; |
$(Q)echo "+incdir+"$(BOOTROM_SW_DIR) >> $@; |
$(Q)echo "+incdir+"$(BOARD_BENCH_VERILOG_INCLUDE_DIR) >> $@; |
$(Q)echo "+libext+.v" >> $@; |
$(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 |
$(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 |
$(Q)echo "-y " $(BOARD_BACKEND_VERILOG_DIR) >> $@; |
$(Q)if [ ! -z "$$GATELEVEL_MODULES" ]; \ |
then echo "-y " $(BOARD_SYN_OUT_DIR) >> $@; \ |
echo "+libext+.vm" >> $@; \ |
fi |
$(Q)echo >> $@ |
|
modelsim_bench.scr: $(BOARD_BENCH_VERILOG_SRC) $(COMMON_BENCH_VERILOG_SRC) |
$(Q)echo "+incdir+"$(BOARD_BENCH_VERILOG_INCLUDE_DIR) > $@; |
$(Q)echo "+incdir+"$(COMMON_BENCH_VERILOG_INCLUDE_DIR) >> $@; |
$(Q)for path in $(BENCH_VERILOG_SUBDIRS); do echo "+incdir+"$$path >> $@; done |
$(Q)for path in $(BENCH_VERILOG_SUBDIRS); do echo "-y "$$path >> $@; done |
$(Q)echo "+incdir+"$(BOARD_RTL_VERILOG_INCLUDE_DIR) >> $@; |
$(Q)echo "+libext+.v" >> $@; |
$(Q)for vsrc in $(BOARD_BENCH_VERILOG_SRC); do echo $$vsrc >> $@; done |
$(Q)for vsrc in $(COMMON_BENCH_VERILOG_SRC); do echo $$vsrc >> $@; done |
$(Q)echo >> $@ |
|
# Modelsim library compilation rules |
# Actel backend library |
BACKEND_LIB=lib_backend |
$(BACKEND_LIB): modelsim_backend.scr |
$(Q)if [ ! -e $@ ]; then vlib $@; fi |
$(Q)echo; echo "\t### Compiling Actel backend library ###"; echo |
$(Q)vlog -nologo $(QUIET) -work $@ -f $< |
|
# Compile DUT into "work" library |
work: modelsim_dut.scr |
$(Q)if [ ! -e $@ ]; then vlib $@; fi |
$(Q)echo; echo "\t### Compiling Verilog design library ###"; echo |
$(Q)vlog $(QUIET) -f $< $(DUT_TOP) |
|
# Single compile rule |
.PHONY : $(MODELSIM) |
$(MODELSIM): modelsim_bench.scr $(TEST_DEFINES_VLG) $(BACKEND_LIB) $(VPI_LIBS) work |
$(Q)echo; echo "\t### Compiling testbench ###"; echo |
$(Q)vlog $(QUIET) -nologo -incr $(BENCH_TOP) -f $< |
$(Q)vopt $(QUIET) $(RTL_TESTBENCH_TOP) $(VOPT_ARGS) -L $(BACKEND_LIB) \ |
-o tb |
$(Q)echo; echo "\t### Launching simulation ###"; echo |
$(Q)vsim $(VSIM_ARGS) tb |
|
|
.PHONY: rtl-test |
rtl-test: clean-sim-test-sw sw clean-test-defines $(TEST_DEFINES_VLG) \ |
$(SIMULATOR) |
|
# Run an RTL test followed by checking of generated results |
rtl-test-with-check: rtl-test |
$(Q)$(MAKE) check-test-log; \ |
if [ $$? -ne 0 ]; then \ |
echo; echo "\t### "$(TEST)" test FAIL ###"; echo; \ |
else \ |
echo; echo "\t### "$(TEST)" test OK ###"; echo; \ |
fi |
|
# Do check, don't print anything out |
rtl-test-with-check-no-print: rtl-test check-test-log |
|
# Main RTL test loop |
rtl-tests: |
$(Q)for test in $(TESTS); do \ |
export TEST=$$test; \ |
$(MAKE) rtl-test-with-check-no-print; \ |
if [ $$? -ne 0 ]; then break; fi; \ |
echo; echo "\t### $$test test OK ###"; echo; \ |
done |
|
|
.PHONY: check-test-log |
check-test-log: |
$(Q)echo "#!/bin/bash" > $@ |
$(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; }" >> $@ |
$(Q)echo "check-test-log" >> $@ |
$(Q)chmod +x $@ |
$(Q) echo; echo "\t### Checking simulation results for "$(TEST)" test ###"; echo; |
$(Q)./$@ |
|
# Include the test-defines.v generation rule |
include $(PROJECT_ROOT)/sim/bin/definesgen.inc |
|
# |
# Software make rules (called recursively) |
# |
include $(PROJECT_ROOT)/scripts/make/Makefile-board-sw.inc |
|
# Path for the current test |
# First check for a local copy of the test. If it doesn't exist then we |
# default to the software tests in the root directory |
TEST_MODULE=$(shell echo $(TEST) | cut -d "-" -f 1) |
BOARD_SW_TEST_DIR=$(BOARD_SW_DIR)/tests/$(TEST_MODULE)/sim |
COMMON_SW_TEST_DIR=$(COMMON_SW_DIR)/tests/$(TEST_MODULE)/sim |
# Do this by testing for the file's existence |
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) |
|
print-test-sw-dir: |
@echo; echo "\tTest software is in the following path"; echo; |
@echo $(BOARD_SW_DIR); echo; |
@echo $(BOARD_SW_TEST_DIR); echo; |
@echo $(SW_TEST_DIR); echo; |
|
print-sw-tests: |
$(Q) $(MAKE) -C $(COMMON_SW_DIR)/lib print-sw-tests |
$(Q) $(MAKE) -C $(COMMON_SW_DIR)/lib print-sw-tests-subdirs |
|
|
# Name of the image the RAM model will attempt to load via Verilog $readmemh |
# system function. |
|
# Set PRELOAD_RAM=1 to preload the system memory - be sure the bootROM program |
# chosen in board.h is the one booting from the reset vector. |
ifeq ($(PRELOAD_RAM), 1) |
SIM_SW_IMAGE ?=sram.vmem |
else |
SIM_SW_IMAGE ?=flash.in |
endif |
|
.PHONY : sw |
sw: $(SIM_SW_IMAGE) |
|
|
flash.in: $(SW_TEST_DIR)/$(TEST).flashin |
$(Q)if [ -L $@ ]; then unlink $@; fi |
$(Q)ln -s $< $@ |
|
sram.vmem: $(SW_TEST_DIR)/$(TEST).vmem |
$(Q)if [ -L $@ ]; then unlink $@; fi |
$(Q)ln -s $< $@ |
|
.PHONY: $(SW_TEST_DIR)/$(TEST).flashin |
$(SW_TEST_DIR)/$(TEST).flashin: |
$(Q) echo; echo "\t### Compiling software ###"; echo; |
$(Q)$(MAKE) -C $(SW_TEST_DIR) $(TEST).flashin |
|
.PHONY: $(SW_TEST_DIR)/$(TEST).vmem |
$(SW_TEST_DIR)/$(TEST).vmem: |
$(Q) echo; echo "\t### Compiling software ###"; echo; |
$(Q)$(MAKE) -C $(SW_TEST_DIR) $(TEST).vmem |
|
# Create test software disassembly |
|
sw-dis: $(SW_TEST_DIR)/$(TEST).dis |
$(Q)cp -v $< . |
|
$(SW_TEST_DIR)/$(TEST).dis: |
$(Q)$(MAKE) -C $(SW_TEST_DIR) $(TEST).dis |
|
# |
# Cleaning rules |
# |
clean: clean-sim clean-sim-test-sw clean-bootrom clean-out clean-sw |
|
clean-sim: |
$(Q) echo; echo "\t### Cleaning simulation run directory ###"; echo; |
$(Q)rm -rf *.* lib_* work transcript check-test-log |
$(Q) if [ -e $(VPI_SRC_C_DIR) ]; then $(MAKE) -C $(VPI_SRC_C_DIR) clean; fi |
|
clean-bootrom: |
$(MAKE) -C $(BOOTROM_SW_DIR) clean |
|
clean-out: |
$(Q)rm -rf $(RTL_SIM_RESULTS_DIR)/*.* |
|
clean-test-defines: |
$(Q)rm -f $(TEST_DEFINES_VLG) |
|
clean-sim-test-sw: |
$(Q)if [ -e $(SIM_SW_IMAGE) ]; then unlink $(SIM_SW_IMAGE); fi |
|
clean-sw: |
$(Q) echo; echo "\t### Cleaning simulation sw directories ###"; echo; |
$(Q) $(MAKE) -C $(COMMON_SW_DIR)/lib distclean |
|
clean-rtl: |
$(Q) echo; echo "\t### Cleaning generated verilog RTL ###"; echo; |
for module in $(RTL_TO_CHECK); do \ |
$(MAKE) -C $(RTL_VERILOG_DIR)/$$module clean; \ |
done |
|
# Removes any checked out RTL |
distclean: clean |
$(Q) echo; echo "\t### Cleaning generated verilog RTL ###"; echo; |
$(Q)for module in $(RTL_TO_CHECK); do \ |
$(MAKE) -C $(RTL_VERILOG_DIR)/$$module distclean; \ |
done |
include $(PROJECT_ROOT)/scripts/make/Makefile-board-simclean.inc |
/boards/actel/ordb1a3pe1500/syn/synplify/bin/Makefile
12,99 → 12,12
# Name of the directory we're currently in |
CUR_DIR=$(shell pwd) |
|
# The root path of the board build |
BOARD_DIR ?=$(CUR_DIR)/../../.. |
PROJECT_ROOT=$(BOARD_DIR)/../../.. |
# The root path of the whole project |
BOARD_ROOT ?=$(CUR_DIR)/../../.. |
# Makefile fragment with most of the setup |
include $(BOARD_ROOT)/Makefile.inc |
|
# Export BOARD for the software makefiles |
BOARD=actel/ordb1a3pe1500 |
export BOARD |
|
DESIGN_NAME=orpsoc |
|
# Paths to other important parts of this test suite |
|
# Paths to other important parts of this test suite |
COMMON_RTL_DIR = $(PROJECT_ROOT)/rtl |
COMMON_RTL_VERILOG_DIR = $(COMMON_RTL_DIR)/verilog |
#COMMON_RTL_VHDL_DIR = $(COMMON_RTL_DIR)/vhdl |
|
BOARD_RTL_DIR=$(BOARD_DIR)/rtl |
BOARD_RTL_VERILOG_DIR=$(BOARD_RTL_DIR)/verilog |
# Only 1 include path for board builds - their own! |
BOARD_RTL_VERILOG_INCLUDE_DIR=$(BOARD_RTL_VERILOG_DIR)/include |
#BOARD_RTL_VHDL_DIR = $(BOARD_RTL_DIR)/vhdl |
|
|
BACKEND_DIR=$(BOARD_DIR)/backend |
BACKEND_VERILOG_DIR=$(BACKEND_DIR)/rtl/verilog |
|
# Set V=1 when calling make to enable verbose output |
# mainly for debugging purposes. |
ifeq ($(V), 1) |
Q= |
else |
Q ?=@ |
endif |
|
|
# |
# Verilog DUT source variables |
# |
# First we get a list of modules in the RTL path of the board's path. |
# Next we check which modules not in the board's RTL path are in the root RTL |
# path (modules which can be commonly instantiated, but over which board |
# build-specific versions take precedence.) |
|
# Paths under board/***/rtl/verilog we wish to exclude when getting modules |
BOARD_VERILOG_MODULES_EXCLUDE= include |
BOARD_VERILOG_MODULES_DIR_LIST=$(shell ls $(BOARD_RTL_VERILOG_DIR)) |
# Apply exclude to list of modules |
BOARD_RTL_VERILOG_MODULES=$(filter-out $(BOARD_VERILOG_MODULES_EXCLUDE),$(BOARD_VERILOG_MODULES_DIR_LIST)) |
|
# Rule for debugging this script |
print-board-modules: |
@echo echo; echo "\t### Board verilog modules ###"; echo; |
@echo $(BOARD_RTL_VERILOG_MODULES) |
|
# Now get list of modules that we don't have a version of in the board path |
COMMON_VERILOG_MODULES_EXCLUDE= include |
COMMON_VERILOG_MODULES_EXCLUDE += $(BOARD_RTL_VERILOG_MODULES) |
|
COMMON_RTL_VERILOG_MODULES_DIR_LIST=$(shell ls $(COMMON_RTL_VERILOG_DIR)) |
COMMON_RTL_VERILOG_MODULES=$(filter-out $(COMMON_VERILOG_MODULES_EXCLUDE), $(COMMON_RTL_VERILOG_MODULES_DIR_LIST)) |
|
# Rule for debugging this script |
print-common-modules-exclude: |
@echo echo; echo "\t### Common verilog modules being excluded due to board versions ###"; echo; |
@echo "$(COMMON_VERILOG_MODULES_EXCLUDE)" |
|
print-common-modules: |
@echo echo; echo "\t### Verilog modules from common RTL dir ###"; echo |
@echo $(COMMON_RTL_VERILOG_MODULES) |
|
# List of verilog source files (only .v files!) |
# Board RTL modules first |
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) |
# Common RTL module source |
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) |
|
# List of verilog includes from board RTL path - only for rule sensitivity |
RTL_VERILOG_INCLUDES=$(shell ls $(BOARD_RTL_VERILOG_INCLUDE_DIR)/*.*) |
|
# |
# Add backend files here, except for the proasic3 library |
# |
RTL_VERILOG_SRC+=$(shell ls $(BACKEND_VERILOG_DIR)/*.v) |
|
# |
# VHDL DUT source variables |
# |
# VHDL modules |
#RTL_VHDL_MODULES=$(shell ls $(RTL_VHDL_DIR)) |
# VHDL sources |
#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) |
|
# Tool settings |
# For Linux, the Actel licenses only support Synplify Pro |
SYN_WORK_DIR ?=synplify_work |
173,14 → 86,6
# Dynamically created files included by different parts of the defines |
# |
|
BOOTROM_FILE=bootrom.v |
BOARD_SW_DIR=$(BOARD_DIR)/sw |
BOARD_BOOTROM_SW_DIR=$(BOARD_SW_DIR)/bootrom |
BOOTROM_VERILOG=$(BOARD_BOOTROM_SW_DIR)/$(BOOTROM_FILE) |
bootrom: $(BOOTROM_VERILOG) |
$(BOOTROM_VERILOG): |
$(MAKE) -C $(BOARD_BOOTROM_SW_DIR) $(BOOTROM_FILE) |
|
SYNDIR_BOOTROM_VERILOG=$(SYN_WORK_DIR)/$(BOOTROM_FILE) |
$(SYNDIR_BOOTROM_VERILOG): $(BOOTROM_VERILOG) |
cp $^ $@ |
213,6 → 118,9
$(Q)for file in $(RTL_VHDL_SRC); do \ |
echo "add_file -vhdl "$$file >> $@; \ |
done |
$(Q)for file in $(BOARD_BACKEND_VERILOG_SRC); do \ |
echo "add_file -verilog "$$file >> $@; \ |
done |
$(Q)echo "add_file -constraint "$(SDC_FILE) >> $@ |
$(Q)echo "set_option -include_path "$(BOARD_RTL_VERILOG_INCLUDE_DIR) >> $@ |
$(Q)echo "set_option -include_path ." >> $@ |
309,7 → 217,7
$(VLOG_NETLIST_FILE_OUT): $(SYN_WORK_DIR)/$(SYN_PROJ_NAME)/$(VLOG_NETLIST_FILE) |
cp $^ $@ |
|
distclean: clean-sw clean clean-edifs |
distclean: clean-sw clean clean-bootrom clean-edifs |
|
clean-sw: |
$(MAKE) -C $(PROJECT_ROOT)/sw/lib distclean |
/boards/xilinx/ml501/Makefile.inc
0,0 → 1,72
# Makefile fragment with some variables global to this board board |
# Expects BOARD_ROOT to be set |
|
FPGA_VENDOR=xilinx |
BOARD_NAME=ml501 |
BOARD=$(FPGA_VENDOR)/$(BOARD_NAME) |
DESIGN_NAME=orpsoc |
|
# Path down to root of project |
PROJECT_ROOT=$(BOARD_ROOT)/../../.. |
|
SYNTHESIS_TOOL=xst |
|
export BOARD |
|
include $(PROJECT_ROOT)/scripts/make/Makefile-misc.inc |
include $(PROJECT_ROOT)/scripts/make/Makefile-board-paths.inc |
include $(PROJECT_ROOT)/scripts/make/Makefile-board-tops.inc |
include $(PROJECT_ROOT)/scripts/make/Makefile-board-definesparse.inc |
|
# Check that the XILINX_PATH variable is set |
ifeq ($(XILINX_PATH),) |
$(error XILINX_PATH environment variable not set. Set it and rerun) |
endif |
XILINX_SETTINGS_SCRIPT=$(XILINX_PATH)/settings32.sh |
XILINX_SETTINGS_SCRIPT_EXISTS=$(shell if [ -e $(XILINX_SETTINGS_SCRIPT) ]; then echo 1; else echo 0; fi) |
ifeq ($(XILINX_SETTINGS_SCRIPT_EXISTS),0) |
$(error XILINX_PATH variable not set correctly. Cannot find $$XILINX_PATH/settings32.sh) |
endif |
|
# Backend directories |
# This one is the board build's backend dir. |
BOARD_BACKEND_DIR=$(BOARD_ROOT)/backend |
BOARD_BACKEND_VERILOG_DIR=$(BOARD_BACKEND_DIR)/rtl/verilog |
BOARD_BACKEND_BIN_DIR=$(BOARD_BACKEND_DIR)/bin |
# Technology backend (vendor-specific) |
TECHNOLOGY_BACKEND_DIR=$(BOARD_ROOT)/../backend |
# This path is for the technology library |
TECHNOLOGY_LIBRARY_VERILOG_DIR=$(XILINX_PATH)/verilog |
|
# Bootrom setup |
# BootROM code, which generates a verilog array select values |
BOOTROM_FILE=bootrom.v |
BOOTROM_SW_DIR=$(BOARD_SW_DIR)/bootrom |
BOOTROM_SRC=$(shell ls $(BOOTROM_SW_DIR)/* | grep -v $(BOOTROM_FILE)) |
BOOTROM_VERILOG=$(BOOTROM_SW_DIR)/$(BOOTROM_FILE) |
|
bootrom: $(BOOTROM_VERILOG) |
|
$(BOOTROM_VERILOG): $(BOOTROM_SRC) |
$(Q)echo; echo "\t### Generating bootup ROM ###"; echo |
$(Q)$(MAKE) -C $(BOOTROM_SW_DIR) $(BOOTROM_FILE) |
|
clean-bootrom: |
$(Q)echo; echo "\t### Cleaning bootup ROM ###"; echo |
$(Q)$(MAKE) -C $(BOOTROM_SW_DIR) clean |
|
include $(PROJECT_ROOT)/scripts/make/Makefile-board-rtlmodules.inc |
|
# "Backend" source file stuff (PLL, RAM macro models.) |
BOARD_BACKEND_VERILOG_SRC=$(shell ls $(BOARD_BACKEND_VERILOG_DIR)/*.v ) |
|
# Backend tool path |
|
# BACKEND_TECHNOLOGY_VERILOG_SRC should be set if we need to compile specific |
# libraries, as in the Actel and Altera case, and left empty for Xilinx who |
# allow us to simply pass the path with the -y option because they have each |
# bit of the tech library in individual files, and in which case this variable |
# should be left unset. |
|
# Keep this variable empty |
BACKEND_TECHNOLOGY_VERILOG_SRC= |
/boards/xilinx/ml501/backend/par/bin/Makefile
8,7 → 8,7
#### #### |
###################################################################### |
#### #### |
#### Copyright (C) 2009,2010 Authors and OPENCORES.ORG #### |
#### Copyright (C) 2009,2010,2011 Authors and OPENCORES.ORG #### |
#### #### |
#### This source file may be used and distributed without #### |
#### restriction provided that this copyright statement is not #### |
37,53 → 37,9
CUR_DIR=$(shell pwd) |
|
# The root path of the board build |
BOARD_DIR ?=$(CUR_DIR)/../../.. |
PROJECT_ROOT=$(BOARD_DIR)/../../.. |
BOARD_ROOT ?=$(CUR_DIR)/../../.. |
include $(BOARD_ROOT)/Makefile.inc |
|
SYN_DIR=$(BOARD_DIR)/syn/xst |
SYN_RUN_DIR=$(SYN_DIR)/run |
|
BOARD_BACKEND_DIR=$(BOARD_DIR)/backend/bin |
|
DESIGN_NAME=orpsoc |
BOARD_NAME=ml501 |
|
# Set V=1 when calling make to enable verbose output |
# mainly for debugging purposes. |
ifeq ($(V), 1) |
Q= |
else |
Q ?=@ |
endif |
|
BOARD_RTL_DIR=$(BOARD_DIR)/rtl |
BOARD_RTL_VERILOG_DIR=$(BOARD_RTL_DIR)/verilog |
# Only 1 include path for board builds - their own! |
BOARD_RTL_VERILOG_INCLUDE_DIR=$(BOARD_RTL_VERILOG_DIR)/include |
BOARD_DESIGN_VERILOG_DEFINES=$(BOARD_RTL_VERILOG_INCLUDE_DIR)/$(DESIGN_NAME)-defines.v |
|
DEFINES_FILE_CUTOFF=$(shell grep -n "end of included module defines" $(BOARD_DESIGN_VERILOG_DEFINES) | cut -d ':' -f 1) |
DESIGN_DEFINES=$(shell cat $(BOARD_DESIGN_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 ) |
|
# Rule to look at what defines are being extracted from main file |
print-defines: |
@echo; echo "\t### Design defines ###"; echo |
@echo "\tParsing "$(BOARD_DESIGN_VERILOG_DEFINES)" and exporting:" |
@echo $(DESIGN_DEFINES) |
|
|
# Backend tool path |
# Check that the XILINX_PATH variable is set |
ifeq ($(XILINX_PATH),) |
$(error XILINX_PATH environment variable not set. Set it and rerun) |
endif |
XILINX_SETTINGS_SCRIPT=$(XILINX_PATH)/settings32.sh |
XILINX_SETTINGS_SCRIPT_EXISTS=$(shell if [ -e $(XILINX_SETTINGS_SCRIPT) ]; then echo 1; else echo 0; fi) |
ifeq ($(XILINX_SETTINGS_SCRIPT_EXISTS),0) |
$(error XILINX_PATH variable not set correctly. Cannot find $$XILINX_PATH/settings32.sh) |
endif |
|
|
# |
# Options for Xilinx PAR tools |
# |
105,9 → 61,7
$(Q)echo "\tSPI_FLASH_SIZE_KBYTES="$(SPI_FLASH_SIZE_KBYTES) |
$(Q)echo "\tSPI_BOOTLOADER_SW_OFFSET_HEX="$(SPI_BOOTLOADER_SW_OFFSET_HEX) |
|
|
|
NGC_FILE=$(SYN_RUN_DIR)/$(DESIGN_NAME).ngc |
NGC_FILE=$(BOARD_SYN_RUN_DIR)/$(DESIGN_NAME).ngc |
NGD_FILE=$(DESIGN_NAME).ngd |
UCF_FILE=../bin/$(BOARD_NAME).ucf |
MAPPED_NCD=$(DESIGN_NAME)_mapped.ncd |
119,12 → 73,12
MCS_FILE=$(DESIGN_NAME).mcs |
|
$(NGC_FILE): |
$(Q)$(MAKE) -C $(SYN_RUN_DIR) $(DESIGN_NAME).ngc |
$(Q)$(MAKE) -C $(BOARD_SYN_RUN_DIR) $(DESIGN_NAME).ngc |
|
$(NGD_FILE): $(UCF_FILE) $(NGC_FILE) |
@echo; echo "\t#### Running NGDBuild ####"; |
$(Q)( . $(XILINX_SETTINGS_SCRIPT) && \ |
ngdbuild -p $(FPGA_PART) -sd $(BOARD_BACKEND_DIR) -uc $(UCF_FILE) \ |
ngdbuild -p $(FPGA_PART) -sd $(BOARD_BACKEND_BIN_DIR) -uc $(UCF_FILE) \ |
$(NGC_FILE) $@ ) |
|
#This target uses Xilinx tools to perform Mapping |
190,7 → 144,7
$(Q)rm -rf *.* xlnx_auto* |
|
clean-syn: |
$(Q)$(MAKE) -C $(SYN_RUN_DIR) distclean |
$(Q)$(MAKE) -C $(BOARD_SYN_RUN_DIR) distclean |
|
distclean: clean-syn clean |
|
/boards/xilinx/ml501/sim/bin/Makefile
15,7 → 15,7
#### #### |
###################################################################### |
#### #### |
#### Copyright (C) 2009,2010 Authors and OPENCORES.ORG #### |
#### Copyright (C) 2009,2010,2011 Authors and OPENCORES.ORG #### |
#### #### |
#### This source file may be used and distributed without #### |
#### restriction provided that this copyright statement is not #### |
43,580 → 43,41
# Name of the directory we're currently in |
CUR_DIR=$(shell pwd) |
|
# The root path of the whole project |
PROJECT_ROOT ?=$(CUR_DIR)/../../../../.. |
BOARD_ROOT=$(CUR_DIR)/../.. |
include $(BOARD_ROOT)/Makefile.inc |
|
DESIGN_NAME=orpsoc |
RTL_TESTBENCH_TOP=$(DESIGN_NAME)_testbench |
# Simulation-specific paths and files from this one |
include $(PROJECT_ROOT)/scripts/make/Makefile-board-benchsrc.inc |
|
# Hardset the board name, even though we could probably determine it |
FPGA_VENDOR=xilinx |
BOARD_NAME=ml501 |
BOARD_DIR=$(PROJECT_ROOT)/boards/$(FPGA_VENDOR)/$(BOARD_NAME) |
|
# Export BOARD for the software makefiles |
BOARD=$(FPGA_VENDOR)/$(BOARD_NAME) |
export BOARD |
|
# Paths to other important parts of this test suite |
COMMON_RTL_DIR = $(PROJECT_ROOT)/rtl |
COMMON_RTL_VERILOG_DIR = $(COMMON_RTL_DIR)/verilog |
#COMMON_RTL_VHDL_DIR = $(COMMON_RTL_DIR)/vhdl |
|
BOARD_RTL_DIR=$(BOARD_DIR)/rtl |
BOARD_RTL_VERILOG_DIR=$(BOARD_RTL_DIR)/verilog |
# Only 1 include path for board builds - their own! |
BOARD_RTL_VERILOG_INCLUDE_DIR=$(BOARD_RTL_VERILOG_DIR)/include |
|
BOARD_BENCH_DIR=$(BOARD_DIR)/bench |
BOARD_BENCH_VERILOG_DIR=$(BOARD_BENCH_DIR)/verilog |
BOARD_BENCH_VERILOG_INCLUDE_DIR=$(BOARD_BENCH_VERILOG_DIR)/include |
|
COMMON_BENCH_DIR=$(PROJECT_ROOT) |
COMMON_BENCH_VERILOG_DIR=$(COMMON_BENCH_DIR)/verilog |
COMMON_BENCH_VERILOG_INCLUDE_DIR=$(COMMON_BENCH_VERILOG_DIR)/include |
|
# Top level files for DUT and testbench |
DUT_TOP=$(BOARD_RTL_VERILOG_DIR)/$(DESIGN_NAME)_top/$(DESIGN_NAME)_top.v |
BENCH_TOP=$(BOARD_BENCH_VERILOG_DIR)/$(DESIGN_NAME)_testbench.v |
|
# Software tests we'll run |
|
# Need this for individual test variables to not break |
TEST ?= or1200-simple |
|
TESTS ?= or1200-simple or1200-cbasic or1200-dctest or1200-float or1200-mmu or1200-basic or1200-except or1200-tick or1200-ticksyscall uart-simple |
|
include $(PROJECT_ROOT)/scripts/make/Makefile-simulators.inc |
|
# Gets turned into verilog `define |
SIM_TYPE=RTL |
|
# Main defines file is from board include path |
PROJECT_VERILOG_DEFINES=$(BOARD_RTL_VERILOG_INCLUDE_DIR)/$(DESIGN_NAME)-defines.v |
|
# Detect technology to use for the simulation |
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 ) |
|
# Rule to look at what defines are being extracted from main file |
print-defines: |
@echo echo; echo "\t### Design defines ###"; echo; |
@echo "\tParsing "$(PROJECT_VERILOG_DEFINES)" and exporting:" |
@echo $(DESIGN_DEFINES) |
|
print-tests: |
@echo; echo; echo "\t### Software tests to be run ###"; echo; |
@echo $(TESTS) |
@echo |
|
# Backend tool path |
# Check that the XILINX_PATH variable is set |
ifeq ($(XILINX_PATH),) |
$(error XILINX_PATH environment variable not set. Set it and rerun) |
endif |
XILINX_SETTINGS_SCRIPT=$(XILINX_PATH)/settings32.sh |
XILINX_SETTINGS_SCRIPT_EXISTS=$(shell if [ -e $(XILINX_SETTINGS_SCRIPT) ]; then echo 1; else echo 0; fi) |
ifeq ($(XILINX_SETTINGS_SCRIPT_EXISTS),0) |
$(error XILINX_PATH variable not set correctly. Cannot find $$XILINX_PATH/settings32.sh) |
endif |
|
|
# Simulation directories |
SIM_DIR ?=$(BOARD_DIR)/sim |
RTL_SIM_DIR=$(SIM_DIR) |
RTL_SIM_RUN_DIR=$(RTL_SIM_DIR)/run |
RTL_SIM_BIN_DIR=$(RTL_SIM_DIR)/bin |
RTL_SIM_RESULTS_DIR=$(RTL_SIM_DIR)/out |
|
# Testbench paths |
BOARD_BENCH_DIR=$(BOARD_DIR)/bench |
BOARD_BENCH_VERILOG_DIR=$(BOARD_BENCH_DIR)/verilog |
COMMON_BENCH_DIR=$(PROJECT_ROOT)/bench |
COMMON_BENCH_VERILOG_DIR=$(COMMON_BENCH_DIR)/verilog |
|
#BENCH_VHDL_DIR=$(BENCH_DIR)/vhdl |
# No SystemC or Verilator support for this build |
#BENCH_SYSC_DIR=$(BENCH_DIR)/sysc |
#BENCH_SYSC_SRC_DIR=$(BENCH_SYSC_DIR)/src |
#BENCH_SYSC_INCLUDE_DIR=$(BENCH_SYSC_DIR)/include |
|
# Backend directories |
# This one is the board build's backend dir. |
BOARD_BACKEND_DIR=$(BOARD_DIR)/backend |
BOARD_BACKEND_VERILOG_DIR=$(BOARD_BACKEND_DIR)/rtl/verilog |
TECHNOLOGY_BACKEND_DIR=$(BOARD_DIR)/../backend |
# This path is for the technology library |
#TECHNOLOGY_BACKEND_VERILOG_DIR=$(TECHNOLOGY_BACKEND_DIR)/rtl/verilog |
# Depends on the XILINX_PATH variable - we check above if it's set properly. |
TECHNOLOGY_BACKEND_VERILOG_DIR=$(XILINX_PATH)/verilog |
|
# Synthesis directory for board |
BOARD_SYN_DIR=$(BOARD_DIR)/syn/synplify |
BOARD_SYN_OUT_DIR=$(BOARD_SYN_DIR)/out |
|
# System software dir |
COMMON_SW_DIR=$(PROJECT_ROOT)/sw |
BOARD_SW_DIR=$(BOARD_DIR)/sw |
|
# BootROM code, which generates a verilog array select values |
BOOTROM_FILE=bootrom.v |
BOARD_BOOTROM_SW_DIR=$(BOARD_SW_DIR)/bootrom |
BOOTROM_SRC=$(shell ls $(BOARD_BOOTROM_SW_DIR)/* | grep -v $(BOOTROM_FILE)) |
BOOTROM_VERILOG=$(BOARD_BOOTROM_SW_DIR)/$(BOOTROM_FILE) |
|
.phony: $(BOOTROM_VERILOG) |
bootrom: $(BOOTROM_VERILOG) |
|
$(BOOTROM_VERILOG): $(BOOTROM_SRC) |
$(Q)echo; echo "\t### Generating bootup ROM ###"; echo |
$(Q)$(MAKE) -C $(BOARD_BOOTROM_SW_DIR) $(BOOTROM_FILE) |
|
# Suffix of file to check after each test for the string |
TEST_OUT_FILE_SUFFIX=-general.log |
TEST_OK_STRING=8000000d |
|
# Dynamically generated verilog file defining configuration for various things |
# Rule actually generating this is found in definesgen.inc file. |
TEST_DEFINES_VLG=test-defines.v |
.PHONY: $(TEST_DEFINES_VLG) |
# Set V=1 when calling make to enable verbose output |
# mainly for debugging purposes. |
ifeq ($(V), 1) |
Q= |
QUIET= |
else |
Q ?=@ |
QUIET=-quiet |
endif |
|
# Modelsim variables |
MGC_VSIM=vsim |
MGC_VLOG_COMP=vlog |
MGC_VHDL_COMP=vcom |
MODELSIM=modelsim |
|
# Default simulator is Modelsim here as we're using the ProASIC3 |
# libraries which are not compilable with Icarus. |
# Set SIMULATOR=modelsim to use Modelsim (Default) |
# Set SIMULATOR=ncverilog to use Cadence's NC-Verilog - TODO |
# Set SIMULATOR=icarus to use Icarus Verilog (Not supported for this board) |
|
SIMULATOR ?= $(MODELSIM) |
|
# |
# Modelsim-specific settings |
# |
VOPT_ARGS=$(QUIET) -suppress 2241 |
# If VCD dump is desired, tell Modelsim not to optimise |
# away everything. |
ifeq ($(VCD), 1) |
#VOPT_ARGS=-voptargs="+acc=rnp" |
VOPT_ARGS=+acc=rnpqv |
endif |
# VSIM commands |
# Suppressed warnings - 3009: Failed to open $readmemh() file |
# Suppressed warnings - 3009: Module 'blah' does not have a `timescale directive in effect, but previous modules do. |
# Suppressed warnings - 8598: Non-positive replication multiplier inside concat. Replication will be ignored |
VSIM_ARGS= -suppress 7 -suppress 3009 -suppress 8598 -c $(QUIET) -do "set StdArithNoWarnings 1; run -all; exit" |
# Include the test-defines.v generation rule |
include $(PROJECT_ROOT)/scripts/make/Makefile-sim-definesgen.inc |
|
# VPI debugging interface variables |
VPI_SRC_C_DIR=$(COMMON_BENCH_VERILOG_DIR)/vpi/c |
VPI_SRC_VERILOG_DIR=vpi/verilog |
VPI_SRCS=$(shell ls $(VPI_SRC_C_DIR)/*.[ch]) |
|
# Modelsim VPI compile variables |
MODELTECH_VPILIB=msim_jp_vpi.sl |
|
|
# Modelsim VPI settings |
ifeq ($(VPI), 1) |
VPI_LIBS=$(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB) |
VSIM_ARGS += -pli $(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB) |
endif |
# Rule to make the VPI library for modelsim |
$(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB): $(VPI_SRCS) |
$(MAKE) -C $(VPI_SRC_C_DIR) $(MODELTECH_VPILIB) |
|
# |
# Verilog DUT source variables |
# Modelsim make rules for RTL tests |
# |
include $(PROJECT_ROOT)/scripts/make/Makefile-board-modelsim.inc |
|
# First consider any modules we'll use gatelevel descriptions of. |
# These will have to be set on the command line |
GATELEVEL_MODULES ?= |
|
# First we get a list of modules in the RTL path of the board's path. |
# Next we check which modules not in the board's RTL path are in the root RTL |
# path (modules which can be commonly instantiated, but over which board |
# build-specific versions take precedence.) |
|
# Paths under board/***/rtl/verilog we wish to exclude when getting modules |
BOARD_VERILOG_MODULES_EXCLUDE= include $(GATELEVEL_MODULES) |
BOARD_VERILOG_MODULES_DIR_LIST=$(shell ls $(BOARD_RTL_VERILOG_DIR)) |
# Apply exclude to list of modules |
BOARD_RTL_VERILOG_MODULES=$(filter-out $(BOARD_VERILOG_MODULES_EXCLUDE),$(BOARD_VERILOG_MODULES_DIR_LIST)) |
|
# Rule for debugging this script |
print-board-modules: |
@echo echo; echo "\t### Board verilog modules ###"; echo |
@echo $(BOARD_RTL_VERILOG_MODULES) |
|
# Now get list of modules that we don't have a version of in the board path |
COMMON_VERILOG_MODULES_EXCLUDE= include |
COMMON_VERILOG_MODULES_EXCLUDE += $(BOARD_RTL_VERILOG_MODULES) |
COMMON_VERILOG_MODULES_EXCLUDE += $(GATELEVEL_MODULES) |
|
COMMON_RTL_VERILOG_MODULES_DIR_LIST=$(shell ls $(COMMON_RTL_VERILOG_DIR)) |
COMMON_RTL_VERILOG_MODULES=$(filter-out $(COMMON_VERILOG_MODULES_EXCLUDE), $(COMMON_RTL_VERILOG_MODULES_DIR_LIST)) |
|
|
# Add these to exclude their RTL directories from being included in scripts |
|
|
|
# Rule for debugging this script |
print-common-modules-exclude: |
@echo echo; echo "\t### Common verilog modules being excluded due to board versions ###"; echo |
@echo "$(COMMON_VERILOG_MODULES_EXCLUDE)" |
|
print-common-modules: |
@echo echo; echo "\t### Verilog modules from common RTL dir ###"; echo |
@echo $(COMMON_RTL_VERILOG_MODULES) |
|
# List of verilog source files (only .v files!) |
# Board RTL modules first |
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) |
# Common RTL module source |
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) |
|
# List of verilog includes from board RTL path - only for rule sensitivity |
RTL_VERILOG_INCLUDES=$(shell ls $(BOARD_RTL_VERILOG_INCLUDE_DIR)/*.*) |
|
print-verilog-src: |
@echo echo; echo "\t### Verilog source ###"; echo |
@echo $(RTL_VERILOG_SRC) |
|
# Rules to make RTL we might need |
# Expects modules, if they need making, to have their top verilog file to |
# correspond to their module name, and the directory should have a make file |
# and rule which works for this command. |
# Add name of module to this list, currently only does verilog ones. |
# Rule 'rtl' is called just before generating DUT modelsim compilation script |
RTL_TO_CHECK= |
rtl: |
$(Q)for module in $(RTL_TO_CHECK); do \ |
$(MAKE) -C $(RTL_VERILOG_DIR)/$$module $$module.v; \ |
done |
|
# |
# VHDL DUT source variables |
# RTL test rules |
# |
# VHDL modules |
#RTL_VHDL_MODULES=$(shell ls $(RTL_VHDL_DIR)) |
# VHDL sources |
#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) |
#print-vhdl-src: |
# @echo echo; echo "\t### VHDL modules and source ###"; echo |
# @echo "modules: "; echo $(RTL_VHDL_MODULES); echo |
# @echo "source: "$(RTL_VHDL_SRC) |
include $(PROJECT_ROOT)/scripts/make/Makefile-rtltestrules.inc |
|
# |
# Testbench source |
# |
BOARD_BENCH_VERILOG_SRC=$(shell ls $(BOARD_BENCH_VERILOG_DIR)/*.v | grep -v $(DESIGN_NAME)_testbench ) |
BOARD_BENCH_VERILOG_SRC_FILES=$(notdir $(BOARD_BENCH_VERILOG_SRC)) |
|
# Now only take the source from the common path that we don't already have in |
# our board's |
COMMON_BENCH_VERILOG_DIR_LS=$(shell ls $(COMMON_BENCH_VERILOG_DIR)/*.v) |
COMMON_BENCH_VERILOG_SRC_FILES=$(notdir $(COMMON_BENCH_VERILOG_DIR_LS)) |
COMMON_BENCH_VERILOG_SRC_FILTERED=$(filter-out $(BOARD_BENCH_VERILOG_SRC_FILES) $(DESIGN_NAME)_testbench.v,$(COMMON_BENCH_VERILOG_SRC_FILES)) |
COMMON_BENCH_VERILOG_SRC=$(addprefix $(COMMON_BENCH_VERILOG_DIR)/, $(COMMON_BENCH_VERILOG_SRC_FILTERED)) |
|
print-board-bench-src: |
$(Q)echo "\tBoard bench verilog source"; \ |
echo $(BOARD_BENCH_VERILOG_SRC) |
|
print-common-bench-src: |
$(Q)echo "\Common bench verilog source"; \ |
echo $(COMMON_BENCH_VERILOG_SRC) |
|
# Testbench source subdirectory detection (exclude include, we always use |
# board bench include directory!) |
BOARD_BENCH_VERILOG_SUBDIRS=$(shell cd $(BOARD_BENCH_VERILOG_DIR) && ls -d */ | grep -v include) |
COMMON_BENCH_VERILOG_SUBDIRS=$(shell cd $(COMMON_BENCH_VERILOG_DIR) && ls -d */ | grep -v include) |
|
# Get rid of ones we have a copy of locally |
COMMON_BENCH_VERILOG_SUBDIRS_EXCLUDE_BOARDS=$(filter-out $(BOARD_BENCH_VERILOG_SUBDIRS),$(COMMON_BENCH_VERILOG_SUBDIRS)) |
|
# Construct list of paths we will want to include |
BENCH_VERILOG_SUBDIRS=$(addprefix $(COMMON_BENCH_VERILOG_DIR)/,$(COMMON_BENCH_VERILOG_SUBDIRS_EXCLUDE_BOARDS)) |
BENCH_VERILOG_SUBDIRS += $(addprefix $(BOARD_BENCH_VERILOG_DIR)/,$(BOARD_BENCH_VERILOG_SUBDIRS)) |
|
# Finally, add include path from local bench path |
BENCH_VERILOG_SUBDIRS += $(BOARD_BENCH_VERILOG_DIR)/include |
|
ifeq ($(VPI), 1) |
# Manually add the VPI bench verilog path |
COMMON_BENCH_VERILOG_SUBDIRS += $(VPI_SRC_VERILOG_DIR) |
endif |
|
print-board-bench-subdirs: |
$(Q)echo "\tBoard bench subdirectories"; \ |
echo $(BOARD_BENCH_VERILOG_SUBDIRS) |
|
print-common-bench-subdirs: |
$(Q)echo "\tCommon bench subdirectories"; \ |
echo $(COMMON_BENCH_VERILOG_SUBDIRS) |
|
print-bench-subdirs: |
$(Q)echo "\tBench subdirectories"; \ |
echo $(BENCH_VERILOG_SUBDIRS) |
|
|
# Backend technology library files |
# We don't do this for the board backend stuff - that should all be properly |
# named, and so we only need to pass the "-y" option for that path. |
BOARD_BACKEND_VERILOG_SRC=$(shell ls $(BOARD_BACKEND_VERILOG_DIR)/*.v ) |
|
# |
# Compile script generation rules: |
# |
|
# Modelsim library compilation rules |
# $(Q)echo "-y " $(BOARD_BACKEND_VERILOG_DIR) >> $@; |
# DUT compile script |
modelsim_dut.scr: rtl $(RTL_VERILOG_SRC) $(RTL_VERILOG_INCLUDES) $(BOOTROM_VERILOG) |
$(Q)echo "+incdir+"$(BOARD_RTL_VERILOG_INCLUDE_DIR) > $@; |
$(Q)echo "+incdir+"$(BOARD_BOOTROM_SW_DIR) >> $@; |
$(Q)echo "+incdir+"$(BOARD_BENCH_VERILOG_INCLUDE_DIR) >> $@; |
$(Q)echo "+libext+.v" >> $@; |
$(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 |
$(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 |
$(Q)echo "-y "$(TECHNOLOGY_BACKEND_VERILOG_DIR)"/src/unisims" >> $@; |
$(Q)echo "-y "$(TECHNOLOGY_BACKEND_VERILOG_DIR)"/src/XilinxCoreLib" >> $@; |
$(Q)if [ ! -z "$$GATELEVEL_MODULES" ]; \ |
then echo "-y " $(BOARD_SYN_OUT_DIR) >> $@; \ |
echo "+libext+.vm" >> $@; \ |
fi |
$(Q)echo >> $@ |
|
modelsim_bench.scr: $(BOARD_BENCH_VERILOG_SRC) $(COMMON_BENCH_VERILOG_SRC) |
$(Q)echo "+incdir+"$(BOARD_BENCH_VERILOG_INCLUDE_DIR) > $@; |
$(Q)echo "+incdir+"$(COMMON_BENCH_VERILOG_INCLUDE_DIR) >> $@; |
$(Q)for path in $(BENCH_VERILOG_SUBDIRS); do echo "+incdir+"$$path >> $@; done |
$(Q)for path in $(BENCH_VERILOG_SUBDIRS); do echo "-y "$$path >> $@; done |
$(Q)echo "+incdir+"$(BOARD_RTL_VERILOG_INCLUDE_DIR) >> $@; |
$(Q)echo "+libext+.v" >> $@; |
$(Q)echo "+incdir+"$(TECHNOLOGY_BACKEND_VERILOG_DIR)"/src" >> $@; |
$(Q)for vsrc in $(BOARD_BENCH_VERILOG_SRC); do echo $$vsrc >> $@; done |
$(Q)for vsrc in $(COMMON_BENCH_VERILOG_SRC); do echo $$vsrc >> $@; done |
$(Q)echo >> $@ |
|
# Modelsim library compilation rules |
|
# Compile DUT into "work" library |
work: modelsim_dut.scr |
$(Q)if [ ! -e $@ ]; then vlib $@; fi |
$(Q)echo; echo "\t### Compiling Verilog design library ###"; echo |
$(Q)vlog $(QUIET) -f $< $(DUT_TOP) |
# $(Q)echo; echo "\t### Compiling VHDL design library ###"; echo |
# $(Q)vcom -93 $(QUIET) $(RTL_VHDL_SRC) |
|
# Single compile rule |
.PHONY : $(MODELSIM) |
$(MODELSIM): modelsim_bench.scr $(TEST_DEFINES_VLG) $(VPI_LIBS) work |
$(Q)echo; echo "\t### Compiling Xilinx support libs, user design & testbench ###"; echo |
$(Q)vlog $(QUIET) -nologo -incr $(BENCH_TOP) -f $< |
$(Q)vopt $(QUIET) glbl $(RTL_TESTBENCH_TOP) $(VOPT_ARGS) -o tb |
$(Q)echo; echo "\t### Launching simulation ###"; echo |
$(Q)vsim $(VSIM_ARGS) tb |
|
|
.PHONY: rtl-test |
rtl-test: clean-sim-test-sw sw-vmem clean-test-defines $(TEST_DEFINES_VLG) \ |
$(SIMULATOR) |
|
# Run an RTL test followed by checking of generated results |
rtl-test-with-check: rtl-test |
$(Q)$(MAKE) check-test-log; \ |
if [ $$? -ne 0 ]; then \ |
echo; echo "\t### "$(TEST)" test FAIL ###"; echo; \ |
else \ |
echo; echo "\t### "$(TEST)" test OK ###"; echo; \ |
fi |
|
# Do check, don't print anything out |
rtl-test-with-check-no-print: rtl-test check-test-log |
|
# Main RTL test loop |
rtl-tests: |
$(Q)for test in $(TESTS); do \ |
export TEST=$$test; \ |
$(MAKE) rtl-test-with-check-no-print; \ |
if [ $$? -ne 0 ]; then break; fi; \ |
echo; echo "\t### $$test test OK ###"; echo; \ |
done |
|
|
.PHONY: check-test-log |
check-test-log: |
$(Q)echo "#!/bin/bash" > $@ |
$(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; }" >> $@ |
$(Q)echo "check-test-log" >> $@ |
$(Q)chmod +x $@ |
$(Q) echo; echo "\t### Checking simulation results for "$(TEST)" test ###"; echo; |
$(Q)./$@ |
|
# Include the test-defines.v generation rule |
include $(PROJECT_ROOT)/sim/bin/definesgen.inc |
|
# |
# Software make rules (called recursively) |
# |
include $(PROJECT_ROOT)/scripts/make/Makefile-board-sw.inc |
|
# Path for the current test |
# First check for a local copy of the test. If it doesn't exist then we |
# default to the software tests in the root directory |
TEST_MODULE=$(shell echo $(TEST) | cut -d "-" -f 1) |
BOARD_SW_TEST_DIR=$(BOARD_SW_DIR)/tests/$(TEST_MODULE)/sim |
COMMON_SW_TEST_DIR=$(COMMON_SW_DIR)/tests/$(TEST_MODULE)/sim |
# Do this by testing for the file's existence |
TEST_SW_DIR=$(shell if [ -e $(BOARD_SW_TEST_DIR)/$(TEST).[cS] ]; then echo $(BOARD_SW_TEST_DIR); else echo $(COMMON_SW_TEST_DIR); fi) |
|
print-test-sw-dir: |
@echo; echo "\tTest software is in the following path"; echo; |
@echo $(BOARD_SW_DIR); echo; |
@echo $(BOARD_SW_TEST_DIR); echo; |
@echo $(TEST_SW_DIR); echo; |
|
print-sw-tests: |
$(Q) $(MAKE) -C $(COMMON_SW_DIR)/lib print-sw-tests |
$(Q) $(MAKE) -C $(COMMON_SW_DIR)/lib print-sw-tests-subdirs |
|
|
# Name of the image the RAM model will attempt to load via Verilog $readmemh |
# system function. |
|
# Set PRELOAD_RAM=1 to preload the system memory - be sure the bootROM program |
# chosen in board.h is the one booting from the reset vector. |
ifeq ($(PRELOAD_RAM), 1) |
SIM_DIR_VMEM_IMAGE ?=sram.vmem |
else |
SIM_DIR_VMEM_IMAGE ?=flash.in |
endif |
|
# Ability to bypass all stuffing around involved with generating software and |
# directly specify an ELF |
ifeq ($(USER_ELF),) |
ELF_FILE=$(TEST_SW_DIR)/$(TEST).elf |
else |
ELF_FILE=$(USER_ELF) |
ELF_FILE_NOTDIR=$(notdir $(USER_ELF)) |
ELF_FILE_NOTDIR_BASENAME=$(basename $(ELF_FILE_NOTDIR)) |
endif |
|
|
# Rules allowing user to specify a pre-existing VMEM file to load into the |
# simulation, instead of compiling a test. |
ifeq ($(USER_VMEM),) |
|
|
ifeq ($(PRELOAD_RAM), 1) |
VMEM_FILE ?= $(TEST_SW_DIR)/$(TEST).vmem |
else |
VMEM_FILE ?= $(TEST_SW_DIR)/$(TEST).flashin |
endif |
.PHONY: $(VMEM_FILE) |
|
|
# If USER_ELF was specified, then we need a slightly different way of |
# generating the VMEM file from it than a usual test |
ifeq ($(USER_ELF),) |
$(SIM_DIR_VMEM_IMAGE): $(VMEM_FILE) |
$(Q)if [ -L $@ ]; then unlink $@; fi |
$(Q)if [ -e $@ ]; then rm $@; fi |
$(Q)ln -s $< $@ |
else # !($(USER_ELF),) - USER_ELF set on command line |
$(SIM_DIR_VMEM_IMAGE): $(USER_ELF) |
$(Q)$(MAKE) -C $(COMMON_SW_DIR)/lib \ |
USER_ELF_BIN=`pwd`/$(ELF_FILE_NOTDIR_BASENAME).bin \ |
USER_ELF_VMEM=`pwd`/$(ELF_FILE_NOTDIR_BASENAME).vmem \ |
gen-user-elf-vmem |
$(Q)cp -v $(ELF_FILE_NOTDIR_BASENAME).vmem $@ |
|
TEST=$(ELF_FILE_NOTDIR_BASENAME) |
endif |
|
else # !($(USER_VMEM),) - USER_VMEM set on command line |
VMEM_FILE=$(USER_VMEM) |
USER_VMEM_NOTDIR=$(notdir $(USER_VMEM)) |
TEST=$(basename $(USER_VMEM_NOTDIR)) |
|
$(SIM_DIR_VMEM_IMAGE): $(VMEM_FILE) |
cp -v $< $@ |
|
endif |
|
|
# Amount to pad the image we'll load into the SPI flash for ML501 sims |
HEX_IMAGE_PADDING ?=0x1c0000 |
|
.PHONY : sw-vmem sw-elf |
sw-vmem: $(SIM_DIR_VMEM_IMAGE) |
|
.PHONY: $(TEST_SW_DIR)/$(TEST).flashin |
$(TEST_SW_DIR)/$(TEST).flashin: |
$(Q) echo; echo "\t### Compiling software ###"; echo; |
$(Q)$(MAKE) -C $(TEST_SW_DIR) $(TEST).flashin \ |
HEX_IMAGE_PADDING=$(HEX_IMAGE_PADDING) |
|
.PHONY: $(TEST_SW_DIR)/$(TEST).vmem |
$(TEST_SW_DIR)/$(TEST).vmem: |
$(Q) echo; echo "\t### Compiling software ###"; echo; |
$(Q)$(MAKE) -C $(TEST_SW_DIR) $(TEST).vmem |
|
# Create test software disassembly |
|
sw-dis: $(TEST_SW_DIR)/$(TEST).dis |
$(Q)cp -v $< . |
|
$(TEST_SW_DIR)/$(TEST).dis: |
$(Q)$(MAKE) -C $(TEST_SW_DIR) $(TEST).dis |
|
# |
# Cleaning rules |
# |
clean: clean-sim clean-sim-test-sw clean-bootrom clean-out clean-sw |
|
clean-sim: |
$(Q) echo; echo "\t### Cleaning simulation run directory ###"; echo; |
$(Q)rm -rf *.* lib_* work transcript check-test-log |
$(Q) if [ -e $(VPI_SRC_C_DIR) ]; then $(MAKE) -C $(VPI_SRC_C_DIR) clean; fi |
|
clean-bootrom: |
$(MAKE) -C $(BOARD_BOOTROM_SW_DIR) clean |
|
clean-out: |
$(Q)rm -rf $(RTL_SIM_RESULTS_DIR)/*.* |
|
clean-test-defines: |
$(Q)rm -f $(TEST_DEFINES_VLG) |
|
clean-sim-test-sw: |
$(Q)if [ -L $(SIM_DIR_VMEM_IMAGE) ]; then unlink $(SIM_DIR_VMEM_IMAGE); fi |
|
clean-sw: |
$(Q) echo; echo "\t### Cleaning simulation sw directories ###"; echo; |
$(Q) $(MAKE) -C $(COMMON_SW_DIR)/lib distclean |
|
clean-rtl: |
$(Q) echo; echo "\t### Cleaning generated verilog RTL ###"; echo; |
for module in $(RTL_TO_CHECK); do \ |
$(MAKE) -C $(RTL_VERILOG_DIR)/$$module clean; \ |
done |
|
# Removes any checked out RTL |
distclean: clean |
$(Q) echo; echo "\t### Cleaning generated verilog RTL ###"; echo; |
$(Q)for module in $(RTL_TO_CHECK); do \ |
$(MAKE) -C $(RTL_VERILOG_DIR)/$$module distclean; \ |
done |
include $(PROJECT_ROOT)/scripts/make/Makefile-board-simclean.inc |
/boards/xilinx/ml501/syn/xst/bin/Makefile
8,7 → 8,7
#### #### |
###################################################################### |
#### #### |
#### Copyright (C) 2009,2010 Authors and OPENCORES.ORG #### |
#### Copyright (C) 2009,2010,2011 Authors and OPENCORES.ORG #### |
#### #### |
#### This source file may be used and distributed without #### |
#### restriction provided that this copyright statement is not #### |
36,137 → 36,19
# Name of the directory we're currently in |
CUR_DIR=$(shell pwd) |
|
# We don't want the usbhostslave module to be pulled in during synthesis because |
# we haven't copied the headers to our RTL director |
#COMMON_VERILOG_MODULES_EXCLUDE+= usbhostslave |
|
|
# The root path of the board build |
BOARD_DIR ?=$(CUR_DIR)/../../.. |
PROJECT_ROOT=$(BOARD_DIR)/../../.. |
BOARD_ROOT ?=$(CUR_DIR)/../../.. |
include $(BOARD_ROOT)/Makefile.inc |
|
DESIGN_NAME ?=orpsoc |
RTL_TOP ?=$(DESIGN_NAME)_top |
|
SYN_DIR=$(BOARD_DIR)/syn/xst |
SYN_RUN_DIR=$(SYN_DIR)/run |
SYN_RUN_DIR=$(BOARD_SYN_DIR)/run |
|
# Paths to other important parts of this test suite |
COMMON_RTL_DIR = $(PROJECT_ROOT)/rtl |
COMMON_RTL_VERILOG_DIR = $(COMMON_RTL_DIR)/verilog |
#COMMON_RTL_VHDL_DIR = $(COMMON_RTL_DIR)/vhdl |
|
BOARD_RTL_DIR=$(BOARD_DIR)/rtl |
BOARD_RTL_VERILOG_DIR=$(BOARD_RTL_DIR)/verilog |
# Only 1 include path for board builds - their own! |
BOARD_RTL_VERILOG_INCLUDE_DIR=$(BOARD_RTL_VERILOG_DIR)/include |
BOARD_DESIGN_VERILOG_DEFINES=$(BOARD_RTL_VERILOG_INCLUDE_DIR)/$(DESIGN_NAME)-defines.v |
#BOARD_RTL_VHDL_DIR = $(BOARD_RTL_DIR)/vhdl |
|
BACKEND_DIR=$(BOARD_DIR)/backend |
BACKEND_BIN_DIR=$(BACKEND_DIR)/bin |
|
# Set V=1 when calling make to enable verbose output |
# mainly for debugging purposes. |
ifeq ($(V), 1) |
Q= |
else |
Q ?=@ |
endif |
|
|
DEFINES_FILE_CUTOFF=$(shell grep -n "end of included module defines" $(BOARD_DESIGN_VERILOG_DEFINES) | cut -d ':' -f 1) |
DESIGN_DEFINES=$(shell cat $(BOARD_DESIGN_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 ) |
# Rule to look at what defines are being extracted from main file |
print-defines: |
@echo; echo "\t### Design defines ###"; echo |
@echo "\tParsing "$(BOARD_DESIGN_VERILOG_DEFINES)" and exporting:" |
@echo $(DESIGN_DEFINES) |
|
|
# Backend tool path |
# Check that the XILINX_PATH variable is set |
ifeq ($(XILINX_PATH),) |
$(error XILINX_PATH environment variable not set. Set it and rerun) |
endif |
XILINX_SETTINGS_SCRIPT=$(XILINX_PATH)/settings32.sh |
XILINX_SETTINGS_SCRIPT_EXISTS=$(shell if [ -e $(XILINX_SETTINGS_SCRIPT) ]; then echo 1; else echo 0; fi) |
ifeq ($(XILINX_SETTINGS_SCRIPT_EXISTS),0) |
$(error XILINX_PATH variable not set correctly. Cannot find $$XILINX_PATH/settings32.sh) |
endif |
|
# |
# Verilog DUT source variables |
# |
# First we get a list of modules in the RTL path of the board's path. |
# Next we check which modules not in the board's RTL path are in the root RTL |
# path (modules which can be commonly instantiated, but over which board |
# build-specific versions take precedence.) |
|
# Paths under board/***/rtl/verilog we wish to exclude when getting modules |
BOARD_VERILOG_MODULES_EXCLUDE= include |
BOARD_VERILOG_MODULES_DIR_LIST=$(shell ls $(BOARD_RTL_VERILOG_DIR)) |
# Apply exclude to list of modules |
BOARD_RTL_VERILOG_MODULES=$(filter-out $(BOARD_VERILOG_MODULES_EXCLUDE),$(BOARD_VERILOG_MODULES_DIR_LIST)) |
|
# Rule for debugging this script |
print-board-modules: |
$(Q)echo echo; echo "\t### Board verilog modules ###"; echo; |
$(Q)echo $(BOARD_RTL_VERILOG_MODULES) |
|
# Now get list of modules that we don't have a version of in the board path |
# List others that cause clahes (ie. source listed, due to utterly pathetic XST |
# not supporting ability to specify search paths, and requiring includes but |
# not used in this board build, hence its includes are not there and result |
# in error.) |
COMMON_VERILOG_MODULES_EXCLUDE= include usbhostslave |
COMMON_VERILOG_MODULES_EXCLUDE += $(BOARD_RTL_VERILOG_MODULES) |
|
COMMON_RTL_VERILOG_MODULES_DIR_LIST=$(shell ls $(COMMON_RTL_VERILOG_DIR)) |
COMMON_RTL_VERILOG_MODULES=$(filter-out $(COMMON_VERILOG_MODULES_EXCLUDE), $(COMMON_RTL_VERILOG_MODULES_DIR_LIST)) |
|
# Rule for debugging this script |
print-common-modules-exclude: |
$(Q)echo echo; echo "\t### Common verilog modules being excluded due to board versions ###"; echo; |
$(Q)echo "$(COMMON_VERILOG_MODULES_EXCLUDE)" |
|
print-common-modules: |
$(Q)echo echo; echo "\t### Verilog modules from common RTL dir ###"; echo |
$(Q)echo $(COMMON_RTL_VERILOG_MODULES) |
|
# List of verilog source files (only .v files!) |
# Board RTL modules first |
VERILOG_SRC_PATHS=$(addprefix $(BOARD_RTL_VERILOG_DIR)/,$(BOARD_RTL_VERILOG_MODULES)) |
VERILOG_SRC_PATHS +=$(addprefix $(COMMON_RTL_VERILOG_DIR)/,$(COMMON_RTL_VERILOG_MODULES)) |
RTL_VERILOG_SRC=$(shell for modulepath in $(VERILOG_SRC_PATHS); do \ |
if [ -d $$modulepath ]; then \ |
ls $$modulepath/*.v; \ |
fi; done) |
|
# List of verilog includes from board RTL path - only for rule sensitivity |
RTL_VERILOG_INCLUDES=$(shell ls $(BOARD_RTL_VERILOG_INCLUDE_DIR)/*.*) |
|
# |
# VHDL DUT source variables |
# |
# VHDL modules |
#RTL_VHDL_MODULES=$(shell ls $(RTL_VHDL_DIR)) |
# VHDL sources |
#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) |
|
|
# |
# Dynamically created files included by different parts of the defines |
# |
|
BOARD_SW_DIR=$(BOARD_DIR)/sw |
|
# BootROM code, which generates a verilog array select values |
BOOTROM_FILE=bootrom.v |
BOARD_BOOTROM_SW_DIR=$(BOARD_SW_DIR)/bootrom |
BOOTROM_VERILOG=$(BOARD_BOOTROM_SW_DIR)/$(BOOTROM_FILE) |
# Export BOARD for the software makefiles |
BOARD=xilinx/ml501 |
export BOARD |
bootrom: $(BOOTROM_VERILOG) |
$(BOOTROM_VERILOG): |
$(MAKE) -C $(BOARD_BOOTROM_SW_DIR) $(BOOTROM_FILE) |
|
TIMESCALE_FILE=timescale.v |
SYNDIR_TIMESCALE_FILE=$(SYN_RUN_DIR)/$(TIMESCALE_FILE) |
$(SYNDIR_TIMESCALE_FILE): |
183,12 → 65,10
GENERATED_DEFINES += $(SYNDIR_TIMESCALE_FILE) |
GENERATED_DEFINES += $(SYNDIR_SYN_VERILOG_DEFINES) |
|
|
FPGA_PART ?=xc5vlx50-ff676-1 |
OPT_MODE ?=Speed |
OPT_LEVEL ?=2 |
|
|
XILINX_FLAGS ?=-intstyle silent |
XILINX_XST_FLAGS ?= -power NO -glob_opt AllClockNets -write_timing_constraints NO -cross_clock_analysis NO -slice_utilization_ratio 100 -bram_utilization_ratio 100 -dsp_utilization_ratio 100 -safe_implementation No -fsm_style lut -ram_extract Yes -ram_style Auto -rom_extract Yes -rom_style Auto -auto_bram_packing NO -mux_extract YES -mux_style Auto -decoder_extract YES -priority_extract YES -shreg_extract YES -shift_extract YES -xor_collapse YES -resource_sharing YES -async_to_sync NO -use_dsp48 auto -iobuf YES -max_fanout 100000 -bufg 32 -register_duplication YES -equivalent_register_removal YES -register_balancing No -slice_packing YES -optimize_primitives NO -use_clock_enable Auto -use_sync_set Auto -use_sync_reset Auto -iob Auto -slice_utilization_ratio_maxmargin 5 |
|
234,7 → 114,9
# option missing from XST - wtf?! $(Q)for vlogpath in $(VERILOG_SRC_PATHS); do \ |
echo -n $$vlogpath" "; done >> $@ |
# $(Q)echo "\"" >> $@ |
$(Q)echo "-vlgincdir { "$(BOARD_RTL_VERILOG_INCLUDE_DIR)" "$(BOARD_BOOTROM_SW_DIR) " }" >> $@ |
# Give board then common verilog include paths, hoping xst does a sensible thing |
# and searches them in order. |
$(Q)echo "-vlgincdir { "$(BOARD_RTL_VERILOG_INCLUDE_DIR)" "$(COMMON_RTL_VERILOG_DIR)/include" "$(BOOTROM_SW_DIR) " }" >> $@ |
$(Q)echo >> $@ |
|
# Generate Xilinx project (.prj) file |