Skip to content

Commit

Permalink
fix(examples/vhdl/array_axis_vcs): add stubs.c
Browse files Browse the repository at this point in the history
  • Loading branch information
umarcor committed Jun 4, 2019
1 parent 88b43d4 commit 72c8f2c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
7 changes: 6 additions & 1 deletion examples/vhdl/array_axis_vcs/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@

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

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

for tb in lib.get_test_benches(pattern='*tb_py_*', allow_empty=False):
tb.set_sim_option('ghdl.elab_flags', ["-Wl," + c_nobj], overwrite=False)

for tb in lib.get_test_benches(pattern='*tb_c_*', allow_empty=False):
tb.set_sim_options.get('ghdl.elab_flags', ["-Wl," + " ".join([c_obj])], overwrite=False)
tb.set_sim_option('ghdl.elab_flags', ["-Wl," + c_obj], overwrite=False)

vu.main()
13 changes: 13 additions & 0 deletions examples/vhdl/array_axis_vcs/src/test/stubs.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <stdio.h>

extern int ghdl_main (int argc, char **argv);

// main is the entrypoint to the application.
int main(int argc, char **argv) {

printf("This is an example of how to wrap a GHDL + VUnit simulation in a C application.\n");

ghdl_main(argc, argv);

return 0;
}

0 comments on commit 72c8f2c

Please sign in to comment.