Skip to content
Snippets Groups Projects
Commit 60f7dada authored by Daniel Newbrook's avatar Daniel Newbrook
Browse files

Add recursiive read to flist tcl script

parent 786ca96d
No related branches found
No related tags found
1 merge request!1changed imem to rom to allow initial program loading, updated bootloader code...
import argparse
import os
import argparse
parser = argparse.ArgumentParser(description="Take flist file for verilog simulation and convert to tcl readable",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("-i", "--input", help="input flist file")
......@@ -7,19 +7,40 @@ parser.add_argument("-o", "--output", help="output tcl file")
args = parser.parse_args()
config = vars(args)
if not os.path.exists(config["output"]):
outfile = open(config["output"], "a")
for line in open(config["input"]):
def readFlist(fname, outfile):
for line in open(fname):
li = line.strip()
if not li.startswith("//"):
if li.endswith(".v"):
if li.startswith("-f"):
#Read file and run readFlist
li = li.replace("-f ","")
tmp = li.split('/')
tmp[0]=tmp[0].replace("$","")
tmp[0]=tmp[0].replace('(','')
tmp[0]=tmp[0].replace(')','')
print(tmp)
envPath = os.environ.get(tmp[0])
print(envPath)
tmp.pop(0)
infile = envPath
for dir in tmp:
infile += '/' + dir
print(infile)
readFlist(infile,outfile)
elif li.endswith(".v"):
output = (line.rstrip()).replace("$","read_verilog $env")
outfile.write(output+'\n')
return
if not os.path.exists(config["output"]):
if os.path.exists(config["input"]):
outfile = open(config["output"], "a")
readFlist(config["input"],outfile)
outfile.close()
else:
print("ERROR: Input file does not exist")
else:
print("ERROR: Output file already exists")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment