Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add output directory to sdc copy to ensure it works for external gall… #34

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions scripts/convert_sdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ def _find_sources(source):
return sources


def __process_file(source, target, subs):
def __process_file(source, target, subs, output_dir):
print(f'Processing {source}')
with open(source, 'r') as f_in:
dir_root = os.path.dirname(source)
with open(os.path.join(dir_root, f'{target}.sdc'), 'w') as f_out:
dir_root = os.path.relpath(os.path.dirname(source), root())
design_path = os.path.join(output_dir, dir_root)
os.makedirs(design_path, exist_ok=True)
with open(os.path.join(design_path, f'{target}.sdc'), 'w') as f_out:
for line in f_in:
for sub_in, sub_out in subs:
line = _process_text(line, sub_in, sub_out)
Expand All @@ -43,6 +45,8 @@ def _process_text(source, sub_in, sub_out):

parser.add_argument('--source', type=str, help='Source main library', required=True)
parser.add_argument('--target', type=str, help='Target main library', required=True)
parser.add_argument('--output_dir', type=str, default=root(),
help='Output designs directory')

parser.add_argument(
'--sub', type=str, nargs='+',
Expand All @@ -56,4 +60,4 @@ def _process_text(source, sub_in, sub_out):
subs.append(sub.split(":"))

for src in _find_sources(args.source):
__process_file(src, args.target, subs)
__process_file(src, args.target, subs, args.output_dir)