• 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 13946
  • 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 11 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
Parents
  • anla
    anla over 11 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
Reply
  • anla
    anla over 11 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
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