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

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

chanra1n2年前 (2023-05-21)Python3819

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

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

import os
import shutil
for temp_file in os.listdir():
    if temp_file.endswith(".prj") :
        prj_name_temp = os.path.splitext(temp_file)
        prj_name = prj_name_temp[0]
        os.mkdir(prj_name+'_rtl')
        print('********************************'+prj_name+'********************************')
        f = open(temp_file,'r')
        for line in f.readlines():
            line = line.split('"')
            try:
                shutil.copyfile(line[1],prj_name+'_rtl/'+os.path.basename(line[1]))
            except:
                print('Error:line[1]')
        f.close()


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

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

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

分享给朋友:

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

2.Python中的基本运算

2.Python中的基本运算

我们打开Python,请你尝试输入如下算式并尝试理解有什么为什么是这样的?1+1 1+1.0 1-2 2-3.5 1*1 1*1.1 1/2 2/1 2/3 3/2 3//2 3/1.0 5/2.5我们不难得到如下结果2 2.0 -1 -1.5 1 1.1 0.5...

math库的使用

math库的使用

math库包括4个数学常数math.pi      圆周率math.e       自然对数math.inf     正无穷大,负无穷大为-math.infmath.nan     非浮点数标记math库常用函数math.cell(x)      向上取整,返回不小于x的最小整数math.facto...

搜索字符串

搜索字符串

常用搜索字符串中子串的方法str.count(substring)      返回str中substring子串出现的无覆盖的次数str.find(s1)                    返回s1在这个字符串的最低下标,如果字符串中不存在s1,则返回-1str.rfind(s1)       ...

Python自动清理错误图片,深度学习训练数据集准备

Python自动清理错误图片,深度学习训练数据集准备

使用python运行from PIL import Image from pathlib import Path import os   path = r'.'  ...

(原创)使用Python递归获取网页内的所有URL,并进行清洗

(原创)使用Python递归获取网页内的所有URL,并进行清洗

import argparse import time from urllib.parse import urljoin, urlparse from selenium import webdriver...

(原创)使用Python自动对子文件夹中的图片文件进行重命名

(原创)使用Python自动对子文件夹中的图片文件进行重命名

为了解决Python深度学习的时候,经常遇到的文件名问题import os # 获取指定目录下的所有子文件夹 def get_subfolders(path):     subfolders = []...