-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvunit
More file actions
executable file
·67 lines (59 loc) · 2.19 KB
/
Copy pathvunit
File metadata and controls
executable file
·67 lines (59 loc) · 2.19 KB
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
#!/usr/bin/env python3
from vunit import VUnit
from pathlib import Path
# Create VUnit instance by parsing command line arguments
vu = VUnit.from_argv(compile_builtins=False)
vu.add_vhdl_builtins()
out_path = Path(getattr(vu, "output_path", None) or getattr(vu, "_output_path", Path(".")))
# Create library 'lib'
lib = vu.add_library("lib")
lib.add_source_files("ip/schmitt_trigger/*.vhd")
lib.add_source_files("ip/adsb/*.vhd")
lib.add_source_files("ip/freq_est/*.vhd")
lib.add_source_files("ip/uart/*.vhd")
lib.add_source_files("tb/*/*.vhd")
lib.add_source_files("tb/*.vhd")
tb_names = [
"adsb_envelope_tb",
"adsb_fifo_tb",
"adsb_preamble_window_tb",
"adsb_rolling_sum_tb",
"adsb_tb",
"adsb_uart_61_440_000_hertz_tb",
"adsb_uart_tb",
"freq_est_serialiser_tb",
"freq_est_tb",
"freq_est_uart_tb",
"preamble_detector_tb",
"schmitt_trigger_tb",
"uart_tx_enc_tb",
"uart_tx_tb",
]
for name in tb_names:
tb = lib.test_bench(name)
tb.set_sim_option("ghdl.sim_flags", [f"--wave={name}.ghw"])
# PPM Demod. Has different test cases, so need to add their own wave files.
tb = lib.test_bench("ppm_demod_tb")
tests = tb.get_tests()
for tc in tests:
# Obtain a usable testcase name (handle .name or .get_name()).
tc_name = getattr(tc, "name", None) or (tc.get_name() if hasattr(tc, "get_name") else str(tc))
wavefile = str(out_path / f"{tb.name}.{tc_name}.ghw")
tc.set_sim_option("ghdl.sim_flags", [f"--wave={wavefile}"])
# PPM Demod Robust.
tb = lib.test_bench("ppm_demod_robust_tb")
tests = tb.get_tests()
for tc in tests:
# Obtain a usable testcase name (handle .name or .get_name()).
tc_name = getattr(tc, "name", None) or (tc.get_name() if hasattr(tc, "get_name") else str(tc))
wavefile = str(out_path / f"{tb.name}.{tc_name}.ghw")
tc.set_sim_option("ghdl.sim_flags", [f"--wave={wavefile}"])
# Same with this one.
tb = lib.test_bench("adsb_serialiser_tb")
tests = tb.get_tests()
for tc in tests:
tc_name = getattr(tc, "name", None) or (tc.get_name() if hasattr(tc, "get_name") else str(tc))
wavefile = str(out_path / f"{tb.name}.{tc_name}.ghw")
tc.set_sim_option("ghdl.sim_flags", [f"--wave={wavefile}"])
# Run vunit function
vu.main()