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

Allow cell flattening in magic extraction #796

Open
d-m-bailey opened this issue Dec 23, 2021 · 2 comments
Open

Allow cell flattening in magic extraction #796

d-m-bailey opened this issue Dec 23, 2021 · 2 comments
Labels
enhancement New feature or request OpenLane 2 Scheduled for next gen OpenLane

Comments

@d-m-bailey
Copy link
Contributor

Prompt

Currently, magic extracts each layout cell separately. This can lead to confusing netlists with unnecessary hierarchies when using parameterized layout cells from GDS. For example, nmos_m10_w7_000_sli_dli_da_p in the openram macros.

Proposal

Allow user specified flattening of cells when reading GDS.
For example, executing these preprocessing commands before GDS input.

gds flatglob {*nmos_m*} 
gds flatglob {*pmos_m*}
gds flatglob {sky130*__*\[A-Z\]*} 
gds flatglob {*_example_*}
gds flatglob {*\$\$*}
gds flatglob {*_CDNS_*}
gds flatten yes

This could be accomplished by modifying run_magic_spice_export of scripts/tcl_scripts/magic.tcl as follows
Before:

if { \[info exist ::env(MAGIC_EXT_USE_GDS)\] && \$::env(MAGIC_EXT_USE_GDS) } {
        gds read \$::env(CURRENT_GDS)
} else {

After:

if { \[info exist ::env(MAGIC_EXT_USE_GDS)\] && \$::env(MAGIC_EXT_USE_GDS) } {
       if { \[info exist ::env(MAGIC_GDS_PREPROCESSING_FILE)\] } {
          source \$::env(MAGIC_GDS_PREPROCESSING_FILE)
       }
        gds read \$::env(CURRENT_GDS)
} else {

The preprocessing commands would be stored in the file specified by MAGIC_GDS_PREPROCESSING_FILE.

Alternatives

There might be a way to store all the preprocessing commands in a variable and eval it.

@donn
Copy link
Collaborator

donn commented Dec 23, 2021

Ah, god, no eval. This codebase is a security nightmare as is.

But this is a reasonable ask.

@donn donn added enhancement New feature or request Flow Script labels Dec 23, 2021
@d-m-bailey
Copy link
Contributor Author

d-m-bailey commented Dec 23, 2021

How about a list of cells to flatten?
Example:

{*nmos_m*} 
{*pmos_m*}

Then programmatically loop through the list adding gds flatten.

if { \[info exist ::env(MAGIC_EXT_USE_GDS)\] && \$::env(MAGIC_EXT_USE_GDS) } {
       if { \[info exist ::env(MAGIC_GDS_FLATTEN_CELLS)\] } {
          foreach cell \$::env(MAGIC_GDS_FLATTEN_CELLS) {
             gds flatten \$cell
          }
          gds flatten yes
       }
        gds read \$::env(CURRENT_GDS)
} else {

@donn donn removed the Flow Script label Dec 28, 2022
@kareefardi kareefardi added the OpenLane 2 Scheduled for next gen OpenLane label Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request OpenLane 2 Scheduled for next gen OpenLane
Projects
None yet
Development

No branches or pull requests

3 participants