• 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 Design
  3. how to use the random function in schematic?

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 125
  • Views 9956
  • 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

how to use the random function in schematic?

lukelukeamd
lukelukeamd over 2 years ago

  Hi

  The following function abRandomNormal had been defined in ciw and it works. However, when give 

abRandomNormal() as a value to resistor in analogLib, in the simulation, it reports the following errors.

Error found by spectre during hierarchy flattening.
ERROR (SFE-1997): "input.scs" 21: Cannot run the simulation because V0: parameter `dc': Function `abRandomNormal' is not defined. Update the netlist to define the function.
, correct the expression and rerun the simulation.

How to use the pre-defined function as a variable to the analogLib devices?

Thanks

defMathConstants('abRandomNormal)
defun(abRandomNormal nil 
    let((max((-1 >> 1)) U V) 
	(U = (float(random(max)) / max)) 
	(V = (float(random(max)) / max)) 
	(sqrt((-2 * log(U))) * cos((2 * (abRandomNormal.PI) * V)))
    )
)
  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 2 years ago

    You can't put SKILL functions in expressions on instances like this.

    What exactly are you trying to do? When do you want the random value to be chosen? Are you trying to do some kind of Monte Carlo analysis? A bit of background as to what the goal is will help in giving you a suitable alternative.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • lukelukeamd
    lukelukeamd over 2 years ago in reply to Andrew Beckett

    Hi Andrew

    Thanks for your reply.

    I would like to generate a random value resistor in my simulation. So I would like to generate a number and used it in schematic for resistor value.

    Thanks

    Brian

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 2 years ago in reply to lukelukeamd

    Dear Brian.

    I assembled one possibility if I understand your need that you might consider. Basically, I've assembled a script that accepts an exported Explorer/Assembler corners comma-separated variable file. As an example, suppose your design variable assigned to the random resistor is called "r_random_ohms" and you want to create N random samples about the average value "r_random_average" with a range of "r_random_range".

    The script "random_resistor.sh" in the compressed directory:

    www.dropbox.com/.../random_resistor_value_090922.zip

    searches the corner file for the design variable name and appends N test columns where the value of design variable "r_random" takes on N random values from [r_random_average - 0.5*"r_random_range] to [r_random_average + 0.5*"r_random_range] . All other design variables and model files in the last corner of the corner file you supply to the script take on the same values as the last corner. I created a test bench to test the methodology and some documentation and the examples are in the note at URL:

    www.dropbox.com/.../random_resistor_value_sml_091122v1p0.pdf

    The compressed file contains a README file that provides much of this information, the script command to create a couple of the example corner files I used.

    I hope I understood your question and this is of some help to you Brian. Please feel free to ask me to clarify any of my instructions - or relate any issues you may experience!

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • lukelukeamd
    lukelukeamd over 2 years ago in reply to ShawnLogan

    Thanks Shawn. It is interesting.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 2 years ago in reply to lukelukeamd

    Dear lukelukeamd,

    I am glad you found it interesting! I thought it might be worth including the ability to generate a Gaussian distribution in addition to a uniform distribution and added that capability. THe updated script directory and documentation has been updated. An example of the simulated distributions using the uniform and gaussian distribution options from page 14 of the note is shown below.

    www.dropbox.com/.../random_resistor_value_090922.zip

    www.dropbox.com/.../random_resistor_value_sml_091122v1p0.pdf

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • ShawnLogan
    ShawnLogan over 2 years ago in reply to lukelukeamd

    Dear lukelukeamd,

    I am glad you found it interesting! I thought it might be worth including the ability to generate a Gaussian distribution in addition to a uniform distribution and added that capability. THe updated script directory and documentation has been updated. An example of the simulated distributions using the uniform and gaussian distribution options from page 14 of the note is shown below.

    www.dropbox.com/.../random_resistor_value_090922.zip

    www.dropbox.com/.../random_resistor_value_sml_091122v1p0.pdf

    Shawn

    • 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