librelane 2.4.0__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.

Files changed (170) hide show
  1. librelane/__init__.py +38 -0
  2. librelane/__main__.py +479 -0
  3. librelane/__version__.py +43 -0
  4. librelane/common/__init__.py +63 -0
  5. librelane/common/cli.py +75 -0
  6. librelane/common/drc.py +246 -0
  7. librelane/common/generic_dict.py +319 -0
  8. librelane/common/metrics/__init__.py +35 -0
  9. librelane/common/metrics/__main__.py +413 -0
  10. librelane/common/metrics/library.py +354 -0
  11. librelane/common/metrics/metric.py +186 -0
  12. librelane/common/metrics/util.py +279 -0
  13. librelane/common/misc.py +456 -0
  14. librelane/common/ring_buffer.py +63 -0
  15. librelane/common/tcl.py +80 -0
  16. librelane/common/toolbox.py +549 -0
  17. librelane/common/tpe.py +41 -0
  18. librelane/common/types.py +116 -0
  19. librelane/config/__init__.py +32 -0
  20. librelane/config/__main__.py +155 -0
  21. librelane/config/config.py +1025 -0
  22. librelane/config/flow.py +490 -0
  23. librelane/config/pdk_compat.py +255 -0
  24. librelane/config/preprocessor.py +464 -0
  25. librelane/config/removals.py +45 -0
  26. librelane/config/variable.py +743 -0
  27. librelane/container.py +285 -0
  28. librelane/env_info.py +320 -0
  29. librelane/examples/spm/config.yaml +33 -0
  30. librelane/examples/spm/pin_order.cfg +14 -0
  31. librelane/examples/spm/src/impl.sdc +73 -0
  32. librelane/examples/spm/src/signoff.sdc +68 -0
  33. librelane/examples/spm/src/spm.v +73 -0
  34. librelane/examples/spm/verify/spm_tb.v +106 -0
  35. librelane/examples/spm-user_project_wrapper/SPM_example.v +286 -0
  36. librelane/examples/spm-user_project_wrapper/base_sdc_file.sdc +145 -0
  37. librelane/examples/spm-user_project_wrapper/config-tut.json +12 -0
  38. librelane/examples/spm-user_project_wrapper/config.json +13 -0
  39. librelane/examples/spm-user_project_wrapper/defines.v +66 -0
  40. librelane/examples/spm-user_project_wrapper/template.def +7656 -0
  41. librelane/examples/spm-user_project_wrapper/user_project_wrapper.v +123 -0
  42. librelane/flows/__init__.py +24 -0
  43. librelane/flows/builtins.py +18 -0
  44. librelane/flows/classic.py +327 -0
  45. librelane/flows/cli.py +463 -0
  46. librelane/flows/flow.py +1049 -0
  47. librelane/flows/misc.py +71 -0
  48. librelane/flows/optimizing.py +179 -0
  49. librelane/flows/sequential.py +367 -0
  50. librelane/flows/synth_explore.py +173 -0
  51. librelane/help/__main__.py +39 -0
  52. librelane/logging/__init__.py +40 -0
  53. librelane/logging/logger.py +323 -0
  54. librelane/open_pdks_rev +1 -0
  55. librelane/plugins.py +21 -0
  56. librelane/py.typed +0 -0
  57. librelane/scripts/base.sdc +80 -0
  58. librelane/scripts/klayout/Readme.md +2 -0
  59. librelane/scripts/klayout/open_design.py +63 -0
  60. librelane/scripts/klayout/render.py +121 -0
  61. librelane/scripts/klayout/stream_out.py +176 -0
  62. librelane/scripts/klayout/xml_drc_report_to_json.py +45 -0
  63. librelane/scripts/klayout/xor.drc +120 -0
  64. librelane/scripts/magic/Readme.md +1 -0
  65. librelane/scripts/magic/common/read.tcl +114 -0
  66. librelane/scripts/magic/def/antenna_check.tcl +35 -0
  67. librelane/scripts/magic/def/mag.tcl +19 -0
  68. librelane/scripts/magic/def/mag_gds.tcl +79 -0
  69. librelane/scripts/magic/drc.tcl +78 -0
  70. librelane/scripts/magic/extract_spice.tcl +98 -0
  71. librelane/scripts/magic/gds/drc_batch.tcl +74 -0
  72. librelane/scripts/magic/gds/erase_box.tcl +32 -0
  73. librelane/scripts/magic/gds/extras_mag.tcl +45 -0
  74. librelane/scripts/magic/gds/mag_with_pointers.tcl +31 -0
  75. librelane/scripts/magic/get_bbox.tcl +11 -0
  76. librelane/scripts/magic/lef/extras_maglef.tcl +61 -0
  77. librelane/scripts/magic/lef/maglef.tcl +26 -0
  78. librelane/scripts/magic/lef.tcl +57 -0
  79. librelane/scripts/magic/open.tcl +28 -0
  80. librelane/scripts/magic/wrapper.tcl +21 -0
  81. librelane/scripts/netgen/setup.tcl +28 -0
  82. librelane/scripts/odbpy/apply_def_template.py +49 -0
  83. librelane/scripts/odbpy/cell_frequency.py +107 -0
  84. librelane/scripts/odbpy/check_antenna_properties.py +116 -0
  85. librelane/scripts/odbpy/contextualize.py +109 -0
  86. librelane/scripts/odbpy/defutil.py +573 -0
  87. librelane/scripts/odbpy/diodes.py +373 -0
  88. librelane/scripts/odbpy/disconnected_pins.py +305 -0
  89. librelane/scripts/odbpy/eco_buffer.py +181 -0
  90. librelane/scripts/odbpy/eco_diode.py +139 -0
  91. librelane/scripts/odbpy/filter_unannotated.py +100 -0
  92. librelane/scripts/odbpy/io_place.py +482 -0
  93. librelane/scripts/odbpy/ioplace_parser/__init__.py +23 -0
  94. librelane/scripts/odbpy/ioplace_parser/parse.py +147 -0
  95. librelane/scripts/odbpy/label_macro_pins.py +277 -0
  96. librelane/scripts/odbpy/lefutil.py +97 -0
  97. librelane/scripts/odbpy/placers.py +162 -0
  98. librelane/scripts/odbpy/power_utils.py +397 -0
  99. librelane/scripts/odbpy/random_place.py +57 -0
  100. librelane/scripts/odbpy/reader.py +250 -0
  101. librelane/scripts/odbpy/remove_buffers.py +173 -0
  102. librelane/scripts/odbpy/snap_to_grid.py +57 -0
  103. librelane/scripts/odbpy/wire_lengths.py +93 -0
  104. librelane/scripts/openroad/antenna_check.tcl +20 -0
  105. librelane/scripts/openroad/antenna_repair.tcl +31 -0
  106. librelane/scripts/openroad/basic_mp.tcl +24 -0
  107. librelane/scripts/openroad/buffer_list.tcl +10 -0
  108. librelane/scripts/openroad/common/dpl.tcl +24 -0
  109. librelane/scripts/openroad/common/dpl_cell_pad.tcl +26 -0
  110. librelane/scripts/openroad/common/grt.tcl +32 -0
  111. librelane/scripts/openroad/common/io.tcl +540 -0
  112. librelane/scripts/openroad/common/pdn_cfg.tcl +135 -0
  113. librelane/scripts/openroad/common/resizer.tcl +103 -0
  114. librelane/scripts/openroad/common/set_global_connections.tcl +78 -0
  115. librelane/scripts/openroad/common/set_layer_adjustments.tcl +31 -0
  116. librelane/scripts/openroad/common/set_power_nets.tcl +30 -0
  117. librelane/scripts/openroad/common/set_rc.tcl +75 -0
  118. librelane/scripts/openroad/common/set_routing_layers.tcl +30 -0
  119. librelane/scripts/openroad/cts.tcl +80 -0
  120. librelane/scripts/openroad/cut_rows.tcl +24 -0
  121. librelane/scripts/openroad/dpl.tcl +24 -0
  122. librelane/scripts/openroad/drt.tcl +37 -0
  123. librelane/scripts/openroad/fill.tcl +30 -0
  124. librelane/scripts/openroad/floorplan.tcl +145 -0
  125. librelane/scripts/openroad/gpl.tcl +88 -0
  126. librelane/scripts/openroad/grt.tcl +30 -0
  127. librelane/scripts/openroad/gui.tcl +37 -0
  128. librelane/scripts/openroad/insert_buffer.tcl +127 -0
  129. librelane/scripts/openroad/ioplacer.tcl +67 -0
  130. librelane/scripts/openroad/irdrop.tcl +51 -0
  131. librelane/scripts/openroad/pdn.tcl +52 -0
  132. librelane/scripts/openroad/rcx.tcl +32 -0
  133. librelane/scripts/openroad/repair_design.tcl +70 -0
  134. librelane/scripts/openroad/repair_design_postgrt.tcl +48 -0
  135. librelane/scripts/openroad/rsz_timing_postcts.tcl +68 -0
  136. librelane/scripts/openroad/rsz_timing_postgrt.tcl +70 -0
  137. librelane/scripts/openroad/sta/check_macro_instances.tcl +53 -0
  138. librelane/scripts/openroad/sta/corner.tcl +393 -0
  139. librelane/scripts/openroad/tapcell.tcl +25 -0
  140. librelane/scripts/openroad/write_views.tcl +27 -0
  141. librelane/scripts/pyosys/construct_abc_script.py +177 -0
  142. librelane/scripts/pyosys/json_header.py +84 -0
  143. librelane/scripts/pyosys/synthesize.py +493 -0
  144. librelane/scripts/pyosys/ys_common.py +153 -0
  145. librelane/scripts/tclsh/hello.tcl +1 -0
  146. librelane/state/__init__.py +24 -0
  147. librelane/state/__main__.py +61 -0
  148. librelane/state/design_format.py +195 -0
  149. librelane/state/state.py +359 -0
  150. librelane/steps/__init__.py +61 -0
  151. librelane/steps/__main__.py +510 -0
  152. librelane/steps/checker.py +637 -0
  153. librelane/steps/common_variables.py +340 -0
  154. librelane/steps/cvc_rv.py +169 -0
  155. librelane/steps/klayout.py +509 -0
  156. librelane/steps/magic.py +576 -0
  157. librelane/steps/misc.py +160 -0
  158. librelane/steps/netgen.py +253 -0
  159. librelane/steps/odb.py +1088 -0
  160. librelane/steps/openroad.py +2460 -0
  161. librelane/steps/openroad_alerts.py +102 -0
  162. librelane/steps/pyosys.py +640 -0
  163. librelane/steps/step.py +1571 -0
  164. librelane/steps/tclstep.py +288 -0
  165. librelane/steps/verilator.py +222 -0
  166. librelane/steps/yosys.py +371 -0
  167. librelane-2.4.0.dist-info/METADATA +169 -0
  168. librelane-2.4.0.dist-info/RECORD +170 -0
  169. librelane-2.4.0.dist-info/WHEEL +4 -0
  170. librelane-2.4.0.dist-info/entry_points.txt +9 -0
@@ -0,0 +1,255 @@
1
+ # Copyright 2023 Efabless Corporation
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ import os
15
+ import re
16
+ from glob import glob
17
+ from typing import Any, List, Mapping, Dict
18
+
19
+
20
+ def migrate_old_config(config: Mapping[str, Any]) -> Dict[str, Any]:
21
+ new = dict(config)
22
+
23
+ # 1. Migrate SYNTH_DRIVING_CELL
24
+ if "SYNTH_DRIVING_CELL_PIN" in new:
25
+ del new["SYNTH_DRIVING_CELL"]
26
+ del new["SYNTH_DRIVING_CELL_PIN"]
27
+ new["SYNTH_DRIVING_CELL"] = (
28
+ f"{config['SYNTH_DRIVING_CELL']}/{config['SYNTH_DRIVING_CELL_PIN']}"
29
+ )
30
+
31
+ # 2. Migrate SYNTH_TIE{HI,LO}_CELL
32
+ if "SYNTH_TIEHI_PORT" in new:
33
+ del new["SYNTH_TIEHI_PORT"]
34
+ new["SYNTH_TIEHI_CELL"] = "/".join(config["SYNTH_TIEHI_PORT"].split(" "))
35
+
36
+ if "SYNTH_TIELO_PORT" in new:
37
+ del new["SYNTH_TIELO_PORT"]
38
+ new["SYNTH_TIELO_CELL"] = "/".join(config["SYNTH_TIELO_PORT"].split(" "))
39
+
40
+ # 3. Migrate SYNTH_BUFFER_CELL
41
+ if "SYNTH_MIN_BUF_PORT" in new:
42
+ del new["SYNTH_MIN_BUF_PORT"]
43
+ new["SYNTH_BUFFER_CELL"] = "/".join(config["SYNTH_MIN_BUF_PORT"].split(" "))
44
+
45
+ # 4. Migrate DIODE_CELL
46
+ if "DIODE_CELL_PIN" in new:
47
+ new["DIODE_CELL"] = f"{config['DIODE_CELL']}/{config['DIODE_CELL_PIN']}"
48
+ del new["DIODE_CELL_PIN"]
49
+
50
+ # 5. Interconnect Corners
51
+ if "RCX_RULESETS" not in new and config.get("RCX_RULES") is not None:
52
+ new["RCX_RULESETS"] = f"nom_* \"{config['RCX_RULES']}\""
53
+ if config.get("RCX_RULES_MIN") is not None:
54
+ new["RCX_RULESETS"] += f" min_* \"{config['RCX_RULES_MIN']}\""
55
+ if config.get("RCX_RULES_MAX") is not None:
56
+ new["RCX_RULESETS"] += f" max_* \"{config['RCX_RULES_MAX']}\""
57
+ if "RCX_RULES" in new:
58
+ del new["RCX_RULES"]
59
+ if "RCX_RULES_MIN" in new:
60
+ del new["RCX_RULES_MIN"]
61
+ if "RCX_RULES_MAX" in new:
62
+ del new["RCX_RULES_MAX"]
63
+
64
+ if "TECH_LEFS" not in new and config.get("TECH_LEF") is not None:
65
+ new["TECH_LEFS"] = f"nom_* \"{config['TECH_LEF']}\""
66
+ if config.get("TECH_LEF_MIN") is not None:
67
+ new["TECH_LEFS"] += f" min_* \"{config['TECH_LEF_MIN']}\""
68
+ if config.get("TECH_LEF_MAX") is not None:
69
+ new["TECH_LEFS"] += f" max_* \"{config['TECH_LEF_MAX']}\""
70
+ if "TECH_LEF" in new:
71
+ del new["TECH_LEF"]
72
+ if "TECH_LEF_MIN" in new:
73
+ del new["TECH_LEF_MIN"]
74
+ if "TECH_LEF_MAX" in new:
75
+ del new["TECH_LEF_MAX"]
76
+
77
+ # 7. RC
78
+ if "SYNTH_CAP_LOAD" in config:
79
+ new["OUTPUT_CAP_LOAD"] = config["SYNTH_CAP_LOAD"]
80
+ del new["SYNTH_CAP_LOAD"]
81
+
82
+ if "DATA_WIRE_RC_LAYER" in config:
83
+ del new["DATA_WIRE_RC_LAYER"]
84
+
85
+ if "CLOCK_WIRE_RC_LAYER" in config:
86
+ del new["CLOCK_WIRE_RC_LAYER"]
87
+
88
+ # 8. Implicit Open PDK Dependencies
89
+ if "CELL_VERILOG_MODELS" not in config:
90
+ model_glob = os.path.join(
91
+ config["PDK_ROOT"],
92
+ config["PDK"],
93
+ "libs.ref",
94
+ config["STD_CELL_LIBRARY"],
95
+ "verilog",
96
+ "*.v",
97
+ )
98
+ new["CELL_VERILOG_MODELS"] = sorted(
99
+ [path for path in glob(model_glob) if "_blackbox" not in path]
100
+ )
101
+
102
+ if "CELL_BB_VERILOG_MODELS" not in config:
103
+ bb_glob = os.path.join(
104
+ config["PDK_ROOT"],
105
+ config["PDK"],
106
+ "libs.ref",
107
+ config["STD_CELL_LIBRARY"],
108
+ "verilog",
109
+ "*__blackbox*.v",
110
+ )
111
+
112
+ if blackbox_models := glob(bb_glob):
113
+ new["CELL_BB_VERILOG_MODELS"] = sorted(blackbox_models)
114
+
115
+ if "CELL_SPICE_MODELS" not in config:
116
+ spice_glob = os.path.join(
117
+ config["PDK_ROOT"],
118
+ config["PDK"],
119
+ "libs.ref",
120
+ config["STD_CELL_LIBRARY"],
121
+ "spice",
122
+ "*.spice",
123
+ )
124
+ new["CELL_SPICE_MODELS"] = sorted(glob(spice_glob))
125
+
126
+ if "CELL_MAGS" not in config:
127
+ mag_glob = os.path.join(
128
+ config["PDK_ROOT"],
129
+ config["PDK"],
130
+ "libs.ref",
131
+ config["STD_CELL_LIBRARY"],
132
+ "mag",
133
+ "*.mag",
134
+ )
135
+ new["CELL_MAGS"] = sorted(glob(mag_glob))
136
+
137
+ if "CELL_MAGLEFS" not in config:
138
+ maglef_glob = os.path.join(
139
+ config["PDK_ROOT"],
140
+ config["PDK"],
141
+ "libs.ref",
142
+ config["STD_CELL_LIBRARY"],
143
+ "maglef",
144
+ "*.mag",
145
+ )
146
+ new["CELL_MAGLEFS"] = sorted(glob(maglef_glob))
147
+
148
+ if "MAGIC_PDK_SETUP" not in config:
149
+ new["MAGIC_PDK_SETUP"] = os.path.join(
150
+ config["PDK_ROOT"],
151
+ config["PDK"],
152
+ "libs.tech",
153
+ "magic",
154
+ f"{config['PDK']}.tcl",
155
+ )
156
+
157
+ # x1. Disconnected Modules (sky130)
158
+ if new["PDK"].startswith("sky130"):
159
+ new["IGNORE_DISCONNECTED_MODULES"] = "sky130_fd_sc_hd__conb_1"
160
+
161
+ # x2. Invalid Variables (gf180mcu)
162
+ if new["PDK"].startswith("gf180mcu"):
163
+ del new["GPIO_PADS_LEF"]
164
+ del new["GPIO_PADS_VERILOG"]
165
+
166
+ del new["CARRY_SELECT_ADDER_MAP"]
167
+ del new["FULL_ADDER_MAP"]
168
+ del new["RIPPLE_CARRY_ADDER_MAP"]
169
+ del new["SYNTH_LATCH_MAP"]
170
+ del new["TRISTATE_BUFFER_MAP"]
171
+
172
+ del new["KLAYOUT_DRC_TECH_SCRIPT"]
173
+
174
+ new["SYNTH_CLK_DRIVING_CELL"] = (
175
+ f"{config['SYNTH_CLK_DRIVING_CELL']}/{config['SYNTH_DRIVING_CELL_PIN']}"
176
+ )
177
+
178
+ # x3. Timing Corners
179
+ lib_sta: Dict[str, List[str]] = {}
180
+ ws = re.compile(r"\s+")
181
+
182
+ default_pvt = ""
183
+
184
+ def process_sta(key: str):
185
+ nonlocal new, default_pvt
186
+ lib_raw = new.pop(key, None)
187
+ if lib_raw is None:
188
+ return
189
+ lib = lib_raw.strip()
190
+ lib_list = ws.split(lib)
191
+ first_lib = os.path.basename(lib_list[0])[:-4]
192
+ pvt = first_lib.split("__")[1]
193
+ if default_pvt == "":
194
+ default_pvt = pvt
195
+ corner = f"*_{pvt}"
196
+ lib_sta[corner] = lib_list
197
+
198
+ if (
199
+ new["PDK"].startswith("sky130") or new["PDK"].startswith("gf180mcu")
200
+ ) and "LIB" not in config:
201
+ process_sta("LIB_SYNTH")
202
+ process_sta("LIB_SLOWEST")
203
+ process_sta("LIB_FASTEST")
204
+
205
+ if new["PDK"].startswith("sky130"):
206
+ new["STA_CORNERS"] = [
207
+ "nom_tt_025C_1v80",
208
+ "nom_ss_100C_1v60",
209
+ "nom_ff_n40C_1v95",
210
+ "min_tt_025C_1v80",
211
+ "min_ss_100C_1v60",
212
+ "min_ff_n40C_1v95",
213
+ "max_tt_025C_1v80",
214
+ "max_ss_100C_1v60",
215
+ "max_ff_n40C_1v95",
216
+ ]
217
+ elif new["PDK"].startswith("gf180mcu"):
218
+ new["STA_CORNERS"] = [
219
+ "nom_tt_025C_5v00",
220
+ "nom_ss_125C_4v50",
221
+ "nom_ff_n40C_5v50",
222
+ "min_tt_025C_5v00",
223
+ "min_ss_125C_4v50",
224
+ "min_ff_n40C_5v50",
225
+ "max_tt_025C_5v00",
226
+ "max_ss_125C_4v50",
227
+ "max_ff_n40C_5v50",
228
+ ]
229
+
230
+ new["DEFAULT_CORNER"] = f"nom_{default_pvt}"
231
+ new["TIMING_VIOLATION_CORNERS"] = ["*tt*"]
232
+ new["LIB"] = lib_sta
233
+
234
+ # x4. Constraints (sky130/gf180mcu)
235
+ if new["PDK"].startswith("sky130") or new["PDK"].startswith("gf180mcu"):
236
+ new["MAX_FANOUT_CONSTRAINT"] = 10
237
+ new["CLOCK_UNCERTAINTY_CONSTRAINT"] = 0.25
238
+ new["CLOCK_TRANSITION_CONSTRAINT"] = 0.15
239
+ new["TIME_DERATING_CONSTRAINT"] = 5
240
+ new["IO_DELAY_CONSTRAINT"] = 20
241
+ new["FP_IO_MIN_DISTANCE"] = 3
242
+ new["FP_IO_HLENGTH"] = 4
243
+ new["FP_IO_VLENGTH"] = 4
244
+
245
+ # x5. Primary Signoff Tool
246
+ if new["PDK"].startswith("sky130") or new["PDK"].startswith("gf180mcu"):
247
+ new["PRIMARY_GDSII_STREAMOUT_TOOL"] = "magic"
248
+
249
+ # x6. Heuristic Antenna Thresholds
250
+ if new["PDK"].startswith("sky130"):
251
+ new["HEURISTIC_ANTENNA_THRESHOLD"] = 90
252
+ elif new["PDK"].startswith("gf180mcu"):
253
+ new["HEURISTIC_ANTENNA_THRESHOLD"] = 130
254
+
255
+ return new