• 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. Use SKILL Code as Parameter Value for Instances in a Sc...

Stats

  • Locked Locked
  • Replies 13
  • Subscribers 145
  • Views 15130
  • 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

Use SKILL Code as Parameter Value for Instances in a Schematic

FormerMember
FormerMember over 5 years ago

Hello,

I have a several cells which contain a schematic view and an 'sp' view. The 'sp' view is an S-parameter text file, which is referenced by an 'nport' in the schematic via the 'file' parameter.

However, only the absolute path to the 'sp' view file is saved at the moment, which becomes invalid every time the cell is moved or copied. My question is, if it is possible to use a SKILL function, or similar, to point the nport always to the sp view of the schematic, it is placed in.

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

    One way I've done this in the past is to have a modified version of the nport where the CDF was updated to have parameters for the lib/cell/view of the sp text view rather than a file, and then have a custom netlist procedure which takes care of converting the lib/cell/view into the actual file.

    The version I had in the past hasn't kept pace with the current nport though which is a bit more complicated, so I can't just post what I did before. Here's what I just tried though:

    1. Copy analogLib/nport to (say) mylib/nport
    2. Edit the base CDF of mylib/nport
      1. Delete the sparam_file_as_var, nportFileB, dataFile
      2. Add three string parameters (in a sensible place) called (say) spLibName spCellName spViewName and given them meaningful prompts
      3. In the Simulation Information tab, pick "spectre" as the simulator, and note the  netlist procedure (in my case it was _spectreNportPrimParameterized ).
      4. Change the netlist procedure to CCFspectreNportPrimParameterized
    3. Load the code below (best place to put it is in the libInit.il of mylib (i.e. the library where you created the copy of the nport). Note that you'll need to change the code if the original netlist procedure was not _spectreNportPrimParameterized, or if you used parameters other than spLibName, spCellName and spViewName

    This seems to work OK - it means you have all the controls that nport has, but the file comes from a lib/cell/view.

    procedure(CCFspectreNportPrimParameterized(inst)
        let((formatter netlister lib cell view ddId)
            formatter=nlGetFormatter(inst)
            netlister=nlGetNetlister(inst)
            ;----------------------------------------------------------------
            ; Call original netlist procedure
            ;----------------------------------------------------------------
            _spectreNportPrimParameterized(inst)
            ;----------------------------------------------------------------
            ; Find file from specified lib/cell/view and netlist that
            ;----------------------------------------------------------------
            lib=nlGetParamStringValue(inst 'spLibName)
            cell=nlGetParamStringValue(inst 'spCellName)
            view=nlGetParamStringValue(inst 'spViewName)
            when(!blankstrp(lib) && !blankstrp(cell) && !blankstrp(view)
                ddId=ddGetObj(lib cell view "*")
                when(ddId
                    nlPrintString(netlister 
                        sprintf(nil " file=\"%s\"" ddId~>readPath)
                    )
                )
            )
        )
    )
    
    

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • FormerMember
    FormerMember over 5 years ago in reply to Andrew Beckett

    Hi Andrew,

    thank you for your fast reply. This solution seems to work and it is much better, than to have absolute paths. However, the library and cell name are still fixed and become invalid in case of copying or moving cells.The problem persists, that if the cell is copied from a local library to a shared hierarchy. It may happen, that other people using the cell will reference the old location, which may become unavailable in the future.

    I know, that it is probably difficult to guarantee the correct parameter values at all times, but maybe it is possible to use a CDF callback to update the parameters every time an instance is edited or inserted?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to FormerMember

    OK, how about this - perhaps closer to what you originally asked for. Don't bother with the spLibName and spCellName CDF parameters and use this as the netlist procedure. The idea is that say you have myLib/myCell/schematic which contains an instance of this nport, you can then have a text view myLib/myCell/myView (i.e. same library and cell as the containing schematic) and you just specify myView on the instance of the nport. Is that better? This should be more relocatable now...

    procedure(CCFspectreNportPrimParameterized(inst)
        let((formatter netlister lib cell view ddId parent)
            formatter=nlGetFormatter(inst)
            netlister=nlGetNetlister(inst)
            ;----------------------------------------------------------------
            ; Call original netlist procedure
            ;----------------------------------------------------------------
            _spectreNportPrimParameterized(inst)
            ;----------------------------------------------------------------
            ; Find file from specified lib/cell/view and netlist that
            ;----------------------------------------------------------------
    	parent=nlGetId(inst)~>cellView
            lib=parent~>libName
            cell=parent~>cellName
            view=nlGetParamStringValue(inst 'spViewName)
            when(!blankstrp(lib) && !blankstrp(cell) && !blankstrp(view)
                ddId=ddGetObj(lib cell view "*")
                when(ddId
                    nlPrintString(netlister 
                        sprintf(nil " file=\"%s\"" ddId~>readPath)
                    )
                )
            )
        )
    )
    
    
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • FormerMember
    FormerMember over 5 years ago in reply to Andrew Beckett

    Thank you for your reply. This solution does exactly what I want. I think there is only a small mistake, you wrote 2x !blankstrp(cell) in the parameter check, instead of !blankstrp(view)?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to FormerMember

    Well spotted - I've fixed that in both bits of code. Thanks for highlighting my silly mistake!

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • FormerMember
    FormerMember over 5 years ago in reply to Andrew Beckett

    Another followup question: Is it possible to somehow keep the original nport from analoglib? If for some reason the analoglib nport changes, this may cause problems.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to FormerMember

    Not really. There's a request to support lib/cell/view on the analogLib nport which would mean you could do this out of the box. 

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • FormerMember
    FormerMember over 5 years ago in reply to Andrew Beckett

    It would be nice, if this feature would be implemented, but I guess it wont happen in the near future.

    At the moment I also have a new Problem. I try to extent the netlistProcedure to allow selecting the S-parameter file dependent on a design variable. I created a CDF parameter "sel" and assigned a variable "x" to it, which I want to sweep. However, it seems if I access the CDF parameter "sel" within the Skill function I only get the string "x". Is there a way to get the assigned value of "x" within the netlistProcedure?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to FormerMember

    Paul,

    The standard analogLib nport allows you to set S-parameter file as Design Var. Could you use that? In essence, the netlist procedure does not try to evaluate the design variable - it passes it through to spectre and then spectre evaluates the variable, which then allows sweeps etc of that variable.

    In essence, you are just ensuring that the netlist procedure doesn't put quotes around it. Normally you really don't want your netlist procedure to try to evaluate variables, because then would have to renetlist the block containing the instance for each and every sweep point (and there isn't really a mechanism to do that; it would be inefficient too).

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to FormerMember

    Paul,

    The standard analogLib nport allows you to set S-parameter file as Design Var. Could you use that? In essence, the netlist procedure does not try to evaluate the design variable - it passes it through to spectre and then spectre evaluates the variable, which then allows sweeps etc of that variable.

    In essence, you are just ensuring that the netlist procedure doesn't put quotes around it. Normally you really don't want your netlist procedure to try to evaluate variables, because then would have to renetlist the block containing the instance for each and every sweep point (and there isn't really a mechanism to do that; it would be inefficient too).

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • FormerMember
    FormerMember over 5 years ago in reply to Andrew Beckett

    Thanks for the fast reply. I know the switch to use variables as file in the nport, but then I have the problem with finding the path again. Lets say I have 2 S-parameter files (eg for corners), which are saved as cell views. I like to have a numeric variable x=1 or 2, to select one of these. I tried to use the ternary operator in the form of "file=(x==1) ? path1 : path2" (without quotes), but it seems that spectre still interprets the 'file' attribute of the nport as string, if it is not a single variable name. 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to FormerMember

    Attached is an example using ADE Explorer (I didn't know which ADE you were using), which stores the s-parameter files in text views, and then sweeps an integer variable "x" between 1 and 2 (it could be extended). Essentially I've defined the variables as follows:

    Variable Expression
    SPVIEW sprintf(nil "%L" case(round(VAR("x")) (1 "splc1") (2 "splc2")))
    SPCELL "myblock"
    SPLIB "mylib"
    SPFILE sprintf(nil "%L" ddGetObj(VAR("SPLIB") VAR("SPCELL") VAR("SPVIEW") "text.txt")~>readPath)
    x 1,2

    Personally I would have done this instead, as it makes it simpler (this is what I had originally):

    Variable Expression
    SPVIEW "splc1","splc2"
    SPCELL "myblock"
    SPLIB "mylib"
    SPFILE sprintf(nil "%L" ddGetObj(VAR("SPLIB") VAR("SPCELL") VAR("SPVIEW") "text.txt")~>readPath)

    In other words, just sweep the view string and not bother with the bit that sweeps an integer.

    The nport in the schematic is just a normal analogLib nport, with the filename set to be a variable, and SPFILE as the variable for the file to reference. As you can see, the SPFILE is a SKILL expression which references the source lib/cell/view and retrieves the file. The sprintf() stuff is to ensure there are quotes around the file name.

    Hope that helps?

    Andrew.

    https://community.cadence.com/cfs-file/__key/communityserver-discussions-components-files/48/sparamViewSweep.tgz

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • FormerMember
    FormerMember over 4 years ago in reply to Andrew Beckett

    I am using the netlistProcedure approach for some time now with spectre and it works quite well. However, now I want to run some AMS simulations with the modified nport as well. I guess I also have to use an own netlistProcedure here, but I cant get it to work. The generated netlist does not contain any modified nport instance.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to FormerMember

    Hi Paul,

    It ought to work with the same netlist procedure for spectre (because the AMS UNL netlister uses the spectre netlister under the hood). Are you essentially using the netlist procedure above for spectre? If not, can you post it here?

    By the way, in IC6.1.8/ICADVM20.1 ISR16 (out later this month), the analogLib nport will have the ability to specify a lib/cell/view on the instance.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

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