Some small bug fixes in toolchains

Signed-off-by: Joppe Blondel <joppe@blondel.nl>
This commit is contained in:
2022-09-14 21:40:52 +02:00
parent 1e8986f8a7
commit 78205b90f2
4 changed files with 20 additions and 3 deletions

View File

@ -11,6 +11,8 @@ import shutil
def do(config, target, log, subprocesses, prefix='.'): def do(config, target, log, subprocesses, prefix='.'):
shutil.rmtree(config.get('project', 'build_dir', fallback='build'), True) shutil.rmtree(config.get('project', 'build_dir', fallback='build'), True)
justsynth = config.getboolean(f'target.{target}', 'justsynth', fallback=False)
log("Syntesize:") log("Syntesize:")
res = xst(config, target, log, subprocesses, prefix) res = xst(config, target, log, subprocesses, prefix)
@ -18,6 +20,9 @@ def do(config, target, log, subprocesses, prefix='.'):
log("ERROR: xst returned with", res) log("ERROR: xst returned with", res)
return res return res
if justsynth:
return res
log("Implement") log("Implement")
res = ngdbuild(config, target, log, subprocesses, prefix) res = ngdbuild(config, target, log, subprocesses, prefix)

View File

@ -25,6 +25,7 @@ def do(config, target, log, subprocesses, prefix='.'):
ghdle_opts = config.get(f'target.{target}', 'ghdle_opts', fallback='') ghdle_opts = config.get(f'target.{target}', 'ghdle_opts', fallback='')
ghdlr_opts = config.get(f'target.{target}', 'ghdlr_opts', fallback='') ghdlr_opts = config.get(f'target.{target}', 'ghdlr_opts', fallback='')
files_vhdl = config.get(f'target.{target}', 'files_vhdl', fallback='').split() files_vhdl = config.get(f'target.{target}', 'files_vhdl', fallback='').split()
files_other = config.get(f'target.{target}', 'files_other', fallback='').split()
build_dir = config.get(f'project', 'build_dir', fallback='build') build_dir = config.get(f'project', 'build_dir', fallback='build')
out_dir = config.get(f'project', 'out_dir', fallback='out') out_dir = config.get(f'project', 'out_dir', fallback='out')
@ -36,6 +37,12 @@ def do(config, target, log, subprocesses, prefix='.'):
os.makedirs(build_dir, exist_ok=True) os.makedirs(build_dir, exist_ok=True)
os.makedirs(out_dir, exist_ok=True) os.makedirs(out_dir, exist_ok=True)
log(" - copy needed files")
for f in files_other:
d = os.path.dirname(f)
os.makedirs(f"{build_dir}/{d}", exist_ok=True)
shutil.copy(f"{prefix}/{f}", f"{build_dir}/{f}")
log(" - analyze files") log(" - analyze files")
res = 0 res = 0
for f in files_vhdl: for f in files_vhdl:

View File

@ -47,7 +47,7 @@ def do(config, target, log, subprocesses, prefix='.'):
log(" - writing do file") log(" - writing do file")
with open(f'{build_dir}/do.do', 'w') as f: with open(f'{build_dir}/do.do', 'w') as f:
f.write("vcd file out.vcd\n vcd add *\nrun -all\nquit\n"); f.write("vcd file out.vcd\n vcd add -r -in -out -inout -internal -ports *\nrun -all\nquit\n");
log(" - run vsim") log(" - run vsim")
p = subprocess.Popen(f"bash ./do.sh 2>&1 | tee do.log", p = subprocess.Popen(f"bash ./do.sh 2>&1 | tee do.log",

View File

@ -6,7 +6,9 @@ import subprocess
def execp(cmd, subprocesses, cwd): def execp(cmd, subprocesses, cwd):
p = subprocess.Popen(cmd, p = subprocess.Popen(cmd,
shell=True, cwd=cwd, shell=True, cwd=cwd,
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) stdin=subprocess.DEVNULL,
# stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
subprocesses.append(p) subprocesses.append(p)
while p.poll() is None: while p.poll() is None:
time.sleep(1) time.sleep(1)
@ -55,7 +57,10 @@ def do(config, target, log, subprocesses, prefix='.'):
for d in os.listdir(f'{build_dir}'): for d in os.listdir(f'{build_dir}'):
if os.path.isdir(f'{build_dir}/{d}') and d.startswith(oname): if os.path.isdir(f'{build_dir}/{d}') and d.startswith(oname):
shutil.copy(f'{build_dir}/{d}/logfile.txt', f'{out_dir}/{d}.log') shutil.copy(f'{build_dir}/{d}/logfile.txt', f'{out_dir}/{d}.log')
shutil.copytree(f'{build_dir}/{d}/engine_0', f'{out_dir}/{d}', dirs_exist_ok=True) try:
shutil.copytree(f'{build_dir}/{d}/engine_0', f'{out_dir}/{d}', dirs_exist_ok=True)
except FileNotFoundError:
pass
if res!=0: if res!=0:
log(" - [-]") log(" - [-]")