• TCL管理Vivado工程


    TCL管理Vivado工程

    工程结构
    [图片]

    [图片]

    1. 项目目录

    [图片]

    • config: 配置文件、coe文件等。
    • doc: 文档
    • fpga: 最后恢复的fpga工程目录
    • ip: ip文件
    • mcs: bit流文件等,方便直接使用
    • src: .v、.vh等源文件
    • tcl: 用来恢复工程的tcl脚本

    2. 导出脚本文件

    通过TCL Console 将目录切换到tcl目录。

    1. 生成新建工程tcl脚本
      在TCL Console执行

      write_project_tcl -use_bd_files {./project.tcl}
      
      • 1
    2. 如果工程有bd文件,生成对应的tcl脚本用于恢复工程。
      ( 需要打开对应的bd文件,不打开会找不到)

      write_bd_tcl -no_ip_version {./bd.tcl}
      
      • 1

      如果有多个bd文件,需要依次打开然后执行上述指令。
      -no_ip_version选项用于去除IP的版本信息,方便工程在高版本vivado中打开的情况。

    3. 生成IP文件脚本

      write_ip_tcl [get_ips ETH_RX_FIFO] {./ip.tcl}
      
      • 1

      这里采用将原工程中ip的xci文件直接拷贝到ip目录中的方式。

    4. 添加仿真文件和约束文件
      将原工程的源文件、仿真文文件、约束文件拷贝到src目录下。
      [图片]

      • vcode中存放源文件
      • xdc中存放约束文件

    3. 修改TCL脚本

    3.1 project.tcl

    1. 修改工程路径
      将
      set origin_dir "."
      修改为
      set origin_dir [ file dirname [ info script ] ]  
      
      • 1
      • 2
      • 3
      • 4
    2. 修改_xil_proj_name_即可更改工程名字
      set _xil_proj_name_ "promanagement"
      
      • 1
    3. 修改恢复后工程的存放路径( 这里希望生成的工程在fpga目录下)
      将
      # Create project
      create_project ${_xil_proj_name_} ./${_xil_proj_name_} -part xc7z020clg484-1
      修改为
      create_project ${_xil_proj_name_} ../fpga/${_xil_proj_name_} -part xc7z020clg484-1
      
      • 1
      • 2
      • 3
      • 4
      • 5
    4. 修改block design相关的配置
      将
      set files [list \
       [file normalize "${origin_dir}/../../promanagement/promanagement.srcs/sources_1/bd/system/system.bd" ]\
       [file normalize "${origin_dir}/../../promanagement/promanagement.srcs/sources_1/bd/system/hdl/system_wrapper.v" ]\
       [file normalize "${origin_dir}/../../promanagement/promanagement.srcs/sources_1/new/top.v" ]\
      ]
      set imported_files [import_files -fileset sources_1 $files]
      
      # Set 'sources_1' fileset file properties for remote files
      # None
      
      # Set 'sources_1' fileset file properties for local files
      set file "system/system.bd"
      set file_obj [get_files -of_objects [get_filesets sources_1] [list "*$file"]]
      set_property -name "registered_with_manager" -value "1" -objects $file_obj
      修改为
      # Create block design
      source $origin_dir/bd.tcl
      
      # Generate the wrapper
      set design_name [get_bd_designs]
      make_wrapper -files [get_files $design_name.bd] -top -import
      set files [list \
          [file normalize "${origin_dir}/../src/vcode/top.v" ]\
      ]
      set imported_files [import_files -fileset sources_1 $files]
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
      • 16
      • 17
      • 18
      • 19
      • 20
      • 21
      • 22
      • 23
      • 24
      • 25
      • 26
    5. 修改v文件配置
      在上一步的修改内容中实际上已经进行了配置
    6. 修改ip文件配置
      将
      set files [list \
       [file normalize "${origin_dir}/../../promanagement/promanagement.srcs/sources_1/ip/clk_wiz_0/clk_wiz_0.xci" ]\
      ]
      修改为
      set files [list \
       [file normalize "${origin_dir}/../ip/clk_wiz_0/clk_wiz_0.xci" ] \
      ]
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
    7. 修改约束文件配置
      将
      set file "new/top.xdc"
      set file_obj [get_files -of_objects [get_filesets constrs_1] [list "*$file"]]
      set file "[file normalize "$origin_dir/../../promanagement/promanagement.srcs/constrs_1/new/top.xdc"]"
      修改为
      set file "xdc/top.xdc"
      set file_obj [get_files -of_objects [get_filesets constrs_1] [list "*$file"]]
      set file "[file normalize "$origin_dir/../src/xdc/top.xdc"]"
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8

    3.2 bd.tcl

    将
    set list_projs [get_projects -quiet]
    if { $list_projs eq "" } {
       create_project project_1 myproj -part xc7z020clg484-1
    }
    注释掉
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    4. 工程恢复

    source project.tcl
    
    • 1
  • 相关阅读:
    数据结构之【堆】(Heap)
    有含金量的AI证书
    安全性归约(一些反例)
    视频监控/安防监控/AI视频分析/边缘计算EasyCVR平台如何调取登录接口获取token?
    JAVA毕业设计教师教学质量评估系统计算机源码+lw文档+系统+调试部署+数据库
    教你如何正确运营小红书账号,纯干货!
    车牌识别C#项目源代码
    主流网络协议
    python——列表(数组)
    【李宏毅机器学习】Domain Adaptation 域适应
  • 原文地址:https://blog.csdn.net/first_bug/article/details/136795688