Home > Community > Forums > Custom IC SKILL > Global and local variables

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

 Global and local variables 

Last post Tue, Oct 21 2008 2:10 PM by skillUser. 1 replies.
Started by mb47 08 Aug 2008 10:25 AM. Topic has 1 replies and 3367 views
Page 1 of 1 (2 items)
Sort Posts:
  • Fri, Aug 8 2008 10:25 AM

    • mb47
    • Not Ranked
    • Joined on Thu, Jul 17 2008
    • Posts 3
    • Points 60
    Global and local variables Reply

    I use Ocean scripts to simulate circuits. Typically I have one (or more) script per circuit. At the moment all the variables in my scripts are global.

    However i'd like to reduce the number of global variables, or at least make such that some variables that are used to simulate one circuit are invisible when simulating a second one.

    I do not want to use let(), because

    • I'd like to avoid to explicitly declare each variable
    • I still want to access some variables interactively from the CIW at the end of the script

    I thought something like a MATLAB workspace could do the job. I read about SKILL++ environments, and I thought that they could do what I need. However:

    • Can use SKILL++ environment in scripts (i.e. non-interactively)?
    • Can you ocean directly inside SKILL++ scripts?
    • How can have similar functionality in SKILL scripts?
    • How are environments setup and used? (simple code example would help here)
    • What other options do I have to share/hide variables?
    • How can I clear all the variables?

    Thanks for any suggestion.

     

    As an example of how I would like to use this functionality, consider the case where I want to have "workspaces", each dedicated to a different circuit/script. All variables used in the script corresponding to one circuit should be hidden when simulating a second one. If this is not easily possible, than at least clear all variables before calling a second script would help.

    • Post Points: 20
  • Tue, Oct 21 2008 2:10 PM

    • skillUser
    • Top 10 Contributor
    • Joined on Fri, Sep 19 2008
    • Austin, TX
    • Posts 2,598
    • Points 16,060
    Re: Global and local variables Reply

     Hi,

    Each symbol in SKILL can have a value (used as a variable), a function definition and a property list.

    One idea that may help is to make sure that you have a procedure defined for a particular simulation or type, and then use the property list slot of the same symbol (i.e. the function name) to store data.  The data is global but looks as if it 'belongs' to the procedure, here is a very simple example:

    procedure(myproc()
     ;blah blah
    )
    myproc.xval = 50
    myproc.yval = 123
     

    The property list value could be a table structure, a list etc. to allow for storage to be grouped under one roof, but it is still global since the property list is on the symbol for the function name, which is by virtue, global (for SKILL anyway, SKILL++ would allow private functions). SKILL Lint does not "see" the property list values as global.  You can also use the SKILL access functions for accessing this, in this case you might use:

      getqq(myproc ?)
    => (xval yval)

    This would seem a simple attempt to solve the problem, but does not really address the issues of global vs. local vs. private (e.g. SKILL++) .  You can use SKILL++ non-interactively, one method is to ensure that the filename ends in the suffix .ils and it will be loaded with SKILL++ semantics, or you can look at the toplevel() function.  I have not tried to use SKILL++ in conjunction with OCEAN, but I do not see any reason why it would not work.

    I hope this helps a little.

    Lawrence.

    • Post Points: 5
Page 1 of 1 (2 items)
Sort Posts:
Started by mb47 at 08 Aug 2008 10:25 AM. Topic has 1 replies.