Skip to content

Commit

Permalink
Added exception handling to copy rtl function
Browse files Browse the repository at this point in the history
  • Loading branch information
mksoc committed Sep 3, 2024
1 parent e96a3ce commit 1f731f3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions cmake/utils/copy_rtl_files/copy_rtl_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ def main():
]

# Get the used files list from vhier
cells_output = subprocess.run([*vhier_base_args, '--cells'], capture_output=True)
try:
cells_output = subprocess.run([*vhier_base_args, '--cells'], capture_output=True, check=True)
except subprocess.CalledProcessError as e:
print("Fatal: ", e.returncode, e.stderr)
raise

output_src.extend(sorted(set([f.decode() for f in cells_output.stdout.split()])))

# Copy files to output directory
Expand All @@ -52,14 +57,19 @@ def main():
dest_dir = os.path.join(args.outdir, i.replace(args.deps_dir, '').split('/')[1].rsplit('-', 1)[0])
os.makedirs(dest_dir, exist_ok=True)
copied_src.append(shutil.copy2(i, dest_dir))

# Write copied files list to outdir
with open(os.path.join(args.outdir, 'rtl_sources.f'), 'w') as outfile:
for i in copied_src:
outfile.write(f'{i}\n')

# Get the includes list from vhier
includes_output = subprocess.run([*vhier_base_args, '--includes'], capture_output=True)
try:
includes_output = subprocess.run([*vhier_base_args, '--includes'], capture_output=True, check=True)
except subprocess.CalledProcessError as e:
print("Fatal: ", e.returncode, e.stderr)
raise

output_inc = sorted(set([f.decode() for f in includes_output.stdout.split()]))

# Copy the include files in a include folder
Expand Down

0 comments on commit 1f731f3

Please sign in to comment.