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

Commits on May 12, 2021

  1. Ethernet100BaseTDecoder: added early-outs so we don't descramble the …

    …entire waveform if the sync offset is wrong. Massive (order of magnitude) speedups.
    azonenberg committed May 12, 2021
    Copy the full SHA
    0c22ea0 View commit details
Showing with 19 additions and 9 deletions.
  1. +19 −9 scopeprotocols/Ethernet100BaseTDecoder.cpp
28 changes: 19 additions & 9 deletions scopeprotocols/Ethernet100BaseTDecoder.cpp
Original file line number Diff line number Diff line change
@@ -416,22 +416,32 @@ bool Ethernet100BaseTDecoder::TrySync(
( (!bits.m_samples[idle_offset + 10]) << 0 );

//Descramble
size_t len = bits.m_samples.size();
for(unsigned int i=idle_offset + 11; i<len && i<stop; i++)
stop = min(stop, bits.m_samples.size());
size_t start = idle_offset + 11;
size_t len = stop - start;
descrambled_bits.m_offsets.reserve(len);
descrambled_bits.m_durations.reserve(len);
descrambled_bits.m_samples.reserve(len);
size_t window = 64 + idle_offset + 11;
for(size_t i=start; i < stop; i++)
{
lfsr = (lfsr << 1) ^ ((lfsr >> 8)&1) ^ ((lfsr >> 10)&1);

descrambled_bits.m_offsets.push_back(bits.m_offsets[i]);
descrambled_bits.m_durations.push_back(bits.m_durations[i]);
bool b = bits.m_samples[i] ^ (lfsr & 1);
descrambled_bits.m_samples.push_back(b);
}

//We should have at least 64 "1" bits in a row once the descrambling is done.
//The minimum inter-frame gap is a lot bigger than this.
for(int i=0; i<64; i++)
{
if(descrambled_bits.m_samples[i + idle_offset + 11] != 1)
return false;
if(descrambled_bits.m_samples.size() == window)
{
//We should have at least 64 "1" bits in a row once the descrambling is done.
//The minimum inter-frame gap is a lot bigger than this.
for(int j=0; j<64; j++)
{
if(descrambled_bits.m_samples[j + idle_offset + 11] != 1)
return false;
}
}
}

//Synced, all good