使用 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的模板文件)
使用 Python 自动生成 Verilog 例化模板的工具

使用示例:

  1. 将待例化的Verilog文件,如frame_gen_k7.v文件,拷贝到genHdlInst.run.py同一个文件夹下,使用文本编辑器打开genHdlInst.run.py,修改147行的 sourcefile 文件名为 frame_gen_k7.v ,保存。
  2. 选择genHdlInst.run.py打开方式为python.exe(需要首先安装了python环境),双击genHdlInst.run.py文件即可执行,运行结果生成inst_frame_gen_k7.v文件,此文件即为例化模板文件。
    使用 Python 自动生成 Verilog 例化模板的工具

方案二:test_gen.py

test_gen.py文件(调用了module_gen_def.py),同样可以直接双击运行(需要python2.7python3.0环境),生成inst_example.v文件,这个文件就是例化模板文件,生成的模板可能会有点小缺陷,发现缺陷后直接修改就可以了。
使用 Python 自动生成 Verilog 例化模板的工具

使用示例:

  1. 将待例化的Verilog文件,如tx_pack.v文件,拷贝到test_gen.py同一个文件夹下,使用文本编辑器打开test_gen.py,修改15行的文件名为 tx_pack.v ,保存。
  2. 选择test_gen.py打开方式为python.exe(需要首先安装了python环境),双击test_gen.py文件即可执行,运行结果生成inst_test_gen.v文件,此文件即为例化模板文件。
    使用 Python 自动生成 Verilog 例化模板的工具

方案三(网上搜索得到):FpgaTool

Description:
  This gui/script is used to generate verilog instance. There are two methods you can use.

Method1(需要QT环境): Use the gui. Demo

  1. Run FpgaTool.py. You can run “python FpgaTool.py” on the command line.
  2. Open a verilog file
  3. Click button “View HDL Inst”使用 Python 自动生成 Verilog 例化模板的工具

Method2: Use script directly. Demo

  1. Run genHdlInst.py. You can run “python genHdlInst.py top.v” on the command line.
  2. It will generate its instance file named “inst_top.v”
    使用 Python 自动生成 Verilog 例化模板的工具