Quartus II 仅在仿真中使用文件

Quartus II use file only in simulation

我想 运行 在 Quartus 中进行仿真。所以我在 Assignment 菜单中分配了一个 Testbench。我的测试台包括我的 DUT(D) 和一个额外的组件 (E),它仅用于模拟(因此该组件包括不可合成的语句)。我的模拟 运行s 如果我从我的 Testbench 中删除 E,但是当我想在我的 Testbench 中包含 E 时,我从 modelsim 中得到错误:

 my_testbench.vhd(197): (vcom-1195) cannot find expanded name "mylib.only_for_simulation".

如何让Quartus/Modelsim编译E文件?

当您开始仿真时,Quartus 分析项目设置中指定的所有 文件(可通过菜单分配 -> 设置 -> 文件访问)。但是,它 从 top-level 实体开始的 DUT 所需的实体(请参阅菜单分配 -> 设置 -> 常规)。 比如我的测试工程中top指定了DUT的实体,而my_testbenchonly_for_simulation只是仿真需要的。这是启动仿真后 Quartus 在消息 window 中的输出:

Info (12021): Found 2 design units, including 1 entities, in source file my_testbench.vhdl

Info (12021): Found 2 design units, including 1 entities, in source file top.vhdl

Info (12021): Found 2 design units, including 1 entities, in source file only_for_simulation.vhdl

Info (12127): Elaborating entity "top" for the top level hierarchy

只有存储在精化期间找到的实体的文件会自动添加到脚本中以启动 ModelSim 模拟器。因此,my_testbenchonly_for_simulation 是否被列为项目文件并不重要。进一步的模拟文件必须 alwaystest-bench setup 中指定,可通过菜单 Assignment -> Settings -> Simulation -> Compile test bench 访问-> 测试台 -> New/Edit。在那里,您必须列出存储 my_testbenchonly_for_simulation 的文件。而且你必须按照 正确的编译顺序 列出它们,即 only_for_simulationmy_testbench 之前。在此对话框中,您还可以通过属性将 only_for_simulation 的库设置为 mylib。这是我的 test-bench 设置的屏幕截图。

生成的ModelSim脚本保存在sub-directorysimulation/modelsim文件中,扩展名为.do。它列出了所有要由 ModelSim 编译的文件。 ModelSim 仅按给定顺序编译它们。