本仿真学习基于工程,个人学习记录使用,附上虚拟环境安装配置全流程
FFT/README.md at main · Jefferson-Lopes/FFT (github.com)
第一步下载安装软件
VMware | VMware 17 下载安装及永久激活使用教程 - 嘿笨笨熊 - 博客园 (cnblogs.com) |
Ubuntu | (这里如果磁盘空间允许最好选择大一些,最开始选了50G,结果后续的quartus占用空间太大无法安装,需要扩容,见磁盘扩容) |
modelsim | Installing ModelSim on Ubuntu (github.com) |
quartus | Quartus||在Ubuntu内安装Quartus Prime Lite版20.1_ubuntu安装quartus-CSDN博客 |
vscode | Documentation for Visual Studio Code |
第二步运行fpga工程进行全编译
在虚拟机当中打开quartus
这里(只下载了源工程而没有经过quartus编译)后续仿真不会进行
因为后续仿真基于 FFT_run_msim_rtl_verilog.do 文件 ,该文件如下
若未经过编译,路径出错,无法进入modelsim仿真
下面为仿真调用modelsim的关键代码
#!/bin/bash
vsim_exec=$1
#OBS: you need to add vsim to your PATH
#change to the executable file directory
cd R22SDF/simulation/modelsim
if [ $# -eq 0 ]; then #if there are no parameters
#command summary: run the simulation and then quit
#-c: run vsim without GUI
#-nostdout: reduce the output
#-do: run the following instruction direct into vsim
#"do .do ; quit -f": run the .do file and then force quit
vsim -c -nostdout -do "do FFT_run_msim_rtl_verilog.do ; quit -f"
else
vsim -c -nostdout -do "do ${vsim_exec} ; quit -f"
fi
第三步添加modelsim路径,修改文件权限
这里的nano类似gedit、vim,也可以换为 gedit ~/.bashrc
[bash 在每次启动时都会加载 .bashrc
文件的内容。每个用户的 home 目录都有这个 shell 脚本。它用来存储并加载你的终端配置和环境变量,是home下的隐藏文件]
第四步配置python环境(此处直接在vscode进行配置,未安装anaconda)
安装指定版本python:ubuntu系统: ubuntu22.04安装python,并设置系统环境变量_ubuntu22.04 python-CSDN博客
安装默认版本:ubuntu下vs code的python虚拟环境的配置 - 千年寒冰火 - 博客园 (cnblogs.com)
source ~/python/fpga/bin/activate
~/python/fpga/bin为虚拟环境所在位置,在终端输入上述语句激活之后可以使用pip安装第三方库
第五步在vscode中运行main.py文件
磁盘扩容
Ubuntu22.04 Linux磁盘扩容/硬盘扩展全过程(包括踩坑过程)_ubantu2204怎么扩容-CSDN博客
首先关闭虚拟机,点击虚拟机设置,填入合适大小的内存容量
然后按照上述教程,最后要通过 df -h 检查主盘是否扩容成功