Home › Forums › Nazca › Questions and Answers › Get connections and cells in TopCell › Reply To: Get connections and cells in TopCell
Dear 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