From 6baa2fd002c1f402b27504aaf9274b2b3b13c23e Mon Sep 17 00:00:00 2001 From: Adam Magnusson Date: Thu, 6 Mar 2025 15:24:37 +0100 Subject: [PATCH] Gantry include paths are now relative --- scripts/build_env.py | 12 ++++-------- scripts/elab.py | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/scripts/build_env.py b/scripts/build_env.py index b6fceff..d9ff493 100644 --- a/scripts/build_env.py +++ b/scripts/build_env.py @@ -43,20 +43,16 @@ def addAllVHDLFiles(std: str, lib: str, init=False): return -1 vhdlFiles = [] currentlyAdded = [] - absWorkDir = os.path.join(os.getcwd(), "work") cfFileId = getCfFileId(std) ## Find already present files if not init: - cfFileName = list(filter(lambda x: ".cf" in x and lib in x and cfFileId in x, os.listdir(absWorkDir)))[0] - cfFilePath = os.path.join(absWorkDir,cfFileName) + cfFileName = list(filter(lambda x: ".cf" in x and lib in x and cfFileId in x, os.listdir("work")))[0] + cfFilePath = os.path.join("work",cfFileName) currentlyAdded = getCurrentlyAddedFiles(cfFilePath) - print(currentlyAdded) ## Add files not added for file in os.listdir(): - print(file) - print(currentlyAdded, file, file not in currentlyAdded) if ".vhd" in file and file not in currentlyAdded: - vhdlFiles.append(os.path.join(os.getcwd(), file)) + vhdlFiles.append(file) if len(vhdlFiles) > 0: print(f"Detected new files. Adding {vhdlFiles}") command = ["ghdl", "-i", "--workdir=work", f"--work={lib}", f"--std={std}"] + vhdlFiles @@ -68,5 +64,5 @@ def getCurrentlyAddedFiles(cfFilePath:str): lines = f.readlines() f.close() fileLines = filter(lambda x: "file" in x, lines) - files = map(lambda x: split("\"",x)[1], fileLines) + files = map(lambda x: split("\" \"",x)[1], fileLines) return list(files) diff --git a/scripts/elab.py b/scripts/elab.py index 1d5a040..7cf0edc 100644 --- a/scripts/elab.py +++ b/scripts/elab.py @@ -7,7 +7,7 @@ from typing import List def generateIncludesForGHDL(includes: List[str]): cmd = [] for inc in includes: - cmd.append(f"-P{os.path.join(os.getcwd(), f"{inc}/work")}") + cmd.append(f"-P{inc}/work") return cmd def elabDesign(topDef: str, arch: str, lib: str, std: str, includes: List[str]): @@ -26,7 +26,7 @@ def runDesign(topDef: str, arch: str, lib: str, std: str, includes): print("Elaboration failed...") return -1 os.makedirs("wave",exist_ok=True) - wavePath = os.path.join(os.getcwd(), "wave") + wavePath = "wave" incs = generateIncludesForGHDL(includes) command = [ ## may add -v for verbose "ghdl", "--elab-run", f"--workdir=work", f"--work={lib}", f"--std={std}"] + incs + ["-o", f"work/{topDef}-{arch}", f"{topDef}", f"{arch}",