• 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. Check for Monte Carlo simulation in Spectre subcircuit?

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 125
  • Views 13771
  • 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

Check for Monte Carlo simulation in Spectre subcircuit?

anla
anla over 10 years ago

Hi!

Is there a chance to make Spectre check whether it runs a Monte Carlo (MC) simulation from within a subcircuit?

Consider the following example:

subckt my_suckt <pins>
  if( MC run ) {
    <<generate random parameter a>>
  } else {
    parameters a=4
  }
  // circuitry using parameter a
  ...
ends

There is a parameter a in a subcircuit. In a nominal simulation, its nominal value should be used; in a MC simulation, some sampling should be done. I'd prefer to hide this case distinction so that a designer instantiating the subcircuit does not need to take care of it. So how can I put "if( MC run )" in Spectre syntax?

Alternative: I could create two subcircuits, my_subckt_nom and my_subckt_mc, with different interiors and let a designer choose which one to instantiate. Hence, my question is not a show-stopper, but such a feature would be nice to have.

Background: The distribution of the subcircuit parameter a is asymmetric. Therefore, its nominal and mean value do not coincide and a case distinction is required in the implementation.

Thank you!

André

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    André,

    There's no means of directly detecting you are in monte carlo. However, I can see a couple of possibilities that might be worth trying.

    First, define your statistical variation:

    parameters varyingPart=0
    statistics {
      mismatch {
        vary varyingPart dist=gauss std=0.1
      }
    }

    and then in your subckt do:

    parameters a=varyingPart==0?4:6+varyingPart

    I made the "mean" of the parameter 6 to illustrate this. Note that I didn't do anything to skew the distribution, so you might need to apply some warping function to the varyingPart parameter - and adjust the mean (because the mean of a warped normal distribution won't be 0 any more).

    The above would almost work because there's only a very small chance of varyingPart being exactly 0 in the monte carlo. Even if it is, I doubt it would significantly affect the distribution.

    The other idea is to simply do:

    parameters a=4+(varyingPart>0?varyingPart*2:varyingPart)

    This will warp the distribution (whether it's the warping you want) and consequently the mean won't be 4 any more.

    Note that I've not tried either of these - they are just ideas off the top of my head.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • anla
    anla over 10 years ago

    Hi Andrew,

    thanks a lot for your proposals. Your first idea exactly performs as required, so I am going with it and have not tried the other.

    For completeness, I add an example netlist:

    ////// resistor test circuit
    //// parameter definitions incl. statistics
    parameters resvar=0
    statistics {
      process {
        vary resvar dist=gauss std=1 percent=no
      }
      mismatch {
        vary resvar dist=gauss std=1 percent=no
      }
    }
    //// subckt definition
    subckt my_res A B
      parameters r1=resvar==0?4:6+resvar
      r1 (A B) resistor r=r1
    ends my_res
    //// circuit definition: force current (I=1A) through resistor
    isource1 (1 0) isource dc=-1 type=dc
    iR1 (1 0) my_res
    //// nominal DC simulation
    dc1 dc
    //// MC DC simulation
    mc1 montecarlo numruns=1e4 seed=1 variations=all sampling=standard \
      donominal=no scalarfile="./mcdata" {
          dc2 dc
    }
    //// print voltage at node 1 - corresponds to resistor value in my_res since I=1A
    print v(1), name=dc1 addto="perf_dc.out"
    print v(1), name=dc2 addto="perf_mc.out"

    As expected, the voltage v(1) in "perf_dc.out" is 4V. From "perf_mc.out", for the voltage v(1), I obtain a mean value of approx. 6V and a standard deviation of approx. sqrt(2)V.

    Kind regards.

    André

    • 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