Search code examples
vhdlmodelsimvunit

How to add compile option for ModelSim using VUnit?


Using ModelSim and VUnit I try to compile some UVVM, but this gives some warnings like:

** Warning: C:\work\Qtec\SVN_sim\Design\uvvm\uvvm_util\src\methods_pkg.vhd(1159): (vcom-1346) Default expression of interface object is not globally static.

So I would like to suppress these warnings, so I tried updating the VUnit "run.py" file with add_compile_option based on VUnit Python Interface:

uvvm_util = prj.add_library('uvvm_util')
uvvm_util.add_source_files(join(root, '../../uvvm/uvvm_util/src/*.vhd'))
uvvm_util.add_compile_option('modelsim.vcom_flags', ['-suppress 1346'])

But when compiling, I then get the error:

Compiling ....\uvvm\uvvm_util\src\types_pkg.vhd into uvvm_util ...

** Error (suppressible): (vcom-1902) Option "-suppress 1346" is either unknown, requires an argument, or was given with a bad argument.


Solution

  • You could edit the suppress entry in the modelsim.ini file. source

    It could be a python/TCL error with spaces. See this link. So the space between -suppress and 1346 is not properly forwarded.

    The VUnit ui.py shows

    modelsim.vcom_flags Extra arguments passed to ModelSim vcom command. Must be a list of strings.

    I cannot test it, but this case the line should possibly be:

    uvvm_util.add_compile_option('modelsim.vcom_flags', ['-suppress', '1346'])
    

    edit: after some reading... To me the difference between add_compile_option and set_compile_option is not clear. Maybe you could try the other?