Continue to Site

generate jittery sine,square wave same amount of jitter

Status
Not open for further replies.

dkumar

Member level 3
hi

I have one more question which is quite different from this.

i want to generate the verilogA model for square wave and sine wave with jitter in both.Like same amount of random jitter in both.

I tried looking designer's guide and i did get the square wave generation with jitter. i tried to modify the same for sine wave and was successfully able to do that but the problem is , then i give the same amount of rms jitter value in both sine and square wave and then i plot the eye diagram , i see different pk-pk value of jitter.

if you want i can post the code here...please let me know if there is any way of generating jittery sine and square wave with same amount of random jitter.

thanks

hi

I haven't looked at the code but I guess that the square wave adds jitter in time (nT+tj, where n is the cycle, T the period and tj the jitter) while the sine wave adds jitter in phase as in sin(wt+jitter). So you just need to transform the phase information into time...

Re: hi

here is the code..i did this for the two cases.

"SQUARE WAVE WITH JITTER"

// VerilogA for SSS, sqarJ2, veriloga

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

module squrJ2 (out);

output out; voltage out; // output terminal
parameter real vl=-1; //low output voltage
parameter real vh=1; //high output voltage
parameter real freqT=1 from (0:inf); // output frequency
parameter real tt=0.01/freqT from (0:inf); //output transition time
parameter real ttol=1u/freqT from (0:1/freqT); // time tolerance
parameter real jitter=0 from [0:0.25/freqT); // period jitter (produces white accumulating jitter), variance of random normal distribution.
real freq, phase, dT ;
integer n, seed;

analog begin
@(initial_step) seed = -561;

// freq to freq2
freq = freqT;

freq = freq/(1 + dT*freq);

// bound the time step to assure no cycles are skipped
$bound_step(0.6/freqT); // phase is the integral of the freq modulo 2p phase = 2*M_PI*idtmod(freq, 0.0, 1.0, -0.5); // update jitter twice per period // M_SQRT2=sqrt(K), K=2 jitter updates/period @(cross(phase + M_PI/2, +1, ttol) or cross(phase - M_PI/2, +1, ttol)) begin dT = M_SQRT2*jitter*$rdist_normal(seed,0, 1);
n = (phase >= -M_PI/2) && (phase < M_PI/2);
end

// generate the output
V(out) <+ transition(n ? vh : vl,330p ,tt);

end
endmodule\
================================================================================================================
"SINE WAVE WITH JITTER" ( modified the above one to get this.)
// VerilogA for SSS, sineJ2, veriloga

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

module sineJ2 (out);

output out; voltage out; // output terminal
parameter real freqT=1 from (0:inf); // output frequency
parameter real ttol=1u/freqT from (0:1/freqT); // time tolerance
parameter real jitter=0 from [0:0.25/freqT); // period jitter (produces white accumulating jitter), variance of random normal distribution.
real freq, phase, dT ;
integer seed;

analog begin
@(initial_step) seed = -561;

// freq to freq2
freq = freqT;

freq = freq/(1 + dT*freq);

// bound the time step to assure no cycles are skipped
// $bound_step(0.6/freqT); // phase is the integral of the freq modulo 2p phase = 2*M_PI*idtmod(freq, 0.0, 1.0, -0.5); // update jitter twice per period // M_SQRT2=sqrt(K), K=2 jitter updates/period @(cross(phase + M_PI/2, +1, ttol) or cross(phase - M_PI/2, +1, ttol)) begin dT = M_SQRT2*jitter*$rdist_normal(seed,0, 1);
end

// generate the output
V(out) <+ 1.2*sin(`M_TWO_PI*freqT*$realtime + phase) ;$bound_step(0.06/freqT);

end
endmodule

Schopenhauer

Points: 2