Skip to content

Commit 72c8f2c

Browse files
committed
fix(examples/vhdl/array_axis_vcs): add stubs.c
1 parent 88b43d4 commit 72c8f2c

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

examples/vhdl/array_axis_vcs/run.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@
2222

2323
# vu.set_sim_option('modelsim.init_files.after_load',['runall_addwave.do'])
2424

25+
c_nobj = join(root, 'src', 'test', 'stubs.o')
2526
c_obj = join(root, 'src', 'test', 'main.o')
27+
print(os.popen('gcc -fPIC -rdynamic -c '+join(root, 'src/**/stubs.c')+' -o '+c_nobj).read())
2628
print(os.popen('gcc -fPIC -rdynamic -c '+join(root, 'src/**/main.c')+' -o '+c_obj).read())
2729

30+
for tb in lib.get_test_benches(pattern='*tb_py_*', allow_empty=False):
31+
tb.set_sim_option('ghdl.elab_flags', ["-Wl," + c_nobj], overwrite=False)
32+
2833
for tb in lib.get_test_benches(pattern='*tb_c_*', allow_empty=False):
29-
tb.set_sim_options.get('ghdl.elab_flags', ["-Wl," + " ".join([c_obj])], overwrite=False)
34+
tb.set_sim_option('ghdl.elab_flags', ["-Wl," + c_obj], overwrite=False)
3035

3136
vu.main()
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include <stdio.h>
2+
3+
extern int ghdl_main (int argc, char **argv);
4+
5+
// main is the entrypoint to the application.
6+
int main(int argc, char **argv) {
7+
8+
printf("This is an example of how to wrap a GHDL + VUnit simulation in a C application.\n");
9+
10+
ghdl_main(argc, argv);
11+
12+
return 0;
13+
}

0 commit comments

Comments
 (0)