librelane 3.0.0.dev34__py3-none-any.whl → 3.0.0.dev37__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of librelane might be problematic. Click here for more details.

librelane/flows/cli.py CHANGED
@@ -1,3 +1,7 @@
1
+ # Copyright 2025 LibreLane Contributors
2
+ #
3
+ # Adapted from OpenLane 2
4
+ #
1
5
  # Copyright 2023 Efabless Corporation
2
6
  #
3
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,6 +16,7 @@
12
16
  # See the License for the specific language governing permissions and
13
17
  # limitations under the License.
14
18
  import os
19
+ import sys
15
20
  from functools import partial, wraps
16
21
  from concurrent.futures import ThreadPoolExecutor
17
22
  from typing import Optional, Union
@@ -21,12 +26,15 @@ from click import (
21
26
  Parameter,
22
27
  echo,
23
28
  )
29
+ from click.formatting import join_options
24
30
  from cloup import (
25
31
  option,
26
32
  argument,
27
33
  option_group,
28
34
  Choice,
29
- Path,
35
+ Argument,
36
+ Option as CloupOption,
37
+ Path as CloupPath,
30
38
  )
31
39
  from cloup.constraints import (
32
40
  mutually_exclusive,
@@ -39,6 +47,70 @@ from ..logging import set_log_level, verbose, err, options, LogLevels
39
47
  from ..state import State, InvalidState
40
48
 
41
49
 
50
+ class Option(CloupOption):
51
+ """
52
+ A slight modification of cloup.Option that consumes the environment
53
+ variable(s) in envvar upon use.
54
+ """
55
+
56
+ def resolve_envvar_value(self, ctx: Context) -> Optional[str]:
57
+ if self.envvar is None:
58
+ return None
59
+ evs = self.envvar
60
+ if isinstance(evs, str):
61
+ evs = [evs]
62
+ for envvar in self.envvar:
63
+ rv = os.environ.pop(envvar, None)
64
+ if rv:
65
+ return rv
66
+ return None
67
+
68
+
69
+ class Path(CloupPath):
70
+ """
71
+ A modification of cloup.Path that rejects paths starting with a tilde (~)
72
+ as too ambiguous. This is because of user confusion.
73
+ """
74
+
75
+ def convert(
76
+ self,
77
+ value: Union[str, os.PathLike],
78
+ param: Optional[Parameter],
79
+ ctx: Optional[Context],
80
+ ):
81
+ value = str(value)
82
+ assert param is not None
83
+ assert ctx is not None
84
+
85
+ is_cmd = False
86
+ if sys.platform == "win32":
87
+ import psutil
88
+
89
+ is_cmd = psutil.Process(os.getppid()).name().lower().endswith("cmd.exe")
90
+ if not is_cmd and value.startswith("~"):
91
+ usage, _ = join_options(param.opts)
92
+ if isinstance(param, Argument):
93
+ usage = ""
94
+ buffer = f"'{value}' starts with a tilde, which is ambiguous.\n"
95
+ buffer += " * If you meant your home directory, make sure your POSIX shell is able to expand the tilde:\n"
96
+ buffer += f" * GOOD: {ctx.command_path} {usage} {value} …\n"
97
+ if usage != "":
98
+ buffer += f" * BAD: {ctx.command_path} {usage}={value} …\n"
99
+ buffer += f' * BAD: {ctx.command_path} {usage} "{value}" …\n'
100
+ env_vars = []
101
+ if param.envvar is not None:
102
+ if isinstance(param.envvar, str):
103
+ env_vars = [param.envvar]
104
+ else:
105
+ env_vars = list(param.envvar)
106
+ for var in env_vars:
107
+ buffer += f" * GOOD: {var}={value} {ctx.command_path} …\n"
108
+ buffer += f' * BAD: {var}="{value}" {ctx.command_path} …\n'
109
+ buffer += ' * If you want a relative file or directory that starts with a literal "~", use an absolute path.\n'
110
+ self.fail(buffer, param, ctx)
111
+ return super().convert(value, param, ctx)
112
+
113
+
42
114
  def set_log_level_cb(
43
115
  ctx: Context,
44
116
  param: Parameter,
@@ -181,7 +253,7 @@ def cloup_flow_opts(
181
253
  Ciel is used by default for this CLI or not.
182
254
  :returns: The wrapper
183
255
  """
184
- o = partial(option, show_default=True)
256
+ o = partial(option, cls=CloupOption, show_default=True)
185
257
 
186
258
  def decorate(f):
187
259
  if config_options:
@@ -355,21 +427,23 @@ def cloup_flow_opts(
355
427
  dir_okay=True,
356
428
  ),
357
429
  is_eager=True,
358
- default=os.environ.pop("PDK_ROOT", None),
430
+ envvar=["PDK_ROOT"],
359
431
  help="Override Ciel PDK root folder. Required if Ciel is not installed, but a default value can also be set via the environment variable PDK_ROOT.",
360
432
  ),
361
433
  o(
362
434
  "-p",
363
435
  "--pdk",
364
436
  type=str,
365
- default=os.environ.pop("PDK", "sky130A"),
437
+ envvar=["PDK"],
438
+ default="sky130A",
366
439
  help="The process design kit to use.",
367
440
  ),
368
441
  o(
369
442
  "-s",
370
443
  "--scl",
371
444
  type=str,
372
- default=os.environ.pop("STD_CELL_LIBRARY", None),
445
+ envvar=["STD_CELL_LIBRARY"],
446
+ # no default, default is obtained dynamically from PDK
373
447
  help="The standard cell library to use. If None, the PDK's default standard cell library is used.",
374
448
  ),
375
449
  )(f)
@@ -63,28 +63,27 @@ proc get_buflist {} {
63
63
  set arg_list [list]
64
64
  lappend arg_list -buf_list [get_buflist]
65
65
  lappend arg_list -root_buf $::env(CTS_ROOT_BUFFER)
66
- lappend arg_list -sink_clustering_size $::env(CTS_SINK_CLUSTERING_SIZE)
67
- lappend arg_list -sink_clustering_max_diameter $::env(CTS_SINK_CLUSTERING_MAX_DIAMETER)
68
- lappend arg_list -sink_clustering_enable
66
+
67
+ append_if_exists_argument arg_list CTS_SINK_CLUSTERING_SIZE -sink_clustering_size
68
+ append_if_exists_argument arg_list CTS_SINK_CLUSTERING_MAX_DIAMETER -sink_clustering_max_diameter
69
+ append_if_flag arg_list CTS_SINK_CLUSTERING_ENABLE -sink_clustering_enable
70
+ append_if_exists_argument arg_list CTS_MACRO_CLUSTERING_SIZE -macro_clustering_size
71
+ append_if_exists_argument arg_list CTS_MACRO_CLUSTERING_MAX_DIAMETER -macro_clustering_max_diameter
72
+ append_if_flag arg_list CTS_DISABLE_POST_PROCESSING -post_cts_disable
73
+ append_if_flag arg_list CTS_OBSTRUCTION_AWARE -obstruction_aware
74
+ append_if_flag arg_list CTS_BALANCE_LEVELS -balance_levels
69
75
 
70
76
  if { $::env(CTS_DISTANCE_BETWEEN_BUFFERS) != 0 } {
71
77
  lappend arg_list -distance_between_buffers $::env(CTS_DISTANCE_BETWEEN_BUFFERS)
72
78
  }
73
- if { $::env(CTS_DISABLE_POST_PROCESSING) } {
74
- lappend arg_list -post_cts_disable
75
- }
76
- if { [info exists ::env(CTS_OBSTRUCTION_AWARE)] && $::env(CTS_OBSTRUCTION_AWARE) } {
77
- lappend arg_list -obstruction_aware
78
- }
79
+
79
80
  if { [info exists ::env(CTS_SINK_BUFFER_MAX_CAP_DERATE_PCT)] } {
80
81
  lappend arg_list -sink_buffer_max_cap_derate [expr $::env(CTS_SINK_BUFFER_MAX_CAP_DERATE_PCT) / 100.0]
81
82
  }
83
+
82
84
  if { [info exists ::env(CTS_DELAY_BUFFER_DERATE_PCT)] } {
83
85
  lappend arg_list -delay_buffer_derate [expr $::env(CTS_DELAY_BUFFER_DERATE_PCT) / 100]
84
86
  }
85
- if { [info exists ::env(CTS_BALANCE_LEVELS)] && $::env(CTS_BALANCE_LEVELS) } {
86
- lappend arg_list -balance_levels
87
- }
88
87
 
89
88
  log_cmd clock_tree_synthesis {*}$arg_list
90
89
 
@@ -2265,17 +2265,33 @@ class CTS(OpenROADStep):
2265
2265
  "Enables obstruction-aware buffering such that clock buffers are not placed on top of blockages or hard macros. "
2266
2266
  + "This option may reduce legalizer displacement, leading to better latency, skew or timing QoR.",
2267
2267
  ),
2268
+ Variable(
2269
+ "CTS_SINK_CLUSTERING_ENABLE",
2270
+ bool,
2271
+ "Enables pre-clustering of sinks to create one level of sub-tree before building the H-tree. "
2272
+ + "Each cluster is driven by a buffer which becomes the end point of the H-tree structure.",
2273
+ default=True,
2274
+ ),
2268
2275
  Variable(
2269
2276
  "CTS_SINK_CLUSTERING_SIZE",
2270
- int,
2277
+ Optional[int],
2271
2278
  "Specifies the maximum number of sinks per cluster.",
2272
- default=25,
2273
2279
  ),
2274
2280
  Variable(
2275
2281
  "CTS_SINK_CLUSTERING_MAX_DIAMETER",
2276
- Decimal,
2277
- "Specifies maximum diameter of the sink cluster.",
2278
- default=50,
2282
+ Optional[Decimal],
2283
+ "Specifies the maximum diameter of the sink cluster.",
2284
+ units="µm",
2285
+ ),
2286
+ Variable(
2287
+ "CTS_MACRO_CLUSTERING_SIZE",
2288
+ Optional[int],
2289
+ "Specifies the maximum number of sinks per cluster for the macro tree.",
2290
+ ),
2291
+ Variable(
2292
+ "CTS_MACRO_CLUSTERING_MAX_DIAMETER",
2293
+ Optional[Decimal],
2294
+ "Specifies the maximum diameter of the sink cluster for the macro tree.",
2279
2295
  units="µm",
2280
2296
  ),
2281
2297
  Variable(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: librelane
3
- Version: 3.0.0.dev34
3
+ Version: 3.0.0.dev37
4
4
  Summary: An infrastructure for implementing chip design flows
5
5
  Home-page: https://github.com/librelane/librelane
6
6
  License: Apache-2.0
@@ -42,7 +42,7 @@ librelane/examples/spm-user_project_wrapper/user_project_wrapper.v,sha256=zc6GC5
42
42
  librelane/flows/__init__.py,sha256=ghtmUG-taVpHJ3CKJRYZGn3dU0r93araT1EIGlBEsxg,896
43
43
  librelane/flows/builtins.py,sha256=tR14Qc1ZUey2w-Ar4DWOvxuP7LGPtMecCJq8WgcYJpk,773
44
44
  librelane/flows/classic.py,sha256=JB9gVgP2hHPhMuCJg7hvoj2BvJcvRec7suEXPgHmz14,10971
45
- librelane/flows/cli.py,sha256=_aJjlalCsmUeLiqy1D8VFmBJ0dLelx24erqaK2q-AOs,16706
45
+ librelane/flows/cli.py,sha256=cW_S12VZqNVaWNcMlAKOVfbCALgl1AG_8rqvTcsvBDY,19324
46
46
  librelane/flows/flow.py,sha256=1zRhYQvnRte-VNcsVmAkikD_kZJVbgsqgLR-8CGYaLI,37034
47
47
  librelane/flows/misc.py,sha256=32Om3isexesfKKiJZCajNmINc-xdv7eVx_tgoh9SR6U,2015
48
48
  librelane/flows/optimizing.py,sha256=OwZz6WGmXpliwO8vtmhjKHD-kzDyNv-zoCECZIigXsI,6076
@@ -116,7 +116,7 @@ librelane/scripts/openroad/common/set_layer_adjustments.tcl,sha256=xqAIDXsTa1_Js
116
116
  librelane/scripts/openroad/common/set_power_nets.tcl,sha256=_2n2AKl8UTh9-KeUOOwKaeyRw_4zi1Ifgh8oa9HIWc4,1253
117
117
  librelane/scripts/openroad/common/set_rc.tcl,sha256=oJJCQG9RvAltgB5KTFsJcCzVvwUIkXeI7KJehCEWex0,7224
118
118
  librelane/scripts/openroad/common/set_routing_layers.tcl,sha256=fCQsIjcFRsHJPFQvk87ta4mPj-gl27KLOCK3SNXH0jM,1335
119
- librelane/scripts/openroad/cts.tcl,sha256=703n6gGekpOXbRhr390DSBIo4h7qNlHUd-Amai4pGgk,3888
119
+ librelane/scripts/openroad/cts.tcl,sha256=QJHK7qsSXSg0L2Rj91Y53h9Immdkyo-9xaGDApQvtbY,3992
120
120
  librelane/scripts/openroad/cut_rows.tcl,sha256=8RN4_muN1FXkXCU1VGVI_nox3BQNVGVNlQn_21HRCKM,1403
121
121
  librelane/scripts/openroad/dpl.tcl,sha256=U5iTPBf7H4w3cmCM8-yTjLTVr8npwc5G7hVuszljCVc,777
122
122
  librelane/scripts/openroad/drt.tcl,sha256=xIBTKJ1HwcvsVCLZW5nMkK6JV7wIskSw9CTHNEqOXcE,3138
@@ -160,14 +160,14 @@ librelane/steps/magic.py,sha256=Cc_qApOgeltIn7lKA7dBQ4Ud9EQtbMatsuGPEvqvpcQ,2118
160
160
  librelane/steps/misc.py,sha256=8ubCvFeFEspXrgnzNWINY5-TXTyalNtlvcX8TSw0qdg,5685
161
161
  librelane/steps/netgen.py,sha256=R9sDWv-9wKMdi2rkuLQdOc4uLlbYhXcKKd6WsZsnLt0,8953
162
162
  librelane/steps/odb.py,sha256=-zsXi0jVdtfBfAJI0OC4x1jI_B2OX5YVn4uAn6NyFdk,38424
163
- librelane/steps/openroad.py,sha256=hgpqsVQi7tFRlj75zefQkD3Vdmq21ubZAFWyU12WxUg,99586
163
+ librelane/steps/openroad.py,sha256=0UZDYTqKHOvkqXTEb44HaesaZ8d4GS-6gUahtjDc-m4,100355
164
164
  librelane/steps/openroad_alerts.py,sha256=IJyB4piBDCKXhkJswHGMYCRDwbdQsR0GZlrGGDhmW6Q,3364
165
165
  librelane/steps/pyosys.py,sha256=BzTUYCFxXJWtHqPtEPAztoWNLbDWvECWnsWVdK_lljU,23589
166
166
  librelane/steps/step.py,sha256=THIxZkhtkNYt1iRgMduD0ywrOTCaV7cCfUB2EqXN6-k,55751
167
167
  librelane/steps/tclstep.py,sha256=68AjCmbLhBscbzQDxRcPQVU-6UvZQNOalO7qNwUXCa4,10138
168
168
  librelane/steps/verilator.py,sha256=MWx2TpLqYyea9_jSeLG9c2S5ujvYERQZRFNaMhfHxZE,7916
169
169
  librelane/steps/yosys.py,sha256=lYdZPFvjcmdu_NE6rtB94_dysIK2qwGdGb480W6pg2w,12711
170
- librelane-3.0.0.dev34.dist-info/METADATA,sha256=qoArrX0bEBJJAvuN8-edEBPE33CRzB_XIie0ZtGxTJo,6561
171
- librelane-3.0.0.dev34.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
172
- librelane-3.0.0.dev34.dist-info/entry_points.txt,sha256=0eZs2NOH-w-W_GVRCs-ualst26XplkPpJkOnGWMaFw0,306
173
- librelane-3.0.0.dev34.dist-info/RECORD,,
170
+ librelane-3.0.0.dev37.dist-info/METADATA,sha256=XRDuS9Fu4WGt0zMRqNHRl_0gut_L7opE_WwTnhfUIVs,6561
171
+ librelane-3.0.0.dev37.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
172
+ librelane-3.0.0.dev37.dist-info/entry_points.txt,sha256=0eZs2NOH-w-W_GVRCs-ualst26XplkPpJkOnGWMaFw0,306
173
+ librelane-3.0.0.dev37.dist-info/RECORD,,