The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 10:01am
Pages: 1
Send Topic Print
help debug this random noise gen code (Read 6652 times)
neoflash
Community Fellow
*****
Offline

Mixed-Signal
Designer

Posts: 397

help debug this random noise gen code
Nov 25th, 2006, 6:05am
 
I developed this code to generate a random noise. However, it seems it will keep constant after initial change, why?

module rj_src (rj_out);
output rj_out;
electrical rj_out,rj_int;
parameter real rj_amp = 1 from (0:inf);
parameter real rj_tau = 10m from (1p:inf);
parameter integer seed = 10 from (1:inf);
real next;
real noise;

analog begin
 
  // this rj_src will generate a random noise voltage and sum with sin_clk_src's output;
  // Thus, jitter is modeled as additive noise;
  @(initial_step) next = $abstime + rj_tau;

  @(timer(next))
     begin
        noise = rj_amp*$rdist_normal(seed,0,1);
        next = next + rj_tau;
     end

  V(rj_int) <+ noise;
  V(rj_out) <+ V(rj_int) + I(rj_out)*50;

end
endmodule
Back to top
 
 
View Profile   IP Logged
neoflash
Community Fellow
*****
Offline

Mixed-Signal
Designer

Posts: 397

Re: help debug this random noise gen code
Reply #1 - Nov 25th, 2006, 7:48am
 
i found that seed should be a local variable, not a parameter.

The function will auto-modify seed to generate prbs.
Back to top
 
 
View Profile   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2386
Silicon Valley
Re: help debug this random noise gen code
Reply #2 - Nov 25th, 2006, 10:13am
 
The model would be a bit more efficient if you make rj_int a local real variable rather than a node.

-Ken
Back to top
 
 
View Profile WWW   IP Logged
neoflash
Community Fellow
*****
Offline

Mixed-Signal
Designer

Posts: 397

Re: help debug this random noise gen code
Reply #3 - Nov 25th, 2006, 6:46pm
 
according to the Jitter Tolerance Pattern Gen on web page, this random noise is summed with sinusoidal wave. How we prevent double crossing?
Back to top
 
 
View Profile   IP Logged
jbdavid
Community Fellow
*****
Offline



Posts: 378
Silicon Valley
Re: help debug this random noise gen code
Reply #4 - Dec 8th, 2006, 11:30pm
 
Why would you, does the REAL noise nicely prevent double crossing?

one way would be to include a delay in the detector, so that ONCE a crossing has happend, a certain amount of time must pass before another one.. that might be more realistic..
for the stats you want to measure it might be more interesting to report any times when there would have been double crossing.. even if the detector masks it in the output.
have fun

Back to top
 
 

jbdavid
Mixed Signal Design Verification
View Profile WWW   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2386
Silicon Valley
Re: help debug this random noise gen code
Reply #5 - Dec 9th, 2006, 9:28am
 
Real circuits often employ hysteresis to avoid the issue with double crossing. Your model can too. Or you can use an arm/trigger strategy where once it is triggered another crossing cannot cause a retrigger until the circuit is rearmed. This is the way oscilloscope triggering works. In your model you should follow what ever strategy your circuit uses.

-Ken
Back to top
 
 
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.