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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [scripts/] [make/] [Makefile-board-modelsim.inc] - Blame information for rev 837

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

Line No. Rev Author Line
1 542 julius
# Modelsim script generation, compile and run rules for board simulations
2
 
3
#
4
# Modelsim-specific settings
5
#
6 560 julius
VOPT_ARGS+=$(QUIET) -suppress 2241
7 542 julius
 
8 651 julius
# If certain versions of modelsim don't have the vopt executable, define
9
# MGC_NO_VOPT=1 when running to skip use of the vopt executable
10
ifeq ($(MGC_NO_VOPT), 1)
11
MGC_VOPT_EXE= \# skipped: vopt
12
 
13
# When no vopt stage, actual vsim target changes, and extra options
14
# must be passed depending on FPGA tech
15
ifeq ($(FPGA_VENDOR), xilinx)
16
MGC_VSIM_TGT=orpsoc_testbench glbl
17
else
18 660 paknick
MGC_VSIM_TGT=orpsoc_testbench
19 651 julius
endif
20
 
21
else
22
MGC_VOPT_EXE= vopt
23
MGC_VSIM_TGT=tb
24
endif
25
 
26
 
27 542 julius
# If VCD dump is desired, tell Modelsim not to optimise
28
# away everything.
29
ifeq ($(VCD), 1)
30
#VOPT_ARGS=-voptargs="+acc=rnp"
31 560 julius
VOPT_ARGS+=+acc=rnpqv
32 542 julius
endif
33
 
34
# VSIM commands
35
# Suppressed warnings - 3009: Failed to open $readmemh() file
36
# Suppressed warnings - 3009: Module 'blah' does not have a `timescale directive in effect, but previous modules do.
37
# Suppressed warnings - 8598: Non-positive replication multiplier inside concat. Replication will be ignored
38 660 paknick
 
39
# - set GUI=1 if you want to invoke Modelsim GUI to debug
40
# - Propably you would like to switch off optimization
41
# also which will allow you to see all nets ...
42
#
43
ifeq ($(GUI), 1)
44
VSIM_ARGS+= -suppress 7 -suppress 3009 -suppress 8598 -novopt -do "set StdArithNoWarnings 1"
45
else
46 560 julius
VSIM_ARGS+=  -suppress 7 -suppress 3009 -suppress 8598 -c $(QUIET) -do "set StdArithNoWarnings 1; run -all; exit"
47 660 paknick
endif
48 542 julius
 
49
# VPI debugging interface set up
50
VPI_SRC_C_DIR=$(COMMON_BENCH_VERILOG_DIR)/vpi/c
51
VPI_SRCS=$(shell ls $(VPI_SRC_C_DIR)/*.[ch])
52
 
53
# Modelsim VPI compile variables
54
MODELTECH_VPILIB=msim_jp_vpi.sl
55
 
56
# Modelsim VPI settings
57
ifeq ($(VPI), 1)
58
VPI_LIBS=$(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB)
59
VSIM_ARGS += -pli $(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB)
60
endif
61
 
62
# Rule to make the VPI library for modelsim
63
$(VPI_SRC_C_DIR)/$(MODELTECH_VPILIB): $(VPI_SRCS)
64
        $(MAKE) -C $(VPI_SRC_C_DIR) $(MODELTECH_VPILIB)
65
 
66
#
67
# Script generation rules
68
#
69
 
70
# Backend script generation - make these rules sensitive to source and includes
71
modelsim_backend.scr: $(BOARD_BACKEND_VERILOG_SRC)
72
        $(Q)echo "+incdir+"$(TECHNOLOGY_BACKEND_VERILOG_DIR) > $@;
73 660 paknick
        $(Q)echo "+incdir+"$(BOARD_BACKEND_VERILOG_SRC) >> $@;
74
        $(Q)echo "+incdir+"$(BOARD_BENCH_VERILOG_DIR) > $@;
75 542 julius
        $(Q)for vsrc in $(BACKEND_TECHNOLOGY_VERILOG_SRC); do echo $$vsrc >> $@; done
76
        $(Q)echo "-y " $(TECHNOLOGY_LIBRARY_VERILOG_DIR) >> $@;
77 660 paknick
        $(Q)for vsrc in $(BOARD_BACKEND_VERILOG_SRC); do echo $$vsrc >> $@; done
78 542 julius
        $(Q)echo "+libext+.v" >> $@;
79
        $(Q)echo >> $@;
80
 
81
# DUT compile script
82
modelsim_dut.scr: $(RTL_VERILOG_SRC) $(RTL_VERILOG_INCLUDES) $(BOOTROM_VERILOG)
83
        $(Q)echo "+incdir+"$(BOARD_RTL_VERILOG_INCLUDE_DIR) > $@;
84
        $(Q)echo "+incdir+"$(BOOTROM_SW_DIR) >> $@;
85
        $(Q)echo "+incdir+"$(BOARD_BENCH_VERILOG_INCLUDE_DIR) >> $@;
86
        $(Q)echo "+libext+.v" >> $@;
87
        $(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
88
        $(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
89
        $(Q)echo "-y " $(BOARD_BACKEND_VERILOG_DIR) >> $@;
90
        $(Q)if [ ! -z "$$GATELEVEL_MODULES" ]; \
91
                then echo "-y " $(BOARD_SYN_OUT_DIR) >> $@; \
92
                echo "+libext+.vm" >> $@; \
93
        fi
94
ifeq ($(FPGA_VENDOR), xilinx)
95 560 julius
        $(Q)echo "-y "$(TECHNOLOGY_LIBRARY_VERILOG_DIR)"/src/unisims" >> $@;
96
        $(Q)echo "-y "$(TECHNOLOGY_LIBRARY_VERILOG_DIR)"/src/XilinxCoreLib" >> $@;
97 542 julius
endif
98 660 paknick
ifeq ($(BOARD_NAME), ordb2a-ep4ce22)
99
        $(Q)echo "../../rtl/verilog/versatile_library/versatile_library_ordbcycloneiv.v" >> $@;
100
endif
101
        $(Q)echo >> $@;
102 542 julius
 
103
modelsim_bench.scr: $(BOARD_BENCH_VERILOG_SRC) $(COMMON_BENCH_VERILOG_SRC)
104 660 paknick
        $(Q)echo "+incdir+"$(BOARD_RTL_VERILOG_INCLUDE_DIR) > $@;
105
        $(Q)echo "+incdir+"$(BOARD_BENCH_VERILOG_INCLUDE_DIR) >> $@;
106 542 julius
        $(Q)echo "+incdir+"$(COMMON_BENCH_VERILOG_INCLUDE_DIR) >> $@;
107
        $(Q)for path in $(BENCH_VERILOG_SUBDIRS); do echo "+incdir+"$$path >> $@; done
108
        $(Q)for path in $(BENCH_VERILOG_SUBDIRS); do echo "-y "$$path >> $@; done
109
        $(Q)echo "+incdir+"$(BOARD_RTL_VERILOG_INCLUDE_DIR) >> $@;
110
        $(Q)echo "+libext+.v" >> $@;
111
        $(Q)for vsrc in $(BOARD_BENCH_VERILOG_SRC); do echo $$vsrc >> $@; done
112
        $(Q)for vsrc in $(COMMON_BENCH_VERILOG_SRC); do echo $$vsrc >> $@; done
113
ifeq ($(FPGA_VENDOR), xilinx)
114 560 julius
        $(Q)echo "+incdir+"$(TECHNOLOGY_LIBRARY_VERILOG_DIR)"/src" >> $@;
115 542 julius
endif
116
        $(Q)echo >> $@
117
 
118
#
119
# Build rules
120
#
121
 
122
# Modelsim backend library compilation rules
123
BACKEND_LIB=lib_backend
124
$(BACKEND_LIB): modelsim_backend.scr
125
        $(Q)if [ ! -e $@ ]; then vlib $@; fi
126
        $(Q)echo; echo "\t### Compiling backend library ###"; echo
127
        $(Q)vlog -nologo $(QUIET) -work $@ -f $<
128
 
129
# Compile DUT into "work" library
130
work: modelsim_dut.scr
131
        $(Q)if [ ! -e $@ ]; then vlib $@; fi
132
        $(Q)echo; echo "\t### Compiling Verilog design library ###"; echo
133 660 paknick
        $(Q)vlog $(QUIET) -f $<  $(DUT_TOP_FILE)
134 558 julius
        $(Q)if [ "$(RTL_VHDL_SRC)" != "" ]; then \
135
                echo; echo "\t### Compiling VHDL design library ###"; \
136
                echo; \
137
                vcom -93 $(QUIET) $(RTL_VHDL_SRC); \
138
        fi
139 542 julius
 
140
#
141 558 julius
# Run rule, one for each vendor
142 542 julius
#
143
 
144
.PHONY : $(MODELSIM)
145
ifeq ($(FPGA_VENDOR), actel)
146
$(MODELSIM): modelsim_bench.scr $(TEST_DEFINES_VLG) $(BACKEND_LIB) $(VPI_LIBS) work
147
        $(Q)echo; echo "\t### Compiling testbench ###"; echo
148 558 julius
        $(Q)vlog $(QUIET) -nologo -incr $(BENCH_TOP_FILE) -f $<
149 651 julius
        $(Q)$(MGC_VOPT_EXE) $(QUIET) $(RTL_TESTBENCH_TOP_NAME) $(VOPT_ARGS) -L $(BACKEND_LIB) -o tb
150 542 julius
        $(Q)echo; echo "\t### Launching simulation ###"; echo
151 651 julius
        $(Q)vsim $(VSIM_ARGS) $(MGC_VSIM_TGT)
152 542 julius
endif
153
 
154
ifeq ($(FPGA_VENDOR), xilinx)
155
$(MODELSIM): modelsim_bench.scr $(TEST_DEFINES_VLG) $(VPI_LIBS) work
156
        $(Q)echo; echo "\t### Compiling Xilinx support libs, user design & testbench ###"; echo
157 560 julius
ifeq ($(DO_XILINX_COMPXLIB), 1)
158 562 julius
        $(Q)$(TECHNOLOGY_BACKEND_BIN_DIR)/compxlib $(XLIB_ARGS)
159 560 julius
endif
160 558 julius
        $(Q)vlog $(QUIET) -nologo -incr $(BENCH_TOP_FILE) -f $<
161 651 julius
        $(Q)$(MGC_VOPT_EXE) $(QUIET) glbl $(RTL_TESTBENCH_TOP_NAME) $(VOPT_ARGS) -o tb
162 542 julius
        $(Q)echo; echo "\t### Launching simulation ###"; echo
163 651 julius
        $(Q)vsim $(VSIM_ARGS) $(MGC_VSIM_TGT)
164 542 julius
endif
165
 
166 558 julius
ifeq ($(FPGA_VENDOR), altera)
167
$(MODELSIM): modelsim_bench.scr $(TEST_DEFINES_VLG) $(BACKEND_LIB) $(VPI_LIBS) work
168
        $(Q)echo; echo "\t### Compiling testbench ###"; echo
169
        $(Q)vlog $(QUIET) -nologo -incr $(BENCH_TOP_FILE) -f $<
170 660 paknick
ifneq ($(MGC_NO_VOPT), 1)
171
        $(Q)echo; echo "\t### Optimizing testbench ###"; echo
172 651 julius
        $(Q)$(MGC_VOPT_EXE) $(QUIET) $(RTL_TESTBENCH_TOP_NAME) $(VOPT_ARGS) -L $(BACKEND_LIB) -o tb
173 660 paknick
endif
174 558 julius
        $(Q)echo; echo "\t### Launching simulation ###"; echo
175 660 paknick
        $(Q)vsim $(QUIET) $(VSIM_ARGS) $(MGC_VSIM_TGT) -L $(BACKEND_LIB)
176
endif

powered by: WebSVN 2.1.0

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