Skip to content

Commit

Permalink
fix sdf unziping and add gen_dir flag
Browse files Browse the repository at this point in the history
  • Loading branch information
M0stafaRady committed Aug 1, 2024
1 parent 718936b commit 77057f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions cocotb/caravel_cocotb/scripts/verify_cocotb/RunFlow.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ def __init__(
sdf_setup=None,
macros=None,
sim_path=None,
gen_defaults_dir=None,
run_path=".",
verbosity="normal",
check_commits=False,
Expand Down Expand Up @@ -272,6 +273,7 @@ def __init__(
self.clk = clk
self.macros = macros
self.sim_path = sim_path
self.gen_defaults_dir = gen_defaults_dir
self.run_path = run_path
self.verbosity = verbosity
# dev only
Expand Down Expand Up @@ -304,6 +306,7 @@ def argparse_to_CocotbArgs(self, args):
self.clk = args.clk
self.macros = args.macros
self.sim_path = args.sim_path
self.gen_defaults_dir = args.gen_defaults_dir
self.lint = args.lint
self.run_path = os.getcwd()
self.verbosity = args.verbosity
Expand Down
13 changes: 8 additions & 5 deletions cocotb/caravel_cocotb/scripts/verify_cocotb/RunRegression.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ def run_defaults_script(self):
if self.args.no_gen_defaults:
return
current_dir = os.getcwd()
os.chdir(f"{self.paths.CARAVEL_ROOT}/")
if self.args.gen_defaults_dir is None:
root_script = f"{self.paths.CARAVEL_ROOT}/"
else:
root_script = self.args.gen_defaults_dir
os.chdir(root_script)
self.logger.info("Running gen_gpio_defaults script")
os.system(
f"python3 scripts/gen_gpio_defaults.py {self.paths.USER_PROJECT_ROOT}"
Expand Down Expand Up @@ -498,14 +502,13 @@ def unzip_sdf_files(self):
pass
else:
sdf_dir = self.args.sdfs_dir

if isinstance(sdf_dir, list):
gz_files = []
for dir in sdf_dir:
gz_files += glob.glob(f"{dir}/**/*.gz")
gz_files += glob.glob(f"{dir}/**/*.gz".replace('"', ''), recursive=True)
else:
gz_files = glob.glob(f"{sdf_dir}/**/*.gz")

gz_files = glob.glob(f"{sdf_dir}/**/*.gz".replace('"', ''), recursive=True)
print("unzipping files {}".format(gz_files))
for gz_file in gz_files:
subprocess.run(f"gzip {gz_file} -d".split())
self.args.macros.append(f'SDF_PATH=\\"{sdf_dir}\\"')
Expand Down

0 comments on commit 77057f6

Please sign in to comment.