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

gdsfactory-gen generators and DRC parsing #218

Merged
merged 72 commits into from
Sep 25, 2023

Conversation

alibillalhammoud
Copy link
Collaborator

This PR provides an intermediate step towards the goals described in issue210. This introduces the following generators and features:

  • mimcap gen
  • fet: nmos, pmos gen
  • routes: straight, C, L routes
  • guardring gen
  • via gen
  • opamp gen
  • pad wrapper for adding pads to opamp (tapeout)
  • DRC parser from @ryanrocket

@msaligane
Copy link
Member

@joamatab Do you think you can help me review this?

@msaligane msaligane requested a review from proppy July 19, 2023 21:28
Co-authored-by: Ryan Wans <37909218+ryanrocket@users.noreply.github.com>


def sky130_add_opamp_labels(opamp_in: Component) -> Component:
opamp_in.unlock()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can create a reference so you don't have to do this hack

@joamatab
Copy link
Contributor

joamatab commented Jul 20, 2023

To ensure the stability and integrity of our gdsfactory Pcells, it is crucial that we adhere to a specific pattern in order to prevent any unintended modifications. These Components are locked for a reason, and it is important that we refrain from unlocking and modifying them once they are in the cache.

For a detailed explanation of the recommended pattern, please refer to the following link:/workflow_0_layout_summary.html?highlight=summary

This is the general pattern we follow

@gf.cell
def mzi_with_bend(radius: float = 10):
    """Returns MZI interferometer with bend."""
    c = gf.Component() # the top level component (our canvas)
    mzi = c.add_ref(gf.components.mzi()) # first reference
    bend = c.add_ref(gf.components.bend_euler(radius=radius)) # second reference
    bend.connect("o1", mzi.ports["o2"]) # connect

    c.add_port("o1", port=mzi.ports["o1"]) # expose some ports
    c.add_port("o2", port=bend.ports["o2"]) # expose some ports
    return c

overall i'd recommend adding the skywater130 and gf180 pdks into the gdsfactory generic PDK
that's the way we can use the generic PCells into more than 10 PDKs that we currently support from gdsfactory

@saicharan0112
Copy link
Collaborator

saicharan0112 commented Sep 5, 2023

@alibillalhammoud can you please mark an order of merging for your PRs?

@msaligane
Copy link
Member

@alibillalhammoud have you synced your Fork? There are too many changes to review. Let's go over this today.

@alibillalhammoud
Copy link
Collaborator Author

@saicharan0112 I just have this PR to merge.

@msaligane I have synced my fork with main. We can go over today.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alibillalhammoud are these gds files using somewhere else? it looks like you moved them in deprecated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what those are for, I did not modify the "deprecated" directories at all. If we want we can delete the deprecated directories. They will be in the git history anyways

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this documented?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a better diagram?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to add a couple comments regarding these port trees

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we create a github issue to track this. This file should be copied from the pdk folder

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msaligane see issue 235. This tracks all the changes I need to make.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see previous comment

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a description of this fct.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like there are no descriptions to your fcts. So it is hard to follow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should come from the PDK

Copy link
Member

@msaligane msaligane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please address my comments.

@msaligane
Copy link
Member

@harshkhandeparkar
FYI

@saicharan0112
Copy link
Collaborator

@alibillalhammoud I am not sure if this is part of the plan (I don't see it in the tasks) but try to create a Jupyter notebook on how to work with pygen-openfasoc. I think that's the best documentation someone could start with

grulesobj["dnwell"]["dnwell"] = {"min_width": 3.0, "min_separation": 6.3}
grulesobj["dnwell"]["pwell"] = {"min_enclosure": 0.0}
grulesobj["dnwell"]["nwell"] = {"min_separation": 4.5}
grulesobj["dnwell"]["p+s/d"] = {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these empty dict initializations be done using two for loops?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to just keep the PNG files for these trees in the docs. I would also suggest creating a subdirectory for the images.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we include gdsfactory dependency in this file? The root requirements file locks the gdsfactory version to 5.1.1. The latest version is 7.4.3. Version 5.1.1 doesn't work on my system with Python 3.11.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@harshkhandeparkar did you make a gdsfactory issue about the broken pip dependencies for the sky130 and gf180 packages?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't yet, but I will soon. I want to test more to figure out what the exact issue is and make sure it is not a problem with my system.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking for this exact comment. Is still the old gdsfactory used?. I see that this commit has something about the gdsfactory version in its message.

Copy link
Collaborator

@saicharan0112 saicharan0112 Oct 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also where exactly the packages mentioned inside this requirements.txt file are installed?

Copy link
Collaborator

@harshkhandeparkar harshkhandeparkar Oct 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requirements.txt file just contains dependencies necessary for the gdsfactory generators. They are not installed separately, just listed in a separate file. But for some reason, the root requirements.txt also has gdsfactory=5.1.1 mentioned as a dependency which it should probably not be.

All functions, classes, etc have a help docustring. See python help() for specific questions

- [Pygen](#pygen)
- [MappedPDK](#mappedpdk)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to have a short section on installing dependencies and running the code.

interfinger_rmult: int=1
) -> Component:
"""Generic NMOS generator
pdk = mapped pdk to use
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These parameters are rendered on a single line in VSCode intellisense.
2023-09-08T19:09:37,549854502+05:30

I would suggest using markdown list syntax or : instead of =

  - pdk = ...
  - width = ...

or

  - pdk: ...
  - width: ...

for glayer in MappedPDK.valid_glayers:
grulesobj[glayer] = dict((x, None) for x in MappedPDK.valid_glayers)

grulesobj["dnwell"]["dnwell"] = {"min_width": 3.0, "min_separation": 6.3}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these values manually entered, or are they pulled from some file? If they are pulled from a file from the PDK, can this process also be automated?

via_flush1 = 0 if viaoffset[0] is None else via_flush1
via_flush2 = via_flush if viaoffset[1] else 0-via_flush
via_flush2 = 0 if viaoffset[1] is None else via_flush2
if round(edge1.orientation) == 0:# facing east
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the code under this function is repeated many times. Is there a possibility for refactoring?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a 1000-line file. I would suggest splitting it for readability.

@saicharan0112
Copy link
Collaborator

@alibillalhammoud I am not sure if this is part of the plan (I don't see it in the tasks) but try to create a Jupyter notebook on how to work with pygen-openfasoc. I think that's the best documentation someone could start with

I think I just saw one of the issues on documentation for gdsfactory-gen that includes python notebook.

Copy link
Member

@msaligane msaligane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. But we need to address issues. #235

@msaligane msaligane merged commit c1f5d19 into idea-fasoc:main Sep 25, 2023
@saicharan0112
Copy link
Collaborator

saicharan0112 commented Oct 2, 2023 via email

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

Successfully merging this pull request may close these issues.

7 participants