**** Generating the ModelSim .do script ****
时间: 2024-05-25 13:08:52 浏览: 212
在使用 ModelSim 进行仿真时,我们需要编写一个 .do 脚本来设置仿真参数、加载需要仿真的模块、运行仿真等。这个 .do 脚本可以手动编写,也可以使用 Quartus Prime 提供的脚本生成工具来自动生成。
生成 .do 脚本的步骤如下:
1. 打开 Quartus Prime,进入该工程的项目文件夹。
2. 在菜单栏中选择 Tools -> Run Simulation Tool -> RTL Simulation。
3. 在弹出的对话框中选择 ModelSim,并勾选 Generate the ModelSim .do script 选项。
4. 点击 OK,等待工具生成 .do 脚本。
5. 生成的 .do 脚本会保存在项目文件夹的 simulation 文件夹中,文件名为 vsim.do。
在生成的 .do 脚本中,我们可以修改仿真参数、添加需要仿真的模块等。修改完成后,我们可以在 ModelSim 中加载该 .do 脚本并运行仿真。
相关问题
Using: C:\intelFPGA\20.1\modelsim_ase\win32aloem To specify a ModelSim executable directory, select: Tools -> Options -> EDA Tool Options Note: if both ModelSim-Altera and ModelSim executables are available, ModelSim-Altera will be used. **** Generating the ModelSim Testbench **** quartus_eda --gen_testbench --tool=modelsim_oem --format=vhdl --write_settings_files=off alu -c alu --vector_source="C:/Users/18145/Downloads/alu181/alu181/alu1/Waveform2.vwf" --testbench_file="C:/Users/18145/Downloads/alu181/alu181/alu1/simulation/qsim/Waveform2.vwf.vht" Info: ******************************************************************* Info: Running Quartus Prime EDA Netlist Writer Info: Version 20.1.1 Build 720 11/11/2020 SJ Lite Edition Info: Copyright (C) 2020 Intel Corporation. All rights reserved. Info: Your use of Intel Corporation's design tools, logic functions Info: and other software and tools, and any partner logic Info: functions, and any output files from any of the foregoing Info: (including device programming or simulation files), and any Info: associated documentation or information are expressly subject Info: to the terms and conditions of the Intel Program License Info: Subscription Agreement, the Intel Quartus Prime License Agreement, Info: the Intel FPGA IP License Agreement, or other applicable license Info: agreement, including, without limitation, that your use is for Info: the sole purpose of programming logic devices manufactured by Info: Intel and sold by Intel or its authorized distributors. Please Info: refer to the applicable agreement for further details, at Info: https://fpgasoftware.intel.com/eula. Info: Processing started: Tue May 20 11:58:19 2025 Info: Command: quartus_eda --gen_testbench --tool=modelsim_oem --format=vhdl --write_settings_files=off alu -c alu --vector_source=C:/Users/18145/Downloads/alu181/alu181/alu1/Waveform2.vwf --testbench_file=C:/Users/18145/Downloads/alu181/alu181/alu1/simulation/qsim/Waveform2.vwf.vht Warning (18236): Number of processors has not been specified which may cause overloading on shared machines. Set the global assignment NUM_PARALLEL_PROCESSORS in your QSF to an appropriate value for best performance. Completed successfully. **** Generating the functional simulation netlist **** quartus_eda --write_settings_files=off --simulation --functional=on --flatten_buses=off --tool=modelsim_oem --format=vhdl --output_directory="C:/Users/18145/Downloads/alu181/alu181/alu1/simulation/qsim/" alu -c alu Info: ******************************************************************* Info: Running Quartus Prime EDA Netlist Writer Info: Version 20.1.1 Build 720 11/11/2020 SJ Lite Edition Info: Copyright (C) 2020 Intel Corporation. All rights reserved. Info: Your use of Intel Corporation's design tools, logic functions Info: and other software and tools, and any partner logic Info: functions, and any output files from any of the foregoing Info: (including device programming or simulation files), and any Info: associated documentation or information are expressly subject Info: to the terms and conditions of the Intel Program License Info: Subscription Agreement, the Intel Quartus Prime License Agreement, Info: the Intel FPGA IP License Agreement, or other applicable license Info: agreement, including, without limitation, that your use is for Info: the sole purpose of programming logic devices manufactured by Info: Intel and sold by Intel or its authorized distributors. Please Info: refer to the applicable agreement for further details, at Info: https://fpgasoftware.intel.com/eula. Info: Processing started: Tue May 20 11:58:21 2025 Info: Command: quartus_eda --write_settings_files=off --simulation=on --functional=on --flatten_buses=off --tool=modelsim_oem --format=vhdl --output_directory=C:/Users/18145/Downloads/alu181/alu181/alu1/simulation/qsim/ alu -c alu Warning (18236): Number of processors has not been specified which may cause overloading on shared machines. Set the global assignment NUM_PARALLEL_PROCESSORS in your QSF to an appropriate value for best performance. Info (204019): Generated file alu.vho in folder "C:/Users/18145/Downloads/alu181/alu181/alu1/simulation/qsim//" for EDA simulation tool Info: Quartus Prime EDA Netlist Writer was successful. 0 errors, 1 warning Info: Peak virtual memory: 4641 megabytes Info: Processing ended: Tue May 20 11:58:22 2025 Info: Elapsed time: 00:00:01 Info: Total CPU time (on all processors): 00:00:01 Completed successfully. **** Generating the ModelSim .do script **** C:/Users/18145/Downloads/alu181/alu181/alu1/simulation/qsim/alu.do generated. Completed successfully. **** Running the ModelSim simulation **** C:/intelFPGA/20.1/modelsim_ase/win32aloem/vsim -c -do alu.do ** Error: vsim: CreateProcess error: 2 Error.
### 关于 'vsim: CreateProcess error: 2' 错误的解决方案
当在使用 ModelSim 和 Quartus 进行联合仿真时,出现 `CreateProcess error: 2` 的错误通常表明系统无法找到指定的可执行文件或其依赖项。以下是可能的原因及其对应的解决方法:
#### 可能原因及解决措施
1. **环境变量未配置正确**
如果系统的 PATH 环境变量中缺少 ModelSim 或 Quartus 安装路径,则可能导致此错误。需要确保以下路径被正确添加到系统的 PATH 中:
- ModelSim 的安装路径(例如:`C:\modeltech_10.2c\win64`)
- Quartus 的二进制工具路径(例如:`C:\intelFPGA\19.1/quartus/bin`)
配置完成后需重新启动终端或 IDE 以使更改生效[^2]。
2. **ModelSim 版本不匹配**
使用的 ModelSim 版本与 Quartus 软件版本可能存在兼容性问题。建议检查两者是否来自同一厂商并保持一致的版本号。例如,Intel FPGA 设计套件推荐搭配特定版本的 ModelSim-Altera 工具链来实现最佳兼容效果[^1]。
3. **项目设置中的路径错误**
在 Quartus II 的 EDA Tool Settings 下,确认 Simulation -> Functional/Timing Simulator 字段指向了正确的 ModelSim 执行程序位置。如果此处填写的内容有误也可能引发类似的找不到进程异常情况。
4. **权限不足**
尝试以管理员身份运行命令提示符窗口后再发起仿真实验;有时操作系统级别的安全策略会阻止某些操作除非获得更高层次授权许可。
5. **其他潜在因素**
包括但不限于硬盘空间耗尽、临时文件夹损坏等问题都可能会间接影响到外部应用程序调用过程顺利与否。因此定期清理磁盘垃圾以及修复注册表等相关维护动作也是必要的预防手段之一。
```bash
# 示例:验证当前环境变量是否包含必要路径
echo %PATH%
```
以上就是针对 `vsim: CreateProcess error: 2` 常见几种排查方向及相关处理意见汇总介绍完毕之后下面给出几个进一步探讨方面供参考学习之用:
Determining the location of the ModelSim executable... Using: E:\intelFPGA\18.1\modelsim_ase\win32aloem To specify a ModelSim executable directory, select: Tools -> Options -> EDA Tool Options Note: if both ModelSim-Altera and ModelSim executables are available, ModelSim-Altera will be used. **** Generating the ModelSim Testbench **** quartus_eda --gen_testbench --tool=modelsim_oem --format=verilog --write_settings_files=off 1 -c 1 --vector_source="E:/intelFPGA/WORK/Waveform.vwf" --testbench_file="E:/intelFPGA/WORK/simulation/qsim/Waveform.vwf.vt" Info: ******************************************************************* Info: Running Quartus Prime EDA Netlist Writer Info: Version 18.1.0 Build 625 09/12/2018 SJ Standard Edition Info: Copyright (C) 2018 Intel Corporation. All rights reserved. Info: Your use of Intel Corporation's design tools, logic functions Info: and other software and tools, and its AMPP partner logic Info: functions, and any output files from any of the foregoing Info: (including device programming or simulation files), and any Info: associated documentation or information are expressly subject Info: to the terms and conditions of the Intel Program License Info: Subscription Agreement, the Intel Quartus Prime License Agreement, Info: the Intel FPGA IP License Agreement, or other applicable license Info: agreement, including, without limitation, that your use is for Info: the sole purpose of programming logic devices manufactured by Info: Intel and sold by Intel or its authorized distributors. Please Info: refer to the applicable agreement for further details. Info: Processing started: Thu May 22 00:35:13 2025 Info: Command: quartus_eda --gen_testbench --tool=modelsim_oem --format=verilog --write_settings_files=off 1 -c 1 --vector_source=E:/intelFPGA/WORK/Waveform.vwf --testbench_file=E:/intelFPGA/WORK/simulation/qsim/Waveform.vwf.vt Warning (18236): Number of processors has not been specified which may cause overloading on shared machines. Set the global assignment NUM_PARALLEL_PROCESSORS in your QSF to an appropriate value for best performance. Completed successfully. Completed successfully. **** Generating the functional simulation netlist **** quartus_eda --write_settings_files=off --simulation --functional=on --flatten_buses=off --tool=modelsim_oem --format=verilog --output_directory="E:/intelFPGA/WORK/simulation/qsim/" 1 -c 1 Info: ******************************************************************* Info: Running Quartus Prime EDA Netlist Writer Info: Version 18.1.0 Build 625 09/12/2018 SJ Standard Edition Info: Copyright (C) 2018 Intel Corporation. All rights reserved. Info: Your use of Intel Corporation's design tools, logic functions Info: and other software and tools, and its AMPP partner logic Info: functions, and any output files from any of the foregoing Info: (including device programming or simulation files), and any Info: associated documentation or information are expressly subject Info: to the terms and conditions of the Intel Program License Info: Subscription Agreement, the Intel Quartus Prime License Agreement, Info: the Intel FPGA IP License Agreement, or other applicable license Info: agreement, including, without limitation, that your use is for Info: the sole purpose of programming logic devices manufactured by Info: Intel and sold by Intel or its authorized distributors. Please Info: refer to the applicable agreement for further details. Info: Processing started: Thu May 22 00:35:14 2025 Info: Command: quartus_eda --write_settings_files=off --simulation=on --functional=on --flatten_buses=off --tool=modelsim_oem --format=verilog --output_directory=E:/intelFPGA/WORK/simulation/qsim/ 1 -c 1 Warning (18236): Number of processors has not been specified which may cause overloading on shared machines. Set the global assignment NUM_PARALLEL_PROCESSORS in your QSF to an appropriate value for best performance. Info (204019): Generated file 1.vo in folder "E:/intelFPGA/WORK/simulation/qsim//" for EDA simulation tool Info: Quartus Prime EDA Netlist Writer was successful. 0 errors, 1 warning Info: Peak virtual memory: 4725 megabytes Info: Processing ended: Thu May 22 00:35:15 2025 Info: Elapsed time: 00:00:01 Info: Total CPU time (on all processors): 00:00:01 Completed successfully. **** Generating the ModelSim .do script **** E:/intelFPGA/WORK/simulation/qsim/1.do generated. Completed successfully. **** Running the ModelSim simulation **** E:/intelFPGA/18.1/modelsim_ase/win32aloem/vsim -c -do 1.do Reading E:/intelFPGA/18.1/modelsim_ase/tcl/vsim/pref.tcl # 10.5b # do 1.do # ** Warning: (vlib-34) Library already exists at "work". # couldn't execute "E:\intelFPGA\18.1\modelsim_ase\win32aloem\vlog": invalid argument # couldn't execute "E:\intelFPGA\18.1\modelsim_ase\win32aloem\vlog": invalid argument # vsim -novopt -c -t 1ps -L cyclonev_ver -L altera_ver -L altera_mf_ver -L 220model_ver -L sgate_ver -L altera_lnsim_ver work.1_vlg_vec_tst # Start time: 00:35:15 on May 22,2025 # ** Error: (vsim-3170) Could not find 'work.1_vlg_vec_tst'. # Searched libraries: # E:/intelFPGA/18.1/modelsim_ase/altera/verilog/cyclonev # E:/intelFPGA/18.1/modelsim_ase/altera/verilog/altera # E:/intelFPGA/18.1/modelsim_ase/altera/verilog/altera_mf # E:/intelFPGA/18.1/modelsim_ase/altera/verilog/220model # E:/intelFPGA/18.1/modelsim_ase/altera/verilog/sgate # E:/intelFPGA/18.1/modelsim_ase/altera/verilog/altera_lnsim # E:/intelFPGA/WORK/simulation/qsim/work # Error loading design Error loading design # End time: 00:35:16 on May 22,2025, Elapsed time: 0:00:01 # Errors: 1, Warnings: 0 Error.
### 错误原因分析
在使用 ModelSim 进行仿真时遇到 `'invalid argument'` 和 `'Could not find work.1_vlg_vec_tst'` 错误,这通常是由于以下几个方面的原因造成的:
#### 1. **编译失败或未成功加载设计文件**
如果 Quartus Prime 中的 EDA Netlist Writer 工具未能正确生成网表文件(`.v` 或 `.vo`),或者这些文件未被成功导入到 ModelSim 中,则可能导致 `work.<design_name>` 库中的对象无法找到。此问题也可能源于编译阶段存在语法错误或其他警告信息而未注意到[^3]。
```bash
# 检查是否有任何编译错误
transcript on
vlog -reportprogress 300 -work work {path_to_your_design_files/*.v}
if {"ERROR" == [catch {vsim -novopt work.top_module} errormsg]} {
puts $errormsg
}
```
---
#### 2. **库映射不一致**
ModelSim 使用的工作库 (`work`) 必须与实际仿真的顶层模块名称相匹配。如果顶层模块名发生变化但未同步更新测试平台 (Testbench),就会触发此类错误。此外,在启动仿真之前需要确认已正确定义了目标库及其对应的路径[^4]。
```tcl
# 设置默认工作目录并重新构建 library
set work_dir "./simulation/work"
file delete -force -- $work_dir
vlib $work_dir
vmap work $work_dir
```
---
#### 3. **测试平台缺失或损坏**
错误消息提到的 `_vlg_vec_tst` 表明这是一个由 Quartus 自动生成的向量波形测试文件。假如该文件丢失、损坏或是命名发生了改变却未及时告知工具链,则同样会引起上述异常状况发生[^5]。
---
### 解决方案建议
针对以上可能成因,可采取如下措施逐一排查解决问题:
1. **验证 Quartus 输出完整性**
确保 Quartus Prime 的 Simulation Settings 下启用了正确的 EDA Tool Options,并且指定的目标仿真器为 ModelSim-Altera 组合模式。之后再次运行全增量综合操作以刷新所有关联资源[^6]。
2. **清理重建工程结构**
删除旧有的临时数据缓存以及中间产物后再尝试重新建立整个项目体系。具体步骤包括但不限于清除既有 libraries 文件夹内容再调用相应初始化指令完成新环境部署[^7]。
3. **修正 Testbench 定义偏差**
手动编辑或通过 GUI 方式重新创建适配当前设计方案的新版 testbench script,特别注意保持其内部引用实体标签同实际 RTL 描述部分完全吻合[^8]。
---
###
阅读全文
相关推荐












