使用 Python 自动生成 Verilog 例化模板的工具
使用Python
自动生成Verilog
例化模板的工具
方案一(推荐):genHdlInst.run.py
genHdlInst.run.py
文件,在安装了python环境之后(需要python2.7
环境,似乎 python3.0
环境也可以,只要修改部分过时的语法就好了)可以直接双击运行,生成inst_top.v
文件,生成的此模版基本没有问题;
(genHdlInst.py
需要在Windows 命令行
终端中使用,命令为:python genHdlInst.py example.v
;会生成inst_example.v
的模板文件)
使用示例:
- 将待例化的Verilog文件,如
frame_gen_k7.v
文件,拷贝到genHdlInst.run.py
同一个文件夹下,使用文本编辑器打开genHdlInst.run.py
,修改147
行的 sourcefile 文件名为 frame_gen_k7.v ,保存。 - 选择
genHdlInst.run.py
打开方式为python.exe
(需要首先安装了python环境),双击genHdlInst.run.py
文件即可执行,运行结果生成inst_frame_gen_k7.v
文件,此文件即为例化模板文件。
方案二:test_gen.py
test_gen.py
文件(调用了module_gen_def.py
),同样可以直接双击运行(需要python2.7
或 python3.0
环境),生成inst_example.v
文件,这个文件就是例化模板文件,生成的模板可能会有点小缺陷,发现缺陷后直接修改就可以了。
使用示例:
- 将待例化的Verilog文件,如
tx_pack.v
文件,拷贝到test_gen.py
同一个文件夹下,使用文本编辑器打开test_gen.py
,修改15
行的文件名为 tx_pack.v ,保存。 - 选择
test_gen.py
打开方式为python.exe
(需要首先安装了python环境),双击test_gen.py
文件即可执行,运行结果生成inst_test_gen.v
文件,此文件即为例化模板文件。
方案三(网上搜索得到):FpgaTool
Description:
This gui/script is used to generate verilog instance. There are two methods you can use.
Method1(需要QT环境): Use the gui. Demo
- Run FpgaTool.py. You can run “python FpgaTool.py” on the command line.
- Open a verilog file
- Click button “View HDL Inst”
Method2: Use script directly. Demo
- Run genHdlInst.py. You can run “python genHdlInst.py top.v” on the command line.
- It will generate its instance file named “inst_top.v”