Home > Community > Forums > Custom IC SKILL > Undocumented (?) gotcha in pcDefinePCell()

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: *

 Undocumented (?) gotcha in pcDefinePCell() 

Last post Wed, Apr 2 2008 4:09 PM by archive. 5 replies.
Started by archive 02 Apr 2008 04:09 PM. Topic has 5 replies and 3271 views
Page 1 of 1 (6 items)
Sort Posts:
  • Wed, Apr 2 2008 4:09 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    Undocumented (?) gotcha in pcDefinePCell() Reply

    In icfb 5.10.41.500.5.107, this works: procedure(makePCell(lib cell view "t") pcDefinePCell( list(ddGetObj(lib) cell view) ( (parameter_a "default value a") (parameter_b "default value b") (parameter_c "default value c") ) ; This is where I would, like, draw shapes and stuff. t ) ) Output: makePCell("myLib" "pcell" "layout") Generating Pcell for 'pcell layout'. db:219751468 But this does not work: procedure(makePCellBroken(lib cellName view "t") pcDefinePCell( list(ddGetObj(lib) cellName view) ( (parameter_a "default value a") (parameter_b "default value b") (parameter_c "default value c") ) ; This is where I would, like, draw shapes and stuff. t ) ) Output: makePCellBroken("myLib" "pcell" "layout") *WARNING* Invalid cell name - nil nil


    Originally posted in cdnusers.org by tweeks
    • Post Points: 0
  • Thu, Apr 3 2008 4:23 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Undocumented (?) gotcha in pcDefinePCell() Reply

    Don't use keywords like libName, cellName, viewName, viewType etc. The pcDefinePCell might be using them internally and that's the reason use of such keywords might make it fail.

    RR


    Originally posted in cdnusers.org by rairaj
    • Post Points: 0
  • Thu, Apr 3 2008 8:11 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Undocumented (?) gotcha in pcDefinePCell() Reply

    Thanks, Rairaj.

    Has this been fixed in 6.x?

    Isn't it possible to write pcDefinePCell() in such a way that its internal variables do not use the same namespace as variables referenced in the body of a pcDefinePCell() call? If that really is not possible, at least couldn't pcDefinePCell()'s internal variables be given names that users are less likely to choose? For example, "__cellName__"?


    Originally posted in cdnusers.org by tweeks
    • Post Points: 0
  • Thu, Apr 3 2008 1:03 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Undocumented (?) gotcha in pcDefinePCell() Reply

    This is due to a phenomenon known as variable capture, which can easily happen with macros and nprocedures (which is what pcDefinePCell is). I've checked, and it's still there in IC612. I see that CCR 547557 has been filed for you on this - there's another recent one on the same subject.

    Regards,

    Andrew.


    Originally posted in cdnusers.org by adbeckett
    • Post Points: 0
  • Thu, Apr 3 2008 3:02 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Undocumented (?) gotcha in pcDefinePCell() Reply

    Hi Andrew,

    Thanks for confirming it's also broken in IC612, and thanks for mentioning the technical term "variable capture". Googling that phrase, I found this very interesting article that gives several guidelines for avoiding variable capture in macros. Perhaps I should forward the link to Cadence support? ;)

    Thanks again!

    --tom


    Originally posted in cdnusers.org by tweeks
    • Post Points: 0
  • Thu, Apr 3 2008 3:09 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Undocumented (?) gotcha in pcDefinePCell() Reply

    Interesting - I looked at that page, and thought "hey, this looks familiar". Turns out it's the text of a book "on lisp" by Paul Graham. Doesn't seem to mention his name anywhere, so I wonder if it's legal...

    Anyway, in the other CCR on this, they know what needs to be done to cure this. One of our other big LISP guys filed it...

    Andrew.


    Originally posted in cdnusers.org by adbeckett
    • Post Points: 0
Page 1 of 1 (6 items)
Sort Posts:
Started by archive at 02 Apr 2008 04:09 PM. Topic has 5 replies.