-
Notifications
You must be signed in to change notification settings - Fork 61
/
snap_env
executable file
·460 lines (421 loc) · 20.5 KB
/
snap_env
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
#!/bin/bash
############################################################################
############################################################################
##
## Copyright 2016,2017 International Business Machines
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE#2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions AND
## limitations under the License.
##
############################################################################
############################################################################
#
snapdir=$(dirname $(readlink -f "$BASH_SOURCE")) # path containing this script
PATH=$snapdir:$PATH
snap_env_sh=$snapdir/snap_env.sh
unset PSL_DCP
unset ACTION_ROOT
unset PSLSE_ROOT
unset TIMING_LABLIMIT
unset ILA_SETUP_FILE
unset DCP_ROOT
unset config_script
unset snap_env_info
TIMING_LABLIMIT_DEFAULT="-200"
while [[ $# -gt 0 ]]; do
case "$1" in
"config")
snap_env_info=y
shift
;;
"ignore_action_root")
ignore_action_root=y
shift
;;
*)
config_script=$1
shift
;;
esac
done
if [ -e "$config_script" ]; then
source $config_script
fi
if [ -e "$snap_env_sh" ]; then
source "$snap_env_sh"
else
touch "$snap_env_sh"
fi
unset SETUP_DONE
while [ -z "$SETUP_DONE" ]; do
SETUP_WARNING=""
SETUP_INFO=""
SETUP_EMPTY=""
echo "======================================================="
echo "== SNAP ENVIRONMENT SETUP =="
echo "======================================================="
####### checking Xilinx Vivado
if [ ! -d "$XILINX_VIVADO" ]; then
SETUP_WARNING="$SETUP_WARNING\n### WARNING ### XILINX_VIVADO (set to \"$XILINX_VIVADO\") is not pointing to a directory:"
SETUP_WARNING="$SETUP_WARNING\n Please source settings64.sh from your Vivado installation"
fi
if [ -z "$XILINXD_LICENSE_FILE" ]; then
SETUP_WARNING="$SETUP_WARNING\n### WARNING ### XILINXD_LICENSE_FILE is not set:"
SETUP_WARNING="$SETUP_WARNING\n The following command needs to be executed before initiating hardware builds:"
SETUP_WARNING="$SETUP_WARNING\n export XILINXD_LICENSE_FILE=<pointer to Vivado license>"
fi
# printing Vivado version
if [ -z `which vivado 2> /dev/null` ]; then
SETUP_WARNING="$SETUP_WARNING\n### WARNING ### Path to vivado is not set:"
SETUP_WARNING="$SETUP_WARNING\n Please add to environment variable \$PATH"
else
echo "Path to vivado is set to: `which vivado`"
echo "Vivado version is set to: `vivado -version|head -n1`"
RESP=`vivado -version|head -n1 |cut -d' ' -f2|cut -c2-`
if [ "$CAPI10" == "y" ] && ([ $RESP == "2018.2" ] || [ $RESP == "2018.3" ]); then
SETUP_INFO="$SETUP_INFO\n### WARNING ### Building an image with Vivado 2018.2 or 2018.3 for CAPI1.0 cards will drive to errors."
SETUP_INFO="$SETUP_INFO\n### It is highly recommended to use Vivado 2018.1 with CAPI1.0 cards."
fi
if [ "$FPGACARD" == "U200" ] && ([ $RESP != "2018.3.1" ] && [ $RESP != "2019.1" ] && [ $RESP != "2019.2" ]); then
SETUP_INFO="$SETUP_INFO\n### WARNING ### Building a U200 image requires Vivado 2018.3 or later."
fi
if [ "$FPGACARD" == "U50" ] && ([ $RESP != "2019.1" ] && [ $RESP != "2019.2" ]); then
SETUP_INFO="$SETUP_INFO\n### WARNING ### Building a U50 image requires Vivado 2019.1 or later."
fi
if [ "$FPGACARD" == "U200" ]; then
SETUP_INFO="$SETUP_INFO\n### WARNING ### The porting of this card U200 is still in development."
fi
echo "Vivado HLS version is set to: `vivado_hls -version|head -n1|cut -d " " -f 11`"
fi
# checking board definition existence for U50 and U200 boards
if [ "$FPGACARD" == "U50" ] && [ ! -d "$XILINX_VIVADO/data/boards/board_files/au50" ]; then
SETUP_WARNING="$SETUP_WARNING\n### WARNING ### XILINX U50 Board definition is not present"
SETUP_WARNING="$SETUP_WARNING\n Please reinstall the latest update of Vivado tool"
SETUP_WARNING="$SETUP_WARNING\n or update the board catalog (open Vivado Menu > Tools > Downaload latest board)"
SETUP_WARNING="$SETUP_WARNING\n and then cp -r ~.Xilinx/Vivado/2019.2/xhub/board_store/XilinxBoardStore/Vivado/2019.2/boards/Xilinx/au* to $XILINX_VIVADO/data/boards/board_files/."
fi
if [ "$FPGACARD" == "U200" ] && [ ! -d "$XILINX_VIVADO/data/boards/board_files/au200" ]; then
SETUP_WARNING="$SETUP_WARNING\n### WARNING ### XILINX U200 Board definition is not present"
SETUP_WARNING="$SETUP_WARNING\n Please reinstall the latest update of Vivado tool"
SETUP_WARNING="$SETUP_WARNING\n or update the board catalog (open Vivado Menu > Tools > Downaload latest board)"
SETUP_WARNING="$SETUP_WARNING\n and then cp -r ~.Xilinx/Vivado/2019.2/xhub/board_store/XilinxBoardStore/Vivado/2019.2/boards/Xilinx/au* to $XILINX_VIVADO/data/boards/board_files/."
fi
####### checking default variables
if [ "$CAPI20" == "y" ]; then
RESP=`grep PSL9_IP_CORE $snap_env_sh`
if [ -z "$RESP" ]; then
echo "#export PSL9_IP_CORE= <for CAPI2.0 cards: path to ibm.com_CAPI_PSL9_WRAP_2.00.zip file>" >> $snap_env_sh
fi
if [ -z "$PSL9_IP_CORE" ]; then
SETUP_INFO="$SETUP_INFO\n### INFO ### Path to PSL9_IP_CORE not set in $(basename $snap_env_sh) file."
SETUP_INFO="$SETUP_INFO\n It is not needed for simulation but only for building an image/FPGA."
SETUP_INFO="$SETUP_INFO\n All information how and where to get this zip file can be found at :"
SETUP_INFO="$SETUP_INFO\n https://github.com/open-power/snap/tree/master/hardware/README.md#power9"
elif [ ! -e "$PSL9_IP_CORE" ]; then
SETUP_WARNING="$SETUP_WARNING\n### WARNING ### Path to PSL9_IP_CORE not set properly in $(basename $snap_env_sh) file."
SETUP_WARNING="$SETUP_WARNING\n Please correct or remove the PSL9_IP_CORE parameter to continue the process."
SETUP_WARNING="$SETUP_WARNING\n It is not needed for simulation but only for building an image/FPGA."
SETUP_WARNING="$SETUP_WARNING\n All information how and where to get this zip file can be found at :"
SETUP_WARNING="$SETUP_WARNING\n https://github.com/open-power/snap/tree/master/hardware/README.md#power9"
fi
else
RESP=`grep PSL_DCP $snap_env_sh`
if [ -z "$RESP" ]; then
echo "#export PSL_DCP= <for CAPI1.0 cards: path to b_route_design.dcp file>" >> $snap_env_sh
fi
if [ -z "$PSL_DCP" ]; then
SETUP_INFO="$SETUP_INFO\n### INFO ### Path to PSL_DCP not set."
SETUP_INFO="$SETUP_INFO\n It is not needed for simulation but only for building an image/FPGA."
SETUP_INFO="$SETUP_INFO\n All information where to get this b_route_design.dcp file can be found at :"
SETUP_INFO="$SETUP_INFO\n https://github.com/open-power/snap/tree/master/hardware/README.md#power8"
elif [ ! -e "$PSL_DCP" ]; then
SETUP_WARNING="$SETUP_WARNING\n### WARNING ### Path to PSL_DCP not set properly in $(basename $snap_env_sh) file."
SETUP_WARNING="$SETUP_WARNING\n Please correct or remove the PSL_DCP parameter to continue the process."
SETUP_WARNING="$SETUP_WARNING\n It is not needed for simulation but only for building an image/FPGA."
SETUP_WARNING="$SETUP_WARNING\n All information where to get this b_route_design.dcp file can be found at :"
SETUP_WARNING="$SETUP_WARNING\n https://github.com/open-power/snap/tree/master/hardware/README.md#power8"
fi
fi
####### checking PSL DCP setup
if [ "$CAPI20" != "y" ]; then # CAPI 2.0 setup does not depend on PSL DCP
if [ "$CLOUD_USER_FLOW" == "TRUE" ]; then
SETUP_INFO="$SETUP_INFO\n### INFO ### Cloud user flow is skipping PSL_DCP check."
elif [ "$IGNORE_CHECK_PSL" == "TRUE" ]; then
SETUP_INFO="$SETUP_INFO\n### INFO ### Skipping PSL_DCP check because environment variable IGNORE_CHECK_PSL is set to TRUE."
else
echo "=====Checking path to PSL design checkpoint============"
echo "PSL_DCP is set to: \"$PSL_DCP\""
if [ -e "$PSL_DCP" ]; then
# checking card type for PSL design checkpoint
PSL_DCP_TYPE=`$snapdir/hardware/snap_check_psl $FPGACARD $PSL_DCP`
if [ "$PSL_DCP_TYPE" != "$FPGACARD" ]; then
if [[ "$PSL_DCP_TYPE" == *"OUTDATED"* ]]; then
SETUP_INFO="$SETUP_INFO\n### INFO ### PSL_DCP for $FPGACARD is pointing to an outdated dcp file in $(basename $snap_env_sh) file."
SETUP_INFO="$SETUP_INFO\n Building the image/FPGA will not be allowed."
SETUP_INFO="$SETUP_INFO\n All information where to get this b_route_design.dcp file can be found"
SETUP_INFO="$SETUP_INFO\n from https://github.com/open-power/snap/tree/master/hardware/README.md#power8"
else
SETUP_INFO="$SETUP_INFO\n### INFO ### PSL_DCP is pointing to a wrong checkpoint dcp file"
SETUP_INFO="$SETUP_INFO\n dcp file is for a $PSL_DCP_TYPE card while FPGACARD is set to $FPGACARD"
SETUP_INFO="$SETUP_INFO\n Building the image/FPGA will not be allowed."
SETUP_INFO="$SETUP_INFO\n Check or set the path to PSL_DCP in $(basename $snap_env_sh) accordingly."
fi
fi
fi
fi
fi
####### checking path to PSLSE (only if simulation is enabled)
# Note: SIMULATOR is defined via snap_config
if [ "$SIMULATOR" != "nosim" ]; then
echo "=====Simulation setup: Setting up PSLSE version=========="
if [ "$CAPI20" == "y" ]; then
PSLVER="9"
else
PSLVER="8"
fi
echo "Setting PSLVER to: \"$PSLVER\""
sed -i '/export[ ^]*PSLVER[ ^]*=/ d' $snap_env_sh
sed -i '1s/^/export PSLVER='$PSLVER'\n/' $snap_env_sh
echo "=====Simulation setup: Checking path to PSLSE=========="
echo "PSLSE_ROOT is set to: \"$PSLSE_ROOT\""
RESP=`grep PSLSE_ROOT $snap_env_sh`
if [ -z "$RESP" ]; then
echo "export PSLSE_ROOT=" >> $snap_env_sh
fi
if [ -z "$PSLSE_ROOT" ]; then
SETUP_EMPTY="$SETUP_EMPTY\n PSLSE_ROOT"
SETUP_WARNING="$SETUP_WARNING\n### WARNING ### Path to PSLSE not set."
SETUP_WARNING="$SETUP_WARNING\n For simulation please clone PSL Simulation Environment"
SETUP_WARNING="$SETUP_WARNING\n from https://github.com/ibm-capi/pslse"
SETUP_WARNING="$SETUP_WARNING\n and let PSLSE_ROOT variable in $(basename $snap_env_sh) point to it."
SETUP_WARNING="$SETUP_WARNING\n Please set Simulator to 'nosim' if you do not intend to run simulation."
elif [ ! -d "$PSLSE_ROOT" ]; then
SETUP_WARNING="$SETUP_WARNING\n### WARNING ### Path to PSLSE not set properly."
SETUP_WARNING="$SETUP_WARNING\n For simulation please clone PSL Simulation Environment"
SETUP_WARNING="$SETUP_WARNING\n from https://github.com/ibm-capi/pslse"
SETUP_WARNING="$SETUP_WARNING\n and let PSLSE_ROOT variable in $(basename $snap_env_sh) point to it."
SETUP_WARNING="$SETUP_WARNING\n Please set Simulator to 'nosim' if you do not intend to run simulation."
fi
fi
####### SNAP path variables
echo "=====ACTION ROOT setup================================="
unset AR
if [ -n "$HDL_EXAMPLE" ]; then
AR='${SNAP_ROOT}/actions/hdl_example'
elif [ -n "$HDL_HELLOWORLD" ]; then
AR='${SNAP_ROOT}/actions/hdl_helloworld'
elif [ -n "$HDL_NVME_EXAMPLE" ]; then
AR='${SNAP_ROOT}/actions/hdl_nvme_example'
elif [ -n "$HLS_MEMCOPY" ]; then
AR='${SNAP_ROOT}/actions/hls_memcopy'
elif [ -n "$HLS_SPONGE" ]; then
AR='${SNAP_ROOT}/actions/hls_sponge'
elif [ -n "$HLS_HASHJOIN" ]; then
AR='${SNAP_ROOT}/actions/hls_hashjoin'
elif [ -n "$HLS_SEARCH" ]; then
AR='${SNAP_ROOT}/actions/hls_search'
elif [ -n "$HLS_BFS" ]; then
AR='${SNAP_ROOT}/actions/hls_bfs'
elif [ -n "$HLS_INTERSECT" ]; then
AR='${SNAP_ROOT}/actions/hls_intersect'
elif [ -n "$HLS_NVME_MEMCOPY" ]; then
AR='${SNAP_ROOT}/actions/hls_nvme_memcopy'
elif [ -n "$HLS_LATENCY_EVAL" ]; then
AR='${SNAP_ROOT}/actions/hls_latency_eval'
elif [ -n "$HLS_MM_TEST" ]; then
AR='${SNAP_ROOT}/actions/hls_mm_test'
elif [ -n "$HLS_HELLOWORLD" ]; then
AR='${SNAP_ROOT}/actions/hls_helloworld'
elif [ -n "$HLS_DECIMAL_MULT" ]; then
AR='${SNAP_ROOT}/actions/hls_decimal_mult'
elif [ -n "$HLS_SCATTER_GATHER" ]; then
AR='${SNAP_ROOT}/actions/hls_scatter_gather'
elif [ -n "$HLS_VECTOR_GENERATOR" ]; then
AR='${SNAP_ROOT}/actions/hls_vector_generator'
elif [ -n "$HLS_PARALLEL_MEMCPY" ]; then
AR='${SNAP_ROOT}/actions/hls_parallel_memcpy'
elif [ -n "$HLS_IMAGE_FILTER" ]; then
AR='${SNAP_ROOT}/actions/hls_image_filter'
elif [ -n "$HLS_RX100G" ]; then
AR='${SNAP_ROOT}/actions/hls_rx100G'
elif [ -n "$HLS_HBM_MEMCOPY" ]; then
AR='${SNAP_ROOT}/actions/hls_hbm_memcopy'
elif [ -n "$HLS_UDP" ]; then
AR='${SNAP_ROOT}/actions/hls_udp'
fi
if [ -z "$AR" ] && [ -n "$ACTION_ROOT" ]; then
AR=$ACTION_ROOT
echo "ACTION_ROOT is set to: \"$ACTION_ROOT\""
SETUP_INFO="$SETUP_INFO\n### INFO ### Kept ACTION_ROOT from previous configuration."
else
echo "Setting ACTION_ROOT to: \"$AR\""
sed -i '/export[ ^]*ACTION_ROOT[ ^]*=/ d' $snap_env_sh
sed -i '1s#^#export ACTION_ROOT='$AR'\n#' $snap_env_sh
fi
if [ -z "$AR" ] && [ "$ignore_action_root" != "y" ]; then
SETUP_EMPTY="$SETUP_EMPTY\n ACTION_ROOT"
else
SNAP_ROOT=$snapdir
eval ACTION_ROOT=$AR
if [ "$ignore_action_root" == "y" ]; then
SETUP_INFO="$SETUP_INFO\n### INFO ### Skipping ACTION_ROOT check"
elif [ ! -d "$ACTION_ROOT" ]; then
SETUP_WARNING="$SETUP_WARNING\n### WARNING ### Please make sure that ACTION_ROOT points to an existing directory."
fi
fi
####### settings for HLS_CLK_CONSTRAINT
# Note: HLS_CLK_CONSTRAINT is defined via snap_config
if [ "$HLS_CLK_CONSTRAINT" == "TRUE" ]; then
RESP=`grep HLS_CLOCK_PERIOD_CONSTRAINT $snap_env_sh`
if [ -z "$RESP" ]; then
echo "export HLS_CLOCK_PERIOD_CONSTRAINT=\"4ns\"" >> $snap_env_sh
SETUP_INFO="$SETUP_INFO\n### INFO ### HLS_CLOCK_PERIOD_CONSTRAINT has been added to snap_env.sh file"
SETUP_INFO="$SETUP_INFO\n Please set it up with the value you want (default is 4ns)"
else
sed -i 's/#export HLS_CLOCK_PERIOD_CONSTRAINT/export HLS_CLOCK_PERIOD_CONSTRAINT/g' $snap_env_sh
SETUP_INFO="$SETUP_INFO\n### INFO ### HLS_CLOCK_PERIOD_CONSTRAINT is uncommented in snap_env.sh file"
SETUP_INFO="$SETUP_INFO\n Please set it up with the value you want (default is 4ns)"
fi
else
RESP=`grep "#export HLS_CLOCK_PERIOD_CONSTRAINT" $snap_env_sh`
if [ -z "$RESP" ] && [ "$CAPI20" == "y" ]; then
sed -i 's/export HLS_CLOCK_PERIOD_CONSTRAINT/#export HLS_CLOCK_PERIOD_CONSTRAINT/g' $snap_env_sh
SETUP_INFO="$SETUP_INFO\n### INFO ### HLS_CLOCK_PERIOD_CONSTRAINT has been commented in snap_env.sh file, if set"
fi
fi
####### settings for ILA Debug
# Note: ILA_DEBUG is defined via snap_config
if [ "$ILA_DEBUG" == "TRUE" ]; then
echo "=====ILA Debug setup==================================="
echo "ILA_SETUP_FILE is set to: \"$ILA_SETUP_FILE\""
RESP=`grep ILA_SETUP_FILE $snap_env_sh`
if [ -z "$RESP" ]; then
echo "export ILA_SETUP_FILE=" >> $snap_env_sh
fi
if [ -z "$ILA_SETUP_FILE" ]; then
SETUP_EMPTY="$SETUP_EMPTY\n ILA_SETUP_FILE"
else
if [ `echo "$ILA_SETUP_FILE" | tr a-z A-Z` = "TRUE" ] && [ ! -e "$ILA_SETUP_FILE" ]; then
SETUP_WARNING="$SETUP_WARNING\n### WARNING ### ILA_DEBUG is set to $ILA_DEBUG but ILA_SETUP_FILE (set to \"$ILA_SETUP_FILE\") is not pointing to a file!"
fi
fi
fi
####### settings for Partial Reconfiguration flow
# Note: USE_PRFLOW is defined via snap_config
if [ "$USE_PRFLOW" == "TRUE" ]; then
echo "=====PR flow setup====================================="
RESP=`grep DCP_ROOT $snap_env_sh`
if [ -z "$RESP" ]; then
echo "export DCP_ROOT=" >> $snap_env_sh
fi
echo "DCP_ROOT is set to: \"$DCP_ROOT\""
if [ -z "$DCP_ROOT" ]; then
SETUP_EMPTY="$SETUP_EMPTY\n DCP_ROOT"
fi
fi
####### checking TIMNG LIMITS setup
if [ -z "$TIMING_LABLIMIT" ]; then
TIMING_LABLIMIT="$TIMING_LABLIMIT_DEFAULT"
sed -i '/export[ ^]*TIMING_LABLIMIT[ ^]*=/ d' $snap_env_sh
sed -i '1s/^/export TIMING_LABLIMIT="'$TIMING_LABLIMIT_DEFAULT'"\n/' $snap_env_sh
SETUP_INFO="$SETUP_INFO\n### INFO ### Timing limit for FPGA image build got set to default value $TIMING_LABLIMIT_DEFAULT"
SETUP_INFO="$SETUP_INFO\n This value can be changed in file $(basename $snap_env_sh) file"
fi
echo "=====Timing limit for FPGA image build in ps============"
echo "TIMING_LABLIMIT is set to: \"$TIMING_LABLIMIT\""
####### Cadence simulation setup:
# Note: SIMULATOR is defined via snap_config
if [ "$SIMULATOR" == "irun" ]; then
echo "=====Cadence simulation setup=========================="
if [ -z `which irun 2> /dev/null` ]; then
SETUP_WARNING="$SETUP_WARNING\n### WARNING ### Path to irun not set, Cadence simulation won't work"
else
echo "Path to irun is: \"`which irun`\""
# checking version
echo "irun version is: \"$(irun -version| cut -f 3)\""
if [ -z "$CDS_INST_DIR" ]; then
SETUP_WARNING="$SETUP_WARNING\n### WARNING ### SIMULATOR is $SIMULATOR but CDS_INST_DIR is not set. Simulation may not work."
fi
echo "CDS_INST_DIR is set to: \"$CDS_INST_DIR\""
fi
if [ -f "$IES_LIBS/cds.lib" ]; then
echo "cds.lib (IES_LIBS) found in: \"$IES_LIBS\""
else
SETUP_WARNING="$SETUP_WARNING\n### WARNING ### Cannot find cds.lib in IES_LIBS=$IES_LIBS. Cadence compilation won't work."
fi
if [ -z "$CDS_LIC_FILE" ] && [ -z "$LM_LICENSE_FILE" ]; then
SETUP_WARNING="$SETUP_WARNING\n### WARNING ### Cadence license not defined with CDS_LIC_FILE or LM_LICENSE_FILE. Simulation may not work."
else
if [ -n "$CDS_LIC_FILE" ]; then
echo "CDS_LIC_FILE is set to: \"$CDS_LIC_FILE\""
fi
if [ -n "$LM_LICENSE_FILE" ]; then
echo "LM_LICENSE_FILE is set to: \"$LM_LICENSE_FILE\""
fi
fi
fi
# Note: NVME_USED and DENALI_USED are defined via snap_config
if [ "$NVME_USED" == "TRUE" ] && [ "$DENALI_USED" == "TRUE" ]; then
echo "=====Denali setup======================================"
if [ -z "$DENALI" ]; then
SETUP_INFO="$SETUP_INFO\n### INFO ### Setting of NVME_USED=$NVME_USED and setting of DENALI_USED=$DENALI_USED but DENALI not set!"
else
echo "DENALI is set to: \"$DENALI\""
fi
fi
# Note: HBM is defined via snap_config
if [ "$HBM_USED" == "TRUE" ]; then
if [ "$BRAM_USED" == "TRUE" ]; then
SETUP_INFO="$SETUP_INFO\n### INFO ### Setting of HBM is NOT with real HBM!"
else
if [ "$SIMULATOR" == "xsim" ]; then
SETUP_INFO="$SETUP_INFO\n### WARNING ### xsim simulator doesn't support HBM! You can however continue building an image."
fi
fi
fi
# Note: ETHERNET_USED is defined via snap_config
if [ "$ETHERNET_USED" == "TRUE" ] && [ "$ETH_LOOP_BACK" == "TRUE" ]; then
#echo "=====Ethernet setup===================================="
SETUP_INFO="$SETUP_INFO\n### INFO ### Setting of ETHERNET is a loopback with NO MAC"
fi
####### Print warning messages and create $snap_env_sh
echo -e "======================================================="
echo -e "\n=====Content of $(basename $snap_env_sh)============================"
cat $snap_env_sh
echo -e "======================================================="
RC=0
if [ -n "$SETUP_WARNING" ]; then
RC=1
echo -e "$SETUP_WARNING"
echo -e "\nPlease add or correct the required environment settings to the file $(basename $snap_env_sh)"
echo -e "All of the variables above have to be filled with the correct values."
fi
if [ "$snap_env_info" == "y" ] && [ -n "$SETUP_INFO" ]; then
echo -e "$SETUP_INFO"
fi
if [ -n "$SETUP_EMPTY" ]; then
let "RC = 2 - $RC"
echo -e "\nThe following environment variables need to get defined before going further:$SETUP_EMPTY"
echo -e "Please edit $(basename $snap_env_sh) and add the correct values"
fi
echo
SETUP_DONE="1"
done
if [ -z "$snap_env_info" ]; then
if [ "$0" == "bash" ]; then
# return value in case that this file was sourced
return $RC
else
# otherwise set an exit state
exit $RC
fi
fi