heitzmann / gdstk

Gdstk (GDSII Tool Kit) is a C++/Python library for creation and manipulation of GDSII and OASIS files.
https://heitzmann.github.io/gdstk/
Boost Software License 1.0
324 stars 78 forks source link

Connecting two Cells together #216

Closed Rishabhgoyal07 closed 7 months ago

Rishabhgoyal07 commented 7 months ago

I have layout of two cells, I have placed them side by side, but what can we connect them together like in cell1 there is Metal M3 running in top cell, how can this M3 can be connect to the M3 of cell2, so that both the cells are connected to each other when we place them together.

joamatab commented 7 months ago

You can use gdsfactory

if you add ports is easy to connect cells together

Rishabhgoyal07 commented 7 months ago

@joamatab is it possible to do it in gdstk? Same cells can be just overlapped to connect, but for different cells to be connected we need pins to be routed to each other to connect the cells

tvt173 commented 7 months ago

@Rishabhgoyal07 there are also various routing functions in gdsfactory, if that's what you're looking for.

https://gdsfactory.github.io/gdsfactory/notebooks/04_routing.html

Rishabhgoyal07 commented 7 months ago

are these ports CAD layers?? used for only identification??

joamatab commented 7 months ago

The ports are not drawn in CAD layers, but saved as python object properties

You can always add pins to the ports if you want to draw them in CAD layers

Rishabhgoyal07 commented 7 months ago

@joamatab @heitzmann I want to know the coordinates of a particular layer of a layout, i know the layer and datatype number of that layer, so there any way or any function in which i can give these numbers and it will return me the coordinates of that layer. The bounding box function returns the coordinates of the box enclosing the elements, even a small part is exceeding the pr boundary of a layout it consider the box according to that and returns the coordinates, but I want to get the coordinates of pr boundary, is it possible? Please reply to this question

nmz787-intel commented 7 months ago

sounds like you want to create a new cell, let's call cell1_2, and you then reference cell1 and cell2 with their respective placement offsets. Then you can place cell1_2 and it will give you the two cells next to each other. When you CAD makes it to the final die database, as long as there are no gaps between your example M3, most DRC/verification tools will merge shapes that touch, regardless of their cell hierarchy. As well, when you get to lithography, if there is no gap, they will end up as a single shape in resist/metal.

https://heitzmann.github.io/gdstk/library/gdstk.Reference.html

cell1= gdstk.Cell("cell1")
# add polygons
cell2= gdstk.Cell("cell2")
# add polygons
cell1_2= gdstk.Cell("cell1_2")
ref1 = gdstk.Reference(cell1)
ref2 = gdstk.Reference(cell2, origin=(10,0)) # ref2 is 10 units away in X dimension from origin, I am assuming this is the width of cell1
cell1_2.add(ref1, ref2)
# add all 3 cells to your library
lib = gdstk.Library()
lib.add(cell1, cell2, cell1_2)