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: 7c09eefe6a51
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 87c2d08cc9b9
Choose a head ref
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Oct 28, 2020

  1. Copy the full SHA
    87c2d08 View commit details
Showing with 59 additions and 10 deletions.
  1. +37 −8 scopeprotocols/DPhyHSClockRecoveryFilter.cpp
  2. +14 −2 scopeprotocols/EyePattern.cpp
  3. +8 −0 scopeprotocols/EyePattern.h
45 changes: 37 additions & 8 deletions scopeprotocols/DPhyHSClockRecoveryFilter.cpp
Original file line number Diff line number Diff line change
@@ -159,17 +159,46 @@ void DPhyHSClockRecoveryFilter::Refresh()
//See if the data is in HS mode
bool hs_mode = (cur_data.m_type == DPhySymbol::STATE_HS0) || (cur_data.m_type == DPhySymbol::STATE_HS1);

//Emit a new sample for this clock pulse if we have a toggle in HS mode
int64_t toff = clk->m_offsets[iclk];
int64_t tend = toff + clk->m_durations[iclk];
if(clock_toggling && hs_mode)
if(clock_toggling)
{
cap->m_offsets.push_back(tstart);
cap->m_durations.push_back(tend - tstart);
cap->m_samples.push_back(cur_out);

cur_out = !cur_out;
tstart = tend;
//Emit a new sample for this clock pulse if we have a toggle in HS mode
if(hs_mode)
{
cap->m_offsets.push_back(tstart);
cap->m_durations.push_back(tend - tstart);
cap->m_samples.push_back(cur_out);

cur_out = !cur_out;
tstart = tend;
}

//If we've left HS mode, delete the last few toggles
else
{
for(size_t i=0; i<10; i++)
{
if(cap->m_offsets.empty())
break;

cap->m_offsets.pop_back();
cap->m_durations.pop_back();
cap->m_samples.pop_back();
}

if(cap->m_offsets.empty())
{
tstart = 0;
cur_out = false;
}
else
{
size_t n = cap->m_offsets.size() - 1;
tstart = cap->m_offsets[n];
cur_out = cap->m_samples[n];
}
}
}

//All good, move on
16 changes: 14 additions & 2 deletions scopeprotocols/EyePattern.cpp
Original file line number Diff line number Diff line change
@@ -99,6 +99,8 @@ EyePattern::EyePattern(const string& color)
, m_centerName("Center Voltage")
, m_maskName("Mask")
, m_polarityName("Clock Edge")
, m_vmodeName("Vertical Scale Mode")
, m_rangeName("Vertical Range")
{
//Set up channels
CreateInput("din");
@@ -120,6 +122,13 @@ EyePattern::EyePattern(const string& color)
m_parameters[m_polarityName].AddEnumValue("Falling", CLOCK_FALLING);
m_parameters[m_polarityName].AddEnumValue("Both", CLOCK_BOTH);
m_parameters[m_polarityName].SetIntVal(CLOCK_BOTH);

m_parameters[m_vmodeName] = FilterParameter(FilterParameter::TYPE_ENUM, Unit(Unit::UNIT_COUNTS));
m_parameters[m_vmodeName].AddEnumValue("Auto", RANGE_AUTO);
m_parameters[m_vmodeName].AddEnumValue("Fixed", RANGE_FIXED);

m_parameters[m_rangeName] = FilterParameter(FilterParameter::TYPE_FLOAT, Unit(Unit::UNIT_VOLTS));
m_parameters[m_rangeName].SetFloatVal(0.25);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -168,7 +177,10 @@ bool EyePattern::NeedsConfig()

double EyePattern::GetVoltageRange()
{
return m_inputs[0].m_channel->GetVoltageRange();
if(m_parameters[m_vmodeName].GetIntVal() == RANGE_AUTO)
return m_inputs[0].m_channel->GetVoltageRange();
else
return m_parameters[m_rangeName].GetFloatVal();
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -420,7 +432,7 @@ void EyePattern::Refresh()

//Process the eye
size_t cend = clock_edges.size();
float yscale = m_height / m_inputs[0].m_channel->GetVoltageRange();
float yscale = m_height / GetVoltageRange();
float ymid = m_height / 2;
float yoff = -center*yscale + ymid;
size_t iclock = 0;
8 changes: 8 additions & 0 deletions scopeprotocols/EyePattern.h
Original file line number Diff line number Diff line change
@@ -155,6 +155,12 @@ class EyePattern : public Filter
CLOCK_BOTH = 3 //CLOCK_RISING | CLOCK_FALLING
};

enum RangeMode
{
RANGE_AUTO = 0,
RANGE_FIXED = 1
};

PROTOCOL_DECODER_INITPROC(EyePattern)

protected:
@@ -170,6 +176,8 @@ class EyePattern : public Filter
std::string m_centerName;
std::string m_maskName;
std::string m_polarityName;
std::string m_vmodeName;
std::string m_rangeName;

EyeMask m_mask;
};