Skip to content

Commit

Permalink
Implemented RX rate control for BERTs. WaveformArea and DisplayedChan…
Browse files Browse the repository at this point in the history
…nel now correctly handle instruments where hardware eye pattern / density map resolution can change
  • Loading branch information
azonenberg committed Mar 17, 2024
1 parent 4c391f3 commit 132767a
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib
26 changes: 26 additions & 0 deletions src/ngscopeclient/BERTInputChannelDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,21 @@ BERTInputChannelDialog::BERTInputChannelDialog(BERTInputChannel* chan, MainWindo

m_tempMaskFile = chan->GetMaskFile();
m_committedMaskFile = m_tempMaskFile;

//Data rate
auto currentRate = chan->GetDataRate();
m_dataRateIndex = 0;
m_dataRates = chan->GetBERT()->GetAvailableDataRates();
Unit bps(Unit::UNIT_BITRATE);
m_dataRateNames.clear();
for(size_t i=0; i<m_dataRates.size(); i++)
{
auto rate = m_dataRates[i];
if(rate == currentRate)
m_dataRateIndex = i;

m_dataRateNames.push_back(bps.PrettyPrint(rate));
}
}

BERTInputChannelDialog::~BERTInputChannelDialog()
Expand Down Expand Up @@ -229,6 +244,17 @@ bool BERTInputChannelDialog::DoRender()
HelpMarker("Expected PRBS pattern");
}

if(m_channel->GetBERT()->IsDataRatePerChannel())
{
if(ImGui::CollapsingHeader("Timebase", defaultOpenFlags))
{
ImGui::SetNextItemWidth(width);
if(Dialog::Combo("Data Rate", m_dataRateNames, m_dataRateIndex))
m_channel->SetDataRate(m_dataRates[m_dataRateIndex]);
HelpMarker("PHY signaling rate for this transmit port");
}
}

if(ImGui::CollapsingHeader("Measurements", defaultOpenFlags))
{
float freq = m_channel->GetDataRate();
Expand Down
5 changes: 5 additions & 0 deletions src/ngscopeclient/BERTInputChannelDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ class BERTInputChannelDialog : public EmbeddableDialog
float m_sampleY;
float m_committedSampleY;

///@brief Data rate selector
int m_dataRateIndex;
std::vector<int64_t> m_dataRates;
std::vector<std::string> m_dataRateNames;

float m_color[3];

std::shared_ptr<FileBrowser> m_fileDialog;
Expand Down
20 changes: 15 additions & 5 deletions src/ngscopeclient/WaveformArea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,21 @@ bool DisplayedChannel::UpdateSize(ImVec2 newSize, MainWindow* top)
size_t x = newSize.x;
size_t y = newSize.y;

//Special processing needed for eyes coming from BERTs or sampling scopes
//These can change size on their own even if the window isn't resized
auto eye = dynamic_cast<EyePattern*>(m_stream.m_channel);
auto constellation = dynamic_cast<ConstellationFilter*>(m_stream.m_channel);
auto waterfall = dynamic_cast<Waterfall*>(m_stream.m_channel);
auto data = m_stream.GetData();
auto eyedata = dynamic_cast<EyeWaveform*>(data);
if( (m_stream.GetType() == Stream::STREAM_TYPE_EYE) && eyedata && !eye)
{
x = eyedata->GetWidth();
y = eyedata->GetHeight();
if( (m_cachedX != x) || (m_cachedY != y) )
LogTrace("Hardware eye resolution changed, processing resize\n");
}

if( (m_cachedX != x) || (m_cachedY != y) )
{
m_cachedX = x;
Expand All @@ -147,11 +162,6 @@ bool DisplayedChannel::UpdateSize(ImVec2 newSize, MainWindow* top)
//To avoid constantly destroying the integrated eye if we slightly resize stuff, round up to next power of 2
size_t roundedX = pow(2, ceil(log2(x)));
size_t roundedY = pow(2, ceil(log2(y)));
auto eye = dynamic_cast<EyePattern*>(m_stream.m_channel);
auto constellation = dynamic_cast<ConstellationFilter*>(m_stream.m_channel);
auto waterfall = dynamic_cast<Waterfall*>(m_stream.m_channel);
auto data = m_stream.GetData();
auto eyedata = dynamic_cast<EyeWaveform*>(data);
if(eye)
{
if( (eye->GetWidth() != roundedX) || (eye->GetHeight() != roundedY) )
Expand Down

0 comments on commit 132767a

Please sign in to comment.