• 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. Mixed-Signal Design
  3. verilogams $rdist_normal for random resistor value in a...

Stats

  • Locked Locked
  • Replies 14
  • Subscribers 64
  • Views 16031
  • 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

verilogams $rdist_normal for random resistor value in a transient simulation

AndyD93
AndyD93 over 3 years ago

I'm trying to generate a Gaussian random resistor value for each transient simulation with the following verilogams code:

`include "constants.vams"
`include "disciplines.vams"

module Rrandom (va, vb);

inout va, vb;
electrical va, vb;
parameter real Rmean = 200.0*63.0;
parameter real Rstdev = 100;
parameter integer seed = 23;

real Rval;

analog
begin
  Rval = $rdist_normal( seed, Rmean, Rstdev, "instance" );
  I(va, vb) <+ V(va,vb)/Rval;
end

endmodule

When I run in "Single Run, Sweeps and Corners" mode the Rval is changing on every timepoint.  Here is a plot of the Rval for one of the resistors in the netlist:

But I'd like to have a single value for the resistor throughout the simulation (not changing per timepoint).  I tried moving the $rdist_normal outside the analog block as a "parameter real" similar to the example shown in the "Cadence Verilog-A Language Reference 21.1" in the $arandom section (but using $rdist_normal) but that gives me a syntax error.

`include "constants.vams"
`include "disciplines.vams"

module Rrandom (va, vb);

inout va, vb;
electrical va, vb;
parameter real Rmean = 200.0*63.0;
parameter real Rstdev = 100;
parameter integer seed = 23;

parameter real Rval = $rdist_normal( seed, Rmean, Rstdev, "instance" );

analog
begin
  I(va, vb) <+ V(va,vb)/Rval;
end

endmodule

How can I get resistor with a Gaussian distribution that does not change every simulation timepoint in the transient run?

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

    I just tried this and don't see it varying (I didn't run in ADE, but running multiple simulations gave consistent results, both with a VerilogAMS model run with AMS Designer (xrun), or with Spectre if it was Verilog-A). I don't see why running from ADE would (or could) change that.

    Which simulator and version are you using?

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • AndyD93
    AndyD93 over 3 years ago in reply to Andrew Beckett

    The Rval is not changing per instance or per MC iteration.  Here are six instances and 10 MC iterations:

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • AndyD93
    AndyD93 over 3 years ago in reply to Andrew Beckett

    The Rval is not changing per instance or per MC iteration.  Here are six instances and 10 MC iterations:

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to AndyD93

    See How to generate unique random numbers for multiple instances based on Monte Carlo iteration number ($cds_get_mc_trial_number)

    • 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