Skip to content

Commit 1b60b2b

Browse files
oharboeclaude
andcommitted
makeIssue: the file variables are the ones variables.yaml marks
makeIssue.py kept its own two lists of the variables that name files, design and platform. variables.yaml, which already describes every flow variable, now says it once: `type: file`. makeIssue reads it, and a new file variable needs only its entry there. EXCLUDE_PLATFORM now leaves out the files under PLATFORM_DIR, whichever variable names them, instead of the variables on the platform list: a macro's LEF in ADDITIONAL_LEFS is the design's own and is archived, and a platform library named by a design variable is left out. SIG_MAP_FILE, read by floorplan.tcl and the floorplan step, gets its entry in variables.yaml and in the generated FlowVariables.md. PDN_CFG, which the flow stopped reading when it became PDN_TCL (#1062), is no longer archived. The test that the file variables are ones the flow reads now reads them from variables.yaml, counts the hooks source_step_tcl composes, and leaves variables.yaml out of the text it searches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent 1296f7c commit 1b60b2b

4 files changed

Lines changed: 128 additions & 62 deletions

File tree

‎docs/user/FlowVariables.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ configuration file.
289289
| <a name="SETUP_MOVE_SEQUENCE"></a>SETUP_MOVE_SEQUENCE| Passed as -sequence to repair_timing. This should be a string of move keywords separated by commas.| |
290290
| <a name="SETUP_REPAIR_PHASES"></a>SETUP_REPAIR_PHASES| Passed as -phases to repair_timing. This should be a string of setup repair phase names separated by spaces. Set to PARALLEL_EVAL to repair setup timing with the experimental parallel evaluation policy. When unset, repair_timing runs its default phases.| |
291291
| <a name="SETUP_SLACK_MARGIN"></a>SETUP_SLACK_MARGIN| Specifies a time margin for the slack when fixing setup violations. This option allows you to overfix or underfix(negative value, terminate retiming before 0 or positive slack). See HOLD_SLACK_MARGIN for more details.| 0|
292+
| <a name="SIG_MAP_FILE"></a>SIG_MAP_FILE| Signal map file for ICeWall-based floorplan initialization: the signal each pad of the FOOTPRINT file connects to.| |
292293
| <a name="SKIP_ANTENNA_REPAIR"></a>SKIP_ANTENNA_REPAIR| Skips antenna repair entirely.| 0|
293294
| <a name="SKIP_ANTENNA_REPAIR_POST_DRT"></a>SKIP_ANTENNA_REPAIR_POST_DRT| Skips antenna repair post-detailed routing.| 0|
294295
| <a name="SKIP_BUFFER_REMOVAL"></a>SKIP_BUFFER_REMOVAL| Passed as -skip_buffer_removal to repair_timing. Do not remove buffers as a transform to fix timing violations (default: allow buffer removal).| |
@@ -480,6 +481,7 @@ configuration file.
480481
- [SETUP_MOVE_SEQUENCE](#SETUP_MOVE_SEQUENCE)
481482
- [SETUP_REPAIR_PHASES](#SETUP_REPAIR_PHASES)
482483
- [SETUP_SLACK_MARGIN](#SETUP_SLACK_MARGIN)
484+
- [SIG_MAP_FILE](#SIG_MAP_FILE)
483485
- [SKIP_BUFFER_REMOVAL](#SKIP_BUFFER_REMOVAL)
484486
- [SKIP_CRIT_VT_SWAP](#SKIP_CRIT_VT_SWAP)
485487
- [SKIP_FLOORPLAN_REPAIR_TIMING](#SKIP_FLOORPLAN_REPAIR_TIMING)

‎flow/scripts/variables.yaml‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,11 @@ TECH_LEF:
134134
description: >
135135
A technology LEF file of the PDK that includes all relevant information
136136
regarding metal layers, vias, and spacing requirements.
137+
type: file
137138
SC_LEF:
138139
description: |
139140
Path to technology standard cell LEF file.
141+
type: file
140142
GDS_FILES:
141143
description: |
142144
Path to platform GDS files.
@@ -145,6 +147,7 @@ LIB_FILES:
145147
A Liberty file of the standard cell library with PVT characterization,
146148
input and output characteristics, timing and power definitions for each
147149
cell.
150+
type: file
148151
LIB_MODEL:
149152
description: >
150153
Selects between NLDM and CCS timing models for the ASAP7 platform.
@@ -398,6 +401,7 @@ SYNTH_NETLIST_FILES:
398401
subsequent modules are silently ignored and only the first module is used.
399402
stages:
400403
- synth
404+
type: file
401405
SYNTH_CANONICALIZE_TCL:
402406
description: >
403407
Specifies a Tcl script with commands to run as part of the synth
@@ -450,16 +454,19 @@ LATCH_MAP_FILE:
450454
Optional mapping file supplied to Yosys to map latches
451455
stages:
452456
- synth
457+
type: file
453458
CLKGATE_MAP_FILE:
454459
description: |
455460
Optional mapping file supplied to Yosys to map clock gating cells
456461
stages:
457462
- synth
463+
type: file
458464
ADDER_MAP_FILE:
459465
description: |
460466
Optional mapping file supplied to Yosys to map adders
461467
stages:
462468
- synth
469+
type: file
463470
INFER_CLKGATES:
464471
description: >
465472
Enables Yosys clock gate inference. By default, it uses the Liberty cell
@@ -634,6 +641,7 @@ TAPCELL_TCL:
634641
Path to Endcap and Welltie cells file.
635642
stages:
636643
- floorplan
644+
type: file
637645
MACRO_PLACEMENT_TCL:
638646
description: |
639647
Specifies the path of a TCL file on how to place macros manually.
@@ -646,13 +654,15 @@ MACRO_PLACEMENT_TCL:
646654
and those locations impact global placement.
647655
stages:
648656
- floorplan
657+
type: file
649658
PDN_TCL:
650659
description: >
651660
File path which has a set of power grid policies used by pdn to be applied
652661
to the design, such as layers to use, stripe width and spacing to generate
653662
the actual metal straps.
654663
stages:
655664
- floorplan
665+
type: file
656666
GLOBAL_CONNECT_TCL:
657667
description: >
658668
File path to the add_global_connection rules that connect the supply pins
@@ -663,16 +673,19 @@ GLOBAL_CONNECT_TCL:
663673
grids.
664674
stages:
665675
- floorplan
676+
type: file
666677
MAKE_TRACKS:
667678
description: |
668679
Tcl file that defines add routing tracks to a floorplan.
669680
stages:
670681
- floorplan
682+
type: file
671683
IO_CONSTRAINTS:
672684
description: |
673685
File path to the IO constraints .tcl file. Also used for manual placement.
674686
stages:
675687
- floorplan
688+
type: file
676689
IO_PLACER_H:
677690
description: >
678691
A list of metal layers on which the I/O pins are placed horizontally (top and
@@ -1068,9 +1081,11 @@ OR_SEED:
10681081
RCX_RULES:
10691082
description: |
10701083
RC Extraction rules file path.
1084+
type: file
10711085
FILL_CONFIG:
10721086
description: |
10731087
JSON rule file for metal fill during chip finishing.
1088+
type: file
10741089
KLAYOUT_TECH_FILE:
10751090
description: |
10761091
A mapping from LEF/DEF to GDS using the KLayout tool.
@@ -1106,6 +1121,7 @@ VERILOG_FILES:
11061121
of modules.
11071122
stages:
11081123
- synth
1124+
type: file
11091125
VERILOG_DEFINES:
11101126
description: >
11111127
Preprocessor defines passed to the language frontend.
@@ -1118,13 +1134,16 @@ SDC_FILE:
11181134
The path to design constraint (SDC) file.
11191135
stages:
11201136
- synth
1137+
type: file
11211138
ADDITIONAL_FILES:
11221139
description: |
11231140
Additional files to be added to `make issue` archive.
1141+
type: file
11241142
ADDITIONAL_LEFS:
11251143
description: >
11261144
Hardened macro LEF view files listed here. The LEF information of the
11271145
macros is immutable and used throughout all stages. Stored in the .odb file.
1146+
type: file
11281147
ADDITIONAL_LIBS:
11291148
description: >
11301149
Hardened macro library files listed here. The library information is
@@ -1182,6 +1201,7 @@ DFF_LIB_FILE:
11821201
synthesis. Takes precedence over DFF_MAP_FILE when set.
11831202
stages:
11841203
- synth
1204+
type: file
11851205
SYNTH_KEEP_MODULES:
11861206
description: |
11871207
Mark modules to keep from getting removed in flattening.
@@ -1268,6 +1288,7 @@ MACRO_WRAPPERS:
12681288
The wrapper file that replaces existing macros with their wrapped version.
12691289
stages:
12701290
- floorplan
1291+
type: file
12711292
CTS_BUF_DISTANCE:
12721293
description: |
12731294
Distance (in microns) between buffers.
@@ -1324,6 +1345,7 @@ POST_CTS_TCL:
13241345
Specifies a Tcl script with commands to run after CTS is completed.
13251346
stages:
13261347
- cts
1348+
type: file
13271349
POST_DENSITY_FILL_TCL:
13281350
description: |
13291351
Specifies a Tcl script with commands to run after density fill.
@@ -1339,6 +1361,7 @@ POST_DETAIL_ROUTE_TCL:
13391361
Specifies a Tcl script with commands to run after detailed route.
13401362
stages:
13411363
- route
1364+
type: file
13421365
POST_FILLCELL_TCL:
13431366
description: |
13441367
Specifies a Tcl script with commands to run after fillcell insertion.
@@ -1354,6 +1377,7 @@ POST_FLOORPLAN_TCL:
13541377
Specifies a Tcl script with commands to run after floorplan is completed.
13551378
stages:
13561379
- floorplan
1380+
type: file
13571381
POST_GLOBAL_PLACE_SKIP_IO_TCL:
13581382
description: |
13591383
Specifies a Tcl script with commands to run after global placement (skip IO).
@@ -1384,6 +1408,7 @@ POST_PDN_TCL:
13841408
Specifies a Tcl script with commands to run after PDN generation.
13851409
stages:
13861410
- floorplan
1411+
type: file
13871412
POST_RESIZE_TCL:
13881413
description: |
13891414
Specifies a Tcl script with commands to run after resize.
@@ -1477,6 +1502,7 @@ PRE_TAPCELL_TCL:
14771502
FASTROUTE_TCL:
14781503
description: |
14791504
Specifies a Tcl script with commands to run before FastRoute.
1505+
type: file
14801506
USE_FILL:
14811507
description: >
14821508
Whether to perform metal density filling.
@@ -1494,6 +1520,7 @@ PRE_GLOBAL_ROUTE_TCL:
14941520
Specifies a Tcl script with commands to run before global route.
14951521
stages:
14961522
- grt
1523+
type: file
14971524
GLOBAL_ROUTE_ARGS:
14981525
description: >
14991526
Replaces default arguments for global route. The -congestion_iterations
@@ -1679,11 +1706,20 @@ FOOTPRINT:
16791706
Custom footprint definition file for ICeWall-based floorplan initialization. Mutually exclusive with FLOORPLAN_DEF or DIE_AREA/CORE_AREA or CORE_UTILIZATION.
16801707
stages:
16811708
- floorplan
1709+
type: file
1710+
SIG_MAP_FILE:
1711+
description: |
1712+
Signal map file for ICeWall-based floorplan initialization: the signal
1713+
each pad of the FOOTPRINT file connects to.
1714+
stages:
1715+
- floorplan
1716+
type: file
16821717
FOOTPRINT_TCL:
16831718
description: |
16841719
Specifies a Tcl script with custom footprint-related commands for floorplan setup.
16851720
stages:
16861721
- floorplan
1722+
type: file
16871723
FLOW_INPUT_VARIANT:
16881724
description: >
16891725
Flow variant a stage reads the previous stage's result from, the
@@ -1836,6 +1872,7 @@ CDL_FILE:
18361872
for generating Circuit Description Language output.
18371873
stages:
18381874
- final
1875+
type: file
18391876
OPT_POST_GRT_WNS:
18401877
default: 1
18411878
description: >

‎flow/test/test_make_issue.py‎

Lines changed: 60 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,29 @@ def test_adjacent_variables_stay_separate(self):
255255
for name in ["dff.lib", "a.lib", "b.lib"]:
256256
self.assertIn(name, files)
257257

258-
def test_every_design_and_platform_variable_is_archived(self):
258+
def test_every_file_variable_is_archived(self):
259259
variables = {
260-
name: f"{name.lower()}.file"
261-
for name in makeIssue.DESIGN_FILE_VARS + makeIssue.PLATFORM_FILE_VARS
260+
name: f"{name.lower()}.file" for name in makeIssue.file_variables()
262261
}
263262
files = self.files(**variables)
264263
for name, path in variables.items():
265264
self.assertIn(path, files, name)
266265

266+
def test_other_variables_are_not_archived(self):
267+
self.assertNotIn("gcd.v", self.files(DESIGN_NAME="gcd.v"))
268+
269+
def test_a_file_variable_needs_only_its_variables_yaml_entry(self):
270+
variables_yaml = os.path.join(self.stub.tmp, "variables.yaml")
271+
self.stub.write(
272+
variables_yaml,
273+
"NEW_FILE:\n description: x\n type: file\n"
274+
"NEW_NUMBER:\n description: y\n type: int\n",
275+
)
276+
with mock.patch.object(makeIssue, "VARIABLES_YAML", variables_yaml):
277+
files = self.files(NEW_FILE="new.file", NEW_NUMBER="new.number")
278+
self.assertIn("new.file", files)
279+
self.assertNotIn("new.number", files)
280+
267281
def test_a_glob_names_the_files_it_matches(self):
268282
extra = os.path.join(self.stub.platform_dir, "extra")
269283
for name in ["a.v", "b.v"]:
@@ -283,10 +297,26 @@ def test_the_issue_files_are_archived(self):
283297
]:
284298
self.assertIn(name, files)
285299

286-
def test_exclude_platform_leaves_out_platform_variables(self):
287-
files = self.files(EXCLUDE_PLATFORM="1", LIB_FILES="a.lib", SDC_FILE="d.sdc")
288-
self.assertNotIn("a.lib", files)
289-
self.assertIn("d.sdc", files)
300+
def test_exclude_platform_leaves_out_the_platform_files(self):
301+
"""By where a file is, not by which variable names it: a design
302+
variable may name a platform file and a platform variable a file
303+
of the design's own."""
304+
platform_lib = os.path.join(self.stub.platform_dir, "cells.lib")
305+
platform_dff = os.path.join(self.stub.platform_dir, "dff.lib")
306+
macro_lef = os.path.join(self.stub.design_dir, "macro.lef")
307+
sdc = os.path.join(self.stub.design_dir, "constraint.sdc")
308+
files = self.files(
309+
EXCLUDE_PLATFORM="1",
310+
LIB_FILES=platform_lib,
311+
DFF_LIB_FILE=platform_dff,
312+
ADDITIONAL_LEFS=macro_lef,
313+
SDC_FILE=sdc,
314+
)
315+
self.assertNotIn(platform_lib, files)
316+
self.assertNotIn(platform_dff, files)
317+
self.assertIn(macro_lef, files)
318+
self.assertIn(sdc, files)
319+
self.assertFalse([f for f in files if f.startswith(self.stub.platform_dir)])
290320

291321
def test_archived_end_to_end(self):
292322
lib = os.path.join(self.stub.platform_dir, "dff.lib")
@@ -304,14 +334,17 @@ def test_archived_end_to_end(self):
304334

305335

306336
class TestFileVariableNames(unittest.TestCase):
307-
"""The file variables makeIssue archives are variables the flow reads.
308-
A flow variable that is renamed or retired takes makeIssue's list with
309-
it (SYNTH_NETLIST_FILES #2899, PRE_GLOBAL_ROUTE_TCL #3333,
337+
"""Which flow variables name files is said once, in variables.yaml
338+
(`type: file`), and each of them is a variable the flow reads. A flow
339+
variable that is renamed or retired takes its entry with it
340+
(SYNTH_NETLIST_FILES #2899, PRE_GLOBAL_ROUTE_TCL #3333,
310341
MACRO_PLACEMENT_TCL #3469, GLOBAL_CONNECT_TCL #4785); a name left
311342
behind silently archives nothing."""
312343

313344
FLOW = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
314345
SOURCES = [".tcl", ".mk", ".py", ".sh", ".yaml", ".cfg"]
346+
# where the names are listed rather than read
347+
LISTS = ["makeIssue.py", "variables.yaml"]
315348

316349
def flow_text(self):
317350
texts = []
@@ -323,20 +356,33 @@ def flow_text(self):
323356
else [os.path.join(d, f) for d, _, fs in os.walk(top) for f in fs]
324357
)
325358
for path in paths:
326-
if os.path.basename(path) == "makeIssue.py":
359+
if os.path.basename(path) in self.LISTS:
327360
continue
328361
if path != top and os.path.splitext(path)[1] not in self.SOURCES:
329362
continue
330363
with open(path, errors="replace") as f:
331364
texts.append(f.read())
332365
return "\n".join(texts)
333366

334-
def test_every_file_variable_is_read_by_the_flow(self):
367+
def test_there_are_file_variables(self):
368+
self.assertIn("VERILOG_FILES", makeIssue.file_variables())
369+
370+
def read_names(self):
371+
"""The names the flow reads: those its sources spell out, the
372+
hooks `source_step_tcl PRE CTS` composes (PRE_CTS_TCL), and
373+
ADDITIONAL_FILES, which only make issue reads."""
335374
text = self.flow_text()
375+
hooks = re.findall(r"source_step_tcl\s+(\w+)\s+(\w+)", text)
376+
return text, {f"{kind}_{step}_TCL" for kind, step in hooks} | {
377+
"ADDITIONAL_FILES"
378+
}
379+
380+
def test_every_file_variable_is_read_by_the_flow(self):
381+
text, names = self.read_names()
336382
unread = [
337383
name
338-
for name in makeIssue.DESIGN_FILE_VARS + makeIssue.PLATFORM_FILE_VARS
339-
if not re.search(r"\b" + name + r"\b", text)
384+
for name in makeIssue.file_variables()
385+
if name not in names and not re.search(r"\b" + name + r"\b", text)
340386
]
341387
self.assertEqual(unread, [])
342388

0 commit comments

Comments
 (0)