Skip to content

Commit

Permalink
Merge pull request #250 from chetanya-goyal/main
Browse files Browse the repository at this point in the history
Fix problem of make not exiting on subprocess errors
  • Loading branch information
saicharan0112 authored Nov 6, 2023
2 parents 00847fe + b43eef0 commit 84fc97f
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 42 deletions.
51 changes: 36 additions & 15 deletions openfasoc/generators/cryo-gen/tools/cryo-gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -155,42 +156,53 @@
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")
print("#----------------------------------------------------------------------")

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")
print("#----------------------------------------------------------------------")

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")
Expand Down Expand Up @@ -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:
Expand Down
20 changes: 12 additions & 8 deletions openfasoc/generators/ldo-gen/tools/ldo-gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down
50 changes: 31 additions & 19 deletions openfasoc/generators/temp-sense-gen/tools/temp-sense-gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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"
],
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -262,4 +274,4 @@
sys.exit(1)

print("Exiting tool....")
exit()
sys.exit(0)

0 comments on commit 84fc97f

Please sign in to comment.