core-695. Add file that converts files list from Altera Quartus to Xilinx format
This commit is contained in:
parent
40d515f6aa
commit
dcd02bd562
1 changed files with 80 additions and 0 deletions
80
utilities/altera_to_xilinx.py
Normal file
80
utilities/altera_to_xilinx.py
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
# -----------------------------------------------------------------------------
|
||||
# Title : Convert Altera TCL to Xilinx TCL
|
||||
# Project : Generic FW tools
|
||||
# -----------------------------------------------------------------------------
|
||||
# File : alt_to_xilinx.py
|
||||
# Author : Dave Steele
|
||||
# Company : Global Inkjet Systems
|
||||
# Created : 2022-06-08
|
||||
# Last update: 2022-06-08
|
||||
# Platform :
|
||||
# Standard : Python 3.x
|
||||
# -----------------------------------------------------------------------------
|
||||
# Description:
|
||||
# Reads the Altera core_hw_tcl and extracts a files list and generic settings
|
||||
# -----------------------------------------------------------------------------
|
||||
# Copyright (c) 2022 Global Inkjet Systems
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
# ###############################################################
|
||||
# Only run if not imported (to test)
|
||||
#
|
||||
if __name__ == '__main__':
|
||||
|
||||
if (len(sys.argv) != 3):
|
||||
print("wrong number of arguments; infile , outfile")
|
||||
exit()
|
||||
print("0- ", sys.argv[0],", 1- ", sys.argv[1])
|
||||
|
||||
fileIn = open(sys.argv[1], 'r')
|
||||
linesIn = fileIn.readlines()
|
||||
fileOut = open(sys.argv[2], 'w')
|
||||
|
||||
for line in linesIn:
|
||||
if (line.find("add_fileset_file") != -1):
|
||||
# Parsing to extract filepath (add_fileset_file sync_uart_tx.vhd VHDL PATH ../../sync_uart/sync_uart_tx.vhd)
|
||||
pathPos = line.find("PATH")
|
||||
subline = line[pathPos+5:]
|
||||
vPos = subline.find(".v")
|
||||
endPos = vPos+2
|
||||
# make sure .v or .vhd is added to the string
|
||||
if (subline[endPos] == "h"):
|
||||
endPos += 2
|
||||
|
||||
#extract just the path
|
||||
path = subline[0:endPos]
|
||||
|
||||
#if file is local to this directory, add a prefix to enable it to be found from build dir
|
||||
if (path[0] != "."):
|
||||
path = "../src/"+path
|
||||
|
||||
# don't include any altera primitives
|
||||
if (path.find("/altera/") == -1):
|
||||
# convert to xilinx tcl format
|
||||
outStr = "\"[file normalize \"$origin_dir/"+path+"\"]\""+"\\"
|
||||
# output
|
||||
#print(outStr)
|
||||
fileOut.write(outStr+"\n")
|
||||
|
||||
fileIn.close()
|
||||
fileOut.close()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue