如何使用 VUnit 为 ModelSim 添加编译选项?

How to add compile option for ModelSim using VUnit?

使用 ModelSim 和 VUnit I try to compile some UVVM,但这会给出一些警告,例如:

** 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.

所以我想抑制这些警告,所以我尝试根据 VUnit Python Interface:

使用 add_compile_option 更新 VUnit“run.py”文件
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'])

但是在编译的时候,我得到了错误:

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.

您可以编辑 modelsim.ini 文件中的 suppress 条目。 source

可能是 python/TCL 错误 space。 See this link。 所以-suppress1346之间的space没有正确转发

VUnit ui.py 显示

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

我无法测试它,但在这种情况下,该行可能是:

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

编辑:经过一些阅读...对我来说 add_compile_optionset_compile_option 之间的区别不清楚。也许你可以试试另一个?