Skip to content

Commit 329a41a

Browse files
oharboeclaude
andcommitted
makeIssue: EXCLUDE_PLATFORM keeps the design's LEF files
EXCLUDE_PLATFORM deletes every member that ends in lib, lef or tlef from the finished archive, which is how the platform's files under FULL_ISSUE and the copies among the flow's objects go. It also deleted a macro's LEF that ADDITIONAL_LEFS names, although the file list had selected it, so the reproducible could not link the design's macros. The files a variable names and the file list kept are now put back after the deletion. DFF_LIB_FILE names a liberty file of the platform's, and only that deletion kept it out of the archive. It is marked `platform: true`, so it stays out wherever the platform keeps it. A file archived twice, in the design directory under FULL_ISSUE and through a variable, is listed twice and was given to tar --delete twice, which stopped makeIssue, as it did makeIssue.sh: tar: .../macro.lef: Not found in archive Each member is now deleted once. The test checks the finished archive of a flow with a design LEF, a platform LEF and a merged liberty file among the objects; it failed before this change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent d592917 commit 329a41a

3 files changed

Lines changed: 47 additions & 4 deletions

File tree

‎flow/scripts/variables.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,7 @@ DFF_LIB_FILE:
12151215
stages:
12161216
- synth
12171217
type: file
1218+
platform: true
12181219
SYNTH_KEEP_MODULES:
12191220
description: |
12201221
Mark modules to keep from getting removed in flattening.

‎flow/test/test_make_issue.py‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,37 @@ def test_exclude_platform_end_to_end(self):
385385
self.assertNotIn(name, names)
386386
self.assertIn("constraint.sdc", names)
387387

388+
def test_exclude_platform_keeps_the_design_lef(self):
389+
"""In the finished archive: the platform's liberty and LEF files
390+
are dropped from it after it is written, the design's stay."""
391+
macro_lef = os.path.join(self.stub.design_dir, "macro.lef")
392+
platform_lef = os.path.join(self.stub.platform_dir, "cells.lef")
393+
merged_lib = os.path.join(
394+
self.stub.flow, self.stub.flow_dirs(".")["OBJECTS_DIR"], "lib", "merged.lib"
395+
)
396+
for path in [macro_lef, platform_lef, merged_lib]:
397+
self.stub.write(path, "\n")
398+
archive = self.stub.make_issue(
399+
".",
400+
EXCLUDE_PLATFORM="1",
401+
FULL_ISSUE="1",
402+
ADDITIONAL_LEFS=f"{macro_lef} {platform_lef}",
403+
)
404+
members = self.stub.members(archive)
405+
self.assertEqual(
406+
[m for m in members if m.endswith((".lef", ".lib"))],
407+
[f"{STEP}_{TAG}/designs/{PLATFORM}/{NICKNAME}/macro.lef"],
408+
)
409+
410+
def test_exclude_platform_leaves_out_the_flip_flop_liberty(self):
411+
"""DFF_LIB_FILE names a liberty file of the platform's, wherever
412+
the platform keeps it."""
413+
dff = os.path.join(self.stub.tmp, "pdk", "dff.lib")
414+
self.stub.write(dff, "\n")
415+
archive = self.stub.make_issue(".", EXCLUDE_PLATFORM="1", DFF_LIB_FILE=dff)
416+
names = [os.path.basename(m) for m in self.stub.members(archive)]
417+
self.assertNotIn("dff.lib", names)
418+
388419
def test_archived_end_to_end(self):
389420
lib = os.path.join(self.stub.platform_dir, "dff.lib")
390421
cells = os.path.join(self.stub.platform_dir, "cells.lib")

‎flow/util/makeIssue.py‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,10 @@ def tar_command(env, tar_name, issue_name, files):
228228
)
229229

230230

231-
def exclude_platform_library(tar_name):
232-
"""Drops the liberty and LEF files from the archive."""
231+
def exclude_platform_library(tar_name, transforms, design_library):
232+
"""Drops the liberty and LEF files from the archive: the platform's
233+
own, and the copies the flow keeps of them among its objects and
234+
results. The design's, which a file variable names, are put back."""
233235
tar = tar_name[: -len(".gz")]
234236
subprocess.run(["gunzip", "-f", tar_name], check=True)
235237
members = subprocess.run(
@@ -238,9 +240,14 @@ def exclude_platform_library(tar_name):
238240
stdout=subprocess.PIPE,
239241
universal_newlines=True,
240242
).stdout.splitlines()
241-
library = [m for m in members if PLATFORM_LIBRARY.search(m)]
243+
library = sorted({m for m in members if PLATFORM_LIBRARY.search(m)})
242244
if library:
243245
subprocess.run(["tar", "--delete", "--file", tar] + library, check=True)
246+
if design_library:
247+
subprocess.run(
248+
["tar", "--ignore-failed-read", "-rhf", tar] + transforms + design_library,
249+
check=True,
250+
)
244251
subprocess.run(["gzip", tar], check=True)
245252

246253

@@ -273,7 +280,11 @@ def make_issue(target, env):
273280
subprocess.run(tar_command(env, tar_name, issue_name, files), check=True)
274281

275282
if "EXCLUDE_PLATFORM" in env:
276-
exclude_platform_library(tar_name)
283+
exclude_platform_library(
284+
tar_name,
285+
tar_transforms(issue_name, env["FLOW_HOME"], env.get("WORK_HOME") or "."),
286+
[f for f in files if PLATFORM_LIBRARY.search(f)],
287+
)
277288

278289
if "COPY_ISSUE" in env:
279290
os.makedirs(env["COPY_ISSUE"], exist_ok=True)

0 commit comments

Comments
 (0)