Skip to content
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

Separate KLayout DRC script and XML wrapper #221

Open
mole99 opened this issue Oct 15, 2024 · 2 comments
Open

Separate KLayout DRC script and XML wrapper #221

mole99 opened this issue Oct 15, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@mole99
Copy link
Contributor

mole99 commented Oct 15, 2024

Currently, the DRC scripts are implemented using a .lydrc file, which is an XML wrapper around the DRC script: https://github.com/IHP-GmbH/IHP-Open-PDK/tree/dev/ihp-sg13g2/libs.tech/klayout/tech/drc

Instead, it would be great if the DRC script could be separated from the wrapper and simply included with # %include.
This would make it possible to run the DRC scripts from within a Ruby or Python script. It is actually possible to run the .lydrc macro directly.

An example of how this works can be found in sky130.
There is one sky130A_mr.drc DRC script that is included in several .lydrc files:

By setting the values of global variables, different DRC runsets can be enabled/disabled.

The same approach could be used to combine the sg13g2_maximal and sg13g2_minimal DRC scripts into a single file.

@sergeiandreyev sergeiandreyev added the enhancement New feature or request label Oct 21, 2024
@akrinke
Copy link
Contributor

akrinke commented Oct 23, 2024

I agree that a single DRC script would be better because it avoids code duplication. However, due to the way we generate the scripts, some major changes are required. Therefore, it is not a priority for us at the moment.

In the end, it is not so different than for sky130: We have two .lydrc files, they have three. Besides, you can already run the .lydrc scripts from Ruby and Python:

# ruby
RBA::Macro::new(path_to_lydrc).run()

Here is a full example:

# DRC script configuration

unless $drc_script
  $drc_script = __dir__ + "/sg13g2_minimal.lydrc"
end

# END OF CONFIGURATION
######################

expanded_path = File.expand_path($drc_script)

start = Time.now
puts "Start: " + start.to_s

RBA::Macro::new(expanded_path).run()

finish = Time.now
puts "End:   " + finish.to_s

duration = finish - start
minutes = duration.to_i / 60
seconds = duration % 60

puts "Duration: %s%.0f s" % [minutes>0 ? "%d min " % [minutes] : "", seconds]

@mole99
Copy link
Contributor Author

mole99 commented Oct 23, 2024

Thanks for the reply! I've updated my comment above to note that it is possible to run a .lydrc file from Ruby/Python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants