import os import subprocess import build_env def elabDesign(topDef: str, arch: str, lib: str, std: str): ## Add all source files present in pwd if build_env.addAllVHDLFiles() == -1: print("Adding files failed. GHDL Build environment may be broken...") return -1 command = [ "ghdl", "-m", f"--workdir={lib}", f"--work={lib}", f"--std={std}", "-o", f"{lib}/{topDef}-{arch}", f"{lib}.{topDef}", f"{arch}"] subprocess.run(command) def runDesign(topDef: str, arch: str, lib: str, std: str): ## elaborate first, then run if elabDesign(topDef, arch, lib, std) == -1: print("Elaboration failed...") return -1 os.makedirs("wave",exist_ok=True) libPath = os.path.join(os.getcwd(), lib) wavePath = os.path.join(os.getcwd(), "wave") command = [ ## may add -v for verbose "ghdl", "-r", f"{topDef}", f"{arch}", f"--wave=../wave/{topDef}-{arch}.ghw" ##, "--read-wave-opt=