fastdrc 0.0.1__tar.gz

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.
Files changed (116) hide show
  1. fastdrc-0.0.1/.github/FUNDING.yml +1 -0
  2. fastdrc-0.0.1/.github/workflows/ci.yml +23 -0
  3. fastdrc-0.0.1/.github/workflows/release.yml +68 -0
  4. fastdrc-0.0.1/.gitignore +33 -0
  5. fastdrc-0.0.1/LICENSE +202 -0
  6. fastdrc-0.0.1/NOTICE +2 -0
  7. fastdrc-0.0.1/PKG-INFO +220 -0
  8. fastdrc-0.0.1/README.md +202 -0
  9. fastdrc-0.0.1/docs/drawing-model.md +1448 -0
  10. fastdrc-0.0.1/docs/figures/process.json +33 -0
  11. fastdrc-0.0.1/docs/figures/rules/centre-and-sum/5-pitch.json +133 -0
  12. fastdrc-0.0.1/docs/figures/rules/centre-and-sum/6-centre-to-edge.json +185 -0
  13. fastdrc-0.0.1/docs/figures/rules/centre-and-sum/7-total.json +188 -0
  14. fastdrc-0.0.1/docs/figures/rules/edges/1-any-shape.json +70 -0
  15. fastdrc-0.0.1/docs/figures/rules/edges/2-wire.json +76 -0
  16. fastdrc-0.0.1/docs/figures/rules/edges/3-line-end.json +142 -0
  17. fastdrc-0.0.1/docs/figures/rules/edges/4-link.json +138 -0
  18. fastdrc-0.0.1/docs/from-a-manual.md +238 -0
  19. fastdrc-0.0.1/docs/img/demo/AN.1.svg +17 -0
  20. fastdrc-0.0.1/docs/img/demo/CO.1.svg +11 -0
  21. fastdrc-0.0.1/docs/img/demo/CO.2.svg +19 -0
  22. fastdrc-0.0.1/docs/img/demo/CO.3.svg +27 -0
  23. fastdrc-0.0.1/docs/img/demo/CO.4.svg +19 -0
  24. fastdrc-0.0.1/docs/img/demo/DN.1.svg +17 -0
  25. fastdrc-0.0.1/docs/img/demo/DN.2.svg +17 -0
  26. fastdrc-0.0.1/docs/img/demo/LU.1.svg +25 -0
  27. fastdrc-0.0.1/docs/img/demo/NW.1.svg +13 -0
  28. fastdrc-0.0.1/docs/img/demo/NW.2.svg +19 -0
  29. fastdrc-0.0.1/docs/img/demo/NW.3.svg +19 -0
  30. fastdrc-0.0.1/docs/img/demo/NW.4_thick.svg +19 -0
  31. fastdrc-0.0.1/docs/img/demo/NW.4_thin.svg +19 -0
  32. fastdrc-0.0.1/docs/img/demo/PO.1.svg +13 -0
  33. fastdrc-0.0.1/docs/img/demo/PO.2.svg +19 -0
  34. fastdrc-0.0.1/docs/img/demo/PO.3.svg +19 -0
  35. fastdrc-0.0.1/docs/img/demo/V1.1.svg +21 -0
  36. fastdrc-0.0.1/docs/img/demo/V1.2.svg +19 -0
  37. fastdrc-0.0.1/docs/img/edges/1-any-shape.svg +11 -0
  38. fastdrc-0.0.1/docs/img/edges/2-wire.svg +13 -0
  39. fastdrc-0.0.1/docs/img/edges/3-line-end.svg +19 -0
  40. fastdrc-0.0.1/docs/img/edges/4-link.svg +20 -0
  41. fastdrc-0.0.1/docs/img/edges/5-pitch.svg +21 -0
  42. fastdrc-0.0.1/docs/img/edges/6-centre-to-edge.svg +24 -0
  43. fastdrc-0.0.1/docs/img/edges/7-total.svg +27 -0
  44. fastdrc-0.0.1/docs/own-and-known.md +185 -0
  45. fastdrc-0.0.1/examples/demo/layout.rb +56 -0
  46. fastdrc-0.0.1/examples/demo/process.json +95 -0
  47. fastdrc-0.0.1/examples/demo/rules/1-wells/LU.1.json +190 -0
  48. fastdrc-0.0.1/examples/demo/rules/1-wells/NW.1.json +76 -0
  49. fastdrc-0.0.1/examples/demo/rules/1-wells/NW.2.json +133 -0
  50. fastdrc-0.0.1/examples/demo/rules/1-wells/NW.3.json +137 -0
  51. fastdrc-0.0.1/examples/demo/rules/1-wells/NW.4.json +137 -0
  52. fastdrc-0.0.1/examples/demo/rules/2-devices/CO.1.json +75 -0
  53. fastdrc-0.0.1/examples/demo/rules/2-devices/CO.2.json +141 -0
  54. fastdrc-0.0.1/examples/demo/rules/2-devices/CO.3.json +231 -0
  55. fastdrc-0.0.1/examples/demo/rules/2-devices/CO.4.json +137 -0
  56. fastdrc-0.0.1/examples/demo/rules/2-devices/PO.1.json +76 -0
  57. fastdrc-0.0.1/examples/demo/rules/2-devices/PO.2.json +133 -0
  58. fastdrc-0.0.1/examples/demo/rules/2-devices/PO.3.json +134 -0
  59. fastdrc-0.0.1/examples/demo/rules/3-metal/AN.1.json +135 -0
  60. fastdrc-0.0.1/examples/demo/rules/3-metal/DN.1.json +127 -0
  61. fastdrc-0.0.1/examples/demo/rules/3-metal/DN.2.json +135 -0
  62. fastdrc-0.0.1/examples/demo/rules/3-metal/V1.1.json +138 -0
  63. fastdrc-0.0.1/examples/demo/rules/3-metal/V1.2.json +138 -0
  64. fastdrc-0.0.1/hatch_build.py +37 -0
  65. fastdrc-0.0.1/pyproject.toml +50 -0
  66. fastdrc-0.0.1/python/fastdrc/__init__.py +11 -0
  67. fastdrc-0.0.1/python/fastdrc/__main__.py +8 -0
  68. fastdrc-0.0.1/python/fastdrc/backend.py +191 -0
  69. fastdrc-0.0.1/python/fastdrc/backend_cases.py +2155 -0
  70. fastdrc-0.0.1/python/fastdrc/backend_docs.py +680 -0
  71. fastdrc-0.0.1/python/fastdrc/backend_klayout.py +1485 -0
  72. fastdrc-0.0.1/python/fastdrc/backend_svg.py +387 -0
  73. fastdrc-0.0.1/python/fastdrc/cli.py +340 -0
  74. fastdrc-0.0.1/python/fastdrc/constraint.py +112 -0
  75. fastdrc-0.0.1/python/fastdrc/editor.py +2128 -0
  76. fastdrc-0.0.1/python/fastdrc/grammars/constraint.rawast +93 -0
  77. fastdrc-0.0.1/python/fastdrc/ir.py +703 -0
  78. fastdrc-0.0.1/python/fastdrc/params.py +147 -0
  79. fastdrc-0.0.1/python/fastdrc/process.py +797 -0
  80. fastdrc-0.0.1/python/fastdrc/rule.py +2276 -0
  81. fastdrc-0.0.1/python/fastdrc/sheet.py +340 -0
  82. fastdrc-0.0.1/python/fastdrc/topology.py +219 -0
  83. fastdrc-0.0.1/rule1.json +75 -0
  84. fastdrc-0.0.1/tests/test_angle.py +236 -0
  85. fastdrc-0.0.1/tests/test_backend.py +283 -0
  86. fastdrc-0.0.1/tests/test_centre_and_sum.py +105 -0
  87. fastdrc-0.0.1/tests/test_constraint.py +167 -0
  88. fastdrc-0.0.1/tests/test_doc_figures.py +22 -0
  89. fastdrc-0.0.1/tests/test_docs.py +226 -0
  90. fastdrc-0.0.1/tests/test_editor_model.py +153 -0
  91. fastdrc-0.0.1/tests/test_example.py +147 -0
  92. fastdrc-0.0.1/tests/test_gf180.py +82 -0
  93. fastdrc-0.0.1/tests/test_installed_decks.py +65 -0
  94. fastdrc-0.0.1/tests/test_ir.py +172 -0
  95. fastdrc-0.0.1/tests/test_natural.py +647 -0
  96. fastdrc-0.0.1/tests/test_params.py +126 -0
  97. fastdrc-0.0.1/tests/test_plugins.py +530 -0
  98. fastdrc-0.0.1/tests/test_readme_for_the_index.py +21 -0
  99. fastdrc-0.0.1/tests/test_scope.py +68 -0
  100. fastdrc-0.0.1/tests/test_selection.py +616 -0
  101. fastdrc-0.0.1/tests/test_sheet.py +434 -0
  102. fastdrc-0.0.1/tests/test_topology.py +97 -0
  103. fastdrc-0.0.1/tests/test_validate_tool.py +143 -0
  104. fastdrc-0.0.1/tests/test_validation.py +97 -0
  105. fastdrc-0.0.1/tools/audit_corpus.py +89 -0
  106. fastdrc-0.0.1/tools/behavioral_diff.py +104 -0
  107. fastdrc-0.0.1/tools/behavioral_validate.py +176 -0
  108. fastdrc-0.0.1/tools/cells_in_a_row.rb +23 -0
  109. fastdrc-0.0.1/tools/compare_reports.py +116 -0
  110. fastdrc-0.0.1/tools/describe_rules.py +54 -0
  111. fastdrc-0.0.1/tools/differential_validate.py +385 -0
  112. fastdrc-0.0.1/tools/doc_figures.py +58 -0
  113. fastdrc-0.0.1/tools/perturb_layout.rb +42 -0
  114. fastdrc-0.0.1/tools/tidy_drawings.py +98 -0
  115. fastdrc-0.0.1/tools/validate_klayout.py +1360 -0
  116. fastdrc-0.0.1/uv.lock +108 -0
@@ -0,0 +1 @@
1
+ github: [lanserge]
@@ -0,0 +1,23 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ python:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ fail-fast: false
13
+ matrix:
14
+ python: ["3.11", "3.13"]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: astral-sh/setup-uv@v5
18
+ with:
19
+ python-version: ${{ matrix.python }}
20
+ - name: Install
21
+ run: uv sync
22
+ - name: Test
23
+ run: uv run pytest -q
@@ -0,0 +1,68 @@
1
+ name: Release
2
+
3
+ # Publishing a GitHub release uploads both packages to PyPI: fastdrc (the tool) and
4
+ # fastdrc-gf180mcu (the deck). A version that is already there is left alone, so to
5
+ # release one of the two, raise its version alone.
6
+ #
7
+ # No password is kept here: PyPI trusts this workflow ("trusted publishing"). Each of
8
+ # the two PyPI projects names it as its publisher -- owner edacommons, repository
9
+ # FastDRC, workflow release.yml -- and each under an environment of its own
10
+ # (pypi-fastdrc, pypi), so that PyPI can tell which project an upload is for.
11
+
12
+ on:
13
+ release:
14
+ types: [published]
15
+ workflow_dispatch: # by hand, from the Actions page: to repeat an upload that did not go through
16
+
17
+ jobs:
18
+ build:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - uses: astral-sh/setup-uv@v5
23
+ with:
24
+ python-version: "3.13"
25
+ - name: Test
26
+ run: |
27
+ uv sync
28
+ uv run pytest -q
29
+ - name: Build
30
+ run: |
31
+ uv build --package fastdrc -o dist/fastdrc
32
+ uv build --package fastdrc-gf180mcu -o dist/fastdrc-gf180mcu
33
+ - uses: actions/upload-artifact@v4
34
+ with:
35
+ name: dist
36
+ path: dist/
37
+
38
+ fastdrc:
39
+ needs: build
40
+ runs-on: ubuntu-latest
41
+ environment: pypi-fastdrc
42
+ permissions:
43
+ id-token: write
44
+ steps:
45
+ - uses: actions/download-artifact@v4
46
+ with:
47
+ name: dist
48
+ path: dist/
49
+ - uses: pypa/gh-action-pypi-publish@release/v1
50
+ with:
51
+ packages-dir: dist/fastdrc
52
+ skip-existing: true
53
+
54
+ fastdrc-gf180mcu:
55
+ needs: build
56
+ runs-on: ubuntu-latest
57
+ environment: pypi
58
+ permissions:
59
+ id-token: write
60
+ steps:
61
+ - uses: actions/download-artifact@v4
62
+ with:
63
+ name: dist
64
+ path: dist/
65
+ - uses: pypa/gh-action-pypi-publish@release/v1
66
+ with:
67
+ packages-dir: dist/fastdrc-gf180mcu
68
+ skip-existing: true
@@ -0,0 +1,33 @@
1
+ # Build output
2
+ /build/
3
+ /dist/
4
+ *.so
5
+ *.dylib
6
+ *.pyd
7
+ *.o
8
+ *.a
9
+
10
+ # CMake
11
+ CMakeCache.txt
12
+ CMakeFiles/
13
+ cmake_install.cmake
14
+
15
+ # Python
16
+ __pycache__/
17
+ *.egg-info/
18
+ .pytest_cache/
19
+ .venv/
20
+ venv/
21
+
22
+ # Editor / OS
23
+ .vscode/
24
+ .idea/
25
+ .DS_Store
26
+
27
+ # Tooling-local
28
+ .doit.db
29
+ # a process's generated deck and rule text
30
+ examples/*/build/
31
+ fastdrc-gf180mcu/fastdrc_gf180mcu/build/
32
+ *.build/
33
+ docs/figures/build/
fastdrc-0.0.1/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
fastdrc-0.0.1/NOTICE ADDED
@@ -0,0 +1,2 @@
1
+ FastDRC
2
+ Copyright 2026 Serge Rabyking
fastdrc-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,220 @@
1
+ Metadata-Version: 2.5
2
+ Name: fastdrc
3
+ Version: 0.0.1
4
+ Summary: Design rules (DRC) drawn by example and compiled for any checking tool through backend plugins. KLayout backend included.
5
+ Project-URL: Homepage, https://github.com/edacommons/FastDRC
6
+ Project-URL: Documentation, https://github.com/edacommons/FastDRC/blob/main/docs/from-a-manual.md
7
+ Project-URL: Issues, https://github.com/edacommons/FastDRC/issues
8
+ Author-email: s.rabykin@gmail.com
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ License-File: NOTICE
12
+ Keywords: DRC,EDA,IC,PCB,design-rule-check,layout
13
+ Classifier: Development Status :: 2 - Pre-Alpha
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
16
+ Requires-Python: >=3.11
17
+ Description-Content-Type: text/markdown
18
+
19
+ # FastDRC
20
+
21
+ **Design rules drawn, not programmed.** You describe a DRC rule the way a design manual
22
+ does — draw an example of the geometry, put an arrow where a distance matters, write
23
+ what must hold — and FastDRC compiles the rules into a working
24
+ [KLayout](https://www.klayout.de) DRC script, with the same rules written out as plain
25
+ sentences to read back. *Fast*: the script is fitted to the set of rules being run —
26
+ the whole deck, or part of it — so what several rules need is computed once.
27
+
28
+ pip install . ./fastdrc-gf180mcu # from a checkout (not on PyPI yet): the tool and the GF180MCU deck; pure Python
29
+
30
+ > Status: pre-alpha. This is the **rule compiler** with its **KLayout backend**
31
+ > (compared rule by rule with the public decks of several open processes), the
32
+ > self-test and the editor. Backends are plugins. A C++ checking core is being
33
+ > developed separately, on the `cpp-core` branch, to become a second backend; it is
34
+ > not part of `main` and nothing here needs it.
35
+
36
+ ## Where it comes from
37
+
38
+ FastDRC began as a DRC engine, and the name is from that. The idea: a deck is not a
39
+ list of separate checks but one graph of operations — Boolean operations on layers,
40
+ sizing, selections, and the checks at the ends. Over a whole deck most of that graph
41
+ is shared, so each operation can be computed once, kept while something still needs
42
+ it, and run in parallel with the others. That is what should make millions of checks
43
+ fast.
44
+
45
+ An engine needs the rules in a form it can reason about, so the work started there:
46
+ how can a design rule be stated formally and still look like the page of the manual
47
+ it comes from? That question grew into what is here now — rules drawn by example and
48
+ a compiler that reads the drawing.
49
+
50
+ A rule stated this way belongs to no tool. The drawing and its constraints say what
51
+ the rule *is*; each backend turns that into something of its own — a KLayout script,
52
+ the rule as a sentence, its figure, the test layouts that show whether a deck obeys
53
+ it. The same description is meant to carry over to other checking tools as backends
54
+ are written for them.
55
+
56
+ The graph is already at work: the compiler builds one for the set of rules being run
57
+ and writes the KLayout script from it, so what several rules need is computed once.
58
+ The C++ core that will execute the graph itself is still in progress, on the
59
+ `cpp-core` branch.
60
+
61
+ ## Authoring rules by drawing
62
+
63
+ You describe a rule the way a design manual does: **draw the shapes** of the layers in
64
+ the situation the rule is about, put an **arrow** where a distance matters, and write
65
+ the one or two things the manual says about it (`W >= 0.8`, `A.net != B.net`,
66
+ `Count(V) >= 2`). You do *not* write `.and` / `.not` / `.inside`: the compiler reads
67
+ what lies inside, across or beside what off the drawing and derives the operations.
68
+
69
+ | ![PO.2](https://raw.githubusercontent.com/edacommons/FastDRC/main/docs/img/demo/PO.2.svg) | ![V1.2](https://raw.githubusercontent.com/edacommons/FastDRC/main/docs/img/demo/V1.2.svg) | ![LU.1](https://raw.githubusercontent.com/edacommons/FastDRC/main/docs/img/demo/LU.1.svg) |
70
+ |---|---|---|
71
+ | `Xp >= 0.2` | `Ww >= 2` (which metal), `Count(VW) >= 2` | `Sl <= 20` |
72
+ | *poly must extend at least 0.2 µm beyond diff* | *every met1 at least 2 µm wide must hold at least 2 via1* | *every part of pdiff combined with nwell must be within 20 µm of ndiff combined with nwell — one in the same piece of nwell* |
73
+ | `poly.enclosing(diff, 0.2.um, euclidian)` | `met1.sized(-0.999.um).sized(0.999.um).not_interacting(via1, 2)` | `pdiff.and(nwell).not(ndiff.and(nwell).sized(20.um))` |
74
+
75
+ Three rules of the example deck: the drawing, what is written on it, the sentence read
76
+ back from it, and the KLayout statement it compiles to.
77
+
78
+ **Straight and wavy edges.** Every edge of a drawn shape is one or the other, and this
79
+ is what makes a picture a rule and not a fixed pattern. A **straight** edge is one the
80
+ rule uses — it is measured, or its length or corner matters. A **wavy** edge asks
81
+ nothing of that side: the shape goes on, or ends, as it likes. The same rectangle:
82
+
83
+ | ![any shape](https://raw.githubusercontent.com/edacommons/FastDRC/main/docs/img/edges/1-any-shape.svg) | ![a wire](https://raw.githubusercontent.com/edacommons/FastDRC/main/docs/img/edges/2-wire.svg) | ![a wire's end](https://raw.githubusercontent.com/edacommons/FastDRC/main/docs/img/edges/3-line-end.svg) | ![a link](https://raw.githubusercontent.com/edacommons/FastDRC/main/docs/img/edges/4-link.svg) |
84
+ |---|---|---|---|
85
+ | no straight edge: **any shape** of the layer (a minimum area) | two straight sides: **a wire** of any length (a minimum width) | the cap straight too: **the wire's end** (an end-of-line enclosure) | an arrow that ends on a wavy edge is **a link**, not a distance: the diff *inside* the well |
86
+
87
+ ```
88
+ fastdrc init mydeck # a deck is a folder: process.json + rules/<section>/<rule>.json
89
+ fastdrc gui mydeck # draw the rules: one rule, one file, one drawing
90
+ fastdrc build mydeck # -> build/<name>.drc (KLayout script), build/<name>.md (the rules as sentences)
91
+ fastdrc selftest mydeck # does every constraint of every rule behave as drawn?
92
+ # ... and is every layout in mydeck/layouts/ read as it says? (whole devices: every rule gets its say)
93
+ fastdrc check chip.gds mydeck # run the deck on a layout, list the violations per rule
94
+ fastdrc check chip.gds mydeck --only "3-metal,NW.*" # part of the deck: one script fitted to that set
95
+ fastdrc check chip.gds mydeck --deep # on the layout's hierarchy: a cell placed many times is checked once
96
+ fastdrc check chip.gds mydeck --profile NAME # a process with options (metal stack, ...): `fastdrc parameters mydeck`
97
+ fastdrc pack mydeck # -> mydeck.zip: the same deck in one file; every command and the editor take it
98
+ fastdrc check chip.gds gf180mcu # a deck installed as a package (pip install fastdrc-gf180mcu) goes by its name: `fastdrc decks`
99
+ ```
100
+
101
+ `build`, `rules` and the editor need nothing but Python; `selftest`, `check` and the editor's
102
+ **Test** button run [KLayout](https://www.klayout.de) (`klayout` on the PATH, or
103
+ `KLAYOUT_BIN`).
104
+
105
+ > **Start with [docs/from-a-manual.md](https://github.com/edacommons/FastDRC/blob/main/docs/from-a-manual.md)** — one invented process
106
+ > taken from the manual's page to a deck that has been run, with every kind of rule
107
+ > ([`examples/demo/`](https://github.com/edacommons/FastDRC/tree/main/examples/demo)): `fastdrc build examples/demo`.
108
+ >
109
+ > **A real process: [`fastdrc-gf180mcu/`](https://github.com/edacommons/FastDRC/tree/main/fastdrc-gf180mcu)** — the open GF180MCU
110
+ > design rules drawn from the public manual, 775 rule files from the front end to
111
+ > antenna, bond pad, seal ring, dummy fill and latch-up rules, with the metal stack, the
112
+ > top metal, the MIM option and the kind of bond pad as parameters; compared with the
113
+ > process's own KLayout deck where it has one. It is a package of its own
114
+ > (`pip install fastdrc-gf180mcu`, then `fastdrc check chip.gds gf180mcu`); its README
115
+ > says how it was checked.
116
+ >
117
+ > **📐 [docs/drawing-model.md](https://github.com/edacommons/FastDRC/blob/main/docs/drawing-model.md)** is the reference: how each kind
118
+ > of rule is drawn and what the compiler derives from it — widths, spacings,
119
+ > enclosures and extensions; a value per table column; exact sizes, squares and bars;
120
+ > arrays and counts; "on one of two sides"; maximum distances; a pitch from centre to
121
+ > centre; a side added up over several shapes; density; nets and antenna ratios; rules
122
+ > for a family of layers; and the cross ("must not exist").
123
+
124
+ **The self-test.** For each constraint of each rule, `selftest` builds small layouts
125
+ from the rule's own picture — a `check` with its quantity just outside the value (must
126
+ be reported) and exactly at it (must not), a `match` with a violation just outside the
127
+ filter (must *not* be reported) — and runs the deck on them. What the rule must do is
128
+ computed from the constraints, not from the deck. Rules it cannot build a case for are
129
+ listed, never counted as passing.
130
+
131
+ **Backends are plugins.** `fastdrc backends` lists them (`klayout`, `docs`, `svg`,
132
+ `facts`, `cases`); another package adds one through the entry-point group `fastdrc.backends`.
133
+ A backend may use another (`get("svg")` for a rule's figure, `get("docs")` for its
134
+ sentence). A backend may also *run* the deck it writes on a layout: `build`, `check` and
135
+ `selftest` take `--backend NAME` and go through that one for both. KLayout is the one
136
+ shipped here that does, and the default; the C++ core will be another.
137
+
138
+ The pieces (Python):
139
+
140
+ ```
141
+ python/fastdrc/topology.py spatial relations off geometry (inside / overlap / ...)
142
+ python/fastdrc/constraint.py the constraint language (a Python-expression subset, parsed with `ast`)
143
+ python/fastdrc/rule.py the analyzed-rule API the backends work against
144
+ python/fastdrc/sheet.py rule files: a value per table column, layer families (and older multi-rule sheets)
145
+ python/fastdrc/process.py a deck (a folder, a zip, or an installed package): build, check, self-test
146
+ python/fastdrc/params.py the parameters of a process (its options), profiles, and the switch that reads them
147
+ python/fastdrc/ir.py the set of rules as one graph of operations: what several rules need is computed once
148
+ python/fastdrc/backend.py the backend registry and plugin discovery
149
+ python/fastdrc/backend_klayout.py -> a KLayout DRC deck
150
+ python/fastdrc/backend_docs.py -> the rules as plain sentences
151
+ python/fastdrc/backend_svg.py -> each rule's drawing as a picture
152
+ python/fastdrc/backend_cases.py -> test layouts made from the drawings, with what to expect
153
+ python/fastdrc/editor.py the visual editor (Tkinter)
154
+ python/fastdrc/cli.py the `fastdrc` command
155
+ tools/compare_reports.py two DRC runs of one layout, compared rule by rule, by place
156
+ tools/cells_in_a_row.rb a cell library laid out flat, to try a deck on
157
+ tools/perturb_layout.rb random small errors put into a layout
158
+ tools/tidy_drawings.py a deck's drawings redrawn neatly, their meaning unchanged
159
+ tools/doc_figures.py the docs' figures, drawn from the rule files (--check: are they current?)
160
+ ```
161
+
162
+ The other `tools/` scripts validate the compiler against a reference deck and a
163
+ drawn-rule corpus read from `docs/gf180mcu/`, which is not part of this repository.
164
+
165
+ ## Layout
166
+
167
+ ```
168
+ python/fastdrc/ the Python package: the rule compiler, its backends, the editor
169
+ examples/demo/ a complete deck for an invented process, with every kind of rule
170
+ fastdrc-gf180mcu/ the package fastdrc-gf180mcu: the design rules of the open GF180MCU process, drawn from its manual
171
+ docs/ the tutorial (from-a-manual.md), the reference (drawing-model.md), what is new (own-and-known.md)
172
+ docs/img/ the docs' figures, drawn from rule files by tools/doc_figures.py
173
+ tools/ validation of the compiler against a reference deck
174
+ tests/ pytest
175
+ ```
176
+
177
+ Two packages are built from this repository: `fastdrc` (the tool) and
178
+ `fastdrc-gf180mcu` (the deck, which needs the tool). A deck package holds the deck
179
+ folder and names it in the entry-point group `fastdrc.decks`;
180
+ [docs/from-a-manual.md](https://github.com/edacommons/FastDRC/blob/main/docs/from-a-manual.md) shows the two lines it takes.
181
+
182
+ ## Compiling a drawn rule
183
+
184
+ ```python
185
+ from fastdrc.backend import get # backends load on first use
186
+ from fastdrc.rule import Rule
187
+
188
+ # a drawn rule = shapes (edges) + measures + constraints; see docs/drawing-model.md
189
+ deck = get("klayout", layermap={"metal1": (34, 0)}).compile(Rule(my_drawn_rule))
190
+ text = get("docs").compile(Rule(my_drawn_rule)) # the same rule as a sentence
191
+
192
+ from fastdrc import process # a whole process folder
193
+ deck_path, text_path, n_rules, warnings = process.build("examples/demo")
194
+
195
+ folder, out = process.find("gf180mcu") # a deck installed as a package, by its name
196
+ deck_path, *_ = process.build(folder, out)
197
+ ```
198
+
199
+ ## Install for development
200
+
201
+ Requires Python 3.11+; pure Python, no compiler.
202
+
203
+ ```bash
204
+ pip install -e . -e ./fastdrc-gf180mcu pytest # the tool and the GF180MCU deck
205
+ pytest
206
+ ```
207
+
208
+ With [uv](https://docs.astral.sh/uv/): `uv sync` then `uv run pytest`. Tests that run a
209
+ deck need [KLayout](https://www.klayout.de) and are skipped without it.
210
+
211
+ ## What is new here
212
+
213
+ Which part of FastDRC is its own, and which was already known from design manuals
214
+ and earlier publications: [docs/own-and-known.md](https://github.com/edacommons/FastDRC/blob/main/docs/own-and-known.md).
215
+
216
+ ## Licence
217
+
218
+ FastDRC is released under the [Apache License 2.0](https://github.com/edacommons/FastDRC/blob/main/LICENSE); copyright 2026 Serge
219
+ Rabyking. The licence covers the tool. A deck you compile from your own drawings is
220
+ yours: the generated KLayout script, text and pictures carry no licence of FastDRC's.