Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

generate jittery sine,square wave same amount of jitter

Status
Not open for further replies.

dkumar

Member level 3
Joined
Jan 4, 2008
Messages
65
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,889
hi

thanks for reply.
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
 

JoannesPaulus

Advanced Member level 3
Joined
Mar 19, 2008
Messages
773
Helped
235
Reputation
470
Reaction score
134
Trophy points
1,323
Location
USA
Activity points
5,006
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...
 

dkumar

Member level 3
Joined
Jan 4, 2008
Messages
65
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,889
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;

// add the phase noise
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;

// add the phase noise
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
 

JoannesPaulus

Advanced Member level 3
Joined
Mar 19, 2008
Messages
773
Helped
235
Reputation
470
Reaction score
134
Trophy points
1,323
Location
USA
Activity points
5,006
hi

yup, as expected. You only have to convert the phase jitter of the sinewave into a time equivalent.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top