How to access with Python the layer information loaded from the lyp file

I am writing a python routine to read all the layer/purpose pair data for layers used in a layout, then cross reference it to the layers loaded from the lyp file. I have the first part complete in I can read the existing layer information and store the layer/purpose pairs in a structure, but I have not yet figured out how to access the loaded layer data. I thought it would be in the layout.technology data but don't see it there. Can someone point me to where it is located? Thanks!

Comments

  • Hello @DavidRLindley and @EugeneZelenko,
    Thanks for your inspiring post. And the comments regarding LayoutView.each_layer.

    Since it looked helpful if I had it, I implemented the feature in a simple command line tool.
    I hope my understanding was OK.

    Usage

    ---------------------------------------------------------------------------------------
    << Layer Information Cross-checker: KLayout Forum #2614 >>
    
    $ [python3] ./f2641-KazzzS.py
       option & argument    : descriptions                            | default value
       ---------------------------------------------------------------+---------------
       <-i|--design <file>> : design file such as 'abc.[oas|gds]'     | ''
       <-l|--lyp <file>>    : layer property file such as 'xyz.lyp'   | ''
       [-c|--case]          : purpose names are case insensitive      | disabled
       [-d|--debug <level>] : debug level                             | 0
       [-?|--??]            : print this usage and exit               | disabled
    ------------------------------------------------------------------+--------------------
    

    Run-1

    $ ./f2641-KazzzS.py -i nand-DMOS4.oas -l nand-DMOS4-complete.lyp
    
    -----------------------------------------------------
     Stage-1 (L,D) set comparison
    -----------------------------------------------------
     == The design and LYP files contain identical (L,D)s.
    
    -----------------------------------------------------
     Stage-2 purpose name comparison
    -----------------------------------------------------
     <> (1, 0)'s purpose names do not match: design=<active> vs LYP=<ACTIVE>
     <> (3, 0)'s purpose names do not match: design=<nwell> vs LYP=<NWELL>
     == (11, 0)'s purpose names match: design=<pplus> vs LYP=<pplus>
     == (12, 0)'s purpose names match: design=<nplus> vs LYP=<nplus>
     == (39, 0)'s purpose names match: design=<contact> vs LYP=<contact>
     == (41, 0)'s purpose names match: design=<poly> vs LYP=<poly>
     == (46, 0)'s purpose names match: design=<metal1> vs LYP=<metal1>
     == (46, 1)'s purpose names match: design=<metal1_lbs> vs LYP=<metal1_lbs>
     == (51, 0)'s purpose names match: design=<S-Recognition> vs LYP=<S-Recognition>
     == (51, 1)'s purpose names match: design=<MaleS-Recognition> vs LYP=<MaleS-Recognition>
     == (52, 0)'s purpose names match: design=<D-Recognition> vs LYP=<D-Recognition>
     == (52, 1)'s purpose names match: design=<FemaleD-Recognition> vs LYP=<FemaleD-Recognition>
    

    Run-2 (with -c)

    $ ./f2641-KazzzS.py -i nand-DMOS4.oas -l nand-DMOS4-complete.lyp -c
    
    -----------------------------------------------------
     Stage-1 (L,D) set comparison
    -----------------------------------------------------
     == The design and LYP files contain identical (L,D)s.
    
    -----------------------------------------------------
     Stage-2 purpose name comparison
    -----------------------------------------------------
     == (1, 0)'s purpose names match: design=<active> vs LYP=<ACTIVE>
     == (3, 0)'s purpose names match: design=<nwell> vs LYP=<NWELL>
     == (11, 0)'s purpose names match: design=<pplus> vs LYP=<pplus>
     == (12, 0)'s purpose names match: design=<nplus> vs LYP=<nplus>
     == (39, 0)'s purpose names match: design=<contact> vs LYP=<contact>
     == (41, 0)'s purpose names match: design=<poly> vs LYP=<poly>
     == (46, 0)'s purpose names match: design=<metal1> vs LYP=<metal1>
     == (46, 1)'s purpose names match: design=<metal1_lbs> vs LYP=<metal1_lbs>
     == (51, 0)'s purpose names match: design=<S-Recognition> vs LYP=<S-Recognition>
     == (51, 1)'s purpose names match: design=<MaleS-Recognition> vs LYP=<MaleS-Recognition>
     == (52, 0)'s purpose names match: design=<D-Recognition> vs LYP=<D-Recognition>
     == (52, 1)'s purpose names match: design=<FemaleD-Recognition> vs LYP=<FemaleD-Recognition>
    

    Run-3

    $ ./f2641-KazzzS.py -i nand-DMOS4.oas -l nand-DMOS4-missing4.lyp
    
    -----------------------------------------------------
     Stage-1 (L,D) set comparison
    -----------------------------------------------------
     <> The following (L,D)s are in the design file but not in the LYP file.
     [(51, 0), (51, 1), (52, 0), (52, 1)]
    
    -----------------------------------------------------
     Stage-2 purpose name comparison
    -----------------------------------------------------
     <> (1, 0)'s purpose names do not match: design=<active> vs LYP=<ACTIVE>
     <> (3, 0)'s purpose names do not match: design=<nwell> vs LYP=<NWELL>
     == (11, 0)'s purpose names match: design=<pplus> vs LYP=<pplus>
     == (12, 0)'s purpose names match: design=<nplus> vs LYP=<nplus>
     == (39, 0)'s purpose names match: design=<contact> vs LYP=<contact>
     == (41, 0)'s purpose names match: design=<poly> vs LYP=<poly>
     == (46, 0)'s purpose names match: design=<metal1> vs LYP=<metal1>
     == (46, 1)'s purpose names match: design=<metal1_lbs> vs LYP=<metal1_lbs>
     <> (51, 0)'s purpose names do not match: design=<S-Recognition> vs LYP=<no_such_(L,D)_in_LYP>
     <> (51, 1)'s purpose names do not match: design=<MaleS-Recognition> vs LYP=<no_such_(L,D)_in_LYP>
     <> (52, 0)'s purpose names do not match: design=<D-Recognition> vs LYP=<no_such_(L,D)_in_LYP>
     <> (52, 1)'s purpose names do not match: design=<FemaleD-Recognition> vs LYP=<no_such_(L,D)_in_LYP>
    

    Run-4 (for GDS2 with -c)

    $ ./f2641-KazzzS.py -i nand-DMOS4.gds -l nand-DMOS4-complete.lyp -c
    
    -----------------------------------------------------
     Stage-1 (L,D) set comparison
    -----------------------------------------------------
     == The design and LYP files contain identical (L,D)s.
    
    -----------------------------------------------------
     Stage-2 purpose name comparison
    -----------------------------------------------------
     <> (1, 0)'s purpose names do not match: design=<> vs LYP=<ACTIVE>
     <> (3, 0)'s purpose names do not match: design=<> vs LYP=<NWELL>
     <> (11, 0)'s purpose names do not match: design=<> vs LYP=<pplus>
     <> (12, 0)'s purpose names do not match: design=<> vs LYP=<nplus>
     <> (39, 0)'s purpose names do not match: design=<> vs LYP=<contact>
     <> (41, 0)'s purpose names do not match: design=<> vs LYP=<poly>
     <> (46, 0)'s purpose names do not match: design=<> vs LYP=<metal1>
     <> (46, 1)'s purpose names do not match: design=<> vs LYP=<metal1_lbs>
     <> (51, 0)'s purpose names do not match: design=<> vs LYP=<S-Recognition>
     <> (51, 1)'s purpose names do not match: design=<> vs LYP=<MaleS-Recognition>
     <> (52, 0)'s purpose names do not match: design=<> vs LYP=<D-Recognition>
     <> (52, 1)'s purpose names do not match: design=<> vs LYP=<FemaleD-Recognition>
    

    Kazzz-S

Sign In or Register to comment.