Home › Forums › Nazca › Questions and Answers › Get connections and cells in TopCell
Tagged: circuit, connections, PHIsim, cell iteration
- This topic has 3 replies, 2 voices, and was last updated 6 years, 6 months ago by
Ronald.
-
AuthorPosts
-
1 August 2018 at 13:47 #4792
Rastko
ParticipantDear Nazca community,
Is there a way to get a list of connections (connected pins) and cells contained in a TopCell, like in the example below?
The purpose is to generate an input file for a simulation software.Example:
import nazca as nd import nazca.demofab as demo with nd.Cell(name='SOA') as soa: demo.soa().put().raise_pins() with nd.Cell(name='Phase modulator') as pm: demo.eopm_dc().put() with nd.Cell(name='Top Cell') as tc: soa.put() pm.put() tc.get_cells() # returns ['SOA', 'Phase modulator'] tc.get_connections() # returns [['SOA-b0', 'Phase modulator-a0']]
1 August 2018 at 22:15 #4796Ronald
KeymasterDear Rastko,
To reproduce a circuit netlist the following steps are needed for each cell in a design:
– find the instances in the cell that represent a “circuit element”
– find the (circuit relevant) pin connections between these instances
– find the original cell of each instance needed to recreate the instance
– export the connectivity something like “cell_1.pin_a, cell_2.pin_b, parameters”The above is expected to be part of the next Nazca release (0.4.4).
Note that the circuit netlist is not the same as the layout netlist to generate gds.In Nazca 0.4.3 your example method ‘get_cells’ can be implemented as follows.
def get_cells(top): tree = nd.cell_iter(top) cells = [] for params in tree: if params.cell_start and params.level == 0: for inode, xya, flip in params.iters['instance']: cells.append(inode.cell.cell_name) return cells print(get_cells(tc))
The output shows the (parent cell) names of all instances. In your example:
['SOA', 'Phase modulator']
The following example shows how to read the cell objects into a dict and reuse them:
def get_cells(top): tree = nd.cell_iter(top) cells = {} for params in tree: if params.cell_start and params.level == 0: for inode, xya, flip in params.iters['instance']: cells[inode.cell.cell_name] = inode.cell return cells cells = get_cells(tc) print(cells)
After that you can put cells via the dict into a layout:
cells['SOA'].put()
In your external simulator case you may want to extract different or more information/parameters from the cell such as component length, waveguide width, compact model, etc.
Ronald
2 August 2018 at 14:08 #4797Rastko
ParticipantGreat, that solves it. With the list of cell objects I can get the length_geo and compare pin positions and orientation to get a list of connections.
Thanks a lot.
Rastko
3 August 2018 at 11:44 #4798Ronald
KeymasterDear Rastko,
That sounds like an interesting workaround for a circuit description. You may get into trouble though for identifying connectivity for components like MMIs, having >2 circuit pins. That said, circuit connectivity is already (being) moved into higher-lever Nazca functionality for cases as you describe. That concept also allows you to add your circuit/functional information to existing Nazca cells and parse that via the circuit netlist into your circuit simulator. In that way you can use Nazca more or less as a Python-based parser for your simulation set-up. An added value is that you describe an accurate mask layout at the same time.
Ronald
-
AuthorPosts
- You must be logged in to reply to this topic.