-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.gitlab-ci.yml
463 lines (406 loc) · 14.3 KB
/
.gitlab-ci.yml
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
461
462
463
image: registry.gitlab.com/canfd/server-tools/ghdl
before_script:
- "export PATH=/opt/ghdl/bin:$PATH"
- export LC_ALL=C.UTF-8
- export LANG=C.UTF-8
- export PYTHONUNBUFFERED=1
- export CTU_TB_TOP_TARGET="tb_ctu_can_fd_rtl_vunit"
stages:
- precheck
#- test_driver
- build
- test_rtl
- test_gates
- coverage
- deploy
check_component:
stage: precheck
script:
- scripts/gen_vivado_component.py
- cd scripts && ./update_reg_map
- git diff --exit-code || (echo "Vivado component file or register map products are not up-to-date. Either run scripts/gen_vivado_component.py and scripts/update_reg_map or download the files from this job's artifacts."; exit 1)
artifacts:
expire_in: 1 week
paths:
- src/component.xml
- doc/core/registerMap.lyx
- driver/ctucanfd_regs.h
- driver/ctucanfd_frame.h
- src/lib/can_fd_register_map.vhd
###############################################################################
# Build stage
###############################################################################
build_ip_and_tests:
stage: build
tags:
- simulation
script:
- cd test
- make elaborate
only: &only
- master # Run on all changes to master branch
- tags # Run on all tags
- triggers # Run by trigger (on merge request)
- web # Run by manual request from web UI
build_compliance_lib:
stage: build
tags:
- simulation
script:
- cd test/main_tb/iso-16845-compliance-tests/
- source ./build.sh
artifacts:
paths:
- test/main_tb/iso-16845-compliance-tests/build/Debug/src/cosimulation/libGHDL_VPI_COSIM_LIB.so
- test/main_tb/iso-16845-compliance-tests/build/Debug/src/cosimulation/libVCS_VHPI_COSIM_LIB.so
- test/main_tb/iso-16845-compliance-tests/build/Release/src/cosimulation/libGHDL_VPI_COSIM_LIB.so
- test/main_tb/iso-16845-compliance-tests/build/Release/src/cosimulation/libVCS_VHPI_COSIM_LIB.so
only: *only
build_driver:
stage: build
tags:
- simulation
only: *only
script:
- cd driver
- "make -j`nproc`"
build_doc:
stage: build
tags:
- simulation
only: *only
image: registry.gitlab.com/canfd/server-tools/lyx
script:
- export LC_ALL=en_US.UTF-8
- export LANG=en_US.UTF-8
- make -C doc/core
- make -C doc/driver
artifacts:
paths:
- doc/core/Progdokum.pdf
- doc/core/ctu_can_fd_architecture.pdf
- doc/core/tb_architecture.pdf
- doc/driver/build
build_linux_driver:
stage: build
tags:
- simulation
only: *only
image: registry.gitlab.com/canfd/server-tools/ctucanfd_drvtest
script:
- cd driver/linux
- "make -j`nproc` KDIR=/linux/build CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm"
- "make checkpatch KDIR=/linux/build CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm"
artifacts:
paths:
- driver/linux/ctucanfd.ko
run_synthesis:
stage: build
tags:
- synthesis
only: *only
tags:
- vps
script:
- source /opt/xilinx/vivado-2018.2/settings.sh
- cd synthesis/Vivado/ci_benchmark
- echo "Running minimal configuration..."
- vivado -mode tcl -source vivado_benchmark_minimal.tcl
- echo "Running typical configuration..."
- vivado -mode tcl -source vivado_benchmark_typical.tcl
- echo "Running maximal configuration..."
- vivado -mode tcl -source vivado_benchmark_maximal.tcl
# Remove reference to UNISIM library, all cell models are included in netlist!
- sed -i 's\library UNISIM;\\g' maximal_design_config/can_top_level.vhd
- sed -i 's\library UNISIM;\\g' typical_design_config/can_top_level.vhd
- sed -i 's\library UNISIM;\\g' minimal_design_config/can_top_level.vhd
artifacts:
paths:
- synthesis/Vivado/ci_benchmark/*_design_config
expire_in: 12 hrs
###############################################################################
# Run emulator tests (on ZynQ MZ_APO board)
###############################################################################
# Disable for now. Multi-project pipelines are available only in Premium Gitlab
# Edition!
#run_emulator_tests:
# stage: test_driver
# only:
# - master
#
# Trigger pipeline in MZ_APO Zynq top repo. This will:
# 1. Update sub-modules (CTU CAN FDs latest master is taken in Zynq build).
# 2. Build Vivado design with CTU CAN FD, SJA1000, Zlogan etc...
# 3. Build CTU CAN FD driver (from latest CTU CAN FD master)
# 3. Run test on MZ_APO board which:
# 1. Loads driver
# 2. Sends frames over SocketCAN between CTU CAN FD and SJA100 in various
# combinations. This is sort-of driver sanity check, not its full
# verification!
#trigger:
# project: canbus/zynq/zynq-can-sja1000-top
# strategy: depend
###############################################################################
# Test RTL stage (fast + nightly)
###############################################################################
test_fast_asic:
stage: test_rtl
tags:
- simulation
only: *only
script:
- cd test
- make tb_rtl_test_fast_asic
- make tb_rtl_test_fast_asic_logs
artifacts:
when: always
paths:
- test/tb_rtl_test_fast_asic.xml
- test/tb_rtl_test_fast_asic_summary
- test/tb_rtl_test_fast_asic.sim_time
reports:
junit: test/tb_rtl_test_fast_asic.xml
test_fast_fpga:
stage: test_rtl
tags:
- simulation
only: *only
script:
- cd test
- make tb_rtl_test_fast_fpga
- make tb_rtl_test_fast_fpga_logs
artifacts:
when: always
paths:
- test/tb_rtl_test_fast_fpga.xml
- test/tb_rtl_test_fast_fpga_summary
- test/tb_rtl_test_fast_fpga.sim_time
reports:
junit: test/tb_rtl_test_fast_fpga.xml
test_nightly:
stage: test_rtl
tags:
- simulation
only:
- master
script:
- cd test
- make tb_rtl_test_nightly
- make tb_rtl_test_nightly_logs
artifacts:
when: always
paths:
- test/tb_rtl_test_nightly.xml
- test/tb_rtl_test_nightly_summary
- test/tb_rtl_test_nightly.sim_time
- test/vunit_out/functional_coverage
reports:
junit: test/tb_rtl_test_nightly.xml
# Nightly tests might fail due to randomization. It is not preffered to
# kill whole follow-up coverage processing due to this failure!
# OTOH, fast pipeline can't fail because it must pass before merge!
allow_failure: true
###############################################################################
# Test RTL stage (Compliance test runs)
###############################################################################
test_compliance_short:
stage: test_rtl
tags:
- simulation
dependencies: [build_compliance_lib]
only: *only
script:
- cd test
- make tb_rtl_test_compliance_short
- make tb_rtl_test_compliance_short_logs
artifacts:
when: always
paths:
- test/tb_rtl_test_compliance_short.xml
- test/tb_rtl_test_compliance_short_summary
- test/tb_rtl_test_compliance_short.sim_time
reports:
junit: test/tb_rtl_test_compliance_short.xml
# For now not all compliance tests are debugged, allow failure...
allow_failure: true
test_compliance_full_typ:
stage: test_rtl
tags:
- simulation
dependencies: [build_compliance_lib]
only:
- master
script:
- cd test
- make tb_rtl_test_compliance_full_typ
- make tb_rtl_test_compliance_full_typ_logs
artifacts:
when: always
paths:
- test/tb_rtl_test_compliance_full_typ.xml
- test/tb_rtl_test_compliance_full_typ_summary
- test/tb_rtl_test_compliance_full_typ.sim_time
- test/vunit_out/functional_coverage
reports:
junit: test/tb_rtl_test_compliance_full_typ.xml
# For now not all compliance tests are debugged, allow failure...
allow_failure: true
test_compliance_full_max:
stage: test_rtl
tags:
- simulation
dependencies: [build_compliance_lib]
only:
- master
script:
- cd test
- make tb_rtl_test_compliance_full_max
- make tb_rtl_test_compliance_full_max_logs
artifacts:
when: always
paths:
- test/tb_rtl_test_compliance_full_max.xml
- test/tb_rtl_test_compliance_full_max_summary
- test/tb_rtl_test_compliance_full_max.sim_time
- test/vunit_out/functional_coverage
reports:
junit: test/tb_rtl_test_compliance_full_max.xml
# For now not all compliance tests are debugged, allow failure...
allow_failure: true
# MIN run is not feasible with GHDL. Min run with VCS on fast machine takes 6-8
# hours -> TODO: Add min run once we flip to NVC.
###############################################################################
# Test gates (Gate level simulation on post synthesis netlist)
###############################################################################
#test_gates_simple:
# stage: test_gates
# tags:
# - simulation
# dependencies: [run_synthesis]
# timeout: 6h
# only:
# - master
# script:
# - cd test
# - make tb_gate_xilinx_test_simple
# - make tb_gate_xilinx_test_simple_logs
# artifacts:
# when: always
# paths:
# - test/tb_gate_xilinx_test_simple.xml
# - test/tb_gate_xilinx_test_simple_summary
# - test/tb_gate_xilinx_test_simple.sim_time
# reports:
# junit: test/tb_gate_xilinx_test_simple.xml
#
# # Some gates might fail, TODO: Debug
# allow_failure: true
test_gates_compliance:
stage: test_gates
tags:
- simulation
dependencies: [run_synthesis, build_compliance_lib]
timeout: 6h
only:
- master
script:
- cd test
- make tb_gate_xilinx_test_compliance
- make tb_gate_xilinx_test_compliance_logs
artifacts:
when: always
paths:
- test/tb_gate_xilinx_test_compliance.xml
- test/tb_gate_xilinx_test_compliance_summary
- test/tb_gate_xilinx_test_compliance.sim_time
reports:
junit: test/tb_gate_xilinx_test_compliance.xml
# TODO: Still some compliance tests are not yet fully debugged!
allow_failure: true
###############################################################################
# Results processing
###############################################################################
process_coverage:
stage: coverage
tags:
- simulation
dependencies: [test_compliance_full_typ, test_nightly]
only:
- master
script:
# Process functional coverage
- cd test
- make functional_coverage
# Generate VRM
- cd ../scripts
- chmod +x gen_vrm
- ./gen_vrm
coverage: "/lines......: ([^%]+%)/"
artifacts:
when: always
paths:
- test/vunit_out/functional_coverage/functional_coverage_report.html
- test/vunit_out/functional_coverage/html
- scripts/VRM.html
pages:
stage: deploy
when: always
script:
- echo "Creating delivery package..."
# Create directory structure for release
- mkdir -p public
- mkdir -p public/rtl
- mkdir -p public/tb
- mkdir -p public/doc
- mkdir -p public/doc/linux_driver
- mkdir -p public/regression_results
- mkdir -p public/synthesis
- mkdir -p public/vivado_component
# Copy RTL
- cp src/*.vhd public/rtl/
- cp src/**/*.vhd public/rtl/
- cp src/**/**/*.vhd public/rtl/
- cp src/slf_*.yml public/
# Copy TB
- cp test/main_tb/*.vhd public/tb/
- cp test/main_tb/**/*.vhd public/tb/
- cp test/main_tb/**/**/*.vhd public/tb/
- cp test/slf_*.yml public/
# Copy test list files
- cp test/tlf_* public/
# Compliance test library
- cp test/main_tb/iso-16845-compliance-tests/build/Release/src/cosimulation/libGHDL_VPI_COSIM_LIB.so public/
- cp test/main_tb/iso-16845-compliance-tests/build/Release/src/cosimulation/libVCS_VHPI_COSIM_LIB.so public/
# Copy regression results and code coverage
# DO NOT pack the complete regression results they include all log files and that overflows pages artifacts!
#- cp test/*.xml public/regression_results/ || true
- cp test/*_summary public/regression_results/ || true
# Measure total simulation time
- cat test/*.sim_time | paste -sd+ | bc > total.sim_time
- echo "Total simulation time is `cat total.sim_time` fs."
# Copy documentation
- mv doc/core/Progdokum.pdf public/doc/Datasheet.pdf || true
- cp doc/core/ctu_can_fd_architecture.pdf public/doc/System_Architecture.pdf || true
- cp doc/core/tb_architecture.pdf public/doc/Testbench.pdf || true
- cp -R doc/driver/build public/doc/linux_driver || true
# Copy functional coverage HTML reports
- mkdir public/regression_results/functional_coverage
- cp test/vunit_out/functional_coverage/*.html public/regression_results/functional_coverage || true
- cp -R test/vunit_out/functional_coverage/html public/regression_results/functional_coverage || true
# Copy synthesis results + constraints
- cp -R synthesis/Vivado/ci_benchmark/*_design_config public/synthesis
- cp synthesis/Constraints/ctu_can_fd.sdc public/synthesis
# Copy Vivado component
- cp src/component.xml public/vivado_component
# VRM result
- cp scripts/VRM.html public/regression_results/ || true
# Check size, compress, check again
- echo "Size of artifacts:"
- du -skh public/*
only:
- master
artifacts:
paths:
- public
variables:
GIT_SUBMODULE_STRATEGY: recursive