-
Notifications
You must be signed in to change notification settings - Fork 518
/
Copy pathMakefile.common.inc
314 lines (255 loc) · 9.93 KB
/
Makefile.common.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# =============================================================================
# Amazon FPGA Hardware Development Kit
#
# Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Amazon Software License (the "License"). You may not use
# this file except in compliance with the License. A copy of the License is
# located at
#
# http://aws.amazon.com/asl/
#
# or in the "license" file accompanying this file. This file is distributed on
# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or
# implied. See the License for the specific language governing permissions and
# limitations under the License.
# =============================================================================
all: make_sim_dir compile run
define \n
endef
define \t
endef
help: ## Display this help
$(info )
$(info $(\n)Targets:)
$(info $(\t)make clean - Removes all simulator specific files)
$(info $(\t)make regenerate_sim_libs - Regenerates the simulation libraries located at $(HDK_COMMON_DIR)/verif/ip_simulation_libraries)
$(info $(\t)make recompile_cl_ips - Recompile the CL IP source files after generating the simulation libraries)
$(info )
$(info $(\n)Supported simulators:)
$(info $(\t)XSIM (default) - Set this to use the Xilinx Vivado XSIM simulator)
$(info $(\t)VCS - Set this to use the Synopsys VCS simulator)
$(info $(\t)QUESTA - Set this to use the Modelsim Questa simulator)
$(info )
$(info SH_DDR Configuration: "make <TEST TARGET> USE_64GB_DDR_DIMM=1")
$(info $(\t)USE_64GB_DDR_DIMM (DEFAULT) - Set this to use a 64GB DDR DIMM for simulations)
$(info $(\t)USE_AP_64GB_DDR_DIMM - Set this to use a 64GB DDR DIMM with user-controlled Auto Precharge for simulations)
$(info $(\n))
VCS ?= 0 ## Set 'VCS=1' ## Enable VCS simulations
QUESTA ?= 0
IES ?= 0
ifeq ($(filter $(strip $(QUESTA)), 0 1),)
$(error Variable QUESTA is set to the value other than 0 or 1 -> QUESTA=$(QUESTA). Exiting...)
endif
ifeq ($(filter $(strip $(VCS)), 0 1),)
$(error Variable VCS is set to the value other than 0 or 1 -> VCS=$(VCS). Exiting...)
endif
ifeq ($(filter $(strip $(IES)), 0 1),)
$(error Variable IES is set to the value other than 0 or 1 -> IES=$(IES). Exiting...)
endif
ifneq ($(filter $(strip $(QUESTA))$(strip $(VCS))$(strip $(IES)), 000),)
define = --define $(strip $(1))
plusarg = --testplusarg "$(strip $(1))"
export SIMULATOR = xsim
else
ifeq ($(filter $(strip $(QUESTA))$(strip $(VCS))$(strip $(IES)), 100 010 001),)
$(info Shall not enable QUESTA=$(strip $(QUESTA)) VCS=$(strip $(VCS)) IES=$(strip $(IES)) altogether!)
$(error Choose only one of them! Exiting...)
endif
define = +define+$(strip $(1))
plusarg = +$(strip $(1))
ifeq ($(strip $(QUESTA)), 1)
export SIMULATOR = questa
endif
ifeq ($(strip $(VCS)), 1)
export SIMULATOR = vcs
endif
ifeq ($(strip $(IES)), 1)
export SIMULATOR = ies
endif
endif
DEFAULT_DEFINES ?=
DEFAULT_DEFINES += +define+AWS_SIM
PLUSARGS ?=
PLUSARGS += +plusarg_save +timeout=1ms
DDR4_RDIMM_WRAPPER = $(HDK_COMMON_DIR)/verif/models/ddr4_rdimm_wrapper/ddr4_rdimm_wrapper.sv
DIMM_REPLACEMENT = "NONE"
ifeq ($(USE_AP_64GB_DDR_DIMM), 1)
DEFAULT_DEFINES += $(call define, USE_AP_64GB_DDR_DIMM=1)
else
DEFAULT_DEFINES += $(call define, USE_64GB_DDR_DIMM=1)
endif
# Simulation variables and directory name changes
ifeq ($(C_TEST),test_null)
# The AXI memory model offers error correction checking
ifeq ($(AXI_MEMORY_MODEL), 1)
DEFAULT_DEFINES += $(call define, FAST_SIM_MODE)
DEFAULT_DEFINES += $(call define, NO_DDR)
ifeq ($(ECC_DIRECT), 1)
DEFAULT_DEFINES += $(call define, ECC_DIRECT_EN=1)
DEFAULT_DEFINES += $(call define, RND_ECC_EN=0)
DEFAULT_DEFINES += $(call define, RND_ECC_WEIGHT=0)
DEFAULT_DEFINES += $(call define, ECC_ADDR_HI=$(ECC_ADDR_HI))
DEFAULT_DEFINES += $(call define, ECC_ADDR_LO=$(ECC_ADDR_LO))
SIM_DIR_EXTENSION = _sv_fast_ecc_direct
else
DEFAULT_DEFINES += $(call define, ECC_DIRECT_EN=0)
DEFAULT_DEFINES += $(call define, RND_ECC_WEIGHT=$(RND_ECC_WEIGHT))
ifeq ($(ECC_RAND), 1)
DEFAULT_DEFINES += $(call define, RND_ECC_EN=1)
SIM_DIR_EXTENSION = _sv_fast_ecc_rnd
else
DEFAULT_DEFINES += $(call define, RND_ECC_EN=0)
SIM_DIR_EXTENSION = _sv_fast
endif
DEFAULT_DEFINES += $(call define, ECC_ADDR_HI=0)
DEFAULT_DEFINES += $(call define, ECC_ADDR_LO=0)
endif
else
SIM_DIR_EXTENSION = _sv
endif
export SIM_DIR = $(SIM_ROOT)/$(TEST)$(SIM_DIR_EXTENSION)
else
SIM_DIR_EXTENSION = _c
export SIM_DIR = $(SIM_ROOT)/$(C_TEST)$(SIM_DIR_EXTENSION)
endif
COMMON_LIBLISTS =\
unisims_ver\
unisim\
unifast_ver\
unifast\
unimacro_ver\
unimacro\
secureip\
xpm\
xil_defaultlib\
axi_dwidth_converter_v2_1_31\
axi_protocol_converter_v2_1_31\
axi_protocol_checker_v2_0_17\
hbm2e_pl_v1_0_1\
noc_hbm_v1_0_0\
hbm_v1_0_16\
axi_register_slice_v2_1_31\
axi_infrastructure_v1_1_0\
axi_crossbar_v2_1_32\
axi_clock_converter_v2_1_30\
fifo_generator_v13_2_10\
axi_data_fifo_v2_1_30\
generic_baseblocks_v2_1_2\
lut_buffer_v2_0_1\
xsdbm_v3_0_2\
xdma_v4_1_29\
xlconstant_v1_1_9\
smartconnect_v1_0
LIBLISTS_ARGS = $(shell echo " $(strip $(COMMON_LIBLISTS))" | sed 's|\ | -L |g')
FILTER_OUT_EMPTY_LINES = grep -v "^\# $$" | sed '/^$$/d'
FILTER_OUT_HBM_META_INJECTIONS = grep -v "\*\*\*Meta" | sed '/^$$/d'
#
#- GENERATE SIMULATION LIBRARIES
#
export IP_SIM_DIR = $(HDK_COMMON_DIR)/verif/ip_simulation_libraries
ifndef COMPLIB_DIR
export COMPLIB_DIR = $(IP_SIM_DIR)/$(strip $(SIMULATOR))_complib
endif
ifndef COMPILE_CL_IP_DIR
export COMPILE_CL_IP_DIR = $(IP_SIM_DIR)/$(strip $(SIMULATOR))_compiled_cl_ips
endif
# DO NOT REMOVE: This is used to space out prints
define n
endef
export COMPLIB_IN_PROGRESS = $(IP_SIM_DIR)/$(strip $(SIMULATOR))_complib_dir_in_progress
check_complib_in_progress:
ifneq ("$(wildcard $(COMPLIB_IN_PROGRESS))","")
$(error "$n ERROR: Simulation library compilation is in progress $n")
else
mkdir -p $(COMPLIB_DIR) && touch $(COMPLIB_IN_PROGRESS)
endif
export CL_IP_IN_PROGRESS = $(IP_SIM_DIR)/$(strip $(SIMULATOR))_compile_cl_ips_dir_in_progress
check_cl_ip_in_progress:
ifneq ("$(wildcard $(CL_IP_IN_PROGRESS))","")
$(error "$n ERROR: CL IP compilation is in progress $n")
else
mkdir -p $(COMPILE_CL_IP_DIR) && touch $(CL_IP_IN_PROGRESS)
endif
regenerate_sim_libs: check_complib_in_progress
rm -rf $(COMPLIB_DIR)
rm -f $(COMPLIB_IN_PROGRESS)
$(MAKE) $(COMPLIB_DIR)
$(MAKE) recompile_cl_ips
recompile_cl_ips: check_cl_ip_in_progress
rm -rf $(COMPILE_CL_IP_DIR)
rm -f $(CL_IP_IN_PROGRESS)
$(MAKE) $(COMPILE_CL_IP_DIR)
$(COMPLIB_DIR): check_complib_in_progress
ifeq ("$(SIMULATOR)","xsim")
$(info "$n WARNING: XSIM does not require simulation library compilation $n")
else
ifeq ("$(wildcard $(COMPLIB_DIR))","")
mkdir -p $(SIM_ROOT)
cd $(SIM_ROOT) && echo "compile_simlib -language all -dir $(COMPLIB_DIR) -simulator $(SIMULATOR) -no_systemc_compile -library all -family all" > create_libs.tcl
cd $(SIM_ROOT) && vivado -mode batch -source create_libs.tcl
cd $(SIM_ROOT) && rm -rf create_libs.tcl
endif
endif
rm -f $(COMPLIB_IN_PROGRESS)
$(COMPILE_CL_IP_DIR): check_cl_ip_in_progress $(COMPLIB_DIR)
ifeq ("$(SIMULATOR)","xsim")
$(MAKE) copy_xsim_ini
endif
ifeq ("$(wildcard $(COMPILE_CL_IP_DIR)/done)","")
$(HDK_COMMON_DIR)/verif/scripts/compile_cl_ips.py --simulator $(SIMULATOR) --complib_dir $(COMPLIB_DIR) --compile_cl_ip_dir $(COMPILE_CL_IP_DIR) --in_progress_file $(CL_IP_IN_PROGRESS);
endif
rm -f $(CL_IP_IN_PROGRESS)
#
include $(HDK_COMMON_DIR)/verif/tb/scripts/Makefile.$(strip $(SIMULATOR)).inc
#
#
#- AUTO GENERATE SIM FILE LIST
#
generate_sim_file_list:
ifndef DONT_GENERATE_FILE_LIST
$(HDK_COMMON_DIR)/verif/scripts/generate_sim_file_list.py --cl_dir $(CL_DIR) --simulator $(SIMULATOR)
endif
$(HDK_COMMON_DIR)/verif/models/fpga/fpga_ports.vh:
#
#- CREATE CL_PORTS ----------
#
@ perl $(HDK_COMMON_DIR)/verif/scripts/cl_ports_gen.pl
$(HDK_COMMON_DIR)/verif/models/sh_bfm/cl_ports_sh_bfm.vh: $(HDK_SHELL_DESIGN_DIR)/interfaces/cl_ports.vh $(HDK_COMMON_DIR)/verif/models/fpga/fpga_ports.vh
#
#- CREATE CL_PORTS ----------
#
@ perl $(HDK_COMMON_DIR)/verif/scripts/cl_ports_gen.pl
make_sim_dir: $(HDK_COMMON_DIR)/verif/models/sh_bfm/cl_ports_sh_bfm.vh
#
#- CREATE SIM_ROOT ----------
#
@ mkdir -p $(SIM_DIR);\
if [ "$(SIMULATOR)" = "xsim" ]; then \
echo "Copying XSIM hbm model config files"; \
cp $(HDK_COMMON_DIR)/verif/include/xsim_hbm/xpm_internal_config* $(SIM_DIR) 2>/dev/null; \
else \
echo "Copying hbm model config files "; \
cp $(HDK_COMMON_DIR)/verif/include/xpm_internal_config* $(SIM_DIR) 2>/dev/null; \
fi; \
touch $(SIM_DIR)/bd_2e02_lmb_bram_I_0.mem $(SIM_DIR)/bd_2e02_second_lmb_bram_I_0.mem;
#
# Command wrapper API source
#
SIMSCR = source $(HDK_COMMON_DIR)/verif/tb/scripts/simapi.sh
#
# Regression Sub-Targets
#
# Get name of target for all tests that are not commented out
DEFAULT_REGRESSION_TEST_LIST_COLLECTION=$(shell grep -h TEST ${CL_DIR}/verif/scripts/Makefile.tests | grep -v '^.*\#.*TEST' | sed 's/:.*//g' | xargs)
REGRESSION_RESULTS_LOG = $(PWD)/$(SIMULATOR)_regression_results$(SIM_DIR_EXTENSION).log
run_regression:
for test_name in $(REGRESSION_TEST_LIST) ; do \
$(MAKE) $$test_name AXI_MEMORY_MODEL=$(AXI_MEMORY_MODEL) ECC_DIRECT=$(ECC_DIRECT) ECC_RAND=$(ECC_RAND) ECC_ADDR_HI=$(ECC_ADDR_HI) ECC_ADDR_LO=$(ECC_ADDR_LO) RND_ECC_WEIGHT=$(RND_ECC_WEIGHT) XSIM=$(XSIM) VCS=$(VCS) QUESTA=$(QUESTA) ; \
done
log_regression_results:
$(HDK_COMMON_DIR)/verif/scripts/log_regression_results.py --simulator $(SIMULATOR) --cl_dir $(CL_DIR) --regression_results_log $(REGRESSION_RESULTS_LOG) --sim_dir_extension "$(SIM_DIR_EXTENSION)"
print_regression_results:
echo "" ; \
echo "*** SEE RESULTS IN '$(REGRESSION_RESULTS_LOG)'" ; \
cat $(REGRESSION_RESULTS_LOG) ; \