The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Mar 29th, 2024, 5:21am
Pages: 1
Send Topic Print
Error on calculating the phase difference (Read 1858 times)
Jason Dai
Guest




Error on calculating the phase difference
Nov 05th, 2004, 6:29pm
 
I'm doing a digital PLL behavior model, need calculate the integrated phase difference of reference clock and divided down VCO feedback clock at every rising edge of reference clock, the code is below:

@(cross(V(refclk)-1.25, 1, ttol)) begin
    state = state +1;
    phasediff = 2 * `M_PI *( state + ($abstime - tfb1)/(tfb1 - tfb0));
   end

@(cross(V(fbclk)-1.25, 1, ttol)) begin
   state = state -1;
   tfb0 = tfb1;
   tfb1 = $abstime;
  end

Simulation shows when the two clocks' rising edge occur at exactly same time, the phase error calculation will go wrong. the reason sounds like the calculation can not be done when the variable it used( state, tfb0, tfb1) changing.

Do somebody have same experience and how to solve it?


Thanks a lot !

Jason
Back to top
 
 
  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.