Home Forums Nazca Questions and Answers Get connections and cells in TopCell

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4792
    Rastko
    Participant

    Dear 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']]
    #4796
    Ronald
    Keymaster

    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

    #4797
    Rastko
    Participant

    Great, 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

    #4798
    Ronald
    Keymaster

    Dear 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

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.