-
Notifications
You must be signed in to change notification settings - Fork 505
Klayout dependency #4001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
maliberty
merged 7 commits into
The-OpenROAD-Project:master
from
Pinata-Consulting:klayout-dependency
Mar 17, 2026
Merged
Klayout dependency #4001
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3d0bc18
Make KLayout an optional dependency
oharboe 7a498f5
Add documentation for KLayout optional dependency
oharboe a4e2395
Add unit tests for KLayout-related Python utilities
oharboe 2337490
Widen CI path triggers for Python util tests
oharboe 6a140bf
Remove do-targets and redundant use-cases from KLayout docs
oharboe cbadd29
Restore GDS dependency on finish target
oharboe f234bb1
Address KLayout docs review feedback
oharboe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # KLayout as an Optional Dependency | ||
|
|
||
| KLayout is only required for GDS/OAS stream generation, DRC, and LVS | ||
| verification. All other ORFS functionality — synthesis, floorplanning, | ||
| placement, CTS, routing, timing reports, and abstract generation — works | ||
| without KLayout installed. | ||
|
|
||
| ## Makefile Targets | ||
|
|
||
| | Target | Requires KLayout | Description | | ||
| |---|---|---| | ||
| | `make finish` | Yes | Complete flow including GDS generation | | ||
| | `make gds` | Yes | Generate GDS/OAS from finished design | | ||
| | `make drc` | Yes | Run DRC checks (requires GDS) | | ||
| | `make lvs` | Yes | Run LVS checks (requires GDS) | | ||
| | `make gallery` | Yes | Generate layout screenshots | | ||
| | `make klayout_<file>` | Yes | Open result in KLayout viewer | | ||
| | `make generate_abstract` | No | Generate LEF/LIB abstracts | | ||
|
|
||
| A `check-klayout` guard produces a clear error message when KLayout is | ||
| missing and a KLayout-dependent target is invoked: | ||
|
|
||
| ``` | ||
| Error: KLayout not found. Install KLayout or set KLAYOUT_CMD. | ||
| Hint: KLayout is needed for GDS/DRC/LVS targets. | ||
| ``` | ||
|
|
||
| ## bazel-orfs Integration | ||
|
|
||
| bazel-orfs uses the `do-` prefixed targets which bypass Make's dependency | ||
| management. The relevant targets follow the standard pattern: | ||
|
|
||
| - `do-finish` / `do-final` — runs the finish stage without GDS | ||
| - `do-gds` — runs GDS generation (requires KLayout) | ||
|
|
||
| An `orfs_gds()` Bazel rule can call `do-gds` independently from | ||
| `orfs_flow()`, making KLayout an optional toolchain dependency configured | ||
| in `MODULE.bazel`. | ||
|
|
||
| ## KLayout Tech File Generation | ||
|
|
||
| The `do-klayout` and `do-klayout_wrap` targets generate `.lyt` technology | ||
| files by substituting LEF and map file paths into platform templates. | ||
| This is implemented in `util/generate_klayout_tech.py` using stdlib XML | ||
| processing — no KLayout dependency required. | ||
|
|
||
| ## Testing Without KLayout | ||
|
|
||
| Unit tests for all KLayout-related Python scripts use `unittest.mock` to | ||
| mock the `pya` API: | ||
|
|
||
| ``` | ||
| cd flow/test | ||
| python -m unittest test_generate_klayout_tech test_def2stream test_convertDrc | ||
| ``` | ||
|
|
||
| These tests cover: | ||
| - `.lyt` tech file generation (`test_generate_klayout_tech.py`) | ||
| - DEF-to-GDS merging logic (`test_def2stream.py`) | ||
| - DRC report conversion (`test_convertDrc.py`) | ||
|
|
||
| ## Future: OpenROAD `write_gds` and KLayout Coexistence | ||
|
|
||
| OpenROAD has an unfinished `write_gds` command. When it is eventually | ||
| completed, it would eliminate the KLayout dependency for GDS generation | ||
| in many cases. However, KLayout support will live alongside `write_gds` | ||
| until there is confidence that `write_gds` is robust and fully covers | ||
| all current use cases. | ||
|
|
||
| Even then, non-public or future PDKs may have requirements that benefit | ||
| from KLayout's mature GDS handling. Whether KLayout support stays in | ||
| ORFS indefinitely remains to be seen. Once `write_gds` works robustly | ||
| for all of today's use cases, extending it to cover future ones may | ||
| turn out to be straightforward. | ||
|
oharboe marked this conversation as resolved.
Outdated
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.