The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> help debug this random noise gen code
https://designers-guide.org/forum/YaBB.pl?num=1164463514

Message started by neoflash on Nov 25th, 2006, 6:05am

Title: help debug this random noise gen code
Post by neoflash on 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

Title: Re: help debug this random noise gen code
Post by neoflash on 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.

Title: Re: help debug this random noise gen code
Post by Ken Kundert on 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

Title: Re: help debug this random noise gen code
Post by neoflash on 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?

Title: Re: help debug this random noise gen code
Post by jbdavid on 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


Title: Re: help debug this random noise gen code
Post by Ken Kundert on 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

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.