• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. defstruct in pcell (for layout), is it possible?

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 144
  • Views 14852
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

defstruct in pcell (for layout), is it possible?

sjoerdh
sjoerdh over 10 years ago

Hello,

This is what I want to do:

  • Create a pcell that instantiates other pcells (layout)
  • Perform various "measurements" on this new instance (i.e.: retrieve the bounding box)
  • This information has to be used lateron in the pcell code

I'd like to store this information in a table, where each cell is a defstruct.The code looks like this:

procedure( genCurMir( ... )
    let( ()
        ...
        curMirInst = makeTable( "curMirInst" nil )
        defstruct( instance boundingBox gateCenter drainCenter sourceCentre )
        curMirInst["CELL1"] = make_instance()
        ...
        curMirInst["CELL1"]->boundingBox = instID~>bBox
        ...
    ) ;;; end of let
) ;;; end of procedure genCurMir

After generating the pcell (loading the code containing the command "pcDefinePCell") weird things happen: I am unable to open any view (layout/schematic/symbol/...).Entering commands in the CIW will result (9 out of 10 times) in an error, which is the same error when trying to open any cell-view:

*Error* setq/set: Variable is protected and cannot be assigned to - instance

I have tried creating the defstruct with an other name (blablablabla, definitely not used anywhere else), but the same error, only "instance" replaced by "blablablabla". I have to restart Cedence to regain control.

Furthermore, this created defstruct seems to be global, whereas I created it inside a let. I'd like to keep it local though.

So my question is:

Is it possible to use defstructs in pcells?
If so, what am I doing wrong?

I'd realy like to use this method (table of defstructs) since it is very conveniant.

Any help is highly appreciated.

Thanks in advance,

Sjoerd

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    Hi Sjoerd,

    I would suggest moving the defstruct outside of a procedure. They are not local anyway, so there is no benefit. I also think that problems may occur because the definition of the structure is stored in a variable called (say) instance. If you have defined this, it may actually stamp on a dynamically scoped variable called instance at the same time.

    You can see this in the following code (completely separate from a pcell):

    defstruct( instance boundingBox gateCenter drainCenter sourceCentre )
    procedure(MyMakeThing()
      make_instance()
    )

    let((instance)
      MyMakeThing()
    )

    this will fail with an error:

    *Error* iliMakeDefstruct: Name given not a defstruct - instance

    the problem is the clash with the local variable instance and the global variable instance containing the structure definition. So I would suggest also ensuring that you call the defastruct MyInstance or something that is definition not going to clash.

    It's possible the instance in your case is clashing with something in the pcell system - I didn't check that.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    Hi Sjoerd,

    I would suggest moving the defstruct outside of a procedure. They are not local anyway, so there is no benefit. I also think that problems may occur because the definition of the structure is stored in a variable called (say) instance. If you have defined this, it may actually stamp on a dynamically scoped variable called instance at the same time.

    You can see this in the following code (completely separate from a pcell):

    defstruct( instance boundingBox gateCenter drainCenter sourceCentre )
    procedure(MyMakeThing()
      make_instance()
    )

    let((instance)
      MyMakeThing()
    )

    this will fail with an error:

    *Error* iliMakeDefstruct: Name given not a defstruct - instance

    the problem is the clash with the local variable instance and the global variable instance containing the structure definition. So I would suggest also ensuring that you call the defastruct MyInstance or something that is definition not going to clash.

    It's possible the instance in your case is clashing with something in the pcell system - I didn't check that.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information