Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7a81e35e0477
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 61b51ec54cb2
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Oct 17, 2020

  1. Copy the full SHA
    ce1a2ed View commit details
  2. Copy the full SHA
    61b51ec View commit details
Showing with 9 additions and 20 deletions.
  1. +9 −20 scopeprotocols/ClockRecoveryFilter.cpp
29 changes: 9 additions & 20 deletions scopeprotocols/ClockRecoveryFilter.cpp
Original file line number Diff line number Diff line change
@@ -129,6 +129,15 @@ void ClockRecoveryFilter::Refresh()
auto din = GetAnalogInputWaveform(0);
auto gate = GetDigitalInputWaveform(1);

//Timestamps of the edges
vector<double> edges;
FindZeroCrossings(din, m_parameters[m_threshname].GetFloatVal(), edges);
if(edges.empty())
{
SetData(NULL, 0);
return;
}

//Convert nominal baud period to ps
//Round nominal period to nearest ps, but use the floating point value for the CDR PLL
float period = 1.0e12f / m_parameters[m_baudname].GetFloatVal();
@@ -142,22 +151,6 @@ void ClockRecoveryFilter::Refresh()
cap->m_triggerPhase = 0;
cap->m_timescale = 1; //recovered clock time scale is single picoseconds

double start = GetTime();

//Timestamps of the edges
vector<double> edges;
FindZeroCrossings(din, m_parameters[m_threshname].GetFloatVal(), edges);

if(edges.empty())
{
SetData(NULL, 0);
return;
}

double dt = GetTime() - start;
start = GetTime();
//LogTrace("Zero crossing: %.3f ms\n", dt * 1000);

//The actual PLL NCO
//TODO: use the real fibre channel PLL.
int64_t tend = din->m_offsets[din->m_offsets.size() - 1] * din->m_timescale;
@@ -252,10 +245,6 @@ void ClockRecoveryFilter::Refresh()
}
}

dt = GetTime() - start;
start = GetTime();
LogTrace("NCO: %.3f ms\n", dt * 1000);

total_error /= edges.size();
LogTrace("average phase error %.1f\n", total_error);