• 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. symbol properties versus defstruct versus ?

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 143
  • Views 14008
  • 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

symbol properties versus defstruct versus ?

drdanmc
drdanmc over 8 years ago

This is really a general skill programming question.

I have a collection of skill procedures that all work together as somewhat of a package.  There is a need to have some common data shared among all of them.  This is analogous to the schRegPostCheckTrigger/schGetPostCheckTriggers/schUnregPostCheckTrigger/[schematic check code] procedures that are part of virtuoso.

Currently I have  a handful (15-20) of moderately short lists (typically < 10 elements) to be stored as well as maybe a few dozen boolean variables.  That is a lot of global name space pollution although I do have them consistently prefixed.  I've read the section in the skill users guide about using symbol properties as a way to control/limit the number of global variables.  However, I'm missing a few basic but critical steps.

1)  if I use a symbol with properties to hold all of this configuration data, it needs to be a consistent symbol so my procedures know how to find it.  gensym() creates a unique symbol when you call it so that seems questionable.  Or maybe I should assign a global variable to the result like:

when(!boundp('MYconfig)

  MYconfig = gensym("MYconfig")

 MYconfg->setting1 = "default1" 

 MYconfig->setting2 = "default2

)

2)  If I do this, it seems like I have to be more careful with loading the file with that gensym() in it first than the old globals way.  In the old way I could just do

when(! boundp('MYsetting1) MYsetting1 = "default value")

and it didn't really matter if you loaded this code before or after a user loaded settings.

3)  should I instead create the property list as a disembodied property list like this:

when(!boundp('MYconfig)

  MYconfig = ncons(nil)

 MYconfg->setting1 = "default1" 

 MYconfig->setting2 = "default2

)

4)  Should I reserve using the property list of a symbol that has a function binding for data which is used exclusively by that function but needs to persist from one call to another call?

5) Should I think about defstructs instead? The manual says the should be faster to access for the slots which were statically declared.  

defstruct(MYconfig_struct setting1 setting2)

when(!boundp('MYconfig)

MYconfig = make_MYconfig_struct(?setting1 "default1" ?setting2 "default2")

)

Then last, I'm trying to decide on a user or project configuring the code by direct setting of properties versus an API which gives a procedure for each.  The latter hides some implementation details (a good thing) at the expense of a proliferation of procedures which are just short wrappers around assigning values.

I know this should be basic stuff especially for how long I've used/written/hacked skill code... but it is never too late to improve.

Thanks

-Dan

  • Cancel
Parents
  • drdanmc
    drdanmc over 8 years ago

    Thanks Andrew!  This is most helpful and as always I appreciate your help.

    -Dan

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • drdanmc
    drdanmc over 8 years ago

    Thanks Andrew!  This is most helpful and as always I appreciate your help.

    -Dan

    • 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