Skip to content

Commit 884a850

Browse files
committed
Apply black code formatting
1 parent 5a2130f commit 884a850

5 files changed

Lines changed: 28 additions & 8 deletions

File tree

‎flow/scripts/memories/gen_memories.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ def find_fakeram_run() -> str | None:
4040
base_dir = Path(schema.__file__).parent
4141
for p in [base_dir] + list(base_dir.parents):
4242
candidate = p / "tools" / "FakeRAM2.0" / "run.py"
43-
sys.stderr.write(f"DEBUG: checking candidate {candidate} (exists: {candidate.is_file()})\n")
43+
sys.stderr.write(
44+
f"DEBUG: checking candidate {candidate} (exists: {candidate.is_file()})\n"
45+
)
4446
if candidate.is_file():
4547
return str(candidate)
4648

@@ -124,7 +126,9 @@ def run(
124126

125127
res = subprocess.run(cmd, capture_output=True, text=True, env=env)
126128
if res.returncode != 0:
127-
sys.stderr.write(f"gen_memories: FakeRAM failed with returncode {res.returncode}:\n{res.stderr}\n{res.stdout}\n")
129+
sys.stderr.write(
130+
f"gen_memories: FakeRAM failed with returncode {res.returncode}:\n{res.stderr}\n{res.stdout}\n"
131+
)
128132
raise subprocess.CalledProcessError(res.returncode, cmd, res.stdout, res.stderr)
129133

130134
for mem in sorted(memories, key=lambda m: m.name):

‎flow/scripts/memories/gen_memories_test.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@
1515
# Bazel test execution
1616
runfiles_dir = Path(os.environ.get("RUNFILES_DIR", "."))
1717
candidates = [
18-
p for p in runfiles_dir.rglob("run.py")
18+
p
19+
for p in runfiles_dir.rglob("run.py")
1920
if "FakeRAM2.0" in p.parts or "fakeram" in p.parts
2021
]
21-
fakeram_run = candidates[0] if candidates else runfiles_dir / "_main" / "tools" / "FakeRAM2.0" / "run.py"
22+
fakeram_run = (
23+
candidates[0]
24+
if candidates
25+
else runfiles_dir / "_main" / "tools" / "FakeRAM2.0" / "run.py"
26+
)
2227
else:
2328
fakeram_run = (
2429
Path(__file__).resolve().parent.parent.parent.parent

‎tools/FakeRAM2.0/orfs/generate.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ def run_orfs(out_dir: Path, json_path: Path, tech_config_path: Path | None = Non
2121
timing_config = tech_data.get("timing", {})
2222

2323
out_dir.mkdir(parents=True, exist_ok=True)
24-
converted = sorted((m for m in memories if m.get("idiomatic")), key=lambda m: m["name"])
24+
converted = sorted(
25+
(m for m in memories if m.get("idiomatic")), key=lambda m: m["name"]
26+
)
2527

2628
process = Process(process_config)
2729
timing_data = TimingData(timing_config)
@@ -54,5 +56,7 @@ def run_orfs(out_dir: Path, json_path: Path, tech_config_path: Path | None = Non
5456
with open(lef_path, "w") as f:
5557
LefExporter(ram).export(f)
5658

57-
(out_dir / "blackboxes.txt").write_text("".join(f"{m['name']}\n" for m in converted))
59+
(out_dir / "blackboxes.txt").write_text(
60+
"".join(f"{m['name']}\n" for m in converted)
61+
)
5862
return 0

‎tools/FakeRAM2.0/run.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ def get_args() -> argparse.Namespace:
4747
def main(args: argparse.Namespace):
4848
if args.orfs_backend:
4949
tech_path = Path(args.tech_config) if args.tech_config else None
50-
return run_orfs(out_dir=Path(args.output_dir), json_path=Path(args.config), tech_config_path=tech_path)
50+
return run_orfs(
51+
out_dir=Path(args.output_dir),
52+
json_path=Path(args.config),
53+
tech_config_path=tech_path,
54+
)
5155

5256
json_data = RunUtils.get_config(args.config)
5357
# Create a process object (shared by all srams)

‎tools/FakeRAM2.0/utils/class_process.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,10 @@ def get_macro_dimensions(self, width_in_bits, depth, num_banks, additional_heigh
120120

121121
total_height += additional_height
122122

123-
min_height = max(self.min_macro_height_um, self.snap_height_nm / 1000.0 if self.snap_height_nm else 0)
123+
min_height = max(
124+
self.min_macro_height_um,
125+
self.snap_height_nm / 1000.0 if self.snap_height_nm else 0,
126+
)
124127
total_height = max(total_height, min_height)
125128

126129
return (total_width, total_height)

0 commit comments

Comments
 (0)