From 78205b90f27e97b707d233cb0b426239b3a4ce64 Mon Sep 17 00:00:00 2001 From: Joppe Blondel Date: Wed, 14 Sep 2022 21:40:52 +0200 Subject: [PATCH] Some small bug fixes in toolchains Signed-off-by: Joppe Blondel --- remotesyn/toolchains/ISE.py | 5 +++++ remotesyn/toolchains/ghdl.py | 7 +++++++ remotesyn/toolchains/questa.py | 2 +- remotesyn/toolchains/symbiyosys.py | 9 +++++++-- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/remotesyn/toolchains/ISE.py b/remotesyn/toolchains/ISE.py index b9f55cf..8b37a62 100644 --- a/remotesyn/toolchains/ISE.py +++ b/remotesyn/toolchains/ISE.py @@ -11,6 +11,8 @@ import shutil def do(config, target, log, subprocesses, prefix='.'): shutil.rmtree(config.get('project', 'build_dir', fallback='build'), True) + justsynth = config.getboolean(f'target.{target}', 'justsynth', fallback=False) + log("Syntesize:") res = xst(config, target, log, subprocesses, prefix) @@ -18,6 +20,9 @@ def do(config, target, log, subprocesses, prefix='.'): log("ERROR: xst returned with", res) return res + if justsynth: + return res + log("Implement") res = ngdbuild(config, target, log, subprocesses, prefix) diff --git a/remotesyn/toolchains/ghdl.py b/remotesyn/toolchains/ghdl.py index 54b6843..1edfaf4 100644 --- a/remotesyn/toolchains/ghdl.py +++ b/remotesyn/toolchains/ghdl.py @@ -25,6 +25,7 @@ def do(config, target, log, subprocesses, prefix='.'): ghdle_opts = config.get(f'target.{target}', 'ghdle_opts', fallback='') ghdlr_opts = config.get(f'target.{target}', 'ghdlr_opts', fallback='') 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') 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(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") res = 0 for f in files_vhdl: diff --git a/remotesyn/toolchains/questa.py b/remotesyn/toolchains/questa.py index 2019f55..6bc9bad 100644 --- a/remotesyn/toolchains/questa.py +++ b/remotesyn/toolchains/questa.py @@ -47,7 +47,7 @@ def do(config, target, log, subprocesses, prefix='.'): log(" - writing do file") 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") p = subprocess.Popen(f"bash ./do.sh 2>&1 | tee do.log", diff --git a/remotesyn/toolchains/symbiyosys.py b/remotesyn/toolchains/symbiyosys.py index e80a156..ea75d1a 100644 --- a/remotesyn/toolchains/symbiyosys.py +++ b/remotesyn/toolchains/symbiyosys.py @@ -6,7 +6,9 @@ import subprocess def execp(cmd, subprocesses, cwd): p = subprocess.Popen(cmd, 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) while p.poll() is None: time.sleep(1) @@ -55,7 +57,10 @@ def do(config, target, log, subprocesses, prefix='.'): for d in os.listdir(f'{build_dir}'): 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.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: log(" - [-]")