File tree Expand file tree Collapse file tree
examples/vhdl/array_axis_vcs Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222
2323# vu.set_sim_option('modelsim.init_files.after_load',['runall_addwave.do'])
2424
25+ c_nobj = join (root , 'src' , 'test' , 'stubs.o' )
2526c_obj = join (root , 'src' , 'test' , 'main.o' )
27+ print (os .popen ('gcc -fPIC -rdynamic -c ' + join (root , 'src/**/stubs.c' )+ ' -o ' + c_nobj ).read ())
2628print (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+
2833for 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
3136vu .main ()
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments