Home > Community > Forums > Custom IC SKILL > How to open two layouts, copy them into a third and save

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 How to open two layouts, copy them into a third and save 

Last post Wed, Jul 29 2009 4:21 PM by skillUser. 9 replies.
Started by LostInRTN 23 Jul 2009 05:33 PM. Topic has 9 replies and 4086 views
Page 1 of 1 (10 items)
Sort Posts:
  • Thu, Jul 23 2009 5:33 PM

    • LostInRTN
    • Not Ranked
    • Joined on Thu, Jul 23 2009
    • Posts 8
    • Points 175
    How to open two layouts, copy them into a third and save Reply

    I'm writing a script that will run automatically using icfb -nograph -replay script.il. I need it to open three layouts, and copy all the contents of two of the layouts into the third, then save it, close and exit.

    I was originally going to use (procedure and let's omitted):
          window1 = dbOpenCellViewByType(Dir Name1 "layout" "" "w")
          window2 = dbOpenCellViewByType(Dir Name2 "layout" "" "r")
          geSelectAll()
          geCopySelSet()
          hiSetCurrentWindow(window1)
          mouseAddPt()
          dbClose(window2)
          window3 = dbOpenCellViewByType(Dir Name3 "layout" "" "r")
          geSelectAll()
          geCopySelSet()
          hiSetCurrentWindow(window1)
          mouseAddPt()  ;
          dbClose(window3)
          dbSave(window1)
          dbClose(window1)
    However, dbOpenCellViewByType opens it in memory but doesn't open a window, so the geSelectAll() won't work. geOpen() just opens a design, but not a window- should I use hiOpenWindow + geOpen?

    Also, the object returned by dbOpenCellViewByType doesn't match what hiSetCurrentWindow wants. And, I'm not sure how to end the geCopySelSet command- it wants a location to put the copied objects and there's no user to click the mouse.

     Thanks for any help

    Tom Spargo

    • Post Points: 35
  • Thu, Jul 23 2009 7:39 PM

    • sparksu
    • Top 500 Contributor
    • Joined on Thu, May 14 2009
    • Beijing, China
    • Posts 17
    • Points 295
    Re: How to open two layouts, copy them into a third and save Reply

    Some suggestions:

    A: dbOpenCellViewByType() will return a cellView ID not a window.

    So in your code window1 is actually a cellView. It is not a window.

    And I don't think "hiSetCurrentWindow(window1)" could work.

    B: Based on my experiences geOpen() will open a design in a new window.

    What you said "geOpen() just opens a design" is not right.

    • Post Points: 5
  • Thu, Jul 23 2009 7:47 PM

    • kbhow
    • Top 50 Contributor
    • Joined on Thu, May 7 2009
    • Penang, Pulau Pinang
    • Posts 120
    • Points 2,045
    Re: How to open two layouts, copy them into a third and save Reply

    Hi Tom,

    dbOpenCellViewByType will only open the cell view in virtual memory. But if you wish to run your script in virtuoso -nograph mode, dbOpenCellViewByType is the best to use rathen than using geOpen since u doesn't not require to open the window to do the work.

    In the other hand, you should not use interactive function which require any input from user in virtouso -nograph since the function is require an input from user.

    To copy all contents of layout1 and layout2 to layout3, you can try this: 

    Cv_dest = dbOpenCellViewByType(libName cellName viewName "maskLayout" "w")

    Cv_src1 = dbOpenCellViewByType(lib1 cell1 view1 "maskLayout" "r")

    Cv_src2 = dbOpenCellViewByType(lib2 cell2 view2 "maksLayout" "r")

    foreach( fig geSelectAllFig(Cv_src1)

            dbCopyFig(fig Cv_dest list(0:0 "R0" 1.0)))

    );foreach

    foreach( fig geSelectAllFig(Cv_src1)

            dbCopyFig(fig Cv_dest list(0:0 "R0" 1.0)))

    );foreach

    dbSave(Cv_dest)

    dbClose(Cv_dest)

    dbClose(Cv_src1)

    dbClose(Cv_src2)

     

    How

    • Post Points: 20
  • Fri, Jul 24 2009 3:08 AM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,567
    • Points 15,575
    Re: How to open two layouts, copy them into a third and save Reply

     Hi Tom,

    How's suggestion is in the right direction, but I don't think it will work since the ge prefix functions work with graphics editor and the cellviews are being opened in virtual memory only, not in graphical windows.  A more direct way to get all of the shape dbId's for copying would be to use

      Cv_src1~>shapes

    instead of

      geSelectAllFig(Cv_src1)

    in the foreach loop.

    NOTE: I have not tested How's code nor my suggestion.

    I hope that this helps,

    Regards,

    Lawrence.

    Filed under: , ,
    • Post Points: 20
  • Fri, Jul 24 2009 3:18 AM

    Re: How to open two layouts, copy them into a third and save Reply

    Lawrence is right. How's code won't work, because geSelectAllFig does not work unless the cellView is open in a window (I tested this in case this was some behaviour I was unfamiliar with).

    Actually to copy everything would get reasonably complicated relatively quickly. In addition to iterating over the shapes, you'd want to iterate over instances (missing out any mosaicInsts) and mosaics. In IC61 you'd also need to iterate over boundaries, markers, vias, and a few other object types. 

    So what I would probably do (as this keeps it simple) would be to use dbCreateInst() to create an instance of the cell you want to copy the contents of, and then use dbFlattenInst to flatten it. Then you have the choice of preserving pins and ROD objects during the "copy".

    Regards,

    Andrew.

    • Post Points: 20
  • Fri, Jul 24 2009 4:01 AM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,567
    • Points 15,575
    Re: How to open two layouts, copy them into a third and save Reply

    Ah yes, I forgot about instances etc. so Andrew's suggestion is really a better approach, and simpler too.
    Just for a brief reference, the dbFlattenInst() function is shown here:

    dbFlattenInst(
      d_instId
      x_levels
      [ g_flattenPCells ]
      [ g_preservePins ]
      [ g_preserveRODobjs ]
    )

    So the code might look something like this:

    procedure(CCScopyCellsToNew(@key lib1 cell1 (view1 "layout")
       lib2 cell2 (view2 "layout")
       libName cellName (viewName "layout") "ttttttttt")
      let(Cv_dest Cv_src1 Cv_src2 id1 id2)
       if(Cv_dest = dbOpenCellViewByType(libName cellName viewName "maskLayout" "w") then
        Cv_src1 = dbOpenCellViewByType(lib1 cell1 view1 "maskLayout" "r")
        Cv_src2 = dbOpenCellViewByType(lib2 cell2 view2 "maksLayout" "r")
        id1 = dbCreateInst(Cv_dest Cv_src1 "I1" 0:0 "R0")
        id2 = dbCreateInst(Cv_dest Cv_src2 "I2" 0:0 "R0")
        dbFlattenInst(id1 32 t t t)
        dbFlattenInst(id2 32 t t t)
        dbSave(Cv_dest)
        dbClose(Cv_dest)
        dbClose(Cv_src1)
        dbClose(Cv_src2)
       else
        warn("CCScopyCellsToNew: could not open destination cell for writing: %s %s %s" libName cellName viewName)
       ); if
      ); let
    ); procedure CCScopyCellsToNew

     

    This is completely untested, I just typed it in, but I expect it is about right, though it may need some tweaking or debugging.

    Regards,

    Lawrence.

    Filed under: , ,
    • Post Points: 20
  • Fri, Jul 24 2009 11:18 AM

    • LostInRTN
    • Not Ranked
    • Joined on Thu, Jul 23 2009
    • Posts 8
    • Points 175
    Re: How to open two layouts, copy them into a third and save Reply

    Thanks guys for all the quick responses!

    If it makes things any easier, I suppose I don't need to open icfb with -nograph. I just thought it made sense since theres no user interaction, but my only real requirement is that this is done with no user input.

    Additionally, it is not a full layout- it is just one metal layer + vias. It appears to be made of rectangles and polygons only.

    I'll work on both methods and see which gives me the least pain.

    Cheers,

    Tom Spargo

    • Post Points: 20
  • Sun, Jul 26 2009 5:21 PM

    • kbhow
    • Top 50 Contributor
    • Joined on Thu, May 7 2009
    • Penang, Pulau Pinang
    • Posts 120
    • Points 2,045
    Re: How to open two layouts, copy them into a third and save Reply

    First of all, my apoligies for posting solution in the SKILL forum, where it cuases error somewhere.

    Ya, Adrew suggestion sound the best in Tom's condition, I miss out this too. :)

     

    How 

    • Post Points: 5
  • Wed, Jul 29 2009 3:27 PM

    • LostInRTN
    • Not Ranked
    • Joined on Thu, Jul 23 2009
    • Posts 8
    • Points 175
    Re: How to open two layouts, copy them into a third and save Reply

    Turns out the easiest way to do this is to use dbCreateInstByMasterName(). :)

    • Post Points: 20
  • Wed, Jul 29 2009 4:21 PM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,567
    • Points 15,575
    Re: How to open two layouts, copy them into a third and save Reply

    Hi Tom,

    Yes, this is an alternative to the dbOpenCellViewByType followed by dbCreateInst , however this method would allow you to check to ensure that the cellview exists (i.e. the function does not return 'nil') beforehand.  You can achieve the same by using ddGetObj to check if a cellview exists before trying to instantiate it.

    Regards,

    Lawrence.

    • Post Points: 5
Page 1 of 1 (10 items)
Sort Posts:
Started by LostInRTN at 23 Jul 2009 05:33 PM. Topic has 9 replies.