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: 35c590eb001c
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 97e647fc6ba2
Choose a head ref
  • 2 commits
  • 114 files changed
  • 1 contributor

Commits on Nov 28, 2020

  1. scopehal: Refactored all drivers, triggers, and Unit class to use fem…

    …toseconds instead of picoseconds as base time unit. See #217.
    azonenberg committed Nov 28, 2020
    Copy the full SHA
    e85f1a9 View commit details
  2. Copy the full SHA
    97e647f View commit details
Showing with 390 additions and 385 deletions.
  1. +11 −11 scopehal/AgilentOscilloscope.cpp
  2. +1 −1 scopehal/AntikernelLabsOscilloscope.cpp
  3. +7 −7 scopehal/AntikernelLogicAnalyzer.cpp
  4. +8 −8 scopehal/DemoOscilloscope.cpp
  5. +1 −1 scopehal/DropoutTrigger.cpp
  6. +5 −5 scopehal/Filter.cpp
  7. +1 −1 scopehal/FilterParameter.h
  8. +2 −2 scopehal/GlitchTrigger.cpp
  9. +3 −3 scopehal/IBISParser.cpp
  10. +45 −45 scopehal/LeCroyOscilloscope.cpp
  11. +2 −2 scopehal/MockOscilloscope.cpp
  12. +2 −2 scopehal/Oscilloscope.h
  13. +1 −1 scopehal/OscilloscopeChannel.cpp
  14. +2 −2 scopehal/PacketDecoder.h
  15. +2 −2 scopehal/PulseWidthTrigger.cpp
  16. +8 −8 scopehal/RigolOscilloscope.cpp
  17. +4 −4 scopehal/RohdeSchwarzOscilloscope.cpp
  18. +2 −2 scopehal/RuntTrigger.cpp
  19. +6 −6 scopehal/SiglentSCPIOscilloscope.cpp
  20. +1 −1 scopehal/SignalGeneratorOscilloscope.cpp
  21. +2 −2 scopehal/SlewRateTrigger.cpp
  22. +37 −31 scopehal/TektronixOscilloscope.cpp
  23. +1 −1 scopehal/TestWaveformSource.cpp
  24. +13 −13 scopehal/Unit.cpp
  25. +3 −2 scopehal/Unit.h
  26. +6 −6 scopehal/Waveform.h
  27. +1 −1 scopehal/WindowTrigger.cpp
  28. +3 −0 scopehal/scopehal.h
  29. +1 −1 scopeprotocols/ACCoupleFilter.cpp
  30. +1 −1 scopeprotocols/ADL5205Decoder.cpp
  31. +1 −1 scopeprotocols/AutocorrelationFilter.cpp
  32. +2 −2 scopeprotocols/BaseMeasurement.cpp
  33. +5 −5 scopeprotocols/CANDecoder.cpp
  34. +7 −7 scopeprotocols/ClockRecoveryFilter.cpp
  35. +1 −1 scopeprotocols/CurrentShuntFilter.cpp
  36. +1 −1 scopeprotocols/DCOffsetFilter.cpp
  37. +1 −1 scopeprotocols/DDR3Decoder.cpp
  38. +1 −1 scopeprotocols/DPhyDataDecoder.cpp
  39. +1 −1 scopeprotocols/DPhyHSClockRecoveryFilter.cpp
  40. +4 −4 scopeprotocols/DPhySymbolDecoder.cpp
  41. +1 −1 scopeprotocols/DSIFrameDecoder.cpp
  42. +1 −1 scopeprotocols/DSIPacketDecoder.cpp
  43. +1 −1 scopeprotocols/DVIDecoder.cpp
  44. +4 −4 scopeprotocols/DeEmbedFilter.cpp
  45. +2 −2 scopeprotocols/DeskewFilter.cpp
  46. +3 −3 scopeprotocols/DownconvertFilter.cpp
  47. +1 −1 scopeprotocols/DownsampleFilter.cpp
  48. +3 −3 scopeprotocols/DramRefreshActivateMeasurement.cpp
  49. +3 −3 scopeprotocols/DramRowColumnLatencyMeasurement.cpp
  50. +2 −2 scopeprotocols/DutyCycleMeasurement.cpp
  51. +1 −1 scopeprotocols/Ethernet1000BaseXDecoder.cpp
  52. +1 −1 scopeprotocols/Ethernet100BaseTDecoder.cpp
  53. +1 −1 scopeprotocols/Ethernet10BaseTDecoder.cpp
  54. +1 −1 scopeprotocols/Ethernet10GBaseRDecoder.cpp
  55. +1 −1 scopeprotocols/Ethernet64b66bDecoder.cpp
  56. +1 −1 scopeprotocols/EthernetGMIIDecoder.cpp
  57. +5 −6 scopeprotocols/EthernetProtocolDecoder.cpp
  58. +1 −1 scopeprotocols/EthernetRGMIIDecoder.cpp
  59. +3 −3 scopeprotocols/EyeBitRateMeasurement.cpp
  60. +11 −11 scopeprotocols/EyeHeightMeasurement.cpp
  61. +6 −6 scopeprotocols/EyeJitterMeasurement.cpp
  62. +7 −6 scopeprotocols/EyePattern.cpp
  63. +3 −3 scopeprotocols/EyePeriodMeasurement.cpp
  64. +6 −6 scopeprotocols/EyeWidthMeasurement.cpp
  65. +5 −5 scopeprotocols/FFTFilter.cpp
  66. +1 −1 scopeprotocols/FFTFilter.h
  67. +3 −3 scopeprotocols/FallMeasurement.cpp
  68. +3 −3 scopeprotocols/FrequencyMeasurement.cpp
  69. +1 −1 scopeprotocols/HistogramFilter.cpp
  70. +6 −6 scopeprotocols/HorizontalBathtub.cpp
  71. +1 −1 scopeprotocols/I2CDecoder.cpp
  72. +1 −1 scopeprotocols/I2CEepromDecoder.cpp
  73. +1 −1 scopeprotocols/IBM8b10bDecoder.cpp
  74. +1 −1 scopeprotocols/IPv4Decoder.cpp
  75. +1 −1 scopeprotocols/JitterSpectrumFilter.cpp
  76. +1 −1 scopeprotocols/JtagDecoder.cpp
  77. +3 −3 scopeprotocols/MDIODecoder.cpp
  78. +1 −1 scopeprotocols/MagnitudeFilter.cpp
  79. +1 −1 scopeprotocols/MultiplyFilter.cpp
  80. +7 −7 scopeprotocols/OFDMDemodulator.cpp
  81. +3 −3 scopeprotocols/OneWireDecoder.cpp
  82. +1 −1 scopeprotocols/OvershootMeasurement.cpp
  83. +1 −1 scopeprotocols/PCIeDataLinkDecoder.cpp
  84. +1 −1 scopeprotocols/PCIeGen2LogicalDecoder.cpp
  85. +1 −1 scopeprotocols/PCIeTransportDecoder.cpp
  86. +1 −1 scopeprotocols/ParallelBus.cpp
  87. +1 −1 scopeprotocols/PeakHoldFilter.cpp
  88. +3 −3 scopeprotocols/PeriodMeasurement.cpp
  89. +1 −1 scopeprotocols/PkPkMeasurement.cpp
  90. +1 −1 scopeprotocols/QSPIDecoder.cpp
  91. +4 −4 scopeprotocols/QuadratureDecoder.cpp
  92. +3 −3 scopeprotocols/RiseMeasurement.cpp
  93. +3 −5 scopeprotocols/SDCmdDecoder.cpp
  94. +1 −1 scopeprotocols/SDDataDecoder.cpp
  95. +1 −1 scopeprotocols/SPIDecoder.cpp
  96. +1 −1 scopeprotocols/SPIFlashDecoder.cpp
  97. +1 −2 scopeprotocols/SWDDecoder.cpp
  98. +1 −1 scopeprotocols/SWDMemAPDecoder.cpp
  99. +1 −1 scopeprotocols/SubtractFilter.cpp
  100. +2 −2 scopeprotocols/TIEMeasurement.cpp
  101. +1 −1 scopeprotocols/TMDSDecoder.cpp
  102. +3 −3 scopeprotocols/TachometerFilter.cpp
  103. +1 −1 scopeprotocols/ThresholdFilter.cpp
  104. +2 −2 scopeprotocols/TopMeasurement.cpp
  105. +2 −3 scopeprotocols/UARTDecoder.cpp
  106. +1 −1 scopeprotocols/USB2ActivityDecoder.cpp
  107. +13 −13 scopeprotocols/USB2PCSDecoder.cpp
  108. +3 −3 scopeprotocols/USB2PMADecoder.cpp
  109. +1 −1 scopeprotocols/USB2PacketDecoder.cpp
  110. +10 −10 scopeprotocols/UartClockRecoveryFilter.cpp
  111. +1 −1 scopeprotocols/UndershootMeasurement.cpp
  112. +1 −1 scopeprotocols/UpsampleFilter.cpp
  113. +2 −2 scopeprotocols/VerticalBathtub.cpp
  114. +5 −6 scopeprotocols/WindowedAutocorrelationFilter.cpp
22 changes: 11 additions & 11 deletions scopehal/AgilentOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -488,19 +488,19 @@ bool AgilentOscilloscope::AcquireData()
&format, &type, &length, &average_count, &xincrement, &xorigin, &xreference, &yincrement, &yorigin, &yreference);

//Figure out the sample rate
int64_t ps_per_sample = round(xincrement * 1e12f);
int64_t fs_per_sample = round(xincrement * FS_PER_SECOND);
//LogDebug("%ld ps/sample\n", ps_per_sample);

//LogDebug("length = %d\n", length);

//Set up the capture we're going to store our data into
//(no TDC data available on Agilent scopes?)
AnalogWaveform* cap = new AnalogWaveform;
cap->m_timescale = ps_per_sample;
cap->m_timescale = fs_per_sample;
cap->m_triggerPhase = 0;
cap->m_startTimestamp = time(NULL);
double t = GetTime();
cap->m_startPicoseconds = (t - floor(t)) * 1e12f;
cap->m_startFemtoseconds = (t - floor(t)) * FS_PER_SECOND;

//Ask for the data
m_transport->SendCommand(":WAV:DATA?");
@@ -781,20 +781,20 @@ void AgilentOscilloscope::PullPulseWidthTrigger()
LogWarning("Malformed TRIG:GLIT:RANG response: %s\n", reply.c_str());
else
{
pt->SetLowerBound(stof(lower_bound) * 1e12);
pt->SetUpperBound(stof(upper_bound) * 1e12);
pt->SetLowerBound(stof(lower_bound) * FS_PER_SECOND);
pt->SetUpperBound(stof(upper_bound) * FS_PER_SECOND);
}

}
else
{
//Lower bound
m_transport->SendCommand("TRIG:GLIT:GRE?");
pt->SetLowerBound(stof(m_transport->ReadReply()) * 1e12);
pt->SetLowerBound(stof(m_transport->ReadReply()) * FS_PER_SECOND);

//Upper bound
m_transport->SendCommand("TRIG:GLIT:LESS?");
pt->SetUpperBound(stof(m_transport->ReadReply()) * 1e12);
pt->SetUpperBound(stof(m_transport->ReadReply()) * FS_PER_SECOND);
}
}

@@ -883,14 +883,14 @@ void AgilentOscilloscope::PushPulseWidthTrigger(PulseWidthTrigger* trig)
if(trig->GetCondition() == Trigger::CONDITION_BETWEEN)
{
m_transport->SendCommand("TRIG:GLIT:RANG " +
to_string_sci(trig->GetUpperBound() * 1e-12f) +
to_string_sci(trig->GetUpperBound() * SECONDS_PER_FS) +
"," +
to_string_sci(trig->GetLowerBound() * 1e-12f));
to_string_sci(trig->GetLowerBound() * SECONDS_PER_FS));
}
else
{
PushFloat("TRIG:GLIT:LESS", trig->GetUpperBound() * 1e-12f);
PushFloat("TRIG:GLIT:GRE", trig->GetLowerBound() * 1e-12f);
PushFloat("TRIG:GLIT:LESS", trig->GetUpperBound() * SECONDS_PER_FS);
PushFloat("TRIG:GLIT:GRE", trig->GetLowerBound() * SECONDS_PER_FS);
}
}

2 changes: 1 addition & 1 deletion scopehal/AntikernelLabsOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -373,7 +373,7 @@ bool AntikernelLabsOscilloscope::AcquireData()
cap->m_triggerPhase = 0;
double t = GetTime();
cap->m_startTimestamp = floor(t);
cap->m_startPicoseconds = (t - cap->m_startTimestamp) * 1e12f;
cap->m_startFemtoseconds = (t - cap->m_startTimestamp) * FS_PER_SECOND;

//Process the samples
float fullscale = GetChannelVoltageRange(0);
14 changes: 7 additions & 7 deletions scopehal/AntikernelLogicAnalyzer.cpp
Original file line number Diff line number Diff line change
@@ -249,8 +249,8 @@ void AntikernelLogicAnalyzer::LoadChannels()
uint8_t rawperiod[3];
SendCommand(CMD_GET_SAMPLE_PERIOD);
m_transport->ReadRawData(3, (unsigned char*)rawperiod);
m_samplePeriod = (rawperiod[0] << 16) | (rawperiod[1] << 8) | rawperiod[2];
//LogDebug("Sample period is %u ps\n", m_samplePeriod);
m_samplePeriod = ( (rawperiod[0] << 16) | (rawperiod[1] << 8) | rawperiod[2] ) * 1000;
//LogDebug("Sample period is %u fs\n", m_samplePeriod);

//Get memory aspect ratio info
uint8_t rawlen[3];
@@ -265,7 +265,7 @@ void AntikernelLogicAnalyzer::LoadChannels()
SendCommand(CMD_GET_MAX_WIDTH);
m_maxWidth = Read1ByteReply();

//Round sampling period down to be an even number of picoseconds
//Round sampling period down to be an even number of femtoseconds
//(this is needed so the clock can be double-rate and not lose sync)
if(m_samplePeriod & 1)
m_samplePeriod --;
@@ -320,13 +320,13 @@ bool AntikernelLogicAnalyzer::AcquireData()

//Synthesize the clock
double time = GetTime();
double ps = (time - floor(time)) * 1e12f;
double fs = (time - floor(time)) * FS_PER_SECOND;
{
DigitalWaveform* cap = new DigitalWaveform;
cap->m_timescale = m_samplePeriod / 2;
cap->m_triggerPhase = 0;
cap->m_startTimestamp = time;
cap->m_startPicoseconds = ps;
cap->m_startFemtoseconds = fs;
cap->m_samples.resize(m_memoryDepth * 2);

auto chan = m_channels[0];
@@ -364,7 +364,7 @@ bool AntikernelLogicAnalyzer::AcquireData()
cap->m_timescale = m_samplePeriod;
cap->m_triggerPhase = 0;
cap->m_startTimestamp = time;
cap->m_startPicoseconds = ps;
cap->m_startFemtoseconds = fs;
cap->m_samples.resize(m_memoryDepth);

//Pull the data
@@ -388,7 +388,7 @@ bool AntikernelLogicAnalyzer::AcquireData()
cap->m_timescale = m_samplePeriod;
cap->m_triggerPhase = 0;
cap->m_startTimestamp = time;
cap->m_startPicoseconds = ps;
cap->m_startFemtoseconds = fs;
cap->m_samples.resize(m_memoryDepth);

for(size_t j=0; j<m_memoryDepth; j++)
16 changes: 8 additions & 8 deletions scopehal/DemoOscilloscope.cpp
Original file line number Diff line number Diff line change
@@ -388,28 +388,28 @@ bool DemoOscilloscope::AcquireData()
m_sweepFreq += 1e6;
if(m_sweepFreq > 1.5e9)
m_sweepFreq = 1.1e9;
float sweepPeriod = 1e12 / m_sweepFreq;
float sweepPeriod = SECONDS_PER_FS / m_sweepFreq;

//Generate waveforms
SequenceSet s;
auto depth = GetSampleDepth();
int64_t sampleperiod = 1e12 / m_rate;
s[m_channels[0]] = m_source.GenerateNoisySinewave(0.9, 0.0, 1000, sampleperiod, depth);
s[m_channels[1]] = m_source.GenerateNoisySinewaveMix(0.9, 0.0, M_PI_4, 1000, sweepPeriod, sampleperiod, depth);
s[m_channels[2]] = m_source.GeneratePRBS31(0.9, 96.9696, sampleperiod, depth);
s[m_channels[3]] = m_source.Generate8b10b(0.9, 800, sampleperiod, depth);
int64_t sampleperiod = FS_PER_SECOND / m_rate;
s[m_channels[0]] = m_source.GenerateNoisySinewave(0.9, 0.0, 1e6, sampleperiod, depth);
s[m_channels[1]] = m_source.GenerateNoisySinewaveMix(0.9, 0.0, M_PI_4, 1e6, sweepPeriod, sampleperiod, depth);
s[m_channels[2]] = m_source.GeneratePRBS31(0.9, 96969.6, sampleperiod, depth);
s[m_channels[3]] = m_source.Generate8b10b(0.9, 800e3, sampleperiod, depth);

//Timestamp the waveform(s)
float now = GetTime();
float tfrac = fmodf(now, 1);
time_t start = round(now - tfrac);
int64_t ps = round(tfrac * 1e12);
int64_t fs = round(tfrac * SECONDS_PER_FS);
for(auto it : s)
{
auto wfm = it.second;

wfm->m_startTimestamp = start;
wfm->m_startPicoseconds = ps;
wfm->m_startFemtoseconds = fs;
wfm->m_triggerPhase = 0;
}

2 changes: 1 addition & 1 deletion scopehal/DropoutTrigger.cpp
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ DropoutTrigger::DropoutTrigger(Oscilloscope* scope)
m_parameters[m_typename].AddEnumValue("Any", EDGE_ANY);

m_timename = "Dropout Time";
m_parameters[m_timename] = FilterParameter(FilterParameter::TYPE_INT, Unit(Unit::UNIT_PS));
m_parameters[m_timename] = FilterParameter(FilterParameter::TYPE_INT, Unit(Unit::UNIT_FS));

m_resetname = "Reset Mode";
if(dynamic_cast<LeCroyOscilloscope*>(scope))
10 changes: 5 additions & 5 deletions scopehal/Filter.cpp
Original file line number Diff line number Diff line change
@@ -234,7 +234,7 @@ bool Filter::VerifyAllInputsOKAndAnalog()
The sampling rate of the data and clock signals need not be equal or uniform.
The sampled waveform has a time scale in picoseconds regardless of the incoming waveform's time scale.
The sampled waveform has a time scale in femtoseconds regardless of the incoming waveform's time scale.
@param data The data signal to sample
@param clock The clock signal to use
@@ -280,7 +280,7 @@ void Filter::SampleOnRisingEdges(DigitalWaveform* data, DigitalWaveform* clock,
The sampling rate of the data and clock signals need not be equal or uniform.
The sampled waveform has a time scale in picoseconds regardless of the incoming waveform's time scale.
The sampled waveform has a time scale in femtoseconds regardless of the incoming waveform's time scale.
@param data The data signal to sample
@param clock The clock signal to use
@@ -326,7 +326,7 @@ void Filter::SampleOnRisingEdges(DigitalBusWaveform* data, DigitalWaveform* cloc
The sampling rate of the data and clock signals need not be equal or uniform.
The sampled waveform has a time scale in picoseconds regardless of the incoming waveform's time scale.
The sampled waveform has a time scale in femtoseconds regardless of the incoming waveform's time scale.
@param data The data signal to sample
@param clock The clock signal to use
@@ -372,7 +372,7 @@ void Filter::SampleOnFallingEdges(DigitalWaveform* data, DigitalWaveform* clock,
The sampling rate of the data and clock signals need not be equal or uniform.
The sampled waveform has a time scale in picoseconds regardless of the incoming waveform's time scale.
The sampled waveform has a time scale in femtoseconds regardless of the incoming waveform's time scale.
@param data The data signal to sample
@param clock The clock signal to use
@@ -418,7 +418,7 @@ void Filter::SampleOnAnyEdges(DigitalWaveform* data, DigitalWaveform* clock, Dig
The sampling rate of the data and clock signals need not be equal or uniform.
The sampled waveform has a time scale in picoseconds regardless of the incoming waveform's time scale.
The sampled waveform has a time scale in femtoseconds regardless of the incoming waveform's time scale.
@param data The data signal to sample
@param clock The clock signal to use
2 changes: 1 addition & 1 deletion scopehal/FilterParameter.h
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ class FilterParameter
TYPE_STRING //arbitrary string
};

FilterParameter(ParameterTypes type = FilterParameter::TYPE_FLOAT, Unit unit = Unit(Unit::UNIT_PS));
FilterParameter(ParameterTypes type = FilterParameter::TYPE_FLOAT, Unit unit = Unit(Unit::UNIT_FS));

void ParseString(const std::string& str);
std::string ToString();
4 changes: 2 additions & 2 deletions scopehal/GlitchTrigger.cpp
Original file line number Diff line number Diff line change
@@ -43,9 +43,9 @@ GlitchTrigger::GlitchTrigger(Oscilloscope* scope)
, m_lowername("Lower Bound")
, m_uppername("Upper Bound")
{
m_parameters[m_lowername] = FilterParameter(FilterParameter::TYPE_INT, Unit(Unit::UNIT_PS));
m_parameters[m_lowername] = FilterParameter(FilterParameter::TYPE_INT, Unit(Unit::UNIT_FS));

m_parameters[m_uppername] = FilterParameter(FilterParameter::TYPE_INT, Unit(Unit::UNIT_PS));
m_parameters[m_uppername] = FilterParameter(FilterParameter::TYPE_INT, Unit(Unit::UNIT_FS));

m_parameters[m_conditionname] = FilterParameter(FilterParameter::TYPE_ENUM, Unit(Unit::UNIT_COUNTS));
m_parameters[m_conditionname].AddEnumValue("Less than", CONDITION_LESS);
6 changes: 3 additions & 3 deletions scopehal/IBISParser.cpp
Original file line number Diff line number Diff line change
@@ -301,7 +301,7 @@ vector<float> IBISModel::CalculateTurnonCurve(
For now, hard coded to PRBS-31 waveform
@param corner Process corner to simulate (TODO others)
@param timescale Picoseconds per simulation time step
@param timescale Femtoseconds per simulation time step
@param length Number of time steps to simulate
@param ui Unit interval for the PRBS
*/
@@ -318,7 +318,7 @@ AnalogWaveform* IBISModel::SimulatePRBS(
VTCurves* rising = GetHighestRisingWaveform();
VTCurves* falling = GetHighestFallingWaveform();

const float dt = timescale * 1e-12;
const float dt = timescale * SECONDS_PER_FS;

//PRBS-31 generator
uint32_t prbs = seed;
@@ -329,7 +329,7 @@ AnalogWaveform* IBISModel::SimulatePRBS(
float now = GetTime();
float tfrac = fmodf(now, 1);
ret->m_startTimestamp = round(now - tfrac);
ret->m_startPicoseconds = tfrac * 1e12;
ret->m_startFemtoseconds = tfrac * FS_PER_SECOND;
ret->m_triggerPhase = 0;
ret->Resize(length);

Loading