diff --git a/examples/vhdl/array_axis_vcs/run.py b/examples/vhdl/array_axis_vcs/run.py index 94518d59b..f3d67ee98 100644 --- a/examples/vhdl/array_axis_vcs/run.py +++ b/examples/vhdl/array_axis_vcs/run.py @@ -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() diff --git a/examples/vhdl/array_axis_vcs/src/test/stubs.c b/examples/vhdl/array_axis_vcs/src/test/stubs.c new file mode 100644 index 000000000..af5fbb066 --- /dev/null +++ b/examples/vhdl/array_axis_vcs/src/test/stubs.c @@ -0,0 +1,13 @@ +#include + +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; +} \ No newline at end of file