diff --git a/openfasoc/generators/cryo-gen/tools/cryo-gen.py b/openfasoc/generators/cryo-gen/tools/cryo-gen.py index 249624d3d..5cdab9f91 100755 --- a/openfasoc/generators/cryo-gen/tools/cryo-gen.py +++ b/openfasoc/generators/cryo-gen/tools/cryo-gen.py @@ -103,12 +103,13 @@ if not os.path.isdir(sky130A_path): os.mkdir(sky130A_path) try: - sp.Popen( - [ - "sed -i 's/set PDKPATH \".*/set PDKPATH $env(PDK_ROOT)\/sky130A/' $PDK_ROOT/sky130A/libs.tech/magic/sky130A.magicrc" - ], - shell=True, - ).wait() + cmd = ["sed -i 's/set PDKPATH \".*/set PDKPATH $env(PDK_ROOT)\/sky130A/' $PDK_ROOT/sky130A/libs.tech/magic/sky130A.magicrc"] + p = sp.Popen(cmd, shell=True) + p.wait() + if p.returncode != 0: + print("[ERROR]: Command '" + ' '.join(cmd) + \ + "' exited with non-zero return code: " + str(p.returncode)) + sys.exit(p.returncode) except: pass shutil.copy2(os.path.join(pdk, "libs.tech/magic/sky130A.magicrc"), sky130A_path) @@ -155,17 +156,21 @@ print() if args.mode == "verilog": print("Exiting tool....") - exit() + sys.exit(0) print("#----------------------------------------------------------------------") print("# Run Synthesis and APR") print("#----------------------------------------------------------------------") # make with different deisgn config + +cmd = ["make", "PLATFORM_ARG=" + args.platform, "SPICE_FILE=" + spice_file] p = sp.Popen( - ["make", "PLATFORM_ARG=" + args.platform, "SPICE_FILE=" + spice_file], cwd=flowDir + cmd, cwd=flowDir ) p.wait() - +if(p.returncode != 0): + print("[ERROR]: Command '" + ' '.join(cmd) + "' exited with non-zero return code: " + str(p.returncode)) + sys.exit(p.returncode) print("#----------------------------------------------------------------------") print("# Place and Route finished") @@ -173,11 +178,15 @@ time.sleep(2) +cmd = ["make", "magic_drc", "PLATFORM_ARG=" + args.platform, "SPICE_FILE=" + spice_file] p = sp.Popen( - ["make", "magic_drc", "PLATFORM_ARG=" + args.platform, "SPICE_FILE=" + spice_file], + cmd, cwd=flowDir, ) p.wait() +if(p.returncode != 0): + print("[ERROR]: Command '" + ' '.join(cmd) + "' exited with non-zero return code: " + str(p.returncode)) + sys.exit(p.returncode) print("#----------------------------------------------------------------------") print("# DRC finished") @@ -185,12 +194,15 @@ time.sleep(2) +cmd = ["make", "netgen_lvs", "PLATFORM_ARG=" + args.platform, "SPICE_FILE=" + spice_file] p = sp.Popen( - ["make", "netgen_lvs", "PLATFORM_ARG=" + args.platform, "SPICE_FILE=" + spice_file], + cmd, cwd=flowDir, ) p.wait() - +if(p.returncode != 0): + print("[ERROR]: Command '" + ' '.join(cmd) + "' exited with non-zero return code: " + str(p.returncode)) + sys.exit(p.returncode) print("#----------------------------------------------------------------------") print("# LVS finished") @@ -274,11 +286,20 @@ print("Exiting tool....") exit() -p = sp.Popen(["yum", "install", "-y", "libXaw-devel"]) -p.wait() -p = sp.Popen(["yum", "install", "-y", "libXaw"]) +cmd = ["yum", "install", "-y", "libXaw-devel"] +p = sp.Popen(cmd) p.wait() +if p.returncode != 0: + print("Command '" + ' '.join(cmd) + "' exited with non-zero return code: " + str(p.returncode)) + sys.exit(p.returncode) +cmd = ["yum", "install", "-y", "libXaw"] +p = sp.Popen(cmd) +p.wait() +if p.returncode != 0: + print("Command '" + ' '.join(cmd) + "' exited with non-zero return code: " + str(p.returncode)) + sys.exit(p.returncode) + pdks_path = "/usr/bin/miniconda3/share/pdk/" if args.prepex: diff --git a/openfasoc/generators/ldo-gen/tools/ldo-gen.py b/openfasoc/generators/ldo-gen/tools/ldo-gen.py index 4def87771..27e097074 100644 --- a/openfasoc/generators/ldo-gen/tools/ldo-gen.py +++ b/openfasoc/generators/ldo-gen/tools/ldo-gen.py @@ -144,11 +144,13 @@ print("#----------------------------------------------------------------------") print("# Run Synthesis and APR") print("#----------------------------------------------------------------------") - p = sp.Popen(["make", "finish"], cwd=directories["flowDir"]) + cmd = ["make", "finish"] + p = sp.Popen(cmd, cwd=directories["flowDir"]) p.wait() - if p.returncode: - print("[Error] Place and Route failed. Refer to the log file") - exit(1) + if p.returncode != 0: + print("[ERROR]: Command '" + ' '.join(cmd) +\ + "' exited with non-zero return code: " + str(p.returncode)) + sys.exit(p.returncode) print("#----------------------------------------------------------------------") print("# Run DRC") @@ -163,11 +165,13 @@ print("#----------------------------------------------------------------------") print("# Run LVS") print("#----------------------------------------------------------------------") - p = sp.Popen(["make", "netgen_lvs"], cwd=directories["flowDir"]) + cmd = ["make", "netgen_lvs"] + p = sp.Popen(cmd, cwd=directories["flowDir"]) p.wait() - if p.returncode: - print("[Error] LVS failed. Refer to the report") - exit(1) + if p.returncode != 0: + print("[ERROR]: Command '" + ' '.join(cmd) +\ + "' exited with non-zero return code: " + str(p.returncode)) + sys.exit(p.returncode) print("#----------------------------------------------------------------------") print("# LVS and DRC finished successfully") diff --git a/openfasoc/generators/temp-sense-gen/tools/temp-sense-gen.py b/openfasoc/generators/temp-sense-gen/tools/temp-sense-gen.py index 7d5d48aa8..5c298fad5 100755 --- a/openfasoc/generators/temp-sense-gen/tools/temp-sense-gen.py +++ b/openfasoc/generators/temp-sense-gen/tools/temp-sense-gen.py @@ -26,12 +26,18 @@ # ------------------------------------------------------------------------------ # Clean the workspace # ------------------------------------------------------------------------------ -print("#----------------------------------------------------------------------") -print("# Cleaning the workspace...") -print("#----------------------------------------------------------------------") + +print("#----------------------------------------------------------------------", flush=True) +print("# Cleaning the workspace...", flush=True) +print("#----------------------------------------------------------------------", flush=True) + if args.clean: - p = sp.Popen(["make", "clean_all"], cwd=genDir) + cmd = ["make", "clean_all"] + p = sp.Popen(cmd, cwd=genDir) p.wait() + if p.returncode != 0: + print("[ERROR]: Command '" + ' '.join(cmd) + "' exited with non-zero return code: " + str(p.returncode)) + sys.exit(p.returncode) p = sp.Popen(["git", "checkout", platformDir + "cdl/sky130_fd_sc_hd.spice"]) p.wait() @@ -67,7 +73,7 @@ if not os.path.isdir(sky130A_path): os.mkdir(sky130A_path) try: - sp.Popen( + p = sp.Popen( [ "sed -i 's/set PDKPATH \".*/set PDKPATH $env(PDK_ROOT)\/sky130A/' $PDK_ROOT/sky130A/libs.tech/magic/sky130A.magicrc" ], @@ -146,37 +152,43 @@ print() if args.mode == "verilog": print("Exiting tool....") - exit() + sys.exit(0) print("#----------------------------------------------------------------------") print("# Run Synthesis and APR") print("#----------------------------------------------------------------------") -p = sp.Popen(["make", "finish"], cwd=flowDir) +cmd = ["make", "finish"] +p = sp.Popen(cmd, cwd=flowDir) p.wait() -if p.returncode: - print("[Error] Place and Route failed. Refer to the log file") - exit(1) +if p.returncode != 0: + print("[ERROR]: Command '" + ' '.join(cmd) +\ + "' exited with non-zero return code: " + str(p.returncode)) + sys.exit(p.returncode) print("#----------------------------------------------------------------------") print("# Place and Route finished") print("#----------------------------------------------------------------------") -p = sp.Popen(["make", "magic_drc"], cwd=flowDir) +cmd = ["make", "magic_drc"] +p = sp.Popen(cmd, cwd=flowDir) p.wait() -if p.returncode: - print("[Error] DRC failed. Refer to the report") - exit(1) +if p.returncode != 0: + print("[ERROR]: Command '" + ' '.join(cmd) + \ + "' exited with non-zero return code: " + str(p.returncode)) + sys.exit(p.returncode) print("#----------------------------------------------------------------------") print("# DRC finished") print("#----------------------------------------------------------------------") -p = sp.Popen(["make", "netgen_lvs"], cwd=flowDir) +cmd = ["make", "netgen_lvs"] +p = sp.Popen(cmd, cwd=flowDir) p.wait() -if p.returncode: - print("[Error] LVS failed. Refer to the report") - exit(1) +if p.returncode != 0: + print("[ERROR]: Command '" + ' '.join(cmd) + \ + "' exited with non-zero return code: " + str(p.returncode)) + sys.exit(p.returncode) print("#----------------------------------------------------------------------") print("# LVS finished") @@ -262,4 +274,4 @@ sys.exit(1) print("Exiting tool....") -exit() +sys.exit(0)