当前位置:首页 > Python > 正文内容

(原创)使用Python提取XISE工程的RTL代码

chanra1n12个月前 (05-21)Python2826

在工程文件夹下运行Python程序即可

#Author       : /
#Description  : 从Vivado的项目文件夹中提取rtl文件,用于LEDA调试
#Time         : 20220805
#Verision     : 0.1
#CopyRights   : myfpga.cn All Right Reservers. 

import os
import shutil
import xml.etree.ElementTree as ET
for temp_file in os.listdir():
    if temp_file.endswith(".xise") :
        prj_name_temp = os.path.splitext(temp_file)
        prj_name = prj_name_temp[0]
        os.mkdir(prj_name+'_rtl')
        tree = ET.ElementTree(file=temp_file)
        root = tree.getroot()
        for elem in tree.iter(tag='file'):
            file_path = elem.attrib['xil_pn:name']
            #file_path = file_path.replace('$PSRCDIR','./'+prj_name+'.srcs')
            if(file_path.endswith(".v") or file_path.endswith(".vh") or file_path.endswith(".vhd") or file_path.endswith(".vhdl") or file_path.endswith(".sv")
            or file_path.endswith(".V") or file_path.endswith(".VH") or file_path.endswith(".VHD") or file_path.endswith(".VHDL") or file_path.endswith(".SV")):
                #print(file_path)
                try:
                    shutil.copyfile(file_path,prj_name+'_rtl/'+os.path.basename(file_path))
                except:
                    print('ERROR:'+prj_name+'_rtl/'+os.path.basename(file_path))


扫描二维码推送至手机访问。

版权声明:本文由我的FPGA发布,如需转载请注明出处。

本文链接:https://myfpga.cn/index.php/post/310.html

分享给朋友:

“(原创)使用Python提取XISE工程的RTL代码” 的相关文章

顺序查找

顺序查找

如果需要查找某个特定值的位置(以便能够替换或删除它),可以直接使用index方法。searchedValue=100 #values是之前定义好的一个列表 if searchedValue in walues:     pos=values.index(searchedValue)     ...

(原创)使用Python对任意网站图片进行爬取,仅用于学习

(原创)使用Python对任意网站图片进行爬取,仅用于学习

import os import time import argparse import requests import re import io from urllib.parse import ...

(原创)使用Python提取ISE工程的RTL代码

(原创)使用Python提取ISE工程的RTL代码

在工程文件夹下运行Python程序即可 #Author       : / #Description  : 从ISE的项目文件夹中提取rtl文件,用于LEDA调试 #Time ...

(原创)使用Python将Leda编码规则检查报告转换为Excel形式

(原创)使用Python将Leda编码规则检查报告转换为Excel形式

#Author       : / #Description  : A tools for leda to analysis r...

(原创)使用FFmpeg截取多个视频中的图片,创建训练集

(原创)使用FFmpeg截取多个视频中的图片,创建训练集

代码使用 Python 中的 subprocess 模块和 FFmpeg、FFprobe 工具来从视频文件中截取多个截图,并使用 PIL 库来检查截图文件是否损坏,如果损坏了就不保存该文件。下面是代码的具体流程:首先读取配置文件或命令行参数来指定截图数量、截图大小、截图时间间隔和截图质量等...